diff options
author | tilpner | 2020-06-15 09:53:06 +0200 |
---|---|---|
committer | tilpner | 2020-06-15 09:53:06 +0200 |
commit | 367b0c114f38d5c332f5ee971ad13dd69e302dec (patch) | |
tree | ec0c5ee3e7e1f0a30517599e51bd0c8172635158 /profiles/addons/qwantjunior/content-script.js | |
parent | 2992d92e6ce0d7c96ccded0747d8815d8cfed956 (diff) | |
download | firefox-profiles-367b0c114f38d5c332f5ee971ad13dd69e302dec.tar.gz firefox-profiles-367b0c114f38d5c332f5ee971ad13dd69e302dec.tar.xz firefox-profiles-367b0c114f38d5c332f5ee971ad13dd69e302dec.zip |
WIP towards module based configuration
Diffstat (limited to 'profiles/addons/qwantjunior/content-script.js')
-rw-r--r-- | profiles/addons/qwantjunior/content-script.js | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/profiles/addons/qwantjunior/content-script.js b/profiles/addons/qwantjunior/content-script.js deleted file mode 100644 index 01b3976..0000000 --- a/profiles/addons/qwantjunior/content-script.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -function changeSettings(managed) { - var preferred = managed.settings; - var userStorage = JSON.parse(localStorage.getItem('user')); - var needsReload = false; - - if (userStorage == null) { - localStorage.setItem('user', JSON.stringify({ - userSetting: preferred - })); - - needsReload = true; - } else if (userStorage.version == "2") { - var setting = userStorage.userSetting; - - for (const [key, value] of Object.entries(preferred)) { - if (setting[key] != preferred[key]) { - setting[key] = preferred[key]; - needsReload = true; - } - } - - localStorage.setItem('user', JSON.stringify(userStorage)); - } - - if (needsReload) { - location.reload(); - } -} - -browser.storage.managed - .get("settings") - .then(changeSettings); |