about summary refs log tree commit diff stats
path: root/src/pages/options/init.js
diff options
context:
space:
mode:
authorBobIsMyManager <bimmgitsignature.nly8m@simplelogin.co>2022-07-26 22:28:50 +0100
committerBobIsMyManager <bimmgitsignature.nly8m@simplelogin.co>2022-07-26 22:28:50 +0100
commit2a0596f08fb54e2faef4bcb4548a28f5837fc067 (patch)
treecf5851f95c37da269a561623cee0d3967ca321ec /src/pages/options/init.js
parentI should really inspect diffs before commiting (diff)
downloadlibredirect-2a0596f08fb54e2faef4bcb4548a28f5837fc067.zip
Many things
Made all instances updateable

Added hyperpipe

Closes https://github.com/libredirect/libredirect/issues/398

Added cloudtube

Closes https://github.com/libredirect/libredirect/issues/397

Start using prettier
Diffstat (limited to 'src/pages/options/init.js')
-rw-r--r--src/pages/options/init.js61
1 files changed, 29 insertions, 32 deletions
diff --git a/src/pages/options/init.js b/src/pages/options/init.js
index daea2963..5b679da4 100644
--- a/src/pages/options/init.js
+++ b/src/pages/options/init.js
@@ -1,38 +1,35 @@
-window.browser = window.browser || window.chrome;
+window.browser = window.browser || window.chrome
 
-import localise from "../../assets/javascripts/localise.js";
+import localise from "../../assets/javascripts/localise.js"
 
 function changeTheme() {
-    return new Promise(resolve => {
-        browser.storage.local.get(
-            "theme",
-            r => {
-                switch (r.theme) {
-                    case "dark":
-                        document.body.classList.add("dark-theme");
-                        document.body.classList.remove("light-theme");
-                        break;
-                    case "light":
-                        document.body.classList.add("light-theme");
-                        document.body.classList.remove("dark-theme");
-                        break;
-                    default:
-                        if (matchMedia("(prefers-color-scheme: light)").matches) {
-                            document.body.classList.add("light-theme");
-                            document.body.classList.remove("dark-theme");
-                        } else {
-                            document.body.classList.add("dark-theme");
-                            document.body.classList.remove("light-theme");
-                        }
-                }
-                resolve();
-            }
-        )
-    })
+	return new Promise(resolve => {
+		browser.storage.local.get("theme", r => {
+			switch (r.theme) {
+				case "dark":
+					document.body.classList.add("dark-theme")
+					document.body.classList.remove("light-theme")
+					break
+				case "light":
+					document.body.classList.add("light-theme")
+					document.body.classList.remove("dark-theme")
+					break
+				default:
+					if (matchMedia("(prefers-color-scheme: light)").matches) {
+						document.body.classList.add("light-theme")
+						document.body.classList.remove("dark-theme")
+					} else {
+						document.body.classList.add("dark-theme")
+						document.body.classList.remove("light-theme")
+					}
+			}
+			resolve()
+		})
+	})
 }
 
-changeTheme();
-if (["ar", "iw", "ku", "fa", "ur"].includes(browser.i18n.getUILanguage())) document.getElementsByTagName("body")[0].classList.add("rtl");
-localise.localisePage();
+changeTheme()
+if (["ar", "iw", "ku", "fa", "ur"].includes(browser.i18n.getUILanguage())) document.getElementsByTagName("body")[0].classList.add("rtl")
+localise.localisePage()
 
-window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", changeTheme)
\ No newline at end of file
+window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", changeTheme)