-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathaddress_page.min.js
1 lines (1 loc) · 1.7 KB
/
address_page.min.js
1
$(document).ready(function(){$("#add-to-wallet").click(function(){goToWallet(address)});$("#deposit").click(function(){loadScript(resource+"wallet/deposit/deposit.js",function(){showDepositModal(address,"bitinstant","Deposit Using Cash")})});$("#payment-request").click(function(){loadScript(resource+"wallet/payment-request.js",function(){showPaymentRequestModal(address,"Payment Request")})});loadScript(resource+"wallet/qr.code.creator.js",function(){var c=makeQRCode(255,250,1,address);$("#qr-code").append(c)});$("#filter").change(function(){$(this).parent().submit()});try{var a=new WebSocket(getWebSocketURL());a.onmessage=function(k){var j=$.parseJSON(k.data);if(j.op=="status"){$("#status").html(j.msg)}else{if(j.op=="utx"){op=j.x;try{playSound("beep")}catch(k){console.log(k)}var d=TransactionFromJSON(op);d.setConfirmations(0);var c=0;for(var h=0;h<d.inputs.length;h++){var g=d.inputs[h];console.log(g.prev_out.addr);if(g.prev_out.addr==address){c-=parseInt(g.prev_out.value)}}console.log("result "+c);var l=0;for(var h=0;h<d.out.length;h++){var f=d.out[h];if(f.addr==address){l+=parseInt(f.value)}}$("#total_received span").attr("data-c",parseInt($("#total_received span").attr("data-c"))+l);c+=l;$("#final_balance span").attr("data-c",parseInt($("#final_balance span").attr("data-c"))+c);flashTitle("New Transaction");d.result=c;$("#tx_container").prepend(d.getHTML());$("#tx-"+op.txIndex).fadeIn("slow").slideDown("slow");console.log($("#n_transactions").val());$("#n_transactions").text(parseInt($("#n_transactions").text())+1);calcMoney()}}};a.onopen=function(){$("#status").html("Connected. ");a.send('{"op":"addr_sub", "addr":"'+address+'"}')};a.onclose=function(){$("#status").html("Disconnected")}}catch(b){console.log(b)}});