From 6bb664039fe2a8e9aea0d8815832ca8a89563eb6 Mon Sep 17 00:00:00 2001 From: Spax Date: Sun, 2 Nov 2025 15:04:39 -0700 Subject: [PATCH] one last javascript fix --- export/pghrtjs.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/export/pghrtjs.js b/export/pghrtjs.js index 25c0ab1..98fcd70 100644 --- a/export/pghrtjs.js +++ b/export/pghrtjs.js @@ -130,7 +130,8 @@ function saveScroll() { // it returns to scroll positions stored in the array "scrollPos" function returnScroll() { - document.getElementById("return").addEventListener("click", () => { + const ret = document.getElementById("return"); + ret.addEventListener("click", () => { const scrollArray = JSON.parse(sessionStorage.getItem("scrollPos") ?? "[]").map(num => Number(num)); // check if saved, otherwise goto top and remove back arrow @@ -140,13 +141,13 @@ function returnScroll() { window.scroll(0, pos); } else if (scrollArray.length === 1) { - this.classList.remove("show"); + ret.classList.remove("show"); let pos = scrollArray.shift(); sessionStorage.setItem("scrollPos", JSON.stringify(scrollArray)); // scroll to top window.scroll(0, pos); } else { - this.classList.remove("show"); + ret.classList.remove("show"); // scroll to top window.scroll(0, 0); }