您的位置:首页 > 其它

FireFox、Chrome油猴脚本:查杀浮动广告

2013-06-14 23:33 260 查看

// ==UserScript==

// @name jsKillAD

// @namespace jsKillAD

// @description 查杀页面浮动广告

// @description:en Kill AD on page

// @author xinggsf~gmail。com

// @homepageURL https://greasyfork.org/scripts/7410
// updateURL https://greasyfork.org/scripts/7410/code/jsKillAD.user.js
// @encoding utf-8

// @license GPL version 3

// @include http://*
// @include https://*
// @exclude http://*.mail.*/*
// @exclude http://*mimg.127.net/*
// @exclude http://*.csdn.net/postedit/*
// @exclude https://mail.google.com/*
// @exclude http://www.google.*/search?*
// @exclude https://www.google.*/search?*
// @exclude http://www.google.*/webhp*
// @exclude https://www.google.*/webhp*
// @exclude http://www.baidu.com/s?*
// @exclude http://play.baidu.com/*
// @exclude http://115.com/*
// @exclude http://*.115.com/*
// @exclude http://*.1ting.com/*
// @exclude http://www.360doc.com/*
// @exclude http://www.cnblogs.com/*
// @exclude http://www.iqiyi.com/v_*
// @exclude http://*.qq.com/*
// @exclude http://video.sina.com.cn/*
// @exclude http://www.yatu.tv/m*/play*.html
// @grant none

// @modified 2015.3.29

// @version 1.3.8

// ==/UserScript==

-function (doc) {

var bc = Array.prototype.forEach;

function getStyle(o, s) {

if (o.style[s]) return o.style[s];

if (doc.defaultView && doc.defaultView.getComputedStyle) {//DOM

var x = doc.defaultView.getComputedStyle(o, '');

//s = s.replace(/([A-Z])/g,'-$1').toLowerCase();

return x && x.getPropertyValue(s);

}

}

function testStyle(o) {

var s = getStyle(o, 'position');

return s === 'fixed' || s === 'absolute';

}

function isFloatLay(o) {

var x = o.offsetParent;

return !x || x.tagName === 'BODY' || x.tagName === 'HTML';

}

-function(el) {

['iframe','img','object','embed'].forEach(function (s) {

bc.call(el.getElementsByTagName(s), function (x) {

while (x) {

if (isFloatLay(x)) {

testStyle(x) && x.parentNode.removeChild(x);

break;

}

x = x.offsetParent;

}

});

});

}(doc);

}(document);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: