彻底清理百度搜索结果首尾的广告、二次广告(什么鬼)与右侧推广
当前为
// ==UserScript==
// @name 百度搜索广告清理
// @namespace hoothin
// @version 0.1
// @description 彻底清理百度搜索结果首尾的广告、二次广告(什么鬼)与右侧推广
// @author hoothin
// @include http*://www.baidu.com/s*
// @grant none
// @run-at document-end
// @license MIT License
// @compatible chrome 测试通过
// @compatible firefox 测试通过
// ==/UserScript==
(function() {
'use strict';
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
var observer = new MutationObserver(function(records){
clearAD();
});
var option = {
'childList': true,
'subtree': true
};
observer.observe(document.body, option);
function clearAD(){
var list=document.body.querySelectorAll("#content_left>div,#content_left>table");
for(let item of list){
let s = item.getAttribute("style");
if (s && /display:(table|block)\s!important/.test(s)) {
item.parentNode.removeChild(item);
}else{
var span=item.querySelector("div>span");
if(span && span.innerHTML=="广告"){
item.parentNode.removeChild(item);
}
}
}
var eb = document.querySelectorAll("#content_right>table>tbody>tr>td>div");
if(eb.length>1)
for(let d of eb){
if (d.id!="con-ar") {
d.parentNode.removeChild(d);
}
}
}
})();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址