干掉UC恶心的广告

手机UC不仅有恶心的缓存,还有恶心的嵌入广告。如果使用后清除缓存后发现没有效果,实际上它是回到了上一次的缓存,而上一次的缓存是没有是该代码会被嵌入广告的。

最好的实验效果就是卸掉重新装。

直接贴代码。

 function () {
            var u = navigator.userAgent;
            var p = navigator.platform;
            var w = p.indexOf("Win");
            if (w > -1) {
                //alert("这货不是手机");
            } else if (u.indexOf('UCBrowser') > -1) {
                // var ind = 0;
                window["uc-recommend-ad_ucd"] || (
                    window["uc-recommend-ad_ucd"] = setInterval(function () {
                        var ucd = $("iframe[name=uc-recommend-ad]");
                        // ind += ucd.length;
                        if (ucd.length > 0) {
                            ucd.length > 0 && ucd.remove();
                            clearInterval(window["uc-recommend-ad_ucd"]);
                            window["uc-recommend-ad_ucd"] = null;
                            ucd = null;
                            //setTimeout(function() {
                            //    alert("成功过滤的广告(" + ind + ")");
                            //}, 10);
                        } else {
                            //   alert("我还在走啊");
                        }
                    }, 500)
                );
                window["uc-recommend-ad_ucda"] || (
                    window["uc-recommend-ad_ucda"] = setInterval(function () {
                        var ucda = $('a[href*="uc.cn/"]');
                        if (ucda.length > 0) {
                            //ind = ucda.length;
                            ucda.each(function () {
                                $(this).before(this.innerText);
                            });
                            $(ucda).remove();
                            ucda = null;
                            clearInterval(window["uc-recommend-ad_ucda"]);
                            window["uc-recommend-ad_ucda"] = null;
                        }
                    }, 5)
                );
                setTimeout(function () {
                    window["uc-recommend-ad_ucda"] != null && (clearInterval(window["uc-recommend-ad_ucda"]), window["uc-recommend-ad_ucda"] = null);
                    window["uc-recommend-ad_ucd"] != null && (clearInterval(window["uc-recommend-ad_ucd"]), window["uc-recommend-ad_ucd"] = null);
                    //alert("我走了");
                }, 8000);
            }
        }
    }

 

posted @ 2017-09-04 09:39  风吹过四季  阅读(876)  评论(0编辑  收藏  举报