|
3 | 3 | <div class="d-md-flex py-2 justify-content-md-between"> |
4 | 4 | <h1 class="h4 my-2 mb-md-0 h1-pager"> |
5 | 5 | {{- if not (eq .Slot 0) -}} |
6 | | - <a href="/slot/{{ .PreviousSlot }}"><i class="fa fa-chevron-left"></i></a> |
| 6 | + <a href="/slot/{{ .PreviousSlot }}" class="slot-nav-link" data-slot-nav-base="/slot/{{ .PreviousSlot }}"><i class="fa fa-chevron-left"></i></a> |
7 | 7 | {{- else -}} |
8 | 8 | <a></a> |
9 | 9 | {{- end -}} |
10 | 10 | <span><i class="fas fa-cube mx-2"></i>Slot <span id="slot">{{ .Slot }}</span></span> |
11 | 11 | {{- if gt .NextSlot 0 -}} |
12 | | - <a href="/slot/{{ .NextSlot }}"><i class="fa fa-chevron-right"></i></a> |
| 12 | + <a href="/slot/{{ .NextSlot }}" class="slot-nav-link" data-slot-nav-base="/slot/{{ .NextSlot }}"><i class="fa fa-chevron-right"></i></a> |
13 | 13 | {{- else -}} |
14 | 14 | <a></a> |
15 | 15 | {{- end -}} |
@@ -455,15 +455,28 @@ <h5 class="mb-3"><i class="fas fa-project-diagram me-2"></i>Tracoor Traces</h5> |
455 | 455 | if (target.length) target.tab('show'); |
456 | 456 | } |
457 | 457 |
|
| 458 | + function syncSlotNavHashes() { |
| 459 | + var hash = window.location.hash || ''; |
| 460 | + $('.slot-nav-link').each(function() { |
| 461 | + var base = this.getAttribute('data-slot-nav-base') || this.getAttribute('href'); |
| 462 | + this.setAttribute('href', base + hash); |
| 463 | + }); |
| 464 | + } |
| 465 | + |
458 | 466 | activateTabByHash(); |
459 | | - window.addEventListener('hashchange', activateTabByHash); |
| 467 | + syncSlotNavHashes(); |
| 468 | + window.addEventListener('hashchange', function() { |
| 469 | + activateTabByHash(); |
| 470 | + syncSlotNavHashes(); |
| 471 | + }); |
460 | 472 |
|
461 | 473 | $('.nav-tabs a[data-bs-toggle="tab"]').on('shown.bs.tab', function(e) { |
462 | 474 | var href = e.target.getAttribute('href') || ''; |
463 | 475 | if (!href.startsWith('#')) return; |
464 | 476 | var newHash = href === '#overview' ? '' : href; |
465 | 477 | if (window.location.hash !== newHash) { |
466 | 478 | window.history.replaceState(null, document.title, window.location.pathname + window.location.search + newHash); |
| 479 | + syncSlotNavHashes(); |
467 | 480 | } |
468 | 481 | }); |
469 | 482 |
|
|
0 commit comments