diff options
author | ManeraKai <manerakai@protonmail.com> | 2024-07-25 15:17:57 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2024-07-25 15:17:57 +0300 |
commit | c6de68c4c4bda3edcf6cf012bd98adea3baf866b (patch) | |
tree | 419e5cb8cdfe04fd734c5590e78888fa16e58e51 /src/pages/options | |
parent | Made Select Frontend searchable and with icons (diff) | |
download | libredirect-c6de68c4c4bda3edcf6cf012bd98adea3baf866b.zip |
Migrating popup to svelte
Diffstat (limited to 'src/pages/options')
-rw-r--r-- | src/pages/options/index.html | 16 | ||||
-rw-r--r-- | src/pages/options/init.js | 45 |
2 files changed, 17 insertions, 44 deletions
diff --git a/src/pages/options/index.html b/src/pages/options/index.html new file mode 100644 index 00000000..c3dcff71 --- /dev/null +++ b/src/pages/options/index.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset='utf-8'> + <meta name='viewport' content='width=device-width,initial-scale=1'> + <link rel="icon" type="image/x-icon" href="../../../assets/images/libredirect.svg"> + <title>Settings</title> + <link rel='stylesheet' href='build/bundle.css'> + <script defer src='build/bundle.js'></script> +</head> + +<body> +</body> + +</html> \ No newline at end of file diff --git a/src/pages/options/init.js b/src/pages/options/init.js index 07da1859..5a7ffb6e 100644 --- a/src/pages/options/init.js +++ b/src/pages/options/init.js @@ -1,51 +1,8 @@ window.browser = window.browser || window.chrome - import localise from "../../assets/javascripts/localise.js" -import utils from "../../assets/javascripts/utils.js" -import servicesHelper from "../../assets/javascripts/services.js" - -if (!(await utils.getOptions())) { - await servicesHelper.initDefaults() -} -async function changeTheme() { - switch ((await utils.getOptions()).theme) { - case "dark": - document.body.classList.add("dark-theme") - document.body.classList.remove("light-theme") - for (const element of document.body.getElementsByClassName("dark")) { - element.style.display = "none" - } - break - case "light": - document.body.classList.add("light-theme") - document.body.classList.remove("dark-theme") - for (const element of document.body.getElementsByClassName("light")) { - element.style.display = "none" - } - break - default: - if (matchMedia("(prefers-color-scheme: light)").matches) { - document.body.classList.add("light-theme") - document.body.classList.remove("dark-theme") - for (const element of document.body.getElementsByClassName("light")) { - element.style.display = "none" - } - } else { - document.body.classList.add("dark-theme") - document.body.classList.remove("light-theme") - for (const element of document.body.getElementsByClassName("dark")) { - element.style.display = "none" - } - } - } -} - -changeTheme() if (["ar", "iw", "ku", "fa", "ur"].includes(browser.i18n.getUILanguage())) { document.getElementsByTagName("body")[0].classList.add("rtl") document.getElementsByTagName("body")[0].dir = "rtl" } -localise.localisePage() - -window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", changeTheme) +localise.localisePage() \ No newline at end of file |