Corriere.it: Hide Annoying popups (the anti-adblock popup and others)

This script hides the annoying popups (the anti-adblock popup and others) that are shown in the web page.

当前为 2025-05-10 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name           Corriere.it: Hide Annoying popups (the anti-adblock popup and others)
// @name:it        Corriere.it: Nasconde i popup fastidiosi (il popup anti-adblock ed altri)
// @description    This script hides the annoying popups (the anti-adblock popup and others) that are shown in the web page.
// @description:it Questo script nasconde i popup fastidiosi (il popup anti-adblock e altri) che vengono visualizzati nella pagina web.
// @match          https://*.corriere.it/*
// @grant          none
// @require        https://update.greasyfork.org/scripts/535551/1586473/HideAnnoyingPopupsLib.js
// @version        1.0.3
// @author         Cyrano68
// @license        MIT
// @namespace      https://greasyfork.org/users/788550
// ==/UserScript==

(function()
{
    "use strict";

    const myVersion = GM_info.script.version;
    consoleLog(`==> Corriere_it_HideAnnoyingPopups: HELLO! Loading script (version: ${myVersion})...`);

    function getZeroFilledMillisecs(dateNow)
    {
        const millisecs = dateNow.getMilliseconds();
        return ("00" + millisecs).slice(-3);
    }

    function consoleLog(text)
    {
        const dateNow = new Date();
        //const now = dateNow.toISOString();
        const now = dateNow.toLocaleString() + "." + getZeroFilledMillisecs(dateNow);
        console.log(`${now} ${text}`);
    }

    //document.addEventListener("DOMContentLoaded", onDOMContentLoaded);
    //window.addEventListener("load", onWindowLoaded);

    consoleLog(`==> Corriere_it_HideAnnoyingPopups: Using library 'HideAnnoyingPopupsLib' (version: ${window.HideAnnoyingPopupsLib.getVersion()})`);

    const mutationObserverConfig  = {subtree: true, childList: true, attributes: true, attributeOldValue: true, attributeFilter: ["class"]};
    const mutatedNodesConfig      = {selectors: ["div.privacy-cp-wall", "div.bck-adblock", "div.tp-container-inner"]/*, onMutatedNode: onMutatedNode*/};
    const mutatedAttributesConfig = {attributeInfos: [{attributeName: "class", targetTagName: "HTML"}, {attributeName: "class", targetTagName: "BODY"}]/*, onMutatedAttribute: onMutatedAttribute*/};

    window.HideAnnoyingPopupsLib.configure(mutationObserverConfig, mutatedNodesConfig, mutatedAttributesConfig);

    consoleLog("==> Corriere_it_HideAnnoyingPopups: Script loaded");
})();