Replace Numbers Globally

Replaces specific numbers across all websites

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Replace Numbers Globally
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Replaces specific numbers across all websites
// @author       You
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    function replaceText(node) {
        if (node.nodeType === Node.TEXT_NODE) {
            let text = node.nodeValue;

            // Replace more specific values first
            text = text.replace(/\b63\.2\b/g, '94.2');
            text = text.replace(/\b63\.4\b/g, '94.4');
            text = text.replace(/\b63\b/g, '94');

            node.nodeValue = text;
        } else {
            for (let child of node.childNodes) {
                replaceText(child);
            }
        }
    }

    function runReplace() {
        replaceText(document.body);
    }

    // Initial run
    runReplace();

    // Observe changes (for dynamic content)
    const observer = new MutationObserver(() => {
        runReplace();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();