Greasy Fork

Spiegel Anti-AntiAdBlock

If you disable AdBlock on spiegel.de, the website may still display a nag-message. This scripts will prevent said popup and content blur.

目前为 2017-10-18 提交的版本。查看 最新版本

// ==UserScript==
// @name         Spiegel Anti-AntiAdBlock
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  If you disable AdBlock on spiegel.de, the website may still display a nag-message. This scripts will prevent said popup and content blur.
// @author       Beat Luginbühl
// @match        http://www.spiegel.de/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    setCookie('abbActivated', false, 365);

    while (true) {
        var popup = getPopUp();
        if ((popup !== null || popup !== 'undefined') && popup.style !== null) {
            popup.style.display = 'none';
            break;
        }
    }

    function getPopUp() {
        var popup = document.getElementsByClassName('ua-detected ua-webkit');
        if (popup.length > 0 && popup[0] !== 'undefined') {
            return popup[0];
        }

        return null;
    }

    /**
     * https://www.w3schools.com/js/js_cookies.asp
     */
    function setCookie(cname, cvalue, exdays) {
        var d = new Date();
        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
        var expires = "expires="+d.toUTCString();
        document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
    }
})();