Greasy Fork 还支持 简体中文。

百度搜索结果屏蔽csdn博客

csdn让我不爽很久了,尤其是是它的博客会导致不能用鼠标关闭网页,那我干脆就屏蔽你

目前為 2021-11-25 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         百度搜索结果屏蔽csdn博客
// @namespace    gcud
// @version      20200119
// @description  csdn让我不爽很久了,尤其是是它的博客会导致不能用鼠标关闭网页,那我干脆就屏蔽你
// @author       gcud
// @match        https://www.baidu.com/s?*
// @grant        none
// ==/UserScript==
let timer;
function HideCSDN(){
    const Elements=document.querySelectorAll(".result.c-container ");
    let num;
    Elements.forEach(function(Item,i){
        let Content=Item.querySelector(".f13 a:first-child").innerText;
        if(Content.includes("CSDN技术社区")){
            Item.parentNode.removeChild(Item);
            num = i
            clearInterval(timer)
        }
    });
    console.log(`共去除${num}条csdn内容`)
}
HideCSDN();

/*绑定键盘回车事件*/
document.querySelector("body").addEventListener('keydown',function () {
    //谷歌能识别event,火狐识别不了,所以增加了这一句,chrome浏览器可以直接支持event.keyCode
    var theEvent = window.event || arguments.callee.caller.arguments[0];
    if (theEvent.keyCode == "13") {//keyCode=13是回车键
        clearInterval(timer)
        timer = setInterval(function(){
            HideCSDN()
            console.log(`123`)
        },1000)
    }
})
/*绑定单机事件*/
document.querySelector("body").addEventListener('click',function () {
    clearInterval(timer)
    timer = setInterval(function(){
        HideCSDN()
        console.log(`123`)
    },1000)
})