Block Ads In Webpages. This Script Can Only Block Ads Which Are In "Iframe" Tags.
目前為
// ==UserScript==
// @name 移除框架广告 Remove Ads In iframes
// @namespace https://ez118.github.io/
// @version 1.5
// @icon https://adblockplus.org/favicon.ico
// @description Block Ads In Webpages. This Script Can Only Block Ads Which Are In "Iframe" Tags.
// @author ZZY_WISU
// @match *://*/*
// @run-at document-end
// @license GNU GPLv3
// ==/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 BlockIt() {
Array.prototype.forEach.call(document.querySelectorAll('iframe'), function(iframe) {
/*iframe.parentElement.removeChild(iframe);*/
for(let i = 0; i < AdsUrlList.length; i ++){
if(iframe.src.includes(AdsUrlList[i])){
try { iframe.remove(); }
catch(e) { iframe.parentElement.removeChild(iframe); }
break;
}
}
});
}
(function() {
'use strict';
BlockIt();
setTimeout(BlockIt, 1000)
setInterval(BlockIt, 6000);
})();