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