您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
替换osu地图状态为英文
// ==UserScript== // @name osu地图状态替换为英文 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 替换osu地图状态为英文 // @author Mon3tr_Miku // @match https://osu.ppy.sh/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // 定义替换规则 const replacements = { '待定': 'Pending', '上架': 'Ranked', '过审': 'Qualified', '社区喜爱': 'Loved', '制作中': 'WIP', '坟场': 'Graveyard' }; // 替换函数 function replaceText(node) { // 如果节点是文本节点,直接替换 if (node.nodeType === Node.TEXT_NODE) { let text = node.textContent; for (const [search, replace] of Object.entries(replacements)) { text = text.replace(new RegExp(search, 'g'), replace); } node.textContent = text; } // 如果节点是元素节点,遍历其子节点 else if (node.nodeType === Node.ELEMENT_NODE) { node.childNodes.forEach(child => replaceText(child)); } } // 监听 DOM 变化 const observer = new MutationObserver(mutations => { mutations.forEach(mutation => { mutation.addedNodes.forEach(node => replaceText(node)); }); }); // 开始监听 observer.observe(document.body, { childList: true, subtree: true }); // 初始替换 replaceText(document.body); })();