derstandard.at adfree Rework Mai 2024

Zeigt normale Bilder bei Artikel an und keine Benachrichtung mehr, dass Werbung geblockt wird.

// ==UserScript==
// @name         derstandard.at adfree Rework Mai 2024
// @namespace    derstandard
// @version      20240503
// @description  Zeigt normale Bilder bei Artikel an und keine Benachrichtung mehr, dass Werbung geblockt wird.
// @author       You
// @match        https://*.derstandard.at/*
// @license MIT
// @grant        GM_addStyle
// @icon         https://www.google.com/s2/favicons?sz=64&domain=derstandard.at
// ==/UserScript==
/*- The @grant directive is needed to work around a major design
    change introduced in GM 1.0. It restores the sandbox.

    If in Tampermonkey, use "// @unwrap" to enable sandbox instead.
*/

console.log('Tampermonkey derstandard.at starting');

(new MutationObserver(check)).observe(document, {childList: true, subtree: true});
(new MutationObserver(check2)).observe(document, {childList: true, subtree: true});

function check(changes, observer) {
    if(document.querySelector("[data-ad-active='false']")) {
        console.log("QuerySelecter executed and found: [data-ad-active='false']");
        //observer.disconnect();
        // actions to perform after #mySelector is found
        document.querySelectorAll("[data-ad-active='false']").forEach(function(elem) {
            console.log('Removing element from "false" match: ', elem);
            elem.remove();
        })
    }
}

function check2(changes, observer) {
    if(document.querySelector("[data-ad-active='true']")) {
        console.log("QuerySelecter executed and found: [data-ad-active='true']");
        //observer.disconnect();
        // actions to perform after #mySelector is found
        document.querySelectorAll("[data-ad-active='true']").forEach(function(elem) {
            console.log('Removing element from "true" match ', elem);
            elem.remove();
        })
    }
}