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
+7 -1
View File
@@ -467,8 +467,14 @@
if (parts[0] !== "valley") return;
const c = parts[1] ? COLOURS.find((x) => x.toLowerCase() === parts[1].toLowerCase()) : null;
const enc = parts[2] && c && S.ENCOUNTERS[c].includes(parts[2]) ? parts[2] : null;
// plain "#valley" (e.g. the tab itself) keeps whatever the reader was looking at
if (!c) { writeHash(); return; }
if (!st.policy) { st.pendingHash = { c, enc }; return; }
if (c !== st.colour || (enc && enc !== st.focus)) { st.colour = c; st.focus = enc; st.expanded = null; render(); }
// a link to a dragon opens its most probable route, fresh: no earlier detours, nothing expanded
st.colour = c; st.focus = enc; st.expanded = null; st.info = null;
delete st.over[enc || ""];
S.ENCOUNTERS[c].forEach((e) => delete st.over[e]);
render();
}
/* ---------- render ---------- */