Hide CSDN

try to take over the world!

目前为 2019-05-21 提交的版本。查看 最新版本

// ==UserScript==
// @name         Hide CSDN
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @include     http*://www.baidu.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // Your code here...
    function cleanTheResult() {
        var list = Array.from(document.getElementsByClassName('c-showurl'))
        var rex = /CSDN|csdn|百度知道|百度经验/;
        var num = 0;

        function findParent(item) {
            // console.log(item);
            if (item.classList.contains('c-container')) {
                item.style.display = 'none';
                num++;
            } else {
                findParent(item.parentElement)
            }
        }
        list.map(item => {
            if (rex.test(item.innerText)) {
                findParent(item);
            }
        })
        console.log("已屏蔽" + num + "条搜索结果")

    }

    document.addEventListener("click", () => {
        cleanTheResult();
    });
})();

QingJ © 2025

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