屏蔽热搜,无闪烁,不闪烁,热搜屏蔽,屏蔽百度热搜,去热搜,去百度热搜,去除热搜,去除百度热搜,百度首页,百度搜索

看你想看的,不受打扰地工作(浏览器屏蔽百度热搜,去百度热搜)

目前為 2023-10-21 提交的版本,檢視 最新版本

// ==UserScript==
// @name         屏蔽热搜,无闪烁,不闪烁,热搜屏蔽,屏蔽百度热搜,去热搜,去百度热搜,去除热搜,去除百度热搜,百度首页,百度搜索
// @namespace    sj
// @version      16.3
// @description  看你想看的,不受打扰地工作(浏览器屏蔽百度热搜,去百度热搜)
// @license MIT
// @match      https://www.baidu.com/*
// @match      http://www.baidu.com/*
// @run-at   document-start
// ==/UserScript==

/*
页面刷新有两种情况。
1,首次进入页面。
2,异步加载,即点击【百度一下】按钮。
*/

var start = Date.now();
//从文档开始加载 就一直执行。早于DOMContentLoaded事件。
var i = 1;
var previousTime;
function DOMContentLoading() {
    setTimeout(function () {
        console.log('DOMContentLoading.次数: ' + i + ' ------ 总耗时: ' + (Date.now() - start) + ' ------ ------ ------ ------ ------ ------ \n');
        console.log('DOMContentLoading.间隔时间: ' + (Date.now() - previousTime) + '\n');

        let div;
        try {
            div = document.getElementById('content_right');
        } catch {
            console.log('error\n');
        }
        //判断元素是否存在;判断元素是否可见
        if (div) {
            // debugger;
            if (!div.hidden) {
                console.log('DOMContentLoading.执行hide\n');
                div.hidden = 'true';
            } else {
                //已隐藏,则退出。
                console.log('DOMContentLoading.已隐藏\n');
            }
        } else {
            console.log('DOMContentLoading.div不存在\n');
            DOMContentLoading();
        }

        previousTime = Date.now();
        i++;
    }, 6);//6 = 7 - 1
}

//DOMContentLoading,早于DOMContentLoaded事件
setTimeout(function () {
    previousTime = Date.now();
    DOMContentLoading();
}, 130);

//DOMContentLoaded事件
document.addEventListener('DOMContentLoaded', function () {
    console.log('DOMContentLoaded.总耗时: ' + (Date.now() - start) + '\n');
    var div = document.getElementById('content_right');
    //判断元素是否存在;判断元素是否可见
    if (div) {
        if (!div.hidden) {
            console.log('DOMContentLoaded.执行hide ****** ****** ****** \n');
            div.hidden = 'true';
        } else {
            console.log('DOMContentLoaded.已隐藏 ****** ****** ****** \n');
        }
    }

    //异步加载,即点击【百度一下】按钮
    mutationObserver.observe(document.getElementById('wrapper_wrapper'),
        { childList: true, subtree: true }
    );
}, false);

var j = 1;
function removeAD() {
    console.log('MutationObserver.removeADの次数: ' + j + '\n');
    j++;

    var div = document.getElementById('content_right');
    //判断元素是否存在;判断元素是否可见
    if (div) {
        if (!div.hidden) {
            console.log('MutationObserver.执行hide ------ ------ ------ ------ ------ ------ \n');
            div.hidden = 'true';
            j = ~~(j / 100) * 100 + 100;
        } else {
            console.log('MutationObserver.已隐藏\n');
        }
    } else {
        console.log('MutationObserver.div不存在\n');
        DOMContentLoading();
    }
}

//MutationObserver。监听DOM结构变化
let mutationObserver = new MutationObserver(function obsCallback(mutations, observer) {
    removeAD();
});//创建观察者实例并传入回调函数

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址