您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
"Warns you of unfrenly people on the internet"
当前为
// ==UserScript== // @name "Nonfren Radar" // @description "Warns you of unfrenly people on the internet" // @include * // @grant GM_getResourceText // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // @resource theList https://files.catbox.moe/rvk3cx.json // @homepageURL https://frenschan.org // @version 1488.0.1 // @license GNU GPLv3 // @namespace https://greasyfork.org/users/1185877 // ==/UserScript== (function () { var theList = JSON.parse(GM_getResourceText("theList")); var regexp = new RegExp("\\b(" + theList.join("|") + ")\\b(?!\\)\\))", "gi"); // Check if the script is disabled for the current site var isDisabled = GM_getValue(window.location.hostname, false); // Add a menu command to disable the script for the current site GM_registerMenuCommand('Disable script for this site', function() { if (!isDisabled) { GM_setValue(window.location.hostname, true); console.log('Script disabled for this site'); location.reload(); // Reload the page to apply the changes } else { console.log('Script is already disabled for this site'); } }); // Add a menu command to enable the script for the current site GM_registerMenuCommand('Enable script for this site', function() { if (isDisabled) { GM_setValue(window.location.hostname, false); console.log('Script enabled for this site'); location.reload(); // Reload the page to apply the changes } else { console.log('Script is already enabled for this site'); } }); if (isDisabled) { console.log('Script is disabled for this site'); return; } function handleText(textNode) { var currentNode = textNode; while (currentNode) { if (currentNode.nodeName.toLowerCase() === 'input' || currentNode.nodeName.toLowerCase() === 'textarea' || currentNode.isContentEditable) { return; // Skip processing if the text node is within an interactive element } currentNode = currentNode.parentNode; } textNode.nodeValue = textNode.nodeValue.replace(regexp, "((($1)))"); } function processNode(node) { if (node.nodeType === 3) { handleText(node); } else { node.childNodes.forEach(processNode); } } // Processes the initial page content processNode(document.body); // Observes the changes in the DOM to handle dynamic content const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { mutation.addedNodes.forEach(processNode); }); }); observer.observe(document.body, { childList: true, subtree: true, }); })();