把他发给你那个爱开【数据删除】腔的朋友并什么也不说
:::epigraph[——【数据删除】User
本插件的原理已经于《喵喵喵》中介绍地很清楚了,也支持更改源码。
源码
// ==UserScript==
// @name 【数据删除】小鬼最爱
// @namespace http://tampermonkey.net/
// @version 0.0
// @description ILove【数据删除】Best
// @author 【数据删除】User
// @match *://*/*
// ==/UserScript==
(function() {
'use strict';
const targetRegex1 = /((?<=[机基激击鸡积饥肌稽及疾及集即极急籍吉汲棘嫉几己挤脊济记技际继季既寄纪绩忌冀暨计])()(?![机基激击鸡积饥肌稽及疾及集即极急籍吉汲棘嫉几己挤脊济记技际继季既寄纪绩忌冀暨计,—。?、!;:“”‘’()…·【】])(.)|(?<=[机基激击鸡积饥肌稽及疾及集即极急籍吉汲棘嫉几己挤脊济记技际继季既寄纪绩忌冀暨计])(?=[机基激击鸡积饥肌稽及疾及集即极急籍吉汲棘嫉几己挤脊济记技际继季既寄纪绩忌冀暨计,—。?、!;:“”‘’()…·【】]))/g;
const targetRegex2 = /([机基激击鸡积饥肌稽及疾及集即极急籍吉汲棘嫉几己挤脊济记技际继季既寄纪绩忌冀暨计]&)/g;
function processNode(node) {
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== "") {
const originalText = node.textContent;
const middleText = originalText.replace( targetRegex1,'\[数据删除\]');
const newText = middleText.replace( targetRegex2,'\[数据删除\]');
if (newText !== originalText) {
node.textContent = newText;
}
}
}
function walk(root) {
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false);
let node;
while (node = walker.nextNode()) {
processNode(node);
}
}
walk(document.body);
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (node.nodeType === Node.TEXT_NODE) {
processNode(node);
} else {
walk(node);
}
});
});
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();
::::