See the route: open the valley on that dragon's most probable route

In-page links now keep their sub-path (#valley/blue) when switching tabs, and
a link to a dragon opens it fresh on its most probable route (earlier detours
cleared). Clicking the Valley tab itself keeps the current selection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
ekcSchiano
2026-11-02 16:22:34 +00:00
co-authored by Claude Opus 5.5
parent 2eace69d7d
commit 790b7e6f5e
2 changed files with 15 additions and 2 deletions
+8 -1
View File
@@ -60,7 +60,14 @@
const a = e.target.closest('a[href^="#"]');
if (!a) return;
const id = a.getAttribute("href").slice(1);
if (tabOf(id)) { e.preventDefault(); showTab(tabOf(id)); return; }
if (tabOf(id)) {
// keep sub-paths such as #valley/blue so the destination can open on that selection
e.preventDefault();
try { history.replaceState(null, "", "#" + id); } catch (err) { /* ignore */ }
showTab(tabOf(id), false, true);
window.scrollTo({ top: 0, behavior: "smooth" });
return;
}
const target = document.getElementById(id);
const panel = target && target.closest(".tabpanel");
if (panel && panel.hidden) { e.preventDefault(); showTab(panel.id.replace("panel-", "")); target.scrollIntoView({ behavior: "smooth" }); }