about summary refs log tree commit diff stats
path: root/src/assets/javascripts/general.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/assets/javascripts/general.js')
-rw-r--r--src/assets/javascripts/general.js110
1 files changed, 49 insertions, 61 deletions
diff --git a/src/assets/javascripts/general.js b/src/assets/javascripts/general.js
index 1c27a55d..0b34c148 100644
--- a/src/assets/javascripts/general.js
+++ b/src/assets/javascripts/general.js
@@ -1,78 +1,66 @@
-"use strict";
-window.browser = window.browser || window.chrome;
+"use strict"
+window.browser = window.browser || window.chrome
 
 function isException(url) {
-    for (const item of exceptions.url)
-        if (item == `${url.protocol}//${url.host}`) return true;
-    for (const item of exceptions.regex)
-        if (new RegExp(item).test(url.href)) return true;
-    return false;
+	for (const item of exceptions.url) if (item == `${url.protocol}//${url.host}`) return true
+	for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true
+	return false
 }
 
-let exceptions;
+let exceptions
 
 function init() {
-    browser.storage.local.get(
-        'exceptions',
-        r => {
-            exceptions = r.exceptions;
-        }
-    )
+	browser.storage.local.get("exceptions", r => {
+		exceptions = r.exceptions
+	})
 }
 
-init();
+init()
 browser.storage.onChanged.addListener(init)
 
 async function initDefaults() {
-    return new Promise(resolve =>
-        browser.storage.local.set({
-            exceptions: {
-                "url": [],
-                "regex": [],
-            },
-            theme: "DEFAULT",
-            popupFrontends: [
-                "youtube",
-                "twitter",
-                "instagram",
-                "tiktok",
-                "imgur",
-                "reddit",
-                "quora",
-                "translate",
-                "maps",
-            ],
-            autoRedirect: false,
-            firstPartyIsolate: false,
-            protocol: "normal",
-            protocolFallback: true
-        }, () => resolve())
-    )
+	return new Promise(resolve =>
+		browser.storage.local.set(
+			{
+				exceptions: {
+					url: [],
+					regex: [],
+				},
+				theme: "DEFAULT",
+				popupFrontends: ["youtube", "twitter", "instagram", "tiktok", "imgur", "reddit", "quora", "translate", "maps"],
+				autoRedirect: false,
+				firstPartyIsolate: false,
+				protocol: "normal",
+				protocolFallback: true,
+			},
+			() => resolve()
+		)
+	)
 }
 
 const allPopupFrontends = [
-    "youtube",
-    "youtubeMusic",
-    "twitter",
-    "instagram",
-    "tiktok",
-    "imgur",
-    "reddit",
-    "search",
-    "translate",
-    "maps",
-    "wikipedia",
-    "medium",
-    "quora",
-    "imdb",
-    "reuters",
-    "peertube",
-    "lbry",
-    "sendTargets"
-];
+	"youtube",
+	"youtubeMusic",
+	"twitter",
+	"instagram",
+	"tiktok",
+	"imgur",
+	"reddit",
+	"search",
+	"translate",
+	"maps",
+	"wikipedia",
+	"medium",
+	"quora",
+	"imdb",
+	"reuters",
+	"peertube",
+	"lbry",
+	"sendTargets",
+]
 
 export default {
-    isException,
-    initDefaults,
-    allPopupFrontends,
+	isException,
+	initDefaults,
+	allPopupFrontends,
 }