Update statsjs.tpl to js.tpl

This commit is contained in:
nrpatten 2013-10-26 21:43:38 -04:00
parent 6eb74aa57d
commit 418e0bd89d
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,30 @@
<script>
{literal}
$(document).ready(function(){
// Ajax API URL
var url = "{/literal}{$smarty.server.PHP_SELF}?page=api&action=getnavbardata{literal}";
function refreshStaticData(data) {
$('#b-workers').html((parseFloat(data.getnavbardata.data.pool.workers).toFixed(0)));
$('#b-hashrate').html((parseFloat(data.getnavbardata.data.pool.hashrate).toFixed(3)));
$('#b-target').html(data.getnavbardata.data.pool.estimated + " (done: " + data.getnavbardata.data.pool.progress + "%)");
$('#b-diff').html(data.getnavbardata.data.network.difficulty);
}
// Our worker process to keep gauges and graph updated
(function worker() {
$.ajax({
url: url,
dataType: 'json',
success: function(data) {
refreshStaticData(data);
},
complete: function() {
setTimeout(worker, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"10000"}{literal})
}
});
})();
});
{/literal}
</script>

View File

@ -6,4 +6,4 @@
{include file="statistics/blocks/small_table.tpl" ALIGN="right" SHORT=true}
{include file="statistics/statsjs.tpl"}
{include file="statistics/js.tpl"}