Skip to content

Commit

Permalink
Merge pull request #47 from HuiiBuh/features
Browse files Browse the repository at this point in the history
Version 2.1: Propper support for own profile download
  • Loading branch information
HuiiBuh authored Jul 17, 2019
2 parents 626c9cf + 987ff69 commit f23cac6
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 86 deletions.
6 changes: 6 additions & 0 deletions chrome/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@
opacity: 1;
}

/* emerson's picture*/
.CfWVH:hover #profile-middle, ._2dbep:hover #profile-middle, ._6q-tv:hover #profile-middle {
opacity: 1;
}

/*own picture */
.IalUJ:hover #profile-middle {
opacity: 1 !important;
}


/* The Modal (background) */
.modal {
Expand Down
14 changes: 10 additions & 4 deletions chrome/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ async function main() {
oldUrl = "heyyyyy";
i = 0;

} else if (url.includes("instagram.com/") && !url.includes("instagram.com/p/") && !url.includes("instagram.com/tv/") && !(/\/channel\/$/.test(url))) {
} else if (url.includes("instagram.com/") && !url.includes("instagram.com/p/") && !url.includes("instagram.com/tv/") && !(/\/channel\/$/.test(url)) || (/\/saved\/$/.test(url)) || (/\/tagged\/$/.test(url))) {
let a = document.getElementsByClassName("_7UhW9 fKFbl yUEEX KV-D4 fDxYl").length;


// man geht nicht immer in die
if (document.getElementsByClassName("_7UhW9 fKFbl yUEEX KV-D4 fDxYl").length > 0 && hoverPictures.length > 0
&& hoverPictures.length !== oldHover && document.getElementsByClassName("_0mzm- sqdOP L3NKy _4pI4F _8A5w5").length === 0
&& hoverPictures.length !== oldHover
|| url.includes("instagram.com/explore/") && hoverPictures.length > 0 && hoverPictures.length !== oldHover
&& document.getElementsByClassName("_0mzm- sqdOP L3NKy _4pI4F _8A5w5 ").length === 0) {

Expand All @@ -104,6 +108,8 @@ async function main() {
oldHover = hoverPictures.length;
hoverButton.removeHover();
hoverButton.createHoverable();
} else {
oldHover = -20;
}

oldUrl = "heyyyy";
Expand All @@ -130,8 +136,8 @@ async function main() {
oldUrl = url;
await sleep(10);
}
}
catch (e) {
} catch (e) {
console.error(e);
await sleep(1000);
main()
}
Expand Down
18 changes: 17 additions & 1 deletion chrome/js/profilePicture.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const profilePictureClass = "_6q-tv";
const profilePictureClassAlt = "be6sR";

class ProfilePicture {
/***
Expand All @@ -13,7 +14,22 @@ class ProfilePicture {
* Creates all hover button
*/
createHoverable() {
let profilePictureImage = document.getElementsByClassName(profilePictureClass)[0];
let profilePictureImage = document.getElementsByClassName(profilePictureClass);
if (profilePictureImage.length > 0)
profilePictureImage = profilePictureImage[0];
else {
profilePictureImage = document.getElementsByClassName(profilePictureClassAlt)[0];
let css = ".IalUJ:hover #profile-middle {\n" +
" opacity: 1 !important;\n" +
"}";
let style = document.createElement('style');


style.appendChild(document.createTextNode(css));

document.getElementsByTagName('head')[0].appendChild(style);
}


let divProfileOverlay = document.createElement("div");
divProfileOverlay.classList.add("profile-middle");
Expand Down
72 changes: 37 additions & 35 deletions chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
{
"manifest_version": 2.0.1,
"name": "Instagram Downloader",
"version": "2",
"icons": {
"48": "icons/instagram.png"
},
"web_accessible_resources": [
"icons/download.png",
"icons/download_multiple.png"
],
"permissions": [
"downloads",
"background"
],
"background": {
"page": "html/background.html"
},
"content_scripts": [{
"matches": [
"*://*.instagram.com/*"
],
"js": [
"js/button.js",
"js/downloadAll.js",
"js/hoverable.js",
"js/downloadHomePage.js",
"js/downloadStory.js",
"js/profilePicture.js",
"js/main.js"
],
"css": [
"css/main.css"
]
}]
}
"manifest_version": 2,
"name": "Instagram Downloader",
"version": "2.1",
"icons": {
"48": "icons/instagram.png"
},
"web_accessible_resources": [
"icons/download.png",
"icons/download_multiple.png"
],
"permissions": [
"downloads",
"background"
],
"background": {
"page": "html/background.html"
},
"content_scripts": [
{
"matches": [
"*://*.instagram.com/*"
],
"js": [
"js/button.js",
"js/downloadAll.js",
"js/hoverable.js",
"js/downloadHomePage.js",
"js/downloadStory.js",
"js/profilePicture.js",
"js/main.js"
],
"css": [
"css/main.css"
]
}
]
}
14 changes: 10 additions & 4 deletions firefox/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ async function main() {
oldUrl = "heyyyyy";
i = 0;

} else if (url.includes("instagram.com/") && !url.includes("instagram.com/p/") && !url.includes("instagram.com/tv/") && !(/\/channel\/$/.test(url))) {
} else if (url.includes("instagram.com/") && !url.includes("instagram.com/p/") && !url.includes("instagram.com/tv/") && !(/\/channel\/$/.test(url)) || (/\/saved\/$/.test(url)) || (/\/tagged\/$/.test(url))) {
let a = document.getElementsByClassName("_7UhW9 fKFbl yUEEX KV-D4 fDxYl").length;


// man geht nicht immer in die
if (document.getElementsByClassName("_7UhW9 fKFbl yUEEX KV-D4 fDxYl").length > 0 && hoverPictures.length > 0
&& hoverPictures.length !== oldHover && document.getElementsByClassName("_0mzm- sqdOP L3NKy _4pI4F _8A5w5").length === 0
&& hoverPictures.length !== oldHover
|| url.includes("instagram.com/explore/") && hoverPictures.length > 0 && hoverPictures.length !== oldHover
&& document.getElementsByClassName("_0mzm- sqdOP L3NKy _4pI4F _8A5w5 ").length === 0) {

Expand All @@ -104,6 +108,8 @@ async function main() {
oldHover = hoverPictures.length;
hoverButton.removeHover();
hoverButton.createHoverable();
} else {
oldHover = -20;
}

oldUrl = "heyyyy";
Expand All @@ -130,8 +136,8 @@ async function main() {
oldUrl = url;
await sleep(10);
}
}
catch (e) {
} catch (e) {
console.error(e);
await sleep(1000);
main()
}
Expand Down
18 changes: 17 additions & 1 deletion firefox/js/profilePicture.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const profilePictureClass = "_6q-tv";
const profilePictureClassAlt = "be6sR";

class ProfilePicture {
/***
Expand All @@ -13,7 +14,22 @@ class ProfilePicture {
* Creates all hover button
*/
createHoverable() {
let profilePictureImage = document.getElementsByClassName(profilePictureClass)[0];
let profilePictureImage = document.getElementsByClassName(profilePictureClass);
if (profilePictureImage.length > 0)
profilePictureImage = profilePictureImage[0];
else {
profilePictureImage = document.getElementsByClassName(profilePictureClassAlt)[0];
let css = ".IalUJ:hover #profile-middle {\n" +
" opacity: 1 !important;\n" +
"}";
let style = document.createElement('style');


style.appendChild(document.createTextNode(css));

document.getElementsByTagName('head')[0].appendChild(style);
}


let divProfileOverlay = document.createElement("div");
divProfileOverlay.classList.add("profile-middle");
Expand Down
84 changes: 43 additions & 41 deletions firefox/manifest.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
{
"manifest_version": 2.0.1,
"name": "Instagram Downloader",
"version": "2",
"icons": {
"48": "icons/instagram.png"
},
"web_accessible_resources": [
"icons/download.png",
"icons/download_multiple.png"
],
"permissions": [
"downloads"
],
"background": {
"scripts": [
"js/download.js",
"js/jszip-utils.min.js",
"js/jszip.min.js"
]
},
"content_scripts": [{
"matches": [
"*://*.instagram.com/*"
],
"js": [
"js/button.js",
"js/hoverable.js",
"js/downloadAll.js",
"js/downloadHomePage.js",
"js/downloadStory.js",
"js/profilePicture.js",
"js/main.js"
],
"css": [
"css/main.css"
]
}],
"applications": {
"gecko": {
"id": "[email protected]"
}
"manifest_version": 2,
"name": "Instagram Downloader",
"version": "2.1",
"icons": {
"48": "icons/instagram.png"
},
"web_accessible_resources": [
"icons/download.png",
"icons/download_multiple.png"
],
"permissions": [
"downloads"
],
"background": {
"scripts": [
"js/download.js",
"js/jszip-utils.min.js",
"js/jszip.min.js"
]
},
"content_scripts": [
{
"matches": [
"*://*.instagram.com/*"
],
"js": [
"js/button.js",
"js/hoverable.js",
"js/downloadAll.js",
"js/downloadHomePage.js",
"js/downloadStory.js",
"js/profilePicture.js",
"js/main.js"
],
"css": [
"css/main.css"
]
}
],
"applications": {
"gecko": {
"id": "[email protected]"
}
}
}

0 comments on commit f23cac6

Please sign in to comment.