Skip to content

Commit

Permalink
Fixes #240
Browse files Browse the repository at this point in the history
  • Loading branch information
HuiiBuh committed Nov 21, 2021
1 parent b88f8a7 commit c8baf4a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/manifest_chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "IG Downloader",
"description": "Open Source und privacy conscious Instagram Downloader, which downloads images, videos, Instagram stories and IGTV.",
"version": "4.5.4",
"version": "4.5.5",
"icons": {
"512": "icons/instagram.png"
},
Expand Down
2 changes: 1 addition & 1 deletion src/manifest_firefox.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "IG Downloader",
"version": "4.5.4",
"version": "4.5.5",
"icons": {
"512": "icons/instagram.png"
},
Expand Down
10 changes: 8 additions & 2 deletions src/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
width: 37px;
height: 37px;
width: 30px;
height: 30px;
margin-right: -5px;
}

Expand Down Expand Up @@ -117,3 +117,9 @@
._47KiJ, .XCodT, .r9-Os {
align-items: center;
}


// V-center the icons in the top bar
.J5g42 {
align-items: center;
}
2 changes: 1 addition & 1 deletion src/ts/QuerySelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export enum QuerySelectors {
// Account, Hover, Explore, Reels
imagePreview = '._bz0w, .pKKVh, .Tjpra > a',
accountName = '._7UhW9.fKFbl.yUEEX.KV-D4.fDxYl',
topRightIconRow = '._47KiJ, .r9-Os',
topRightIconRow = '._47KiJ, .r9-Os, .J5g42',

// Account Image
accountImageWrapper = '.RR-M-, .M-jxE',
Expand Down
21 changes: 21 additions & 0 deletions src/ts/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,24 @@ export function log(message: any[] | any, level: LoggingLevel = LoggingLevel.def
}

}

export const shortcodeToDateString = (shortcode: string): string =>
instaIDToTimestamp(
shortcodeToInstaID(shortcode),
);

export const shortcodeToInstaID = (shortcode: string): number => {
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
let id = 0;
for (const char of shortcode) {
id = (id * 64) + alphabet.indexOf(char);
}

return id;
};

export const instaIDToTimestamp = (id: number) => {
const timestamp = (id / Math.pow(2, 23)) + 1314220021721;

return new Date(timestamp).toLocaleString();
};

0 comments on commit c8baf4a

Please sign in to comment.