Greasy Fork is available in English.

kim

币安 价格 刷新放在网页右上角

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

Advertisement:

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Advertisement:

// ==UserScript==
// @name         kim
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  币安 价格 刷新放在网页右上角
// @author       You
// @match        *://*/*
// @grant        GM_xmlhttpRequest
// @grant        GM_download
// ==/UserScript==

(function () {
      'use strict';

      var div=document.createElement('div');
      var ul=document.createElement('ul');
      ul.id='ul'
      div.style.position='fixed';
      div.style.zIndex=10000;
      div.style.top='5px';
      div.style.right='20px';
      div.style.background="#fff"
      div.appendChild(ul)
      document.body.appendChild(div);

      var initDataLength=0

      setInterval(() => {
        GM_xmlhttpRequest({
          method: "GET",
          url: "https://fapi.binance.com/fapi/v1/ticker/price",
          onload: function (res) {
            if (res.status==200) {
              var text=res.responseText;
              var json=JSON.parse(text);

              var newData=json
                .filter(item => item.symbol.toLocaleLowerCase().indexOf('usdt')>-1)
                .filter(item =>
                  ['mbl', 'nkn', 'matic', 'btc'].some(_item =>
                    item.symbol.toLocaleLowerCase().startsWith(_item)
                  )
                )
                .map(item => `${item.symbol.replace('USDT', '')}_${item.price}`)


              if (initDataLength!==newData.length) {
                initDataLength=newData.length
                ul.innerHTML=''
                newData.forEach(item => {
                  var li=document.createElement('li');
                  li.id='li'
                  li.style.listStyle="demical"
                  li.innerText=item
                  ul.appendChild(li);
                })
              } else {
                document.querySelectorAll('#li').forEach((item, index) => {
                  item.innerText=newData[index]
                })
              }
            }
          }
        });
      }, 1000)

    })();