|
@ -34,6 +34,8 @@ if (id) { |
|
|
$("<p />").text(data.amount/100000000 + "BTC").appendTo($("p#amount")); |
|
|
$("<p />").text(data.amount/100000000 + "BTC").appendTo($("p#amount")); |
|
|
$("a").attr("href", data.URI); |
|
|
$("a").attr("href", data.URI); |
|
|
$("<p />").text("Powered by Electrum").appendTo($("p#powered")); |
|
|
$("<p />").text("Powered by Electrum").appendTo($("p#powered")); |
|
|
|
|
|
var websocket_server = data.websocket_server; |
|
|
|
|
|
var websocket_port = data.websocket_port; |
|
|
$(function () { |
|
|
$(function () { |
|
|
var current; |
|
|
var current; |
|
|
var max = 100; |
|
|
var max = 100; |
|
@ -57,14 +59,11 @@ if (id) { |
|
|
var interval = setInterval(update, 1000); |
|
|
var interval = setInterval(update, 1000); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}) |
|
|
|
|
|
.fail(function() { |
|
|
|
|
|
console.log("error fail"); |
|
|
|
|
|
$("<p />").text("error").appendTo($("p#error")); |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var ws = new WebSocket("wss://" + window.location.hostname + ":9999/"); |
|
|
var wss_address = "wss://" + websocket_server + ":" + websocket_port +"/"); |
|
|
|
|
|
console.log("Opening WSS: " + wss_address) |
|
|
|
|
|
var ws = new WebSocket(wss_address); |
|
|
|
|
|
|
|
|
ws.onopen = function() { |
|
|
ws.onopen = function() { |
|
|
ws.send('id:' + id); |
|
|
ws.send('id:' + id); |
|
|
}; |
|
|
}; |
|
@ -76,6 +75,12 @@ ws.onmessage = function (evt) { |
|
|
else alert("Message is received:"+ received_msg); |
|
|
else alert("Message is received:"+ received_msg); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
.fail(function() { |
|
|
|
|
|
console.log("error fail"); |
|
|
|
|
|
$("<p />").text("error").appendTo($("p#error")); |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
// See http://stackoverflow.com/questions/29186154/chrome-clicking-mailto-links-closes-websocket-connection |
|
|
// See http://stackoverflow.com/questions/29186154/chrome-clicking-mailto-links-closes-websocket-connection |
|
|
$(document).on('click', 'a[href^="bitcoin:"]', function (e) { |
|
|
$(document).on('click', 'a[href^="bitcoin:"]', function (e) { |
|
|