SC2Casts.com Adblock Nag Screen Remover

Removes the 'disable Adblock' nag screen.

当前为 2016-05-25 提交的版本,查看 最新版本

// ==UserScript==
// @name         SC2Casts.com Adblock Nag Screen Remover
// @namespace    http://lazy.artifact
// @version      0.27
// @description  Removes the 'disable Adblock' nag screen.
// @author       Lazy Artifact
// @match        http://sc2casts.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    /*
        hi santah!! :-)
        hope things are well.
    */

    var popupFuncBodyRegex = new RegExp('\u0069\u0066\u005C\u0028\u0021\u006F\u0066\u0066\u005C\u0029', 'ui'),
        i,
        noop = function() {},
        globalWhiteList =
        ['applicationCache','caches','closed','controllers','crypto','devicePixelRatio','dialogArguments','document','frameElement','frames','fullScreen','history','indexedDB','innerHeight','innerWidth','isSecureContext','length','localStorage','location','locationbar','menubar','messageManager','mozAnimationStartTime','mozInnerScreenX','mozInnerScreenY','mozPaintCount','name','navigator','onabort','onafterprint','onbeforeprint','onbeforeunload','onblur','onchange','onclick','onclose','oncontextmenu','ondblclick','ondevicelight','ondevicemotion','ondeviceorientation','ondeviceorientationabsolute','ondeviceproximity','onerror','onfocus','onhashchange','oninput','onkeydown','onkeypress','onkeyup','onlanguagechange','onload','onmousedown','onmousemove','onmouseout','onmouseover','onmouseup','onmozbeforepaint','onpaint','onpointercancel','onpointerdown','onpointerenter','onpointerleave','onpointermove','onpointerout','onpointerover','onpointerup','onpopstate','onrejectionhandled','onreset','onresize','onscroll','onselect','onselectstart','onstorage','onsubmit','ontouchcancel','ontouchmove','ontouchstart','onunhandledrejection','onunload','onuserproximity','onvrdisplayconnected','onvrdisplaydisconnected','onvrdisplaypresentchange','opener','outerHeight','outerWidth','parent','performance','personalbar','screen','screenX','screenY','scrollbars','scrollMaxX','scrollMaxY','scrollX','scrollY','self','sessionStorage','sidebar','speechSynthesis','status','statusbar','toolbar','top','URL','window,','alert','atob','back','blur','btoa','cancelAnimationFrame','cancelIdleCallback','captureEvents','clearImmediate','clearInterval','clearTimeout','close','confirm','convertPointFromNodeToPage','createImageBitmap','dump','event','fetch','find','focus','forward','getAttention','getComputedStyle','getDefaultComputedStyle','getSelection','home','matchMedia','minimize','moveBy','moveTo','open','openDialog','postMessage','print','prompt','releaseEvents','requestAnimationFrame','requestIdleCallback','resizeBy','resizeTo','restore','scroll','scrollBy','scrollByLines','scrollByPages','scrollTo','setCursor','setImmediate','setInterval','setTimeout','showModalDialog','sizeToContent','stop','updateCommands'],
        regexBodyAction = function(i, obj) {
            if (popupFuncBodyRegex.test(obj[i].toString(), "")) {
                obj[i] = noop;
            }
        },
        walk = function(obj, action, maxDepth) {
            var i,
                nodes = [
                    {
                        value: obj,
                        parent: null
                    }
                ],
                nodeType,
                parent,
                currentDepth;

            while(nodes.length > 0) {
            
                obj = nodes.shift();
        
                parent = obj.parent;
                
                currentDepth = 0;

                while(parent !== null && parent !== undefined) {
                    parent = parent.parent;

                    currentDepth++;
                }
    
                if(maxDepth !== undefined && maxDepth !== null && currentDepth >= maxDepth) {
                    break;
                }

                for(i in obj.value) {
                    if(obj.value[i] === null || obj.value[i] === undefined) {
                        continue;
                    }

                    if(!Object.prototype.hasOwnProperty.call(obj.value, i)) {
                        continue;
                    }
                    
                    if(currentDepth === 0 && globalWhiteList.findIndex(function(e) { return i === e; }) >= 0) {
                        continue;
                    }

                    nodeType = typeof obj.value[i];
                   
                    if(nodeType === 'object' && !(obj.value[i] instanceof window.constructor)) {
                     
                        
                        if(nodes.findIndex(function(e) { return obj.value[i] === e; }) < 0) {
                            continue;
                        }


                        nodes.push({
                            value: obj.value[i],
                            parent: obj
                        });

                        continue;
                    }

                    if(nodeType !== 'function') {
                        continue;
                    }

                    action(i, obj.value);
                
                }

            }
        };
       
   
    
    walk(window, regexBodyAction, null);

   
})();

QingJ © 2025

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