Skip to content

Commit

Permalink
v10.0.2 πŸ’£πŸš€πŸŽ‰ Project rewrite
Browse files Browse the repository at this point in the history
[instangram] Complete rewrite of the Project to support Firefox again.
By rewriting, we were also able to increase the speed noticeably.
Fixed bug on profile page modal showed twice.
Fixed bug on some pages where nothing happens.
  • Loading branch information
saschaheim committed Jun 28, 2021
1 parent 9e0f1b1 commit e3a53e4
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 26 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# <img style="float: left; vertical-align: bottom; " width="35" src="https://upload.wikimedia.org/wikipedia/commons/4/4c/Typescript_logo_2020.svg"> [instantgram] v10.0.1
![GitHub release](https://img.shields.io/badge/release-v10.0.1-green)
# <img style="float: left; vertical-align: bottom; " width="35" src="https://upload.wikimedia.org/wikipedia/commons/4/4c/Typescript_logo_2020.svg"> [instantgram] v10.0.2
![GitHub release](https://img.shields.io/badge/release-v10.0.2-green)

![badge](https://img.shields.io/badge/for-instagram-yellow.svg?style=flat-square)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)
Expand Down Expand Up @@ -39,6 +39,10 @@ With this version we support all modern browsers that have ECMAScript 2015 (es6)
Read [CONTRIBUTING.md](CONTRIBUTING.md) for more information. :heart:

## Changelog
- v10.0.2 - [instangram] Complete rewrite of the Project to support Firefox again. \
By rewriting, we were also able to increase the speed noticeably. \
Fixed bug on profile page modal showed twice.
Fixed bug on some pages where nothing happens.
- v10.0.1 - [instangram] Complete rewrite of the Project to support Firefox again. \
By rewriting, we were also able to increase the speed noticeably. \
Fixed bug on some pages where nothing happens.
Expand Down
2 changes: 1 addition & 1 deletion dist/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lang/de-de/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lang/en-us/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lang/es-ar/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lang/pt-br/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "instantgram",
"version": "10.0.1",
"version": "10.0.2",
"description": "A bookmarklet for download photos in Instagram",
"author": "Matheus FalcΓ£o as of 4.0.0 Sascha Heim",
"homepage": "https://thinkbig-company.github.io/instantgram/",
Expand Down
1 change: 1 addition & 0 deletions src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export type Program = {
foundByModule: null | string;
foundVideo: boolean;
foundImage: boolean;
foundProfile: boolean;
}
2 changes: 1 addition & 1 deletion src/_langs/partials/button.html

Large diffs are not rendered by default.

31 changes: 20 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const program: Program = {

foundByModule: null,
foundVideo: false,
foundImage: false
foundImage: false,
foundProfile: false
}

if (process.env.DEV) {
Expand All @@ -35,15 +36,27 @@ if (process.env.DEV) {
// verify if are running on instagram site
if (program.regexHostname.test(program.hostname)) {

new MediaScanner().execute(program, function (found: boolean, scannerProgram: Program) {
if (found == false) {
new MediaScanner().execute(program, function (scannerFound: boolean, scannerProgram: Program) {
if (process.env.DEV) {
console.log('scannerFound', scannerFound);
}

program.foundVideo = scannerProgram.foundVideo;
program.foundImage = scannerProgram.foundImage;
program.foundByModule = scannerProgram.foundByModule;

if (scannerFound == false) {
// Profile page -> instagram.com/instagram/
if (scannerProgram.regexProfilePath.test(scannerProgram.path)) {
new ProfilePageDownload().execute(scannerProgram, function (profilePageDownload: boolean, profilePageDownloadProgram: Program) {
if (process.env.DEV) {
console.log('profilePageDownload', profilePageDownload);
}

program.foundVideo = profilePageDownloadProgram.foundVideo;
program.foundImage = profilePageDownloadProgram.foundImage;
program.foundByModule = profilePageDownloadProgram.foundByModule;

if (profilePageDownload == false) {
new Modal({
heading: [
Expand All @@ -63,17 +76,13 @@ if (program.regexHostname.test(program.hostname)) {
}
}

if (typeof scannerProgram.foundVideo !== 'undefined' && scannerProgram.foundByModule == undefined) {
if (program.foundByModule == undefined) {
if (process.env.DEV) {
console.log('foundVideo', scannerProgram.foundVideo);
console.log('foundImage', scannerProgram.foundImage);
console.log('foundByModule', scannerProgram.foundByModule);
console.log('foundVideo', program.foundVideo);
console.log('foundImage', program.foundImage);
console.log('foundByModule', program.foundByModule);
}

program.foundVideo = scannerProgram.foundVideo;
program.foundImage = scannerProgram.foundImage;
program.foundByModule = scannerProgram.foundByModule;

if (program.foundVideo == false && program.foundImage == false) {
new Modal({
heading: [
Expand Down
12 changes: 12 additions & 0 deletions src/modules/ProfilePageDownload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,16 @@ export class ProfilePageDownload implements Module {
if (document.querySelector('section > main > div:first-child > div > article > div:nth-child(1)').classList.length == 2) {
this.displayIsPrivateModal();

program.foundProfile = false;

callback(false, program);
return;
}

// Set some neccessary things
program.foundProfile = true;
program.foundByModule = this.getName();

// Get all links of content posts
const postLinks: Set<string> = await this.collectImageLinks(parseInt('1', 0) % 3);

Expand All @@ -316,8 +322,14 @@ export class ProfilePageDownload implements Module {
this.modal.close();

if (error == false) {
program.foundProfile = true;
program.foundByModule = this.getName();

callback(true, program);
} else {
program.foundProfile = false;
program.foundByModule = undefined;

callback(false, program);
}
}
Expand Down

0 comments on commit e3a53e4

Please sign in to comment.