initial repo - 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 d0229906849489c71a94f40f1788ffff6119aee8
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 7 Aug 2018 20:18:03 +0200
initial repo
Diffstat:
A .gitignore | 1 +
A LICENSE | 15 +++++++++++++++
A Makefile | 7 +++++++
A README | 31 +++++++++++++++++++++++++++++++
A TODO | 9 +++++++++
A extension/global/fiximg.js | 9 +++++++++
A extension/global/focus.js | 66 +++++++++++++++++++++++++++++++
A extension/manifest.json | 45 +++++++++++++++++++++++++++++++
A extension/site/buienradar.css | 3 +++
A extension/site/gamekings.css | 20 ++++++++++++++++++++
A extension/site/gamekings.js | 16 ++++++++++++++++
A extension/site/hardwareinfo.css | 7 +++++++
A extension/site/hardwareinfo.js | 9 +++++++++
A extension/site/kudtkoekiewet.js | 5 +++++
A extension/site/tweakers.js | 10 ++++++++++
A extension/site/twitter.css | 3 +++
16 files changed, 256 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/.gitignore b/.gitignore
@@ -0,0 +1 @@
+*.xpi
(DIR) diff --git a/LICENSE b/LICENSE
@@ -0,0 +1,15 @@
+ISC License
+
+Copyright (c) 2018 Hiltjo Posthuma <hiltjo@codemadness.org>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
(DIR) diff --git a/Makefile b/Makefile
@@ -0,0 +1,7 @@
+package: clean
+ ( cd extension; \
+ zip -r -FS ../firefox-extension.xpi *; \
+ cd ../ )
+
+clean:
+ rm -f firefox-extension.xpi
(DIR) diff --git a/README b/README
@@ -0,0 +1,31 @@
+Features
+--------
+
+- focus.js: Focus the first input field with ctrl-space if no input with
+ "autofocus" is present.
+- fiximg.js: Fixup some elements to show images. Javascript is commonly abused
+ to "lazyload" images.
+
+
+Build dependencies
+------------------
+- POSIX shell
+- Make
+- zip
+
+
+Build
+-----
+make
+
+
+Install
+-------
+
+in about:config set
+xpinstall.signatures.required to true
+
+(I don't support Mozilla add-on store nazism)
+
+
+Then on the add-ons page load the .xpi file from disk or from a url.
(DIR) diff --git a/TODO b/TODO
@@ -0,0 +1,9 @@
+- CSS: disable animations? CSS animation override?
+- CSS: disable transitions?
+- detect big overlay with opacity: 0 in some way?
+- detect bad constrast in content text: grey on white, dark grey on black:
+ override using CSS.
+- detect common javascript image links of some frameworks and fix them up?
+ - check React, Vue.js, etc.
+- fixup "font-awesome" icons somehow? classname: "fa fa-blablabla"
+- fixup other font icons somehow? for example on bol.com: rating stars.
(DIR) diff --git a/extension/global/fiximg.js b/extension/global/fiximg.js
@@ -0,0 +1,9 @@
+(function() {
+ Array.from(document.querySelectorAll("img[data-mediumthumb]")).map(function(img) {
+ img.src = img.getAttribute("data-mediumthumb");
+ });
+
+ Array.from(document.querySelectorAll("img[data-original]")).map(function(img) {
+ img.src = img.getAttribute("data-original");
+ });
+})();
(DIR) diff --git a/extension/global/focus.js b/extension/global/focus.js
@@ -0,0 +1,66 @@
+// ==UserScript==
+// @name Input focus
+// @namespace -
+// @description Input focus
+// @version 1.1
+// @grant none
+// ==/UserScript==
+//
+// 1.1
+// - added toggle to blur field (ctrl+space).
+//
+(function() {
+ function hasfocus(el) {
+ return el === document.activeElement;
+ }
+ function findfield() {
+ var found = null;
+ var el = document.activeElement;
+ if(typeof(el) == 'object') {
+ var type = (el.type || '').toLowerCase();
+ if(el.tagName == 'INPUT' && ['text', 'search'].indexOf(type) != -1)
+ found = el;
+ }
+ if(found === null) {
+ var els = document.getElementsByTagName('input') || [];
+ for(var i = 0; i < els.length; i++) {
+ var type = (els[i].type || '').toLowerCase();
+ if(['text', 'search'].indexOf(type) != -1) {
+ found = els[i];
+ break;
+ }
+ }
+ }
+ if(found !== null) {
+ return found;
+ }
+ return null;
+ }
+ function focusfield(el) {
+ if(el === null)
+ return el;
+ el.click(); // Some sites require this to clear the input field.
+ var value = el.value || '';
+ el.selectionStart = 0; // value.length;
+ el.selectionEnd = value.length;
+ el.focus();
+ return el;
+ }
+ function blurfield(el) {
+ el.blur();
+ }
+ function onkeydown(e) {
+ if(e.ctrlKey && e.keyCode == 32) { /* ctrl + space */
+ var el = findfield();
+ /* toggle */
+ if(hasfocus(el)) {
+ blurfield(el);
+ } else {
+ focusfield(el);
+ }
+
+ }
+ }
+ window.addEventListener('keydown', onkeydown, true);
+// focusfield(findfield());
+})();
(DIR) diff --git a/extension/manifest.json b/extension/manifest.json
@@ -0,0 +1,45 @@
+{
+ "manifest_version": 2,
+ "name": "fix-web",
+ "version": "1.0",
+ "description": "Scripts to make the web suck less and fixup some things",
+ "permissions": [ "activeTab" ],
+ "background": { "scripts": [] },
+ "applications": {
+ "gecko": {
+ "id": "hiltjo@codemadness.org"
+ }
+ },
+ "content_scripts": [
+ {
+ "matches": [ "*://*/*" ],
+ "js": [ "global/focus.js", "global/fiximg.js" ]
+ },
+ {
+ "matches": [ "*://www.gamekings.tv/*" ],
+ "js": [ "site/gamekings.js" ],
+ "css": [ "site/gamekings.css" ]
+ },
+ {
+ "matches": [ "*://kudtkoekiewet.nl/*" ],
+ "js": [ "site/kudtkoekiewet.js" ]
+ },
+ {
+ "matches": [ "*://twitter.com/*" ],
+ "css": [ "site/twitter.css" ]
+ },
+ {
+ "matches": [ "*://tweakers.net/*" ],
+ "js": [ "site/tweakers.js" ]
+ },
+ {
+ "matches": [ "*://www.buienradar.nl/*" ],
+ "css": [ "site/buienradar.css" ]
+ },
+ {
+ "matches": [ "*://*.hardware.info/*" ],
+ "css": [ "site/hardwareinfo.css" ],
+ "js": [ "site/hardwareinfo.js" ]
+ }
+ ]
+}
(DIR) diff --git a/extension/site/buienradar.css b/extension/site/buienradar.css
@@ -0,0 +1,3 @@
+#br-ad-outofpage, .spec-block {
+ display: none !important;
+}
(DIR) diff --git a/extension/site/gamekings.css b/extension/site/gamekings.css
@@ -0,0 +1,20 @@
+.getpremium, .slider {
+ display: none !important;
+
+}
+.content {
+ opacity: 1 !important;
+}
+.post__image {
+ top: 0 !important;
+ left: 0 !important;
+ width: 100% !important;
+ height: 100% !important;
+ position: static !important;
+ transition: none !important;
+ transform: none !important;
+}
+.video {
+ overflow: initial !important;
+ height: auto !important;
+}
(DIR) diff --git a/extension/site/gamekings.js b/extension/site/gamekings.js
@@ -0,0 +1,16 @@
+(function() {
+
+Array.from(document.querySelectorAll("#videoplayer[data-url]")).map(function(v) {
+ var url = v.getAttribute("data-url") || "";
+ var thumb = v.getAttribute("data-thumb") || "";
+ if (url.length && thumb.length) {
+ var a = document.createElement("a");
+ a.href = url;
+ a.innerHTML = "<img src=\"" + thumb + "\" alt=\"\" />";
+
+ v.parentNode.replaceChild(a, v);
+ }
+});
+
+})();
+
(DIR) diff --git a/extension/site/hardwareinfo.css b/extension/site/hardwareinfo.css
@@ -0,0 +1,7 @@
+#sitearea > div:not([id='content']) *,
+#sitearea > div:not([id='content']) {
+ display: none !important;
+ color: transparent !important;
+ border: 0 !important;
+ background: none !important;
+}
(DIR) diff --git a/extension/site/hardwareinfo.js b/extension/site/hardwareinfo.js
@@ -0,0 +1,9 @@
+(function() {
+
+var c = document.getElementById("cookiecontainer");
+if (typeof(c) != "undefined" && (document.cookie || "").match("cookiebar=1") === null) {
+ document.cookie = "cookiebar=1";
+ window.location.reload(true);
+}
+
+})();
(DIR) diff --git a/extension/site/kudtkoekiewet.js b/extension/site/kudtkoekiewet.js
@@ -0,0 +1,5 @@
+(function() {
+
+location.href = location.search.match(/t=(.*)/)[1]+"?kudtcookiewet=jakapmetzeuren&kudtcookiernd=1";
+
+})();
(DIR) diff --git a/extension/site/tweakers.js b/extension/site/tweakers.js
@@ -0,0 +1,10 @@
+(function() {
+
+var c = document.getElementById("cookieContainer");
+if (typeof(c) != "undefined") {
+ var b = c.getElementsByClassName("fancyButton");
+ if (b.length)
+ b[0].click();
+}
+
+})();
(DIR) diff --git a/extension/site/twitter.css b/extension/site/twitter.css
@@ -0,0 +1,3 @@
+form.NoScriptForm{
+ display: none !important;
+}