From 17c0644e5130c2d317a54c56fcc5bfccef80d7ae Mon Sep 17 00:00:00 2001 From: "Michael J. Ryan" <tracker1@gmail.com> Date: Sat, 20 Feb 2021 17:43:06 -0800 Subject: [PATCH] Update common.js When the property was changed, it now blows up on any browser with the previous configuration schema, explicitly checking for the expected text value without parsing. --- webv4/root/js/common.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webv4/root/js/common.js b/webv4/root/js/common.js index 79c5e6c87a..a48b8843ea 100644 --- a/webv4/root/js/common.js +++ b/webv4/root/js/common.js @@ -91,9 +91,9 @@ function registerEventListener(scope, callback, params) { } function darkmodeRequested() { - const ls = JSON.parse(localStorage.getItem('darkSwitch')); - if (ls) return true; - if (ls === false) return false; + const ls = localStorage.getItem('darkSwitch'); + if (ls === "true") return true; + if (ls === "false") return false; if ((window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches)) return true; if ($('#darkSwitch').prop('checked')) return true; return false; -- GitLab