From 2f78f75a907823d494b6b317cf711d538dbd22b3 Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Mon, 19 Jun 2023 11:42:25 +0200 Subject: [PATCH] escape marker-set id when saving to local storage --- BlueMapCommon/webapp/src/js/markers/MarkerSet.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/BlueMapCommon/webapp/src/js/markers/MarkerSet.js b/BlueMapCommon/webapp/src/js/markers/MarkerSet.js index b1f9c196..71c9566e 100644 --- a/BlueMapCommon/webapp/src/js/markers/MarkerSet.js +++ b/BlueMapCommon/webapp/src/js/markers/MarkerSet.js @@ -61,7 +61,7 @@ export class MarkerSet extends Scene { this.markerSets.filter(markerSet => markerSet.listed).length > 0 }, saveState: () => { - setLocalStorage("markerset-" + this.data.id + "-visible", this.visible); + setLocalStorage(this.localStorageKey("visible"), this.visible); } }); @@ -71,7 +71,7 @@ export class MarkerSet extends Scene { }); if (this.data.toggleable) { - let storedVisible = getLocalStorage("markerset-" + this.data.id + "-visible"); + let storedVisible = getLocalStorage(this.localStorageKey("visible")); if (storedVisible !== undefined) { this.visible = !!storedVisible; } else if (this.data.defaultHide) { @@ -229,4 +229,8 @@ export class MarkerSet extends Scene { }); } + localStorageKey(key) { + return "bluemap-markerset-" + encodeURIComponent(this.data.id) + "-" + key; + } + } \ No newline at end of file