Anti-AdBlocker & DeBlocker

Remove Anti-AdBlocker & DeBlocker

当前为 2020-02-29 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Anti-AdBlocker & DeBlocker
// @version      1.06
// @description  Remove Anti-AdBlocker & DeBlocker
// @author       Elwyn
// @license      MIT
// @namespace    https://openuserjs.org/install/Elwyn/Anti-AdBlocker_DeBlocker.user.js
// @include      *
// @run-at document-start
// @grant unsafeWindow
// ==/UserScript==
(function() {

    if ( window.location !== window.parent.location ) return;

    var excludes = ['360.cn', 'adblockplus.org', 'agar.io', 'aliexpress.com', 'amazon.', 'apple.com', 'ask.com', 'baidu.com', 'bing.com', 'bufferapp.com', 'calm.com', 'chatango.com', 'chromeactions.com', 'dolldivine.com', 'easyinplay.net', 'ebay.com', 'exacttarget.com', 'facebook.com', 'flattr.com', 'flickr.com', 'fsf.org', 'greasyfork.org', 'ghacks.net', 'google.', 'imdb.com', 'imgbox.com', 'imgur.com', 'instagram.com', 'jsbin.com', 'jsfiddle.net', 'linkedin.com', 'live.com', 'mail.ru', 'microsoft.com', 'msn.com', 'openuserjs.org', 'pandoon.info', 'paypal.com', 'pinterest.com', 'plnkr.co', 'popmech.ru', 'preloaders.net', 'qq.com', 'reddit.com', 'stackoverflow.com', 'tampermonkey.net', 'twitter.com', 'vimeo.com', 'wikipedia.org', 'w3schools.com', 'xemvtv.net', 'yahoo.', 'yandex.ru', 'youtu.be', 'youtube.com', 'vod.pl'];
    if (new RegExp( excludes.join('|').replace(/\./g,'\.') ).test( location.host )) return;

    function addStyle(str) {
        var node = document.createElement('style');
        node.innerHTML = str;
        document.body.appendChild(node);
    }

    function randomInt( min, max )
    {
        // min and max included
        if ( max === undefined ) {
            max = min;
            min = 0;
        }
        return Math.floor(min + Math.random() * (max - min + 1));
    }

    function getRandomName( size )
    {
        var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        var i;
        var name = '';
        for (i = 0; i < (size||randomInt(10,24)); i++)
        {
            name += chars.charAt( randomInt(0,chars.length) );
        }
        return name;
    }

    function addRandomClass( el ) {
        var name = el.className;
        if ( typeof name != 'undefined' ) {
            if( /\s/.test( name ) ) {
                name = name.split(' ');
                name = name[0];
            }
        } else {
            name = getRandomName();
            el.classList.add( name );
        }
        return '.' + name + ',';
    }

    function removeModal( el )
    {
        console.log( 'ANTI-DEBLOCKER: Anti-AdBlock Found!');

        var classes = '';

        for (;;) {
            if ( el.parentNode.tagName == 'BODY' ) break;
            classes += addRandomClass( el );
            el = el.parentNode;
        }

        document.querySelectorAll( 'div' ).forEach( ( el ) => {
            let style = window.getComputedStyle( el );
            let height;
            if ( style.getPropertyValue( 'position' ) == 'fixed' )
            {
                height = style.getPropertyValue( 'height' );
                if ( height == '100%' )
                {
                    classes += addRandomClass( el );
                }
                else if ( /px/i.test( height ) && parseInt( height ) > window.innerHeight - 100 )
                {
                    classes += addRandomClass( el );
                }
            }
        });

        if ( classes.length > 0 ) {

            classes = classes.substring( 0, classes.length - 1 );

            console.log( 'ANTI-DEBLOCKER Elements:' + classes );

            let $_removeChild = unsafeWindow.Node.prototype.removeChild;
            unsafeWindow.Node.prototype.removeChild = ( node ) => {
                if ( node.tagName != 'HEAD' && node.tagName != 'BODY' ) {
                    $_removeChild.apply( this, arguments );
                }
            }

            addStyle( classes + '{ display: none !important; }' );

            addStyle( '* { -webkit-filter: blur(0px) !important; filter: blur(0px) !important; }' );
        }

    }

    document.addEventListener('DOMContentLoaded', function() {
        // Mutation Observer
        var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;

        // Create an observer instance
        var observer = new MutationObserver( (mutations) => {
            mutations.forEach( (mutation) => {
                if ( mutation.addedNodes.length ) {
                    Array.prototype.forEach.call( mutation.addedNodes, (addedNode) => {
                        if ( typeof addedNode.innerText == 'undefined' ) return;
                        if ( addedNode.innerText.length < 2 ) return;
                        //console.log( 'ANTI-DEBLOCKER Text:' + addedNode.innerText );
                        if( /A\s*d\s*-?B\s*l\s*o\s*c\s*k|bloqueur|bloqueador|Werbeblocker|&#1570;&#1583;&#1576;&#1604;&#1608;&#1603; &#1576;&#1604;&#1587;|блокировщиком/i.test( addedNode.innerText ) ){
                            removeModal( addedNode );
                        }
                    });
                }
            });
        });
        // Observer
        observer.observe(document, {
            childList : true,
            subtree : true
        });
    }, false);


})();