diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Dagbladet noblink/Dagbladet noblink.user.js | 34 | ||||
-rw-r--r-- | Fix input fields/fix-input-fields.user.js (renamed from fix-input-fields.js) | 30 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | Nettavisen noblink/Nettavisen noblink.user.js | 24 | ||||
-rw-r--r-- | README.md | 14 |
6 files changed, 84 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e88e7b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.gm.json diff --git a/Dagbladet noblink/Dagbladet noblink.user.js b/Dagbladet noblink/Dagbladet noblink.user.js new file mode 100644 index 0000000..a775e8b --- /dev/null +++ b/Dagbladet noblink/Dagbladet noblink.user.js @@ -0,0 +1,34 @@ +// ==UserScript== +// @name Dagbladet noblink +// @namespace snake66 +// @description Remove annoying blinking backgrounds and animated marquees at dagbladet.no. +// @include https://*.dagbladet.no/* +// @include https://*.dinside.no/* +// @version 5 +// @grant none +// ==/UserScript== + +let blink_classes = [ + 'breaking-dots', + 'breaking-just-now-slug', + 'breaking--just-now', + 'breaking--just-now-wave', + 'breaking--just-now-wave-blink', + 'breaking--pulse-background', + 'breaking--pulse-kicker', + 'breaking--pulsating-dots', + 'pulse' +] + +function dagbladet_noblink() +{ + for (let cls of blink_classes) { + for (let blinker of document.getElementsByClassName(cls)) { + //console.log("Disabling marquee on " + blinker.nodeName + " - " + blinker.nodeId) + blinker.classList.remove(cls) + } + } +} + +let dagbladet_obsrvr = new MutationObserver(dagbladet_noblink) +dagbladet_obsrvr.observe(document, { attributes: true, childList: true, subtree: true })// ==UserScript== diff --git a/fix-input-fields.js b/Fix input fields/fix-input-fields.user.js index 2c7c83e..d300fbd 100644 --- a/fix-input-fields.js +++ b/Fix input fields/fix-input-fields.user.js @@ -7,29 +7,13 @@ // @version 2 // @grant none // ==/UserScript== -// -// Greasemonkey userscript to fix invisible input fields on websites with bad css. -// Copyright (C) 2019 Harald Eilertsen -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <https://www.gnu.org/licenses/>. function normalizedColor(color) { let argstart = color.indexOf("(") + 1; let arglen = color.lastIndexOf(")") - argstart; let type = color.substr(0, argstart - 1); - let args = color.substr(argstart, arglen).split(", ").map(function(v) { + let args = color.substr(argstart, arglen).split(", ").map(function(v) { return parseInt(v); }); return {type: type, val: args} @@ -39,16 +23,16 @@ function isBright(color) { if (!color || color == "") return false; - + let c = normalizedColor(color); if (c.type != "rgb") return false; - + let avg = (c.val[0] + c.val[1] + c.val[2]) / 3; return avg > 90; } -function fixInputFields() +function fixInputFields() { let inputs = document.getElementsByTagName("input"); console.log("Fix input fields found " + inputs.length + " inputs..."); @@ -59,11 +43,11 @@ function fixInputFields() let fg = style.getPropertyValue("color"); let bg = style.getPropertyValue("background-color"); let image = style.getPropertyValue("background-image"); - + if (image) { input.style.backgroundImage = "none"; } - + if (isBright(bg)) { if (isBright(fg)) { input.style.color = "darkslategray"; @@ -75,4 +59,4 @@ function fixInputFields() console.log("Fix input fields end..."); } -fixInputFields(); +fixInputFields();
\ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d974190 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +all: userscripts.zip + +userscripts.zip: */*.js + zip -9ur $@ * diff --git a/Nettavisen noblink/Nettavisen noblink.user.js b/Nettavisen noblink/Nettavisen noblink.user.js new file mode 100644 index 0000000..02e0c12 --- /dev/null +++ b/Nettavisen noblink/Nettavisen noblink.user.js @@ -0,0 +1,24 @@ +// ==UserScript== +// @name Nettavisen noblink +// @namespace snake66 +// @description Remove annoying blinking backgrounds and animated marquees at nettavisen.no. +// @include https://*.nettavisen.no/* +// @version 1 +// @grant none +// ==/UserScript== + +let nettavisen_blink_classes = [ + 'optimus-element-sonar', +] + +function nettavisen_noblink() +{ + for (let cls of nettavisen_blink_classes) { + for (let blinker of document.getElementsByClassName(cls)) { + blinker.remove() + } + } +} + +let nettavisen_obsrvr = new MutationObserver(nettavisen_noblink) +nettavisen_obsrvr.observe(document, { attributes: true, childList: true, subtree: true }) @@ -4,3 +4,17 @@ A small collection of GreaseMonkey userscripts I use to make the web less annoyi If you find the useful, that's great, if not... well, they work for me :) As always, code is GPLv3. + +## Installation + +You can install directly from this repository, just click [tree](tree/) in the +menu above, and navigate to the source of the userscript you want to install, +and click on the `(plain)` link above the actual code. Be sure to verify that +the code looks sane to you before trusting it. + +## Usage + +This is [free software](https://fsfe.org/freesoftware/freesoftware.en.html) +under the GNU General Public License (GPL) version 3. This means you are free +to use, adapt and reshare in any way you want. Please see the included +`LICENSE` file for details. |