您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
FF14 Garland 场景汉化脚本 更新至国服5.01
当前为
// ==UserScript== // @name test // @namespace Violentmonkey Scripts // @match *://*.garlandtools.org/* // @grant none // @description FF14 Garland 场景汉化脚本 更新至国服5.01 // @author CDS MG // @version 0.0.13 // ==/UserScript== 'use strict' const i18n = new Map([ ["fire","高兴高兴高兴"], ["ice","哀伤哀伤哀伤"] ]) const alertbak = window.alert.bind(window) window.alert = (message) => { if (i18n.has(message)) message = i18n.get(message) return alertbak(message) } const confirmbak = window.confirm.bind(window) window.confirm = (message) => { if (i18n.has(message)) message = i18n.get(message) return confirmbak(message) } const promptbak = window.prompt.bind(window) window.prompt = (message, _default) => { if (i18n.has(message)) message = i18n.get(message) return promptbak(message, _default) } replaceText(document.body) const bodyObserver = new MutationObserver(mutations => { mutations.forEach(mutation => { mutation.addedNodes.forEach(addedNode => replaceText(addedNode)) }) }) bodyObserver.observe(document.body, { childList: true, subtree: true }) function replaceText(node) { nodeForEach(node).forEach(textNode => { i18n.forEach(function (value, key, map){ var regexPattern=new RegExp(key,"ig") //if (textNode instanceof Text && regexPattern.test(textNode.nodeValue)){ if (textNode instanceof Text && regexPattern.test(textNode.nodeValue)){ textNode.nodeValue = textNode.nodeValue.replace(regexPattern,value) } else if (textNode instanceof HTMLInputElement) { if (textNode.type === 'button' && regexPattern.test(textNode.value)) textNode.value = textNode.value.replace(regexPattern,value) else if (textNode.type === 'text' && regexPattern.test(textNode.placeholder)) textNode.placeholder = textNode.placeholder.replace(regexPattern,value) } }) }) } function nodeForEach(node) { const list = [] if (node.childNodes.length === 0) list.push(node) else { node.childNodes.forEach(child => { if (child.childNodes.length === 0) list.push(child) else list.push(...nodeForEach(child)) }) } return list }