forked from blockchain/unused-My-Wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
address_page.min.js
1 lines (1 loc) · 2.31 KB
/
address_page.min.js
1
function insertParam(d,e){d=escape(d);e=escape(e);var b=document.location.search.substr(1).split("&");if(b==""){document.location.search="?"+d+"="+e}else{var c=b.length;var a;while(c--){a=b[c].split("=");if(a[0]==d){a[1]=e;b[c]=a.join("=");break}}if(c<0){b[b.length]=[d,e].join("=")}document.location.search=b.join("&")}}$(document).ready(function(){var b=parseInt($(document.body).data("filter"));var c=parseInt($(document.body).data("offet"));var a=$(document.body).data("address");$("#payment-request").click(function(){loadScript("wallet-legacy/frame-modal",function(){showFrameModal({title:"Create Payment Request",description:"Request Payment into address <b>"+a+"</b>",src:root+"payment_request?address="+a})})});$("#create-donation-button").click(function(){loadScript("wallet-legacy/frame-modal",function(){showFrameModal({title:"Create Donation Button",description:"Create Donation Button To Address <b>"+a+"</b>",src:root+"create_donation_button?address="+a,height:"600px"})})});$(".tx_filter a").click(function(){var d=$(this).data("value");if(d=="export"){loadScript("wallet-legacy/frame-modal",function(){showFrameModal({title:"Export History",description:"",src:root+"export-history?active="+a})});return}insertParam("filter",$(this).data("value"))});if(b==0&&c==0){webSocketConnect(function(d){d.onmessage=function(l){var h=$.parseJSON(l.data);if(h.op=="status"){$("#status").html(h.msg)}else{if(h.op=="utx"){op=h.x;playSound("beep");var k=TransactionFromJSON(op);k.setConfirmations(0);var p=0;for(var j=0;j<k.inputs.length;j++){var m=k.inputs[j];if(!m.prev_out){continue}var n=parseInt(m.prev_out.value);if(m.prev_out.addr==a){p-=n}}for(var j=0;j<k.out.length;j++){var g=k.out[j];var n=parseInt(g.value);if(g.addr==a){p+=n}}$("#total_received span").data("c",parseInt($("#total_received span").data("c"))+Math.max(p,0));$("#final_balance span").data("c",parseInt($("#final_balance span").data("c"))+p);k.result=p;$("#no_tx").hide();var o=k.getHTML();var f=$("#tx_container");f.prepend(o);setupSymbolToggle();o.hide().slideDown("slow");if(f.find(".txdiv").length>50){f.find(".txdiv:last-child").remove()}$("#n_transactions").text(parseInt($("#n_transactions").text())+1);calcMoney()}}};d.onopen=function(){$("#status").html("Connected. ");d.send('{"op":"addr_sub", "addr":"'+a+'"}')};d.onclose=function(){$("#status").html("Disconnected")}})}});