所周知,DBD-Raws 及其组长黑暗路基艾尔在网络上臭名狼藉。

近期,天使同萌发公告,永久禁止发布 DBD-Raws 的资源。

该组还在蓝光未发布的时候在网上发布“UHD BD remux”,令笔者不禁遐想其原片来源。

因此我创建了一个简单的浏览器脚本来屏蔽他们的组名、QQ群号、宣传语等文本内容。

https://greasyfork.org/zh-CN/scripts/464086-%E5%B1%8F%E8%94%BD-dbd-raws

以下是代码(1.0)

// ==UserScript==
// @name        屏蔽 DBD-Raws
// @namespace   anti-DBD-Raws
// @version     1.0
// @description a simple script to block the display of DBD-Raws
// @author      CropCircle
// @match       http://*/*
// @match       https://*/*
// @grant       GM_setValue
// @grant       GM_getValue
// @run-at      DOMContentLoaded
// @exclude     https://*.google.*
// @exclude     https://*.bing.*
// @exclude     https://*.baidu.*
// @exclude     https://greasyfork.org/*
// @homepageURL https://greasyfork.org/zh-CN/scripts/464086-%E5%B1%8F%E8%94%BD-dbd-raws
// @supportURL  https://aiccrop.com/
// @license     MIT
// ==/UserScript==

(function() {
    'use strict';
    var currentURL = window.location.href;
    (function() {
        const defaultReplacement = '😅😅😅';
        let replacement = GM_getValue('replacement', null);
        if (replacement === null) {
            // Prompt the user to enter a replacement text for the first time
            replacement = prompt('Enter the text you want to replace the keywords with', defaultReplacement);
            if (replacement !== null) {
                GM_setValue('replacement', replacement);
            } else {
                // Use the default replacement text if the user cancels the prompt
                replacement = defaultReplacement;
            }
        }
        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',
            '神圣之路基艾尔'
        ];

        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;
            }
        }

        // Create a prompt for the user to enter a replacement text
        function setReplacement() {
            const input = prompt('Enter the text you want to replace the keywords with', replacement);
            if (input !== null) {
                replacement = input;
                GM_setValue('replacement', replacement); // Save the new value to GM storage
                traverse(document.body); // Re-run the text replacement with the new replacement text
            }
        }

        traverse(document.body);
    })();
})();

DMCA:https://aiccrop.com/dmca/

Cover: https://commons.wikimedia.org/wiki/File:Access-denied_story.jpg (Licence: CC BY-SA 4.0)