Skip to content

Instantly share code, notes, and snippets.

@oderwat
Created September 26, 2017 12:01
Show Gist options
  • Save oderwat/05372f5a882f965eef2b942c409d4ebe to your computer and use it in GitHub Desktop.
Save oderwat/05372f5a882f965eef2b942c409d4ebe to your computer and use it in GitHub Desktop.
Spiegel Online AdBlocker-Blocker
// ==UserScript==
// @name Spiegel Online AddBlocker removal
// @namespace http://oderwat.de/soabrem
// @version 0.1
// @description I hate adblocker
// @author H. Raaf
// @match www.spiegel.de/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
function load(url, onLoad, onError) {
var e = document.createElement("script");
e.setAttribute("src", url);
if (onLoad !== null) { e.addEventListener("load", onLoad); }
if (onError !== null) { e.addEventListener("error", onError); }
document.body.appendChild(e);
return e;
}
function execute(functionOrCode) {
var code = functionOrCode;
if (typeof code === "function") {
code = "(" + code + ")();";
}
var e = document.createElement("script");
e.textContent = code;
document.body.appendChild(e);
return e;
}
function loadAndExecute(url, functionOrCode) {
load(url, function() { execute(functionOrCode); });
}
function init() {
if(!document.body) {
window.setTimeout(init,100);
return;
}
loadAndExecute("//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js", function() {
var removeAB = function() {
if($('#wrapper-content').attr('style')) {
console.log("Removing AdBlockerBlocker overlay");
$('.ua-detected').hide();
$('#wrapper-content').attr('style','');
} else {
window.setTimeout(removeAB, 100);
}
};
removeAB();
});
}
init();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment