From 70b1086c50b434d4213c4991acbd9c45843b57d8 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sun, 6 Feb 2022 01:20:08 +0300 Subject: [PATCH] upload old saved styles --- modules/load.js | 10 ++++++++++ modules/ui/stylePresets.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/load.js b/modules/load.js index fec7f6d9..07d95925 100644 --- a/modules/load.js +++ b/modules/load.js @@ -929,6 +929,16 @@ function parseLoadedData(data) { if (layerIsOn("markers")) drawMarkers(); } } + + if (version < 1.72) { + const storedStyles = Object.keys(localStorage).filter(key => key.startsWith("style")); + storedStyles.forEach(styleName => { + const style = localStorage.getItem(styleName); + const newStyleName = styleName.replace(/^style/, customPresetPrefix); + localStorage.setItem(newStyleName, style); + localStorage.removeItem(styleName); + }); + } })(); void (function checkDataIntegrity() { diff --git a/modules/ui/stylePresets.js b/modules/ui/stylePresets.js index c08bdf90..96e5aa0b 100644 --- a/modules/ui/stylePresets.js +++ b/modules/ui/stylePresets.js @@ -2,7 +2,7 @@ "use strict"; const systemPresets = ["default", "ancient", "gloom", "clean", "light", "watercolor", "cyberpunk", "monochrome"]; -const customPresetPrefix = "fmgStyle"; +const customPresetPrefix = "fmgStyle_"; // add style presets to list {