Last active
June 30, 2024 21:57
-
-
Save dertuxmalwieder/cfdfdccb32f4883a8e37a88284fc17e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name kicker.de entwerben | |
// @namespace tuxproject.de | |
// @match https://www.kicker.de/* | |
// @require https://raw.githubusercontent.com/franciscop/umbrella/master/umbrella.min.js | |
// @version 1.1 | |
// @author tux0r | |
// @license CDDL-1.1; https://spdx.org/licenses/CDDL-1.1.html#licenseText | |
// @description Entfernt Reklamebanner auf kicker.de. | |
// @run-at document-idle | |
// ==/UserScript== | |
/* globals u */ | |
// Einiges wird erst nach dem Laden nachgeladen. Warte darauf und handle dann: | |
const kickerObserver = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutation) { | |
// Schwebendes Werbeding unten und Banner oben: | |
u("img[referrerpolicy='unsafe-url']").each((elem) => { | |
u(elem).parent().remove(); | |
}); | |
// Alles, was direkt in div.kick__article__container kein | |
// <article> ist, ist Reklame: | |
u(".kick__article__container > div").remove(); | |
// Alles, was direkt in div.kick__article__content__child | |
// ein <div> ist, ist Reklame: | |
u(".kick__article__content__child > div").remove(); | |
// <iframes> sind auch nur Werbung... | |
u("iframe").remove(); | |
// Im Liveblog ist ein DIV am Ende voller Werbung: | |
u(".kick__liveblog--main + div").remove(); | |
// Jetzt leere Platzhalter raus (Seite breiter): | |
u(".kick__ad-pos_wrapper").remove(); | |
}); | |
}); | |
const obsConfig = { | |
attributes: false, | |
childList: true, | |
characterData: false, | |
subtree: false | |
}; | |
kickerObserver.observe(document.body, obsConfig); | |
// Funktion ovLoadExportz() überschreiben: | |
function ovLoadExportz() { | |
// noop | |
} | |
function addJS_Node(text, s_URL, funcToRun, runOnLoad) { | |
var scriptNode = document.createElement ('script'); | |
if (runOnLoad) { | |
scriptNode.addEventListener ("load", runOnLoad, false); | |
} | |
scriptNode.type = "text/javascript"; | |
if (text) scriptNode.textContent = text; | |
if (s_URL) scriptNode.src = s_URL; | |
if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()'; | |
var targ = document.getElementsByTagName ('head')[0] || document.body || document.documentElement; | |
targ.appendChild (scriptNode); | |
} | |
addJS_Node(ovLoadExportz); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment