Bitcoin Forum

Bitcoin => Project Development => Topic started by: sjonkeesse on January 06, 2018, 06:23:14 PM



Title: Small platform improvement script
Post by: sjonkeesse on January 06, 2018, 06:23:14 PM
Hi there. For myself I needed some extra information within Bittrex. I wanted to see the worth of each currency in Euro's and also the total value in the Euro currency. For that I created the following script that you can automatically load within Bittrex with the Chrome CJS plugin.

Example of extra info:
https://i.imgur.com/0WEHENZ.jpg

Quote
var dollarToEuro = 1.20302;
 
function addEUR() {
    var btc = $('[data-bind="text:navigation.displayBitcoinUsd"]').text().substring(9);
 
    // To Table
    if (0 === $('#balanceTable td[colspan="9"]').length && 0 === $('#balanceTable .sjonkeesse').length) {
        var amount, euro;
      
        [].forEach.call($('#balanceTable tbody tr'), function(e) {
            amount = $(e).find('td:nth-child(8)').text().trim();
            euro = Math.round(amount * btc / dollarToEuro * 100) / 100;
      
            $(e).append($(`<td class="sjonkeesse number">&euro; ${euro}</td>`));
        });
    }
 
    // To total
    var strTotal = $('#pad-wrapper h4').text();
 
    if (-1 === strTotal.indexOf("EUR")) {
        var totalBTC = strTotal.substr(17, strTotal.indexOf('BTC') - 18);
        var totalEUR = Math.round(totalBTC * btc / dollarToEuro * 100) / 100;
 
        $('#pad-wrapper h4').text(`${strTotal} / ${totalEUR} EUR 💰`);
    }
}
 
$(document).ready(function() {
    $('#balanceTable thead tr').append($('<th><span>EST. Euro</span></th>'));
 
    setInterval(function() {
        addEUR();
    }, 100);
});


To use this code you can install the Chrome plugin called CJS and then navigate to the Bittrex website. In the top right you will find the blue cjs icon. When you click on it you can enter the quoted code above and click on 'enable cjs for this host'. Then click on safe.

Chrome CJS Plugin: https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija (https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija)


Note: Do not just use every code you get. Review it first to see if there is any malicious code!  ;)