Greasy Fork

移除广告 Remove Ads

Block Most Of The Ads In Pages. This Script Can Only Block Ads Which Are In "Iframe" Tags.

目前为 2022-06-22 提交的版本。查看 最新版本

// ==UserScript==
// @name             移除广告 Remove Ads
// @namespace        https://ez118.github.io/
// @version          1.1
// @icon             https://adblockplus.org/favicon.ico
// @description      Block Most Of The Ads In Pages. This Script Can Only Block Ads Which Are In "Iframe" Tags.
// @author           ZZY_WISU
// @match            *://*/*
// @license          GNU GPLv3
// @run-at document-end
// @grant            none
// ==/UserScript==

/*If this can't block your ads, add the url to block it!*/
var AdsUrlList = ["kunpeng-sc.csdnimg.cn", "googleads.g.doubleclick.net", "pos.baidu.com", "vt.ipinyou.com", "www.2345.com", "show-3.mediav.com"];
/*目前可拦截这些广告商的广告: CSDN, GOOGLE, BAIDU等 */

function CheckAndRemoveAds(){
    var Iframes = document.getElementsByTagName("iframe");
    for(let i = 0; i < Iframes.length(); i ++) {
        for(let j = 0; j < AdsUrlList.length(); j ++){
            if(Iframes[i].src.includes(AdsUrlList[j])){
                Iframes[i].remove();;
            }
        }
    }
}

(function() {
    'use strict';
    setTimeout(function() { CheckAndRemoveAds(); }, 2000);
    setTimeout(function() { CheckAndRemoveAds(); }, 8000);
})();