Greasy Fork镜像 还支持 简体中文。

Binance BTC Fixed Display

Показва фиксирано BTC количество и смята реална USD стойност

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/548057/1652988/Binance%20BTC%20Fixed%20Display.js

// ==UserScript==
// @name         Binance BTC Fixed Display
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Показва фиксирано BTC количество и смята реална USD стойност
// @author       You
// @match        https://www.binance.com/en/my/wallet/account/overview
// @match        https://www.binance.com/en/my/wallet/account/main
// @grant        GM_xmlhttpRequest
// @connect      api.binance.com
// ==/UserScript==


(function() {
    'use strict';

    const FIXED_BTC = 8.97;
    const FIXED_USD = 968429.90;

    function replaceDisplay() {
        // --- BTC ---
        const btcElem = document.querySelector('.typography-Headline4');
        if (btcElem) {
            btcElem.style.color = 'transparent';
            btcElem.style.position = 'relative';
            if (!btcElem.querySelector('.fixed-btc')) {
                const fixedBTC = document.createElement('span');
                fixedBTC.className = 'fixed-btc';
                fixedBTC.style.position = 'absolute';
                fixedBTC.style.left = '0';
                fixedBTC.style.top = '0';
                fixedBTC.style.color = '#fff';
                fixedBTC.textContent = FIXED_BTC.toFixed(8);
                btcElem.appendChild(fixedBTC);
            }
        }

        // --- USD (обща сума с дневната промяна) ---
        const usdElem = document.querySelector('.body3.mt-2');
        if (usdElem) {
            usdElem.style.color = 'transparent';
            usdElem.style.position = 'relative';
            if (!usdElem.querySelector('.fixed-usd')) {
                const fixedUSD = document.createElement('span');
                fixedUSD.className = 'fixed-usd';
                fixedUSD.style.position = 'absolute';
                fixedUSD.style.left = '0';
                fixedUSD.style.top = '0';
                fixedUSD.style.color = '#fff';
                usdElem.appendChild(fixedUSD);
            }

            // Взимаме процента от SELL или BUY
            let adjustedTotal = FIXED_USD;
            let percent = null;

            const sellElem = document.querySelector('.text-t-sell');
            const buyElem = document.querySelector('.text-t-buy');

            let match = null;
            if (sellElem) {
                match = sellElem.textContent.match(/\(([-+]?[0-9]*\.?[0-9]+)%\)/);
            }
            if ((!match || !match[1]) && buyElem) {
                match = buyElem.textContent.match(/\(([-+]?[0-9]*\.?[0-9]+)%\)/);
            }

            if (match) {
                percent = parseFloat(match[1]);
                const delta = FIXED_USD * (percent / 100);
                adjustedTotal = FIXED_USD + delta;
            }

            usdElem.querySelector('.fixed-usd').textContent =
                `≈ $${adjustedTotal.toLocaleString('en-US', {
                    minimumFractionDigits: 2,
                    maximumFractionDigits: 2
                })}`;
        }

        // --- SELL / дневна промяна ---
        const sellElem = document.querySelector('.text-t-sell');
        if (sellElem) {
            const text = sellElem.textContent;
            const match = text.match(/\(([-+]?[0-9]*\.?[0-9]+)%\)/);
            if (match) {
                const percent = parseFloat(match[1]);
                const delta = FIXED_USD * (percent / 100);
                const color = percent < 0 ? 'red' : '#2ebd85';
                sellElem.innerHTML =
                    `<span style="font-size:0.85em; color:${color}">≈ $${delta.toLocaleString('en-US', {
                        minimumFractionDigits: 2,
                        maximumFractionDigits: 2
                    })} (${percent.toFixed(2)}%)</span>`;
            } else {
                sellElem.innerHTML = '-';
            }
        }

        // --- BUY / дневна промяна ---
        const buyElem = document.querySelector('.text-t-buy');
        if (buyElem) {
            const text = buyElem.textContent;
            const match = text.match(/\(([-+]?[0-9]*\.?[0-9]+)%\)/);
            if (match) {
                const percent = parseFloat(match[1]);
                const delta = FIXED_USD * (percent / 100);
                const color = percent < 0 ? 'red' : '#2ebd85';
                buyElem.innerHTML =
                    `<span style="font-size:0.85em; color:${color}">≈ $${delta.toLocaleString('en-US', {
                        minimumFractionDigits: 2,
                        maximumFractionDigits: 2
                    })} (${percent.toFixed(2)}%)</span>`;
            } else {
                buyElem.innerHTML = '-';
            }
        }
    }

    replaceDisplay();
    setInterval(replaceDisplay, 500);

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址