净化Baidu首页

A script to remove baidu AD.

// ==UserScript==
// @name 净化Baidu首页
// @version 1.0
// @description A script to remove baidu AD.
// @match *://*.baidu.com/*
// @namespace https://greasyfork.org/users/1363287
// ==/UserScript==

(function() {
    function main(){
        const observer = new MutationObserver(()=>{document.querySelector(`#s_wrap`);document.querySelector(`#s_wrap`).style.display = `none`;}); //处理广告
        observer.observe(document.body, {childList: true, subtree: true }); //以上述配置开始观察广告节点
    }

    if (document.readyState === `loading`) {
        document.addEventListener(`DOMContentLoaded`, main); // 此时加载尚未完成
    } else {
        main();// 此时`DOMContentLoaded` 已经被触发
    }

})();