Skip to content

Instantly share code, notes, and snippets.

@StigNygaard
Last active July 26, 2016 13:26
Show Gist options
  • Save StigNygaard/b60b923e4f6be783f1bf9be4c11cc0ad to your computer and use it in GitHub Desktop.
Save StigNygaard/b60b923e4f6be783f1bf9be4c11cc0ad to your computer and use it in GitHub Desktop.
Politiken Splash Killer - Fjern addblocker besked på politiken.dk
// ==UserScript==
// @name Politiken Splash Killer
// @namespace dk.rockland.userscript.politiken.splashkill
// @description Fjern addblocker besked på politiken.dk
// @author Stig Nygaard, http://www.rockland.dk
// @include http://politiken.dk/*
// @version 2016.05.16.01
// @grant none
// ==/UserScript==
var DEBUG = false;
function log(s) {
if (DEBUG && window.console) {
window.console.log(s);
}
}
log('Running...');
var itimer = 0;
function killSplash() {
log('killSplash()');
var trash = document.querySelector('span.modal--closeBtn');
if (trash && document.querySelector('body.dit-modal-open')) {
log('trash found to be removed...');
while(trash) {
trash = trash.parentNode;
trash.parentNode.removeChild(trash);
trash = document.querySelector('span.modal--closeBtn');
}
document.body.classList.remove("dit-modal-open");
clearInterval(itimer);
}
}
function stopKiller() {
log('stopKiller()');
clearInterval(itimer);
}
itimer = setInterval(killSplash, 300);
setTimeout(stopKiller, 8000);
/*
var timer = 0;
function killSplash() {
log('killSplash()');
if (timer>3000) {
log('killSplash() clearTimeout');
clearInterval(timer);
}
while (var b=document.querySelector('span.modal--closeBtn')) {
log('while iteration...');
if (typeof b.onclick == "function") {
log('run onclick.');
b.onclick.apply(b);
}
}
}
timer = setInterval(killSplash, 500);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment