[BitoEX] show price per bitcoin

BitoEX show price per bitcoin in dashboard

  1. // ==UserScript==
  2. // @name [BitoEX] show price per bitcoin
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.1
  5. // @description BitoEX show price per bitcoin in dashboard
  6. // @author SSARCandy
  7. // @match https://www.bitoex.com/dashboard*
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12. var bitcoins = [];
  13. var totalPrices = [];
  14.  
  15. $('#tab-2 > div > table > tbody > tr > td:nth-child(4)').each((x, i) => {
  16. bitcoins.push( parseFloat(i.innerText));
  17. });
  18. $('#tab-2 > div > table > tbody > tr > td:nth-child(5)').each((x, i) => {
  19. totalPrices.push( parseInt(i.innerText.replace(/,/g, '')));
  20. });
  21.  
  22. for(var i = 0; i < totalPrices.length; i++){
  23. var price = (totalPrices[i] / bitcoins[i]);
  24. $('#tab-2 > div > table > tbody > tr:nth-child('+(i+1)+') > td:nth-child(4)').after('<td>'+(price.toFixed(0)).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")+'</td>');
  25. }
  26. $('#tab-2 > div > table > thead > tr > th:nth-child(4)').after('<th>單價(TWD)</th>');
  27. })();