From 7b0cd275072503d2d7f8c7dad569a348af0d03de Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Tue, 20 Oct 2026 20:41:34 +0300 Subject: [PATCH] Site: a reload no longer jumps back to the download section After a jump to an anchor (a download badge, a menu link) the anchor is dropped from the address, so a reload keeps the place the visitor scrolled to. Co-Authored-By: Claude Opus 5.5 --- website/static/js/site.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/website/static/js/site.js b/website/static/js/site.js index 342348d..d041b37 100644 --- a/website/static/js/site.js +++ b/website/static/js/site.js @@ -216,12 +216,17 @@ } function openHash() { var id = location.hash.slice(1); - if (!id || id.indexOf("download-") !== 0) return; - var panelId = id.replace(/^(download-(windows|macos|linux)).*/, "$1"); - var tab = tabs.filter(function (x) { return x.getAttribute("aria-controls") === panelId; })[0]; - if (tab) select(tab); - var target = $(id); - if (target) target.scrollIntoView(); + if (!id || /^screenshot-/.test(id)) return; + if (id.indexOf("download-") === 0) { + var panelId = id.replace(/^(download-(windows|macos|linux)).*/, "$1"); + var tab = tabs.filter(function (x) { return x.getAttribute("aria-controls") === panelId; })[0]; + if (tab) select(tab); + var target = $(id); + if (target) target.scrollIntoView(); + } + // The jump is done: drop the anchor, or a reload jumps there again from wherever + // the visitor has scrolled since. + history.replaceState(history.state, "", location.pathname + location.search); } window.addEventListener("hashchange", openHash); openHash();