变!
当前为
// ==UserScript==
// @name 全给我变成小南娘!
// @namespace https://penyo.ru/
// @version 1.0.3
// @description 变!
// @author Penyo
// @match *://*/*
// @grant none
// @license WTFPL
// ==/UserScript==
(function () {
"use strict";
/**
* @param {Element} root
*/
function replace(root) {
requestIdleCallback(() => {
root
.querySelectorAll(
"h1, h2, h3, h4, h5, h6, p, article, section, blockquote, li, a, span"
)
.forEach((e) => {
if (
e.textContent.match(
/[我们大家你您然后也矣兮乎者焉哉啊吗呢吧哇呀哦的了]/
)
) {
const after = e.innerHTML
.replace(/我们/g, "咱喵和其它猫猫们")
.replace(/大家/g, "各位猫猫们")
.replace(/我/g, "咱喵")
.replace(/你们/g, "汝等")
.replace(/你|您/g, "汝")
.replace(
/([也矣兮乎者焉哉]|[啊吗呢吧哇呀哦])([ !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\u3000-\u303F\uFF00-\uFFEF]|$)/g,
"喵$2"
)
.replace(
/([的了])([!"#$%&'()*+,-./:;=>?@[\]^_`{|}~\u3000-\u303F\uFF00-\uFFEF]|\s+(?![<\w])|$)/g,
"$1喵$2"
);
if (e.innerHTML != after) {
e.innerHTML = after;
}
}
});
});
}
/**
* @param {Element} root
*/
async function afterDomLoaded(root) {
if (!root) return;
const fn = () => {
replace(root);
root.querySelectorAll("*").forEach(async (node) => {
if (node.shadowRoot) {
await afterDomLoaded(node.shadowRoot);
}
});
};
while (document.readyState == "loading") {
await new Promise((r) => setTimeout(r, 1000));
}
fn();
}
afterDomLoaded(document);
setInterval(() => afterDomLoaded(document), 2000);
})();