Search Engine Instance
diff --git a/src/pages/options/options.js b/src/pages/options/options.js
index 91e7ac0..938abd2 100644
--- a/src/pages/options/options.js
+++ b/src/pages/options/options.js
@@ -6,6 +6,7 @@ import youtubeHelper from "../../assets/javascripts/helpers/youtube.js";
import instagramHelper from "../../assets/javascripts/helpers/instagram.js";
import mapsHelper from "../../assets/javascripts/helpers/google-maps.js";
import redditHelper from "../../assets/javascripts/helpers/reddit.js";
+import mediumHelper from "../../assets/javascripts/helpers/medium.js";
import searchHelper from "../../assets/javascripts/helpers/google-search.js";
import googleTranslateHelper from "../../assets/javascripts/helpers/google-translate.js";
import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js";
@@ -15,6 +16,7 @@ const invidiousInstances = youtubeHelper.redirects;
const bibliogramInstances = instagramHelper.redirects;
const osmInstances = mapsHelper.redirects;
const redditInstances = redditHelper.redirects;
+const scribeInstances = mediumHelper.redirects;
const searchEngineInstances = searchHelper.redirects;
const simplyTranslateInstances = googleTranslateHelper.redirects;
const wikipediaInstances = wikipediaHelper.redirects;
@@ -24,6 +26,7 @@ const autocompletes = [
{ id: "bibliogram-instance", instances: bibliogramInstances },
{ id: "osm-instance", instances: osmInstances },
{ id: "reddit-instance", instances: redditInstances },
+ { id: "scribe-instance", instances: scribeInstances },
{
id: "search-engine-instance",
instances: searchEngineInstances.map((instance) => instance.link),
@@ -38,6 +41,7 @@ let invidiousInstance = document.getElementById("invidious-instance");
let bibliogramInstance = document.getElementById("bibliogram-instance");
let osmInstance = document.getElementById("osm-instance");
let redditInstance = document.getElementById("reddit-instance");
+let scribeInstance = document.getElementById("scribe-instance");
let searchEngineInstance = document.getElementById("search-engine-instance");
let simplyTranslateInstance = document.getElementById(
"simply-translate-instance"
@@ -48,6 +52,7 @@ let disableInvidious = document.getElementById("disable-invidious");
let disableBibliogram = document.getElementById("disable-bibliogram");
let disableOsm = document.getElementById("disable-osm");
let disableReddit = document.getElementById("disable-reddit");
+let disableScribe = document.getElementById("disable-scribe");
let disableSearchEngine = document.getElementById("disable-search-engine");
let disableSimplyTranslate = document.getElementById(
"disable-simply-translate"
@@ -103,6 +108,7 @@ browser.storage.sync.get(
"bibliogramInstance",
"osmInstance",
"redditInstance",
+ "scribeInstance",
"searchEngineInstance",
"simplyTranslateInstance",
"wikipediaInstance",
@@ -111,6 +117,7 @@ browser.storage.sync.get(
"disableBibliogram",
"disableOsm",
"disableReddit",
+ "disableScribe",
"disableSearchEngine",
"disableSimplyTranslate",
"disableWikipedia",
@@ -139,6 +146,7 @@ browser.storage.sync.get(
bibliogramInstance.value = result.bibliogramInstance || "";
osmInstance.value = result.osmInstance || "";
redditInstance.value = result.redditInstance || "";
+ scribeInstance.value = result.scribeInstance || "";
searchEngineInstance.value =
(result.searchEngineInstance && result.searchEngineInstance.link) || "";
simplyTranslateInstance.value = result.simplyTranslateInstance || "";
@@ -148,6 +156,7 @@ browser.storage.sync.get(
disableBibliogram.checked = !result.disableBibliogram;
disableOsm.checked = !result.disableOsm;
disableReddit.checked = !result.disableReddit;
+ disableScribe.checked = !result.disableScribe;
disableSearchEngine.checked = !result.disableSearchEngine;
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
disableWikipedia.checked = !result.disableWikipedia;
@@ -311,6 +320,15 @@ const redditInstanceChange = debounce(() => {
}, 500);
redditInstance.addEventListener("input", redditInstanceChange);
+const scribeInstanceChange = debounce(() => {
+ if (scribeInstance.checkValidity()) {
+ browser.storage.sync.set({
+ scribeInstance: parseURL(scribeInstance.value),
+ });
+ }
+}, 500);
+scribeInstance.addEventListener("input", scribeInstanceChange);
+
const searchEngineInstanceChange = debounce(() => {
const instance = searchEngineInstances.find(
(instance) => instance.link === searchEngineInstance.value
@@ -369,6 +387,10 @@ disableReddit.addEventListener("change", (event) => {
browser.storage.sync.set({ disableReddit: !event.target.checked });
});
+disableScribe.addEventListener("change", (event) => {
+ browser.storage.sync.set({ disableScribe: !event.target.checked });
+});
+
disableSearchEngine.addEventListener("change", (event) => {
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
});