diff --git a/webext/css/options.css b/webext/css/options.css index 55ee1c4..0b880c9 100644 --- a/webext/css/options.css +++ b/webext/css/options.css @@ -189,3 +189,43 @@ ul, .custom-icon-container > div { margin: 10px; } + +button[name="savebutton"] { + display: inline-block; + padding: 8px 16px; + vertical-align: middle; + overflow: hidden; + text-decoration: none; + color: inherit; + background-color: #f1f1f1; + text-align: center; + cursor: pointer; + white-space: nowrap; + border: 1px solid #ccc; + border-radius: 8px; +} + +button[name="savebutton"]:hover { + color: #000; + background-color: #ccc; +} + +button[name="resetbutton"] { + display: inline-block; + padding: 8px 16px; + vertical-align: middle; + overflow: hidden; + text-decoration: none; + color: inherit; + background-color: #f1f1f1; + text-align: center; + cursor: pointer; + white-space: nowrap; + border: 1px solid #f44336; + border-radius: 8px; +} + +button[name="resetbutton"]:hover { + color: #000; + background-color: #ccc; +} diff --git a/webext/js/defaults.js b/webext/js/defaults.js index de93c31..005cd36 100644 --- a/webext/js/defaults.js +++ b/webext/js/defaults.js @@ -1,18 +1,14 @@ // // Get the prefered storage // -function storage() { - return browser.storage.local; - - /* - if (SysTrayX.Info.storageType === "sync") { +function storage(store) { + if (SysTrayX.Info.browserInfo.majorVersion < 91 || store === "sync") { console.log("Using sync storage"); return browser.storage.sync; } else { console.log("Using local storage"); return browser.storage.local; } - */ } // @@ -426,7 +422,13 @@ function checkFilters(filters) { } } } - } else if (filters.length > 0) { + } else { + const convertTo91Filters = + SysTrayX.Info.browserInfo.majorVersion >= 91 && + filters[0].unread !== undefined; + + console.debug("Convert filter: " + convertTo91Filters); + // Check the filters newFilters = filters; @@ -599,3 +601,24 @@ async function addFolderToFilters(newFolder) { filters: newFilters, }); } + +// +// Storage move +// +async function storageMove() { + const src = "sync"; + const dst = "local"; + + // + // Debug state + // + await storage(src) + .get("debug") + .then( + async (result) => + result.debug && + (await storage(dst).set({ + debug: `${result.debug}`, + })) + ); +} diff --git a/webext/options.html b/webext/options.html index ae14ba2..bfd4549 100644 --- a/webext/options.html +++ b/webext/options.html @@ -544,7 +544,7 @@ - + @@ -552,14 +552,14 @@
-
- - - - - - -
+ + + + + + diff --git a/webext/options.js b/webext/options.js index e9b12f9..122b411 100644 --- a/webext/options.js +++ b/webext/options.js @@ -2,17 +2,13 @@ // Get the prefered storage // function storage() { - return browser.storage.local; - - /* - if (SysTrayX.Info.storageType === "sync") { + if (SysTrayX.Info.browserInfo.majorVersion < 91 || store === "sync") { console.log("Using sync storage"); return browser.storage.sync; } else { console.log("Using local storage"); return browser.storage.local; } - */ } SysTrayX.SaveOptions = { @@ -1260,8 +1256,8 @@ async function start() { // Enable reset button document - .querySelector('[name="resetform"]') - .addEventListener("submit", SysTrayX.StorageReset.reset); + .querySelector('[name="resetbutton"]') + .addEventListener("click", SysTrayX.StorageReset.reset); browser.storage.onChanged.addListener(SysTrayX.StorageChanged.changed);