Greasy Fork is available in English.

去除电信运营商劫持广告

去除中国电信等运营商的劫持内嵌广告

Verzia zo dňa 18.06.2017. Pozri najnovšiu verziu.

// ==UserScript==
// @name         去除电信运营商劫持广告
// @namespace    hoothin
// @version      0.9
// @description  去除中国电信等运营商的劫持内嵌广告
// @author       hoothin
// @include      http://*/*
// @grant        none
// @license      MIT License
// ==/UserScript==

(function() {
    'use strict';
    setTimeout(function(){
        [].every.call(document.querySelectorAll("iframe"),function(i){
            if(i.src.indexOf(location.href)===0 && i.src!=location.href && i.src.replace(location.href,"").indexOf("?")===0){
                console.info("检测到劫持广告!");
                alert("检测到劫持广告!");
                var ad=document.querySelector("iframe#a");
                if(ad)ad.parentNode.removeChild(ad);
                i.onload=function(){
                    document.querySelector("html").innerHTML=i.contentWindow.document.querySelector("html").innerHTML;
                };
                return false;
            }
            return true;
        });
    },100);
})();