Skip to content

Commit f7dd084

Browse files
committed
Add Explorer nav link to all pages when explorer is enabled
Dynamically inject an Explorer link into the navigation on every page when currency_info.explorer_enabled is true. Links to the external explorer URL (e.g., voidbind.com:9090). Pages updated: dashboard, graphs, stratum, miners, miner, index, share. All pages now have consistent navigation: Dashboard | [PPLNS | Sharechain] | Graphs | Stratum | Miners | Classic | Explorer
1 parent a089600 commit f7dd084

7 files changed

Lines changed: 85 additions & 2 deletions

File tree

web-static/dashboard.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2760,7 +2760,25 @@ <h4>Legend</h4>
27602760
if (info && info.block_period) {
27612761
parentBlockPeriodMs = info.block_period * 1000;
27622762
}
2763-
2763+
2764+
// Inject Explorer nav link when explorer is enabled
2765+
if (info && info.explorer_enabled && info.explorer_url) {
2766+
var nav = document.querySelector('nav');
2767+
if (nav && !document.getElementById('nav-explorer')) {
2768+
var classicLink = nav.querySelector('a[href="index.html"]');
2769+
var a = document.createElement('a');
2770+
a.id = 'nav-explorer';
2771+
a.href = info.explorer_url;
2772+
a.target = '_blank';
2773+
a.textContent = 'Explorer';
2774+
if (classicLink && classicLink.nextSibling) {
2775+
nav.insertBefore(a, classicLink.nextSibling);
2776+
} else {
2777+
nav.appendChild(a);
2778+
}
2779+
}
2780+
}
2781+
27642782
// Now load everything else
27652783
loadStats();
27662784
loadBlocks();

web-static/graphs.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,17 @@ <h2>Memory Usage</h2>
594594
window.location.search = "Day";
595595
} else {
596596
d3.json('../web/currency_info', function(currency_info) {
597+
if (currency_info && currency_info.explorer_enabled && currency_info.explorer_url) {
598+
var nav = document.querySelector('nav');
599+
if (nav && !document.getElementById('nav-explorer')) {
600+
var a = document.createElement('a');
601+
a.id = 'nav-explorer';
602+
a.href = currency_info.explorer_url;
603+
a.target = '_blank';
604+
a.textContent = 'Explorer';
605+
nav.appendChild(a);
606+
}
607+
}
597608
change_period(period, currency_info);
598609
});
599610
}

web-static/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@
267267

268268
d3.json('../web/currency_info', function(currency_info) {
269269
d3.selectAll('.symbol').text(currency_info.symbol);
270+
if (currency_info.explorer_enabled && currency_info.explorer_url) {
271+
var navP = document.querySelector('body > p:first-of-type');
272+
if (navP && navP.innerHTML.indexOf('Explorer') === -1) {
273+
navP.innerHTML += ' | <a href="' + currency_info.explorer_url + '" target="_blank">Explorer</a>';
274+
}
275+
}
270276

271277
// Use current_merged_payouts which includes derived merged addresses
272278
d3.json('../current_merged_payouts', function(mergedPays) {

web-static/miner.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,10 +1521,20 @@ <h3>Maturing Merged Rewards</h3>
15211521
// Load currency info
15221522
d3.json('../web/currency_info', function(info) {
15231523
currency_info = info || {};
1524-
// Update currency symbol throughout the page
15251524
var symbol = currency_info.symbol || 'COIN';
15261525
document.getElementById('currency_symbol').textContent = symbol;
15271526
document.getElementById('payout_label').textContent = symbol + ' on next block';
1527+
if (info && info.explorer_enabled && info.explorer_url) {
1528+
var nav = document.querySelector('nav');
1529+
if (nav && !document.getElementById('nav-explorer')) {
1530+
var a = document.createElement('a');
1531+
a.id = 'nav-explorer';
1532+
a.href = info.explorer_url;
1533+
a.target = '_blank';
1534+
a.textContent = 'Explorer';
1535+
nav.appendChild(a);
1536+
}
1537+
}
15281538
loadMinerStats();
15291539
});
15301540

web-static/miners.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,17 @@ <h2>🔗 Merged Mining Blocks <span class="badge" id="merged_blocks_count" style
644644
d3.json('../web/currency_info', function(info) {
645645
currency_info = info || {};
646646
d3.selectAll('.symbol-small').text((info && info.symbol) || 'DASH');
647+
if (info && info.explorer_enabled && info.explorer_url) {
648+
var nav = document.querySelector('nav');
649+
if (nav && !document.getElementById('nav-explorer')) {
650+
var a = document.createElement('a');
651+
a.id = 'nav-explorer';
652+
a.href = info.explorer_url;
653+
a.target = '_blank';
654+
a.textContent = 'Explorer';
655+
nav.appendChild(a);
656+
}
657+
}
647658
});
648659

649660
// Load version

web-static/share.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,18 @@ <h1 style="font-size: 1.3rem; font-weight: 600; color: #008de4; margin: 0;">c2po
10021002
}
10031003

10041004
d3.json('../web/currency_info', function(currency_info) {
1005+
if (currency_info && currency_info.explorer_enabled && currency_info.explorer_url) {
1006+
var nav = document.querySelector('nav');
1007+
if (nav && !document.getElementById('nav-explorer')) {
1008+
var a = document.createElement('a');
1009+
a.id = 'nav-explorer';
1010+
a.href = currency_info.explorer_url;
1011+
a.target = '_blank';
1012+
a.textContent = 'Explorer';
1013+
a.style.cssText = 'color:#e0e0e0;text-decoration:none;padding:6px 14px;border-radius:6px;font-size:0.85rem;background:#16162a';
1014+
nav.appendChild(a);
1015+
}
1016+
}
10051017
reload(currency_info);
10061018
// Watch for hash changes (navigation between shares)
10071019
window.addEventListener('hashchange', function() {

web-static/stratum.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,21 @@ <h2>📡 Connections by IP</h2>
12211221
});
12221222
}
12231223

1224+
// Inject Explorer nav link if enabled
1225+
d3.json('../web/currency_info', function(info) {
1226+
if (info && info.explorer_enabled && info.explorer_url) {
1227+
var nav = document.querySelector('nav');
1228+
if (nav && !document.getElementById('nav-explorer')) {
1229+
var a = document.createElement('a');
1230+
a.id = 'nav-explorer';
1231+
a.href = info.explorer_url;
1232+
a.target = '_blank';
1233+
a.textContent = 'Explorer';
1234+
nav.appendChild(a);
1235+
}
1236+
}
1237+
});
1238+
12241239
// Initial load
12251240
update_stats();
12261241

0 commit comments

Comments
 (0)