-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
54 lines (54 loc) · 1.66 KB
/
index.html
File metadata and controls
54 lines (54 loc) · 1.66 KB
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
47
48
49
50
51
52
53
54
<!doctype html>
<html>
<head>
<title>Event Monitor</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font: 1em Helvetica, Arial; }
form { background: #000; padding: 3px; position: fixed; bottom: 0; width: 100%; }
#messages { list-style-type: none; margin: 0; padding: 0; width: 100% }
#messages tr { padding: 5px 10px; }
#messages tr:nth-child(odd) { background: #eee; }
#messages { margin-bottom: 40px }
</style>
</head>
<body>
<h2>
<div id="msg">connecting</div>
<div id="blocks"></div>
<div id="events"></div>
</h2>
<table id="messages">
</table>
<script src="/socket.io/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script>
$(function () {
var count = 0;
var socket = io();
function load(msg){
$('#blocks').text('block height ' + msg.block);
$('#events').text('event count ' + count);
$('#messages')
.prepend($('<tr>')
.append($('<td>').append(msg.block))
.append($('<td>').append(msg.channel))
.append($('<td>').append(msg.msp))
.append($('<td>').append(msg.namespace))
.append($('<td>').append(msg.transaction))
.animate({fontSize: '.7em'}, "slow"));
}
socket.on('connect', function(msg){
count=0;
$('#msg').text('connected');
$('#messages').empty();
socket.emit('sync', 3)
});
socket.on('event', function(msg){
count++;
load(msg);
});
});
</script>
</body>
</html>