about summary refs log tree commit diff stats
path: root/src/pages/options/reddit.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/options/reddit.js')
-rw-r--r--src/pages/options/reddit.js24
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