油猴百度广告过滤
var selectors = `
#content_left [style*="display:block !important;visibility:visible !important"]
[tpl="right_toplist"]
[class="c-gray c-feedback"]
[data-click*="vLevel"]
` ;
selectors = selectors. trim ( ) . split ( '\n' ) ;
var count = 0 ;
function showCount ( cn) {
if ( cn> 0 ) {
count+= cn;
var content_right = document. querySelector ( '#content_right' ) ;
if ( content_right) {
content_right. style. position = 'relative' ;
var style = `
line-height: 42px;
text-align: center;
background: #0c0;
color: #fff;
margin-bottom:30px;
` ;
var msgCount = document. querySelector ( '#msg-remove' ) ;
if ( ! msgCount) {
content_right. insertAdjacentHTML ( 'afterbegin' , '<div id="msg-remove" style="' + style+ '"></div>' ) ;
msgCount = document. querySelector ( '#msg-remove' ) ;
}
}
}
}
function clear ( ) {
selectors. forEach ( function ( selector) {
var doms = document. querySelectorAll ( selector) ;
if ( doms. length) {
doms = Array. from ( doms) ;
showCount ( doms. length) ;
doms. forEach ( function ( dom) {
dom. parentNode. removeChild ( dom) ;
} ) ;
}
} ) ;
}
setInterval ( function ( ) {
clear ( ) ;
} , 500 ) ;