forked from dsias/blockchain.info
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipaddress_page.js
46 lines (31 loc) · 1.13 KB
/
ipaddress_page.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$(document).ready(function() {
webSocketConnect(function(ws) {
ws.onmessage = function(e) {
var obj = $.parseJSON(e.data);
if (obj.op == 'status') {
$('#status').html(obj.msg);
} else if (obj.op == 'utx') {
op = obj.x;
playSound('beep');
var tx = TransactionFromJSON(op);
var tx_html = $(tx.getHTML());
var container = $('#tx_container');
container.prepend(tx_html);
setupSymbolToggle();
tx_html.hide().slideDown('slow');
if (container.find('.txdiv').length > 50) {
container.find('.txdiv:last-child').remove();
}
$('#n_transactions').text(parseInt($('#n_transactions').text())+1);
calcMoney();
}
};
ws.onopen = function() {
$('#status').html('Connected. ');
ws.send('{"op":"ip_sub", "ip":"'+ip+'"}');
};
ws.onclose = function() {
$('#status').html('Disconnected');
};
});
});