Anti-Anti Adblock v1 (All Sites)

A simple anti-adblock script, will work for typical anti-adblock stuff rolled out by Google.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           Anti-Anti Adblock v1 (All Sites)
// @namespace      https://greasyfork.org/en/users/198860-zyenith
// @grant          none
// @description    A simple anti-adblock script, will work for typical anti-adblock stuff rolled out by Google.
// @author         zyenith
// @version        0.0.1
// @match          *://*/*
// @run-at         document-start
// @antifeature    Tracking, for compatibility info
// @require        https://greasyfork.org/scripts/410512-sci-js-from-ksw2-center/code/scijs%20(from%20ksw2-center).js
// ==/UserScript==

const detected = {
    active: false,
    element: null
};

const observer = new MutationObserver((mutations) => {
    mutations.forEach((mutation) => {
        mutation.addedNodes.forEach((node) => {
            if (!node.classList) {
                return;
            }

            const allElements = document.getElementsByTagName("*");

            const element = Array.from(allElements).find((element) => element.classList.value.length && element.tagName === "DIV" && element.textContent.match(/Support\sFree\s\w+/));

            if (!element) {
                return;
            }

            detected.active = true;
            detected.element = element;

            observer.disconnect();

            const visibilityObserver = new MutationObserver((mutations) => {
                mutations.forEach((mutation) => {
                    if (mutation.target.style.visibility === "hidden") {
                        element.remove();
                        visibilityObserver.disconnect();
                    };
                });
            });

            visibilityObserver.observe(element, { attributes: true });
        });
    });
});

observer.observe(document, { childList: true, subtree: true });

setTimeout(observer.disconnect, 25000);