forked from blockchain/unused-My-Wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
homepage.min.js
1 lines (1 loc) · 2.34 KB
/
homepage.min.js
1
function updateTimes(){var a=new Date().getTime()/1000;$("td[data-time]").each(function(b){var e=parseInt($(this).data("time"));if(e==0){$(this).text("")}var d=a-e;if(d<60){$(this).text("< 1 minute")}else{if(d<3600){var c=(parseInt(d/60)>1)?"s":"";$(this).text(parseInt(d/60)+" minute"+c)}else{var c=(parseInt(d/3600)>1)?"s":"";$(this).text(parseInt(d/3600)+" hour"+c+" "+parseInt((d%3600)/60)+" minutes")}}})}webSocketConnect(function(a){a.onmessage=function(i){var h=$.parseJSON(i.data);if(h.op=="minitx"){var b=h.x;var c;if(b.tag){c='<a href="'+root+"tx/"+b.hash+'" class="tag-address" style="width:85px">'+b.hash+'</a> <span class="tag">('+b.tag;if(b.tag_link){c+=' <a class="external" rel="nofollow" href="'+root+"r?url="+encodeURI(b.tag_link)+'" target="new"></a>'}c+=")</span>"}else{c='<a href="'+root+"tx/"+b.hash+'">'+b.hash.substring(0,25)+"...</a>"}var f=$("<tr><td><div>"+c+'</div></td><td class="hidden-phone" data-time="'+b.time+'"><div>< 1 minute</div></td><td><div><button class="btn btn-success cb">'+formatMoney(b.value,true)+"</button></div></td></tr>");f.insertAfter($("#txs tr:first")).find("div").hide().slideDown("slow");$("#txs tr:last-child").remove()}else{if(h.op=="block"){var j=BlockFromJSON(h.x);if($("#bi-"+j.blockIndex).length>0){return}var g="Unknown";if(j.foundBy!=null){g='<a href="'+j.foundBy.link+'">'+j.foundBy.description+"</a>"}if(j.txIndex){var d=j.txIndex.length}else{var d=0}$('<tr id="bi-'+j.blockIndex+'"><td><div><a href="'+root+"block/"+j.hash+'">'+j.height+'</a></div></td><td data-time="'+j.time+'"><div>< 1 minute</div></td><td class="hidden-phone"><div>'+j.txIndex.length+'</div></td><td class="hidden-phone"><div>'+formatMoney(j.totalBTCSent,true)+"</div></td><td><div>"+g+'</div></td><td class="hidden-phone"><div>'+parseInt(j.size/1000)+"</div></td></tr>").insertAfter($("#blocks tr:first")).find("div").hide().slideDown("slow");$("#blocks tr:last-child").remove()}}setupSymbolToggle()};a.onopen=function(){a.send('{"op":"set_tx_mini"}{"op":"unconfirmed_sub"}{"op":"blocks_sub"}')}});$(document).ready(function(){if(top.location!=self.location){top.location=self.location.href}setInterval(updateTimes,1000);if($("#home-container").width()<748){$("#home-search-container").remove().prependTo($("#home-container"))}$("#search_button").click(function(){document.location=root+"search/"+document.getElementById("search_input2").value;return false})});