aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/options
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2021-10-12 15:24:16 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2021-10-12 15:24:16 +0700
commit362bef86586f04f615b97fdb740424e6568002e0 (patch)
tree3e76ee83bb088f60b2a280de94bb3808974dbcf0 /src/pages/options
parentAdd redirect from Medium to Scribe (diff)
downloadlibredirect-362bef86586f04f615b97fdb740424e6568002e0.zip
Fix copy-and-replace mistakes
- Change scribe's default input to 'Random instance (none selected)' - Add random pool variables and functions for scribe
Diffstat (limited to 'src/pages/options')
-rw-r--r--src/pages/options/options.html2
-rw-r--r--src/pages/options/options.js13
2 files changed, 13 insertions, 2 deletions
diff --git a/src/pages/options/options.html b/src/pages/options/options.html
index 43db929d..bafff5f8 100644
--- a/src/pages/options/options.html
+++ b/src/pages/options/options.html
@@ -284,7 +284,7 @@
<input
id="scribe-instance"
type="url"
- placeholder="https://libredd.it"
+ placeholder="Random instance (none selected)"
/>
</div>
</section>
diff --git a/src/pages/options/options.js b/src/pages/options/options.js
index 938abd24..71bdc99e 100644
--- a/src/pages/options/options.js
+++ b/src/pages/options/options.js
@@ -73,6 +73,7 @@ let useFreeTube = document.getElementById("use-freetube");
let nitterRandomPool = document.getElementById("nitter-random-pool");
let invidiousRandomPool = document.getElementById("invidious-random-pool");
let bibliogramRandomPool = document.getElementById("bibliogram-random-pool");
+let scribeRandomPool = document.getElementById("scribe-random-pool");
let exceptions;
window.browser = window.browser || window.chrome;
@@ -137,6 +138,7 @@ browser.storage.sync.get(
"nitterRandomPool",
"invidiousRandomPool",
"bibliogramRandomPool",
+ "scribeRandomPool",
],
(result) => {
theme.value = result.theme || "";
@@ -184,6 +186,9 @@ browser.storage.sync.get(
bibliogramRandomPool.value =
result.bibliogramRandomPool ||
commonHelper.filterInstances(bibliogramInstances);
+ scribeRandomPool.value =
+ result.scribeRandomPool ||
+ commonHelper.filterInstances(scribeInstances);
}
);
@@ -474,7 +479,13 @@ const bibliogramRandomPoolChange = debounce(() => {
bibliogramRandomPool: bibliogramRandomPool.value,
});
}, 500);
-bibliogramRandomPool.addEventListener("input", bibliogramRandomPoolChange);
+
+const scribeRandomPoolChange = debounce(() => {
+ browser.storage.sync.set({
+ scribeRandomPool: scribeRandomPool.value,
+ });
+}, 500);
+scribeRandomPool.addEventListener("input", scribeRandomPoolChange);
theme.addEventListener("change", (event) => {
const value = event.target.options[theme.selectedIndex].value;