更新 'baidu/clearAd.user.js'
This commit is contained in:
parent
928e2f8ddc
commit
de0393ecca
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 百度广告去除
|
// @name 百度广告去除
|
||||||
// @namespace http://ide.yumc.pw/
|
// @namespace http://ide.yumc.pw/
|
||||||
// @version 0.0.5
|
// @version 0.0.6
|
||||||
// @description 去除百度上下推广广告
|
// @description 去除百度上下推广广告
|
||||||
// @author MiaoWoo
|
// @author MiaoWoo
|
||||||
// @include http*://*.baidu.*
|
// @include http*://*.baidu.*
|
||||||
@ -21,7 +21,7 @@
|
|||||||
var count = 0;
|
var count = 0;
|
||||||
function showCount(cn){
|
function showCount(cn){
|
||||||
if(cn>0){
|
if(cn>0){
|
||||||
count+=cn;
|
count += cn;
|
||||||
var content_right = document.querySelector('#content_right');
|
var content_right = document.querySelector('#content_right');
|
||||||
if(content_right){
|
if(content_right){
|
||||||
content_right.style.position = 'relative';
|
content_right.style.position = 'relative';
|
||||||
@ -42,31 +42,39 @@ margin-bottom:30px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function clear() {
|
function clear() {
|
||||||
|
tempCount = 0
|
||||||
selectors.forEach(function(selector) {
|
selectors.forEach(function(selector) {
|
||||||
var doms = document.querySelectorAll(selector);
|
var doms = document.querySelectorAll(selector);
|
||||||
if(doms.length){
|
if(doms.length){
|
||||||
doms = Array.from(doms);
|
doms = Array.from(doms);
|
||||||
showCount(doms.length);
|
tempCount += doms.length;
|
||||||
doms.forEach(function(dom) {
|
doms.forEach(function(dom) {
|
||||||
dom.parentNode.removeChild(dom);
|
dom.parentNode.removeChild(dom);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
['.m', 'a span'].forEach(function (c) {
|
var adKeyword = ['广告', '评价']
|
||||||
|
var classKeyWord = ['.m', 'a span']
|
||||||
|
classKeyWord.forEach(function (c) {
|
||||||
var result = $(c)
|
var result = $(c)
|
||||||
var tempCount = 0
|
|
||||||
result.each(function (index,element) {
|
result.each(function (index,element) {
|
||||||
if($(element).html() == "广告" && $(element).parent().parent().css('display')!='none'){
|
if(adKeyword.indexOf($(element).text())){
|
||||||
$(element).parent().parent().remove();
|
|
||||||
tempCount++
|
|
||||||
}
|
|
||||||
if($(element).html() == "评价" && $(element).parent().parent().parent().css('display')!='none'){
|
|
||||||
$(element).parent().parent().remove();
|
$(element).parent().parent().remove();
|
||||||
tempCount++
|
tempCount++
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
showCount(tempCount);
|
|
||||||
})
|
})
|
||||||
|
$('.ad-block').each(function (index,element) {
|
||||||
|
$(element).parent().parent().parent().remove();
|
||||||
|
tempCount++
|
||||||
|
})
|
||||||
|
$('div a').each(function (index, element) {
|
||||||
|
if($(element).text()=="广告"){
|
||||||
|
$(element).parent().parent().parent().parent().parent().parent().parent().remove()
|
||||||
|
}
|
||||||
|
tempCount++
|
||||||
|
})
|
||||||
|
showCount(tempCount);
|
||||||
}
|
}
|
||||||
setInterval(clear, 500);
|
setInterval(clear, 500);
|
||||||
})();
|
})();
|
Loading…
Reference in New Issue
Block a user