diff options
author | ManeraKai <manerakai@protonmail.com> | 2022-01-31 21:01:16 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2022-01-31 21:01:24 +0300 |
commit | 540b41ef0a752bf7aa0d90df37bdb69a28b6f39f (patch) | |
tree | 741443b9b61f81b0c8690c3c71aed75bc770c781 /src/pages/options/reddit.js | |
parent | Updating RandomPools (diff) | |
download | libredirect-540b41ef0a752bf7aa0d90df37bdb69a28b6f39f.zip |
Refining code. Adding frontend option to search
Diffstat (limited to 'src/pages/options/reddit.js')
-rw-r--r-- | src/pages/options/reddit.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/pages/options/reddit.js b/src/pages/options/reddit.js index 59307096..6702c4de 100644 --- a/src/pages/options/reddit.js +++ b/src/pages/options/reddit.js @@ -39,10 +39,10 @@ browser.storage.sync.get( tedditRandomPoolElement.value = tedditRandomPool.join("\n"); commonHelper.updateListElement(tedditRandomPoolListElement, tedditRandomPool); - let id = "reddit-instance"; - let instances = redditInstances; - shared.autocompletes.push({ id: id, instances: instances }) - shared.autocomplete(document.getElementById(id), instances); + // let id = "reddit-instance"; + // let instances = redditInstances; + // shared.autocompletes.push({ id: id, instances: instances }) + // shared.autocomplete(document.getElementById(id), instances); } ) @@ -74,4 +74,18 @@ tedditRandomPoolElement.addEventListener("input", commonHelper.debounce(() => { tedditRandomPool = commonHelper.filterList(tedditRandomPoolElement.value.split("\n")) commonHelper.updateListElement(tedditRandomPoolListElement, tedditRandomPool); browser.storage.sync.set({ tedditRandomPool: tedditRandomPool }); -}, 50)); \ No newline at end of file +}, 50)); + +browser.storage.onChanged.addListener((changes) => { + if ("libredditRandomPool" in changes) { + libredditRandomPool = changes.libredditRandomPool.newValue; + libredditRandomPoolElement.value = libredditRandomPool.join("\n"); + commonHelper.updateListElement(libredditRandomPoolListElement, libredditRandomPool); + } + + if ("tedditRandomPool" in changes) { + tedditRandomPool = changes.tedditRandomPool.newValue; + tedditRandomPoolElement.value = tedditRandomPool.join("\n"); + commonHelper.updateListElement(tedditRandomPoolListElement, tedditRandomPool); + } +}) \ No newline at end of file |