// ==UserScript== // @name 屏蔽 DBD-Raws // @namespace anti-DBD-Raws // @version 0.94 // @description a simple script to block the display of DBD-Raws // @author CropCircle // @match http://*/* // @match https://*/* // @grant none // @run-at document-idle // @exclude https://*.google.* // @exclude https://*.bing.* // @exclude https://*.baidu.* // @exclude https://greasyfork.org/* // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Define the keywords to filter and replace const keywords = [ '黑暗路基艾尔', 'DBD-Raws', 'DBD分流Q群', 'DBD', 'https://afdian.net/@112127luji', '746546998', '560823326', '1158412873', '1040411052', 'https://space.bilibili.com/97177229', 'https://space.bilibili.com/476857955', '神圣之路基艾尔' ]; const replacement = '██视力保护██'; //const replacenum = '██视力保护██'; // Loop through all the text nodes on the page function traverse(node) { let child, next; switch (node.nodeType) { case 1: // Element case 9: // Document case 11: // Document fragment child = node.firstChild; while (child) { next = child.nextSibling; traverse(child); child = next; } break; case 3: // Text node if (keywords.some((keyword) => node.nodeValue.match(keyword))) { node.nodeValue = node.nodeValue.replace(new RegExp(keywords.join('|'), 'g'), replacement); } break; } } traverse(document.body); })();