Site: a reload no longer jumps back to the download section
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run

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 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-20 20:41:34 +03:00
parent a773d73208
commit 7b0cd27507

View file

@ -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();