kim

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

  1. // ==UserScript==
  2. // @name kim
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 币安 价格 刷新放在网页右上角
  6. // @author You
  7. // @match *://*/*
  8. // @grant GM_xmlhttpRequest
  9. // @grant GM_download
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. var div=document.createElement('div');
  16. var ul=document.createElement('ul');
  17. ul.id='ul'
  18. div.style.position='fixed';
  19. div.style.zIndex=10000;
  20. div.style.top='5px';
  21. div.style.right='20px';
  22. div.style.background="#fff"
  23. div.appendChild(ul)
  24. document.body.appendChild(div);
  25.  
  26. var initDataLength=0
  27.  
  28. setInterval(() => {
  29. GM_xmlhttpRequest({
  30. method: "GET",
  31. url: "https://fapi.binance.com/fapi/v1/ticker/price",
  32. onload: function (res) {
  33. if (res.status==200) {
  34. var text=res.responseText;
  35. var json=JSON.parse(text);
  36.  
  37. var newData=json
  38. .filter(item => item.symbol.toLocaleLowerCase().indexOf('usdt')>-1)
  39. .filter(item =>
  40. ['mbl', 'nkn', 'matic', 'btc'].some(_item =>
  41. item.symbol.toLocaleLowerCase().startsWith(_item)
  42. )
  43. )
  44. .map(item => `${item.symbol.replace('USDT', '')}_${item.price}`)
  45.  
  46.  
  47. if (initDataLength!==newData.length) {
  48. initDataLength=newData.length
  49. ul.innerHTML=''
  50. newData.forEach(item => {
  51. var li=document.createElement('li');
  52. li.id='li'
  53. li.style.listStyle="demical"
  54. li.innerText=item
  55. ul.appendChild(li);
  56. })
  57. } else {
  58. document.querySelectorAll('#li').forEach((item, index) => {
  59. item.innerText=newData[index]
  60. })
  61. }
  62. }
  63. }
  64. });
  65. }, 1000)
  66.  
  67. })();

QingJ © 2025

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