imgur album browser script - firefox-fix-web - Firefox extension: fix web
(HTM) git clone git://git.codemadness.org/firefox-fix-web
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 5f5e6c2069ed391a0a1eeb7ab264cf88220f86a1
(DIR) parent ff6892788a0e16a4729e66ffeaf32df2f87f9b5a
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 25 Feb 2019 20:33:20 +0100
imgur album browser script
Diffstat:
M extension/manifest.json | 4 ++++
A extension/site/imgur.js | 16 ++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/extension/manifest.json b/extension/manifest.json
@@ -57,6 +57,10 @@
"matches": [ "*://*.hardware.info/*" ],
"css": [ "site/hardwareinfo.css" ],
"js": [ "site/hardwareinfo.js" ]
+ },
+ {
+ "matches": [ "*://imgur.com/*" ],
+ "js": [ "site/imgur.js" ]
}
]
}
(DIR) diff --git a/extension/site/imgur.js b/extension/site/imgur.js
@@ -0,0 +1,16 @@
+(function() {
+ // not an album page.
+ if (!document.querySelectorAll("div.post-header").length)
+ return;
+
+ var els = Array.from(document.querySelectorAll("div.post-image-container[id]"));
+ var html = "";
+ for (var i = 0; i < els.length; i++) {
+ var id = els[i].getAttribute("id") || "";
+ if (!id.length)
+ continue;
+ var url = "https://i.imgur.com/" + id + ".jpg";
+ html += "<a href=\"" + url + "\"><img src=\"" + url + "\" alt=\"\" width=\"100%\" /></a><br/>";
+ }
+ document.body.innerHTML = html;
+})();