Skip to content

Instantly share code, notes, and snippets.

@gue-ni
Last active February 23, 2022 11:56
Show Gist options
  • Save gue-ni/0679f1de46c7196d9d74516edeac49d3 to your computer and use it in GitHub Desktop.
Save gue-ni/0679f1de46c7196d9d74516edeac49d3 to your computer and use it in GitHub Desktop.
AdBlock für derstandard.at
// ==UserScript==
// @name Der Standard AdBlock
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Easy way to block ads on derstandard.com
// @author Jakob Maier
// @match https://www.derstandard.at/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
const selectors = [
'ad-container',
'.native-ad',
'.animation',
'.teads-ui',
'.template.theme-supporter',
'.dstpiano-message.dstpiano-width-960.template-loaded',
'.dstpiano-container.visible-message',
'#piano-supporter-inline-container'
];
const callback = (mutations, observer) => {
for (let selector of selectors){
for (let element of document.querySelectorAll(selector)){
element.style.display = "none";
}
}
}
let observer = new MutationObserver(callback);
let body = document.querySelector("body");
observer.observe(body, { childList: true, subtree: true});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment