您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
屏蔽CSDN搜索结果
// ==UserScript== // @name Google & Bing 屏蔽CSDN搜索结果 // @license MIT // @namespace http://tampermonkey.net/ // @version 1.2 // @description 屏蔽CSDN搜索结果 // @author YourName // @match *://www.google.com/search* // @match *://www.google.com.hk/search* // @match *://www.bing.com/search* // @grant none // ==/UserScript== (function() { 'use strict'; // 定义屏蔽规则(支持正则匹配) const blockList = [ /csdn\.net/i, // 屏蔽CSDN /csdnimg\.cn/i, /cloud\.baidu\.com/i, // 可追加其他网站,如:/jianshu\.com/i ]; // 定义选择器:每个引擎对应一个数组 const selectors = { google: ['.g'], bing: ['.b_ans ','.b_algo', '.b_wpt_bl','.slide'], baidu: ['.result'], }; // 检测当前搜索引擎 const host = window.location.hostname; let engine = ''; if (host.includes('google')) engine = 'google'; else if (host.includes('bing')) engine = 'bing'; else if (host.includes('baidu')) engine = 'baidu'; // 隐藏匹配的搜索结果 const hideCSDN = () => { if (!selectors[engine]) return; const queryStr = selectors[engine].join(', '); const items = document.querySelectorAll(queryStr); items.forEach(item => { let link = ''; if (engine === 'bing') { // Bing 特殊处理 .b_wpt_bl,链接可能在 cite 或 a 标签中 link = item.querySelector('cite')?.innerText || item.querySelector('a')?.href || ''; } else { link = item.querySelector('a')?.href || ''; } if (blockList.some(regex => regex.test(link))) { item.remove(); } }); }; // 监听页面变化(应对无限滚动加载) new MutationObserver(hideCSDN).observe( document.body, { childList: true, subtree: true } ); // 初始执行 hideCSDN(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址