normalized indentation in index.html
[p2pool.git] / web-static / index.html
1 <html>
2     <head>
3         <title>P2Pool Stats</title>
4         <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
5         <script type="text/javascript">
6             // based on goblin's p2pool-stats project
7             $(document).ajaxError(function(event, request, settings, err) {
8                 alert("error: " + settings.url + ": " + err.message);
9             });
10             
11             $.getJSON('/rate', function(rate) {
12                 $('#hashrate').html(rate / 1000000000);
13             });
14             
15             $.getJSON('/current_payouts', function(pays) {
16                 $.getJSON('/payout_addr', function(addr) {
17                     $('#payout').html(addr);
18                     $('#amt').html(pays["Address. Address: " + addr]);
19                 });
20                     
21                     var arr = new Array;
22                     var total = 0;
23                     for(var i in pays) {
24                         arr.push(i);
25                     }
26                     arr.sort(function(a, b) { return (pays[b] - pays[a]); });
27                     for(var j in arr) {
28                         var addr = arr[j];
29                         addr = addr.replace(/^.*: /, "");
30                         $('#payouts tr:last').after('<tr><td><a href="http://blockexplorer.com/address/' + addr + '">' + arr[j] + '</a></td><td>' +
31                             pays[arr[j]] + '</td></tr>');
32                         total += pays[arr[j]];
33                     }
34                     $('#payouts tr:last').after('<tr><td><b>Total:</b></td><td><b>' + total.toFixed(8) + '</b></td></tr>');
35             });
36             
37             $.getJSON('/recent_blocks', function(blocks) {
38                 for(var i in blocks) {
39                     var ts = new Date(1000 * blocks[i]['ts']);
40                     var padded_hash = blocks[i]['hash'];
41                     while(padded_hash.length < 64) {
42                         padded_hash = '0' + padded_hash;
43                     }
44                     $('#blocks tr:last').after('<tr><td>' + ts.toString() +
45                         '</td><td><a href="http://blockexplorer.com/block/'
46                         + padded_hash + '">' + padded_hash + '</a></td></tr>');
47                 }
48             });
49         </script>
50     </head>
51     <body>
52         <h1>P2Pool Stats</h1>
53         <p><a href="graphs.html">Graphs</a></p>
54         <p>Total pool GH/s: <span id="hashrate"></span></p>
55         <p>My payout address: <span id="payout"></span></p>
56         <p>Payout if a block were found NOW: <span id="amt"></span> BTC</p>
57         
58         <h2>Blocks found since program started:</h2>
59         <table border="1" id="blocks">
60             <tr><th>time</th><th>hash</th></tr>
61         </table>
62         
63         <h2>Payouts if a block were found NOW:</h2>
64         <table border="1" id="payouts">
65             <tr><th>address</th><th>amount in BTC</th></tr>
66         </table>
67     </body>
68 </html>