Assassinate Ad Block Blockers

You know those annoying content blockers that popup demanding you remove your AdBlock so you can read the content? This script removes them by force. Please note, this is not UNIVERSAL like AdBlock Plus. It operates at a per-site basis.

目前為 2021-01-11 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Assassinate Ad Block Blockers
// @namespace    http://tampermonkey.net/
// @version      1.27
// @description  You know those annoying content blockers that popup demanding you remove your AdBlock so you can read the content? This script removes them by force. Please note, this is not UNIVERSAL like AdBlock Plus. It operates at a per-site basis.
// @author       Kxmode
// @run-at       document-idle
// @match        *://www.vg247.com/*
// @match        *://www.eurogamer.net/*
// @match        *://www.makeuseof.com/*
// @match        *://www.gamesradar.com/*
// @match        *://www.usatoday.com/*
// @match        *://www.cnn.com/*
// @match        *://www.businessinsider.com/*
// @match        *://www.thedailybeast.com/*
// @match        *://www.forbes.com/*
// @match        *://*.nytimes.com/*
// @match        *://*.dailymail.co.uk/*
// @match        *://*.washingtonpost.com/*
// @match        *://*.insider.com/*
// @match        *://*.latimes.com/*
// ==/UserScript==

// Loads jQuery and triggers a callback function when jQuery has finished loading
function addJQuery(callback) {
    var script = document.createElement("script");
    script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js");
    script.addEventListener('load', function() { callback(); }, false);
    document.body.appendChild(script);
}

// The main script
function main() {

    const $ = (unsafeWindow || window).$;

    // For domains that uses a specific service blocking AdBlockers
    var arrayStandardBlockerDomains = [ "www.vg247.com",
                                        "www.eurogamer.net",
                                        "www.gamesradar.com",
                                        "www.usatoday.com",
                                        "www.cnn.com"].map(String);

    // For domains that follow a nonstandard or custom way of blocking AdBlockers
    var arrayAbnormalBlockerDomains = [ "www.makeuseof.com",
                                        "www.businessinsider.com",
                                        "www.thedailybeast.com",
                                        "www.nytimes.com",
                                        "cooking.nytimes.com",
                                        "www.forbes.com",
                                        "www.dailymail.co.uk",
                                        "www.washingtonpost.com",
                                        "www.insider.com",
                                        "www.latimes.com"].map(String);

    // For domains that typically launch third-party modals for random stuff like sign-ups
    var arrayAuxiliaryBlockerDomains = [ "www.gamesradar.com"].map(String);

    // Use to display the loading animation
    $("body").prepend('<div id="Injected-By-Assassinate-Ad-Block-Blockers" style="background-color: #D8070E; font-weight: bold; color: white; text-align: center; margin: auto; padding: 10px; position: relative; z-index: 9999999999 !important; top: 220px;"><style>#Injected-By-Assassinate-Ad-Block-Blockers img { width: unset; }</style><img src="https://i.imgur.com/velCxDX.gif" style="display: inline-block; vertical-align: middle;" /> <span>Assassinate Ad Block Blockers is doing its jobs. Please wait a few seconds.</span></div>');

    function DOMStatusCheck() {
        if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1)
        {
            var isHTMLBlocked = $("html").attr("style");
            var isBodyBlocked = $("body").attr("style");
            var isHTMLClassBlocked = $("html").hasClass("sp-message-open");

            if (isHTMLBlocked !== undefined || isBodyBlocked !== undefined || isHTMLClassBlocked)
            {
                clearInterval(currentStatus1);
                // We're on a page that is blocked

                $("html").removeAttr("style");
                $("body").removeAttr("style");
                $("html").removeClass("sp-message-open");

                switch(window.location.hostname)
                {
                    case arrayStandardBlockerDomains[0]: // vg247
                    case arrayStandardBlockerDomains[1]: // eurogamer
                    case arrayStandardBlockerDomains[2]: // gamesradar
                    case arrayStandardBlockerDomains[3]: // usatoday
                    case arrayStandardBlockerDomains[4]: // cnn
                        $("[class*='sp_veil']").remove();
                        $("[id*='sp_message_id']").remove();
                        break;
                }
            }

            console.clear();
        }

        if (arrayAuxiliaryBlockerDomains.indexOf(window.location.hostname) > -1)
        {
            switch(window.location.hostname)
            {
                case arrayAuxiliaryBlockerDomains[0]: // gamesradar
                    if ($(".raleigh-optin-visible").is(":visible"))
                    {
                        $("[class*='raleigh-optin-']").remove();
                    }
                    clearInterval(currentStatus2);
                    break;
            }
        }

        if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1)
        {
            switch(window.location.hostname)
            {
                case arrayAbnormalBlockerDomains[0]: // makeuseof
                    $("[class*='unblockplease-overlay']").remove();
                    $(".unblockplease").removeAttr("style");
                    break;
                case arrayAbnormalBlockerDomains[1]: // businessinsider
                    $(".tp-modal").remove();
                    $(".tp-backdrop").remove();
                    $("body").removeClass("tp-modal-open");
                    break;
                case arrayAbnormalBlockerDomains[3]: // nytimes
                case arrayAbnormalBlockerDomains[4]: // nytimes cooking
                    // nytimes
                    $("#standalone-footer").remove();
                    $("#gateway-content").remove();
                    $("body").attr("style", "overflow: unset;");
                    $("#site-content").attr("style","position: unset;");
                    $("[id*='lire-ui-'").remove();
                    $("[class*='css-1bd']").remove();

                    // nytimes' cooking
                    $(".nytc---modal-window---windowContainer").parents("#appContainer").remove(); // a modal with no close button. wtf nyt?!
                    $("#container").attr("style","overflow: unset;");
                    $(".nytc---modal-window---noScroll").attr("style","overflow: unset;");
                    $("#site-content").attr("style","position: unset;");

                    // nytimes' magazine and site-wide
                    $("[class*='css-mcm']").attr("style","position: unset;");
                    break;
               case arrayAbnormalBlockerDomains[5]: // forbes
                    $(".tp-modal").remove();
                    $(".tp-backdrop.tp-active").remove();
                    $("body").removeAttr("class");
                    $(".page-loaded").remove();
                    $(".article-fixed[_nghost-c11]").attr("style", "position: unset;");
                    // abnormal situation. these appear on certain pages.
                    $("#lightboxjs-lightboxlib").remove();
                    $("#aax_prefetch_frame").remove();
                    $("#cok_aax").remove();
                    $("body > iframe:nth-of-type(1)").remove(); // these run in sequence. we want to remove the first 7-9 iframes since iframes typically contain ABB-related injection code or advertisements.
                    $("body > iframe:nth-of-type(1)").remove();
                    $("body > iframe:nth-of-type(1)").remove();
                    $("body > iframe:nth-of-type(1)").remove();
                    $("body > iframe:nth-of-type(1)").remove();
                    $("body > iframe:nth-of-type(1)").remove();
                    $(".fbs-auth__container").remove();
                    $(".fbs-ad--ntv-contentd-wrapper").remove();
                    $(".body--no-scroll").attr("style", "overflow: unset;");
                    $.each($("script"), function() { // scans all scripts for a very specific paywall script
                        var selector = $(this).attr("src");
                        var target = String(selector).match(/(paywall)+.(unlock-protocol)+./g); // the script is found
                        if (target !== null)
                        {
                            $(this).remove(); // and removed so that it can't re-inject itself
                        }
                    });
                    $("#article-container-0").attr("style","position: unset;");
                    break;
               case arrayAbnormalBlockerDomains[6]: // www.dailymail.co.uk
                    $("#mol-ads-cmp-iframe").next().remove();
                    $("html").removeAttr("class");
                    $("body").removeAttr("class");
                    break;
               case arrayAbnormalBlockerDomains[7]: // washingtonpost
                    $("html").removeAttr("style");
                    $("body").removeAttr("style");
                    $("[data-qa*='paywall']").remove();
                    $("[rel*='apple-touch-icon']").last().next().next().remove(); // removes the blocker html
                    $("[rel*='apple-touch-icon']").last().next().next().remove(); // removes the blocker styles
                    break;
               case arrayAbnormalBlockerDomains[8]: // insider
                    $(".tp-modal").remove();
                    $(".tp-backdrop.tp-active").remove();
                    $("body").removeAttr("class");
                    break;
               case arrayAbnormalBlockerDomains[9]: // latimes
                    $("html").attr("style","overflow: unset;");
                    $("body").removeAttr("style");
                    $(".Page-body").removeAttr("style");
                    $(".fc-ab-root").remove();
                    break;
            }
        }
    }

    function SledgehammerRemoval() {
        if (window.location.hostname == arrayAbnormalBlockerDomains[2]) // dailybeast
        {
            $("#Injected-By-Assassinate-Ad-Block-Blockers").attr("style","background-color: green; font-weight: bold; color: white; text-align: center; margin: auto; padding: 10px; position: relative; z-index: 9999999999 !important; transition: .5s; top: 220px;");
            $("#Injected-By-Assassinate-Ad-Block-Blockers").find("img").attr("src","https://i.imgur.com/i5e5xp0.gif");
            $("#Injected-By-Assassinate-Ad-Block-Blockers").find("span").text("Success. Enjoy!");

            // Wait 1.5 seconds
            setTimeout(function()
            {
                $(".tp-modal").remove();
                $(".tp-backdrop").remove();
                $("body").removeClass("tp-modal-open");
                $("[id*='offer-0-']").remove();
                $("[displayname*='PianoTag']").remove();
                $("[src*='tinypass.min.js']").remove();
                $("#piano_bottom_ribbon_wrapper").remove();
                console.clear();
                console.log("blocker code removed");
                $("#Injected-By-Assassinate-Ad-Block-Blockers").remove();
            }, 1500);
        }
    }

    SledgehammerRemoval();

    function ClearAllIntervals()
    {
        $("#Injected-By-Assassinate-Ad-Block-Blockers").attr("style","background-color: green; font-weight: bold; color: white; text-align: center; margin: auto; padding: 10px; position: relative; z-index: 9999999999 !important; transition: .5s; top: 220px;");
        $("#Injected-By-Assassinate-Ad-Block-Blockers").find("img").attr("src","https://i.imgur.com/i5e5xp0.gif");
        $("#Injected-By-Assassinate-Ad-Block-Blockers").find("span").text("Success. Enjoy!");

        // Wait 1.5 seconds
        setTimeout(function()
        {
            console.clear();
            var totalTimeouts = 10;

            if (window.location.hostname != arrayAbnormalBlockerDomains[2]) // dailybeast
            {
                if (window.location.hostname == arrayAbnormalBlockerDomains[3] || window.location.hostname == arrayAbnormalBlockerDomains[4]) // nytimes and nytimes cooking
                {
                    console.log("Final pass for nytimes");
                    $("[class*='css-1bd']").remove();
                }
                if (window.location.hostname == arrayAbnormalBlockerDomains[5]) // forbes
                {
                    console.log("Final pass for forbes");
                    $(".unlock.start").remove();
                    $("#article-container-0").attr("style","position: unset;");
                }
                if (window.location.hostname == arrayAbnormalBlockerDomains[6]) // www.dailymail.co.uk
                {
                    $("#mol-ads-cmp-iframe").next().remove();
                    $("html").removeAttr("class");
                    $("body").removeAttr("class");
                }
                if (window.location.hostname == arrayAbnormalBlockerDomains[7]) // washingtonpost
                {
                    $("html").removeAttr("style");
                    $("body").removeAttr("style");
                    $("[data-qa*='paywall']").remove();
                    $("[rel*='apple-touch-icon']").last().next().next().remove(); // removes the blocker html
                    $("[rel*='apple-touch-icon']").last().next().next().remove(); // removes the blocker styles
                }
                if (window.location.hostname == arrayAbnormalBlockerDomains[8]) // washingtonpost
                {
                    $(".tp-modal").remove();
                    $(".tp-backdrop.tp-active").remove();
                    $("body").removeAttr("class");
                }
                if (window.location.hostname == arrayAbnormalBlockerDomains[9]) // latimes
                {
                    $("html").attr("style","overflow: unset;");
                    $(".Page-body").removeAttr("style");
                    $(".fc-ab-root").remove();
                }

                clearInterval("SledgehammerRemoval");
                console.log("Sledgehammer interval cleared");
            }
            for (var i = 1; i <= totalTimeouts; i++)
            {
                var intervalName = "currentStatus" + i;
                clearInterval(intervalName);
            }
            clearInterval(ci);
            console.log("all intervals cleared");

            $("#Injected-By-Assassinate-Ad-Block-Blockers").remove();
        }, 1500);
    }

    // Sets up listeners to supercede any blocker shenanigans
    if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus1 = setInterval(DOMStatusCheck, 50); }
    if (arrayAuxiliaryBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus2 = setInterval(DOMStatusCheck, 50); }

    // Second pass after 1.5 seconds
    if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus3 = setTimeout(DOMStatusCheck, 1500); }
    if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus4 = setTimeout(DOMStatusCheck, 1500); }

    // Third pass after 2.5 seconds
    if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus5 = setTimeout(DOMStatusCheck, 2500); }
    if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus6 = setTimeout(DOMStatusCheck, 2500); }

    // Fourth pass after 5.5 seconds
    if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus7 = setTimeout(DOMStatusCheck, 5500); }
    if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus8 = setTimeout(DOMStatusCheck, 5500); }

    // Fifth pass after 7 seconds
    if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus9 = setTimeout(DOMStatusCheck, 7000); }
    if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus10 = setTimeout(DOMStatusCheck, 7000); }

    // Last-pass guarantee after 7.05 seconds (We want this to fire immediately after the fifth pass)
    var ci = setTimeout(ClearAllIntervals, 7050);

    // Perpetual check and removal every 2.5 seconds - The Peter Gabriel Sledgehammer Special
    if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1) { var ABStatus = setInterval(SledgehammerRemoval, 2500); }

    console.clear();
}

// Load jQuery and then execute the main function
addJQuery(main);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址