HPOOL CHIA收益计算

2021/4/15下午3:32:44

// ==UserScript==
// @name        HPOOL CHIA收益计算
// @namespace   Violentmonkey Scripts
// @match       *://www.hpool.co/statistics/chia*
// @grant       none
// @version     1.8
// @author      Edik
// @description 2021/4/15下午3:32:44
// @require    https://code.jquery.com/jquery-2.2.4.js
// ==/UserScript==

(function() {
  'use strict';
  
  document.addEventListener("DOMContentLoaded",startaa);

  startaa();

  function startaa(){
    
    $.get("https://www.hpool.co/api/pool/detail?language=zh&type=chia", function(result){
  
      let capacity = result.data.capacity
      
      let html = $($($('.stat-t').children()[2]).children()[2]).html()
      
      let num = html.substring(0,html.indexOf("<small"))
      
      
      let htmlNew = '<div><img src="/static/media/income.861e0a5700.png" alt=""><div class="mt15 d">日平均收益</div><h2>'+(num/1024).toFixed(6)+' <small>XCH/TB</small></h2></div>'

      $('.stat-t').append(htmlNew)
      
      htmlNew = '<div><img src="/static/media/income.861e0a5700.png" alt=""><div class="mt15 d">日总收益</div><h2>'+(num*capacity/1024/1024).toFixed(6)+' <small>XCH/'+(capacity/1024).toFixed(2)+'TB</small></h2></div>'

      $('.stat-t').append(htmlNew)
      
    });
    
  }

})();