From 22453cb7b5accea910eae0568ab7cf19396e8f39 Mon Sep 17 00:00:00 2001 From: qx6ghqkz <93668667+qx6ghqkz@users.noreply.github.com> Date: Thu, 5 Dec 2024 02:12:38 +0000 Subject: [PATCH] fix: remember box height and scroll position --- templates/index.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/templates/index.html b/templates/index.html index 70b2166..4aaaf22 100644 --- a/templates/index.html +++ b/templates/index.html @@ -245,13 +245,13 @@

gallery-dl

btn.innerText = "Hide Logs"; box.style.display = "inline"; loadBox(); - localStorage.setItem("logs","shown"); + localStorage.setItem("logs", "shown"); } else { saveBox(); btn.innerText = "Show Logs"; box.style.display = "none"; - localStorage.setItem("logs","hidden"); + localStorage.setItem("logs", "hidden"); } } @@ -262,9 +262,10 @@

gallery-dl

box.style.height = sessionStorage.getItem("boxHeight") + "px"; } else { - box.scrollTop = box.scrollHeight; + box.style.height = ""; } - if ("scrollPos" in sessionStorage && sessionStorage.getItem("scrollPos") != "0") { + + if ("scrollPos" in sessionStorage) { box.scrollTop = sessionStorage.getItem("scrollPos"); } else { @@ -280,7 +281,9 @@

gallery-dl

} window.onbeforeunload = function(event) { - saveBox(); + if (localStorage.getItem("logs") == "shown") { + saveBox(); + } }