Rewrote URL references and redirects to be relative, not absolute, so server can...
[p2pool.git] / web-static / share.html
index 4414ae7..620a3b3 100644 (file)
             function reload(currency_info) {
                 var share_hash = document.location.hash.substr(1);
                 if(share_hash == current_hash) return;
-                d3.json('/web/share/' + share_hash, function(share) {
+                d3.json('../web/share/' + share_hash, function(share) {
                     current_hash = share_hash;
                     var b = d3.select('body');
                     b.selectAll('*').remove();
                     var h1 = b.append('h1');
-                        h1.append('a').attr('href', '/static/').text('P2Pool');
+                        h1.append('a').attr('href', '../static/').text('P2Pool');
                         h1.append('span').text(' > Share ');
                         h1.append('a').attr('href', '#' + share_hash).text(share_hash.substr(-8));
                     if(share == null) {
@@ -41,7 +41,9 @@
                         parent.append('a').attr('href', '#' + share.parent).text(share.parent.substr(-8));
                     var children = b.append('p');
                         children.append('span').text('Children: ');
-                        children.data(share.children).append('a').attr('href', function(c){return '#' + c}).text(function(c){return c.substr(-8)});
+                        children.selectAll().data(share.children).enter().append('span').text(' ').append('a')
+                            .attr('href', function(c){return '#' + c})
+                            .text(function(c){return c.substr(-8)});
                     b.append('p').text('Type: ' + share.type_name);
                     b.append('h2').text('Local data');
                     b.append('p').text('Verified: ' + share.local.verified);
                     b.append('p').text('Timestamp: ' + new Date(1000*share.share_data.timestamp) + ' (' + share.share_data.timestamp + ')');
                     b.append('p').text('Difficulty: ' + target_to_difficulty(share.share_data.target));
                     b.append('p').text('Minimum difficulty: ' + target_to_difficulty(share.share_data.max_target));
-                    b.append('p').text('Payout address: ' + share.share_data.payout_address);
+                    b.append('p').text('Payout address: ').append('a').text(share.share_data.payout_address).attr('href', currency_info.address_explorer_url_prefix+share.share_data.payout_address);
                     b.append('p').text('Donation amount: ' + d3.format('.3p')(share.share_data.donation));
                     b.append('p').text('Last stale: ' + share.share_data.stale_info);
                     b.append('p').text('Nonce: ' + share.share_data.nonce);
                     b.append('p').text('Desired version: ' + share.share_data.desired_version);
+                    b.append('p').text('Absolute height: ' + share.share_data.absheight);
+                    b.append('p').text('Absolute work: ' + share.share_data.abswork);
                     b.append('h2').text('Block');
                     var block = b.append('p')
                         block.append('span').text('Hash: ')
                         block.append('a').attr('href', currency_info.block_explorer_url_prefix + share.block.hash).text(share.block.hash);
-                    b.append('p').text('Transaction count: ' + share.block.txn_count);
-                    b.append('h2').text('Header');
+                    b.append('h3').text('Header');
                     b.append('p').text('Version: ' + share.block.header.version);
                     var prevblock = b.append('p')
                         prevblock.append('span').text('Previous block: ');
                         prevblock.append('a').attr('href', currency_info.block_explorer_url_prefix + share.block.header.previous_block).text(share.block.header.previous_block);
                     b.append('p').text('Merkle root: ' + share.block.header.merkle_root);
-                    b.append('p').text('Timestamp: ' + share.block.header.timestamp);
+                    b.append('p').text('Timestamp: ' + new Date(1000*share.block.header.timestamp) + ' (' + share.block.header.timestamp + ')');
                     b.append('p').text('Difficulty: ' + target_to_difficulty(share.block.header.target));
                     b.append('p').text('Nonce: ' + share.block.header.nonce);
-                    b.append('h2').text('Generation transaction');
-                    b.append('p').text('Hash: ' + share.block.gentx.hash);
-                    b.append('p').text('Coinbase: ' + share.block.gentx.coinbase + ' ' + hex2a(share.block.gentx.coinbase));
+                    b.append('h3').text('Generation transaction');
+                    b.append('p').text('Hash: ').append('a').text(share.block.gentx.hash).attr('href', currency_info.tx_explorer_url_prefix+share.block.gentx.hash);
+                    b.append('p').text('Coinbase (hex): ' + share.block.gentx.coinbase);
+                    b.append('p').text('Coinbase (text): ' + hex2a(share.block.gentx.coinbase));
                     b.append('p').text('Value: ' + share.block.gentx.value + ' ' + currency_info.symbol);
+                    b.append('p').text('Last txout nonce (used by Stratum miners): ' + share.block.gentx.last_txout_nonce);
+                    b.append('h3').text('Other transactions');
+                    b.append('p').selectAll().data(share.block.other_transaction_hashes).enter().append('span').text(' ').append('a')
+                            .attr('href', function(tx_hash){return currency_info.tx_explorer_url_prefix + tx_hash})
+                            .text(function(tx_hash, i){return i+1});
                     return true;
                 });
             }
             
-            d3.json('/web/currency_info', function(currency_info) {
+            d3.json('../web/currency_info', function(currency_info) {
                 reload(currency_info);
                 setInterval(function(){ reload(currency_info) }, 100);
             });