Last active
September 6, 2017 18:27
-
-
Save creaoy/916f345c0ba1d411febedcdeab98f0e7 to your computer and use it in GitHub Desktop.
finshi front sciprt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row" style="color:#fff;z-index:2;position:relative;"><div class="col-md-4 col-md-offset-4" style="text-align:center;"><p>Total Tokens Bought</p><h1 id="total_usd"></h1><small>1 FINS = 1 USD</small></div> | |
<!-- | |
<div class="ico-info"> | |
Ethereum | |
<div id="invested_eth"></div> | |
Total Tokens Bought | |
<div id="total_tokens_bought"></div> | |
1 FINS = 1 USD | |
Bitcoin | |
<div id="invested_btc"></div> | |
</div> | |
--> | |
jQuery(function(){ | |
var roundUp = function(amount, divider){ | |
return Math.ceil(amount * divider)/divider | |
} | |
var afterResponse = function (response) { | |
response = jQuery.parseJSON(response); | |
var currentBonus = parseInt(response.bonus) | |
var totalInvestedBTC = roundUp(response.total_btc, Math.pow(10, 6)).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,'); | |
var totalInvestedUSD = roundUp(response.total_usd, Math.pow(10, 2)).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,'); | |
var participants = response.participants | |
var investedBTC = roundUp(response.invested_btc, Math.pow(10, 6)).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,'); | |
var investedETH = roundUp(response.invested_eth, Math.pow(10, 4)).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,'); | |
var investedUSD = roundUp(response.invested_usd, Math.pow(10, 2)).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,'); | |
var investedUSDT = roundUp(response.invested_usdt, Math.pow(10, 2)).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,'); | |
var investedTokens = roundUp(response.total_tokens_bought, Math.pow(10, 6)).toFixed(1).replace(/(\d)(?=(\d{3})+\.)/g, '$1,'); | |
var bonusList = ['25', '22', '20', '17', '15', '12', '10', '7', '5', '0'] | |
console.log(investedTokens); | |
jQuery('#total_btc').text(totalInvestedBTC) | |
jQuery('#total_usd').text(totalInvestedUSD) | |
jQuery('#participants').text(participants) | |
jQuery('#invested_btc').text(investedBTC) | |
jQuery('#invested_eth').text(investedETH) | |
jQuery('#invested_usd').text(investedUSD) | |
jQuery('#invested_usdt').text(investedUSDT) | |
jQuery('#total_tokens_bought').attr('data-count', investedTokens) | |
jQuery('#total_tokens_bought').html(investedTokens) | |
var passedBonuses = bonusList.filter(function(value){return parseInt(value) > currentBonus}) | |
passedBonuses.map(function(obj){ | |
var bonusRow = jQuery("body").find('#' + obj); | |
bonusRow.addClass('blur'); | |
}) | |
} | |
jQuery.ajax({ | |
type: 'GET', | |
url: 'https://naidisebe.com/polybius/proxy/', | |
}).done(afterResponse) | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment