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