dash-website/currency/index.html
Perry Woodin 995d1c5dcc Currency page
Getting and displaying data for:
- Markets
- Governance
- Blockchain
2016-07-27 11:34:54 -04:00

161 lines
No EOL
3.6 KiB
HTML

---
layout: default
title: pages.currency.title
description: pages.currency.description
---
{% tf currency/hero.html %}
<div class="content">
<h2>{% t pages.currency.markets-heading %}</h2>
<table>
<thead>
<tr>
<th>Exchange</th>
<th>Volume (24h)</th>
<th>Price</th>
<th>Volume (%)</th>
</tr>
</thead>
<tbody id="exchanges">
</tbody>
</table>
<h2>{% t pages.currency.governance-heading %}</h2>
<table>
<thead>
<tr>
<th>Title</th>
<th>Owner</th>
<th>Votes (yes/no)</th>
<th>Votes Required</th>
<th>Monthly Amount</th>
<th>Will be Funded</th>
</tr>
</thead>
<tbody id="budgets">
</tbody>
</table>
<h2>{% t pages.currency.network-heading %}</h2>
<div id="masternodes_count"></div>
<div id="masternodes_max"></div>
<h2>{% t pages.currency.blockchain-heading %}</h2>
<table>
<thead>
<tr>
<th>Height</th>
<th>Age</th>
<th>Transactions</th>
<th>Value Out</th>
<th>Difficulty</th>
</tr>
</thead>
<tbody id="blocks">
</tbody>
</table>
</div>
<script type="text/javascript">
$( document ).ready(function(){
// Get the exchange data
$.ajax({
url: "{{ site.api }}/exchange/",
error: function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR);
console.log(textStatus);
console.log('errorThrown:');
}
})
.done(function(response){
var exchanges = response;
exchanges.map(function(exchange){
if(exchange){
console.log('exchange',exchange);
var name = exchange.exchange,
url = exchange.url
volume = "$" + formatCurrency(exchange.volume,0),
price = "$" + formatCurrency(exchange.price),
change = formatNumber(exchange.percent_change);
$("#exchanges").append('<tr><td><a target="_blank" href="' + url + '">' + name + '</a></td><td>' + volume + '</td><td>' + price + '</td><td>' + change + '%</td></tr>');
}
});
});
// Get the current number of masternodes.
$.ajax({
url: "{{ site.api }}/masternodes/stats/"
})
.done(function(response){
console.log('masternode stats', response.stats);
var masternodes_count = formatNumber(response.stats['count']),
masternodes_max = formatNumber(response.stats['max']);
$("#masternodes_count").text(masternodes_count);
$("#masternodes_max").text(masternodes_max);
});
// Get the budget proposals
$.ajax({
url: "{{ site.api }}/budgets/"
})
.done(function(response){
var proposals = response.proposals;
proposals.map(function(proposal){
var title = proposal.title ? proposal.title : proposal.name,
url = proposal.dw_url,
owner = proposal.owner_username,
votes_yes = proposal.yes,
votes_no = proposal.no,
required_votes = proposal.remaining_yes_votes_until_funding,
amount_monthly = formatCurrency(proposal.monthly_amount)
will_be_funded = proposal.will_be_funded ? "yes" : "no";
$("#budgets").append('<tr><td>' + title + '</td><td>' + owner + '</td><td>' + votes_yes + '/' + votes_no + '</td><td>' + required_votes + '</td><td>' + amount_monthly + '</td><td>' + will_be_funded + '</td></tr>');
});
});
// Get the blockchain info
$.ajax({
url: "{{ site.api }}/chain/latestBlocks/"
})
.done(function(response){
var blocks = response.blocks;
console.log(blocks);
blocks.map(function(block){
var height = block.height,
age = moment.unix(block.time).format("LLL"),
txs = block.txlength,
out = block.cbvalue,
difficulty = block.difficulty;
$("#blocks").append('<tr><td>' + height + '</td><td>' + age + '</td><td>' + txs + '</td><td>' + out + '</td><td>' + difficulty + '</td></tr>');
});
});
});
</script>