BinanceCNY

显示法定币价

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         BinanceCNY
// @namespace    https://www.binance.com/
// @version      0.3
// @description  显示法定币价
// @author       Shevckcccc
// @match        https://www.binance.com/trade.html?symbol=*
// ==/UserScript==

(function() {
    'use strict';
    setInterval(function(){
        var current_price = parseFloat($('.kline-para ul li strong').eq(0).text());
        var country_price = parseFloat($('.kline-para ul li strong').eq(1).text().replace(/[^0-9\.]/g, ''));
        var unit_price = country_price / current_price;

        var asks = $('#askScrollBox .askTable tr .f-left .ng-binding span');
        asks.each(function (index, item) {
            var origin_price = item.innerText.split('|')[0];
            var price = parseFloat(origin_price * unit_price).toFixed(2);
            $(item).text(origin_price + '|' + price);
        });

        var bids = $('#bidScrollBox .bidTable tr .f-left .ng-binding span');
        bids.each(function (index, item) {
            var origin_price = item.innerText.split('|')[0];
            var price = parseFloat(origin_price * unit_price).toFixed(2);
            $(item).text(origin_price + '|' + price);
        });
    }, 2000);
})();