From 21e87a6412b4dac679846884af16f744bc152eca Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Mon, 30 Jan 2023 15:46:10 +0300 Subject: Fixed locales and other typing stuff --- src/pages/options/index.js | 16 +++++++++------- src/pages/options/init.js | 5 ++++- src/pages/options/widgets/about.pug | 25 ------------------------- src/pages/options/widgets/general.pug | 6 +++--- src/pages/options/widgets/services.pug | 10 +++++----- 5 files changed, 21 insertions(+), 41 deletions(-) delete mode 100644 src/pages/options/widgets/about.pug (limited to 'src/pages/options') diff --git a/src/pages/options/index.js b/src/pages/options/index.js index 7b560248..c6c21095 100644 --- a/src/pages/options/index.js +++ b/src/pages/options/index.js @@ -6,11 +6,13 @@ let config, divs = {} for (const a of document.getElementById("links").getElementsByTagName("a")) { - a.addEventListener("click", e => { - const path = a.getAttribute("href").replace("#", "") - loadPage(path) - e.preventDefault() - }) + if (!a.href.includes("https://")) { + a.addEventListener("click", e => { + const path = a.getAttribute("href").replace("#", "") + loadPage(path) + e.preventDefault() + }) + } } config = await utils.getConfig() @@ -55,7 +57,7 @@ async function loadPage(path) { window.history.pushState({ id: "100" }, "Page 2", `/pages/options/index.html#${path}`) - if (path != 'general' && path != 'about') { + if (path != 'general') { const service = path; divs[service] = {} @@ -72,7 +74,7 @@ async function loadPage(path) { else options[service][option] = divs[service][option].value browser.storage.local.set({ options }) - changeFrontendsSettings(service) + changeFrontendsSettings(service) }) } diff --git a/src/pages/options/init.js b/src/pages/options/init.js index aab66f93..5883aafa 100644 --- a/src/pages/options/init.js +++ b/src/pages/options/init.js @@ -40,7 +40,10 @@ function changeTheme() { } changeTheme() -if (["ar", "iw", "ku", "fa", "ur"].includes(browser.i18n.getUILanguage())) document.getElementsByTagName("body")[0].classList.add("rtl") +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) diff --git a/src/pages/options/widgets/about.pug b/src/pages/options/widgets/about.pug deleted file mode 100644 index 64d88501..00000000 --- a/src/pages/options/widgets/about.pug +++ /dev/null @@ -1,25 +0,0 @@ -section(class="option-block" id="about_page") - div(class="some-block option-block") - h1 - a(target="_blank" data-localise="__MSG_about__" href="https://libredirect.github.io") About - hr - div(class="about") - div(class="some-block option-block") - h4 Donate: ♥️ - h4 - a(href="https://libredirect.github.io/donate" target="_blank") https://libredirect.github.io/donate - - div(class="some-block option-block") - h4 FAQ: - h4 - a(href="https://libredirect.github.io/faq" target="_blank") https://libredirect.github.io/faq - - div(class="some-block option-block") - h4 Docs: - h4 - a(href="https://libredirect.github.io/docs" target="_blank") https://libredirect.github.io/docs - - div(class="some-block option-block") - h4 Source Code: - h4 - a(href="https://libredirect.github.io/source_code" target="_blank") https://libredirect.github.io/source_code \ No newline at end of file diff --git a/src/pages/options/widgets/general.pug b/src/pages/options/widgets/general.pug index 8a3f1859..eafd3e79 100644 --- a/src/pages/options/widgets/general.pug +++ b/src/pages/options/widgets/general.pug @@ -6,12 +6,12 @@ section(class="option-block" id="general_page") div(class="some-block option-block") h4(data-localise="__MSG_theme__") Theme select#theme - option(value="detect" data-localise="__MSG_detect__") Detect + option(value="detect" data-localise="__MSG_auto__") Auto option(value="light" data-localise="__MSG_light__") Light option(value="dark" data-localise="__MSG_dark__") Dark div(class="some-block option-block") - h4(data-localise="__MSG_exclude_from_redirecting_") Excluded from redirecting + h4(data-localise="__MSG_excludeFromRedirecting__") Excluded from redirecting form(id="custom-exceptions-instance-form") div(class="some-block option-block") @@ -52,6 +52,6 @@ section(class="option-block" id="general_page") svg(xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor") path(d="M12,5V2L8,6l4,4V7c3.31,0,6,2.69,6,6c0,2.97-2.17,5.43-5,5.91v2.02c3.95-0.49,7-3.85,7-7.93C20,8.58,16.42,5,12,5z") path(d="M6,13c0-1.65,0.67-3.15,1.76-4.24L6.34,7.34C4.9,8.79,4,10.79,4,13c0,4.08,3.05,7.44,7,7.93v-2.02 C8.17,18.43,6,15.97,6,13z") - x(localise="__MSG_resetSettings__") Reset Settings + x(data-localise="__MSG_resetSettings__") Reset Settings script(type="module" src="./widgets/general.js") \ No newline at end of file diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug index b5f330cc..79d20535 100644 --- a/src/pages/options/widgets/services.pug +++ b/src/pages/options/widgets/services.pug @@ -2,7 +2,7 @@ each val, service in services section(class="option-block" id=service+"_page") div(class="some-block option-block") h1 - a(target="_blank" href=services[service].url)=services[service].name + a(target="_blank" href=services[service].url data-localise=`__MSG_${service}__`)=services[service].name hr @@ -13,7 +13,7 @@ each val, service in services div(id=service+"-opacity") div(class="some-block option-block") - h4(data-localise="__MSG_show_in_popup__") Show in Popup + h4(data-localise="__MSG_showInPopup__") Show in popup input(id=service type="checkbox") if Object.keys(services[service].frontends).length> 1 @@ -40,9 +40,9 @@ each val, service in services each val, frontend in services[service].frontends if services[service].frontends[frontend].instanceList - div(id=frontend) - div(class="some-block option-block") - h4(data-localise="__MSG_instances__") Add your favorite instances + div(id=frontend dir="ltr") + div(dir="auto" class="some-block option-block") + h4(data-localise="__MSG_addYourFavoriteInstances__") Add your favorite instances form(class="custom-instance-form") div(class="some-block option-block") -- cgit 1.4.1