From 45f56b8c5d064d7e2181e5b81227e0b91f7985d8 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Nov 2025 03:38:33 +0000 Subject: [PATCH] fix: persist onloadBehavior setting for default map feature The default map feature was not working on page refresh because the onloadBehavior dropdown value was not being persisted or restored. Changes: - main.js: Restore onloadBehavior from localStorage on page load - save.js: saveAsDefaultMap() now saves "default" to localStorage - save.js: clearDefaultMap() now removes the localStorage setting - index.html: Update version hashes to 1.108.13 Now when users click "Set as default", the setting persists across page refreshes and their default map loads automatically. --- index.html | 4 ++-- main.js | 6 ++++++ modules/io/save.js | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index d73b3ff7..976ee481 100644 --- a/index.html +++ b/index.html @@ -8232,7 +8232,7 @@ - @@ -8277,7 +8277,7 @@ - + diff --git a/main.js b/main.js index 4f4bdb63..1f91ed4a 100644 --- a/main.js +++ b/main.js @@ -291,6 +291,12 @@ async function checkLoadParameters() { return; } + // restore onloadBehavior from localStorage if saved + const storedBehavior = localStorage.getItem("onloadBehavior"); + if (storedBehavior) { + byId("onloadBehavior").value = storedBehavior; + } + // check if there is a default map saved to indexedDB if (byId("onloadBehavior").value === "default") { try { diff --git a/modules/io/save.js b/modules/io/save.js index 7a9236c7..c4db90a2 100644 --- a/modules/io/save.js +++ b/modules/io/save.js @@ -175,6 +175,8 @@ async function saveAsDefaultMap() { const mapData = prepareMapData(); const blob = new Blob([mapData], {type: "text/plain"}); await ldb.set("defaultMap", blob); + localStorage.setItem("onloadBehavior", "default"); + byId("onloadBehavior").value = "default"; tip("Map is set as default and will open on load", true, "success", 5000); } catch (error) { ERROR && console.error(error); @@ -186,6 +188,8 @@ async function saveAsDefaultMap() { async function clearDefaultMap() { try { await ldb.set("defaultMap", null); + localStorage.removeItem("onloadBehavior"); + byId("onloadBehavior").value = "random"; tip("Default map cleared", false, "success", 2000); } catch (error) { ERROR && console.error(error);