diff --git a/background.js b/background.js index 58e6867..daedb5d 100644 --- a/background.js +++ b/background.js @@ -71,7 +71,11 @@ async function buildRegExList() { async function getFromStorage(type, id, fallback) { let tmp = await browser.storage.local.get(id); - return typeof tmp[id] === type ? tmp[id] : fallback; + if (typeof tmp[id] === type) { + return tmp[id]; + } + await setToStorage(id, fallback); + return fallback; } async function setToStorage(id, value) { diff --git a/manifest.json b/manifest.json index 03ce132..b2711fb 100644 --- a/manifest.json +++ b/manifest.json @@ -36,5 +36,5 @@ "tabs" ], "optional_permissions": ["bookmarks", "history"], - "version": "1.1.30" + "version": "1.1.31" } diff --git a/options.html b/options.html index a87e24a..80373f3 100644 --- a/options.html +++ b/options.html @@ -33,14 +33,14 @@

(?)

diff --git a/options.js b/options.js index 1dbfc8d..7a1b401 100644 --- a/options.js +++ b/options.js @@ -57,9 +57,11 @@ function onChange(evt) { let el = document.getElementById(id); let val = obj[id]; - if (Array.isArray(val) && val.length > 0) { - for (var i = 0; i < el.options.length; i++) { + for (var i = 0; i < el.options.length; i++) { + if (Array.isArray(val)) { el.options[i].selected = val.includes(el.options[i].value); + } else { + el.options[i].selected = val == el.options[i].value; } } })