Fuck CSDN

在搜索结果中屏蔽 CSDN。支持 Google / Baidu / Bing / 360 搜索

اعتبارا من 19-03-2022. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Fuck CSDN
// @namespace    Alex3236
// @version      2.0
// @icon         https://www.google.com/s2/favicons?sz=64&domain=csdn.net
// @description  在搜索结果中屏蔽 CSDN。支持 Google / Baidu / Bing / 360 搜索
// @license      GNU-GPLv3
// @include      *://www.baidu.com/s?*
// @include      *://*.google.*/search*
// @include      *://*.bing.com/search*
// @include      *://www.so.com/s*
// @include      *://*.csdn.net/*
// @grant        none
// ==/UserScript==

function isSite(domain) {
    return window.location.href.match(new RegExp("^https?:\/\/[\\w.]+?" + domain))
}

function HideCSDN(){
    const filters = ".source_1Vdff, .iUh30, .b_attribution, .g-linkinfo-a".split(", ")
    const Elements=document.querySelectorAll(".result.c-container, .g, .b_algo, .res-list");
    let num;
    Elements.forEach(function(Item,i){
        for (var filter in filters) {
            let selectedContent=Item.querySelector(filters[filter])
            if (selectedContent !== null) {
                if (selectedContent.innerText.toLowerCase().includes("csdn")) {
                    Item.parentNode.removeChild(Item);
                    num = i;
                    break;
                }
            }
        }
    });
    if (num !== undefined) {
        console.log(`[Fuck CSDN] 已去除 ${num} 条 CSDN 内容`)
    }
}

function bind() {
    document.querySelectorAll(".page-item_M4MDr, #form, #page, .ac_wrap").forEach(
        function(Item) {
            Item.addEventListener('mousedown',function () {
                setTimeout(function(){
                    HideCSDN();
                    if (isSite('so.com')) {
                        bind();
                    }
                },1000);
            })
        }
)}

// 绑定回车事件
document.querySelectorAll("input.gLFyf.gsfi, input#kw, input#keyword").forEach(
function(Item) {
    Item.addEventListener('keydown', function () {
    var evt = window.event || arguments.callee.caller.arguments[0];
    if (evt.keyCode == "13") {
        setTimeout(function(){HideCSDN();},1000);
    }
})})

if (isSite('csdn.net')) {
    document.body.innerHTML = "Blocked by Fuck CSDN.";
    window.history.go(-1);
}

HideCSDN();
bind();