From c6de68c4c4bda3edcf6cf012bd98adea3baf866b Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Thu, 25 Jul 2024 15:17:57 +0300 Subject: Migrating popup to svelte --- src/pages/options_src/App.svelte | 118 +++++++++++ src/pages/options_src/General/Exceptions.svelte | 108 ++++++++++ src/pages/options_src/General/General.svelte | 70 +++++++ .../options_src/General/SettingsButtons.svelte | 118 +++++++++++ src/pages/options_src/Services/FrontendIcon.svelte | 43 ++++ src/pages/options_src/Services/Instances.svelte | 233 +++++++++++++++++++++ src/pages/options_src/Services/RedirectType.svelte | 99 +++++++++ src/pages/options_src/Services/ServiceIcon.svelte | 40 ++++ src/pages/options_src/Services/Services.svelte | 188 +++++++++++++++++ src/pages/options_src/Sidebar.svelte | 43 ++++ src/pages/options_src/main.js | 7 + src/pages/options_src/stores.js | 5 + 12 files changed, 1072 insertions(+) create mode 100644 src/pages/options_src/App.svelte create mode 100644 src/pages/options_src/General/Exceptions.svelte create mode 100644 src/pages/options_src/General/General.svelte create mode 100644 src/pages/options_src/General/SettingsButtons.svelte create mode 100644 src/pages/options_src/Services/FrontendIcon.svelte create mode 100644 src/pages/options_src/Services/Instances.svelte create mode 100644 src/pages/options_src/Services/RedirectType.svelte create mode 100644 src/pages/options_src/Services/ServiceIcon.svelte create mode 100644 src/pages/options_src/Services/Services.svelte create mode 100644 src/pages/options_src/Sidebar.svelte create mode 100644 src/pages/options_src/main.js create mode 100644 src/pages/options_src/stores.js (limited to 'src/pages/options_src') diff --git a/src/pages/options_src/App.svelte b/src/pages/options_src/App.svelte new file mode 100644 index 00000000..6bbacb9b --- /dev/null +++ b/src/pages/options_src/App.svelte @@ -0,0 +1,118 @@ + + +{#if _options && _config} +
+ + {#if _page == "general"} + + {:else if _page == "services"} + + {/if} +
+{:else} +

Loading...

+{/if} + + diff --git a/src/pages/options_src/General/Exceptions.svelte b/src/pages/options_src/General/Exceptions.svelte new file mode 100644 index 00000000..4ef5591b --- /dev/null +++ b/src/pages/options_src/General/Exceptions.svelte @@ -0,0 +1,108 @@ + + +
+ + + + +
+ { + if (e.key === "Enter") addException() + }} + /> + + + + + + + + + +
diff --git a/src/pages/options_src/Services/FrontendIcon.svelte b/src/pages/options_src/Services/FrontendIcon.svelte new file mode 100644 index 00000000..24942fd6 --- /dev/null +++ b/src/pages/options_src/Services/FrontendIcon.svelte @@ -0,0 +1,43 @@ + + +{#if imageType} + {#if imageType == "svgMono"} + {#if theme == "dark"} + {details.label} + {:else} + {details.label} + {/if} + {:else} + {details.label} + {/if} +{/if} diff --git a/src/pages/options_src/Services/Instances.svelte b/src/pages/options_src/Services/Instances.svelte new file mode 100644 index 00000000..892e395b --- /dev/null +++ b/src/pages/options_src/Services/Instances.svelte @@ -0,0 +1,233 @@ + + +{#if serviceConf.frontends[selectedFrontend].instanceList && redirects && blacklist} +
+
+
+ +
+ + + + + + + e.key === "Enter" && addInstance()} + /> + + + + {#each _options[selectedFrontend] as instance} + + + {instance} + {#if isCustomInstance(instance)} + custom + {/if} + {#if pingCache && pingCache[instance]} + {pingCache[instance].value} + {/if} + + + +
+ {/each} + + {#if redirects !== "disabled" && blacklist !== "disabled"} + {#if redirects[selectedFrontend] && redirects[selectedFrontend]["clearnet"]} + {#each Object.entries(_config.networks) as [networkName, network]} + {#if redirects[selectedFrontend] && redirects[selectedFrontend][networkName] && redirects[selectedFrontend][networkName].length > 0} + + +
+ {#each redirects[selectedFrontend][networkName] as instance} + + + {instance} + {#if blacklist.cloudflare.includes(instance)} + + cloudflare + + {/if} + {#if _options[selectedFrontend].includes(instance)} + chosen + {/if} + {#if pingCache && pingCache[instance]} + {pingCache[instance].value} + {/if} + + + +
+ {/each} + {/if} + {/each} + {:else} + + {/if} + {/if} +
+{/if} + + diff --git a/src/pages/options_src/Services/RedirectType.svelte b/src/pages/options_src/Services/RedirectType.svelte new file mode 100644 index 00000000..7f7a2843 --- /dev/null +++ b/src/pages/options_src/Services/RedirectType.svelte @@ -0,0 +1,99 @@ + + + { + serviceOptions.redirectType = e.target.options[e.target.options.selectedIndex].value + options.set(_options) + }} + {values} +/> + +{#if serviceConf.frontends[frontendName].desktopApp && serviceOptions.redirectType != "main_frame"} + + + { + serviceOptions.embedFrontend = e.detail.value + options.set(_options) + }} + items={embeddableFrontends} + > +
+ + {item.label} +
+
+ + {selection.label} +
+
+
+{/if} diff --git a/src/pages/options_src/Services/ServiceIcon.svelte b/src/pages/options_src/Services/ServiceIcon.svelte new file mode 100644 index 00000000..89393cf6 --- /dev/null +++ b/src/pages/options_src/Services/ServiceIcon.svelte @@ -0,0 +1,40 @@ + + +{#if imageType} + {#if imageType == "svgMono"} + {#if theme == "dark"} + {details.label} + {:else} + {details.label} + {/if} + {:else} + {details.label} + {/if} +{/if} diff --git a/src/pages/options_src/Services/Services.svelte b/src/pages/options_src/Services/Services.svelte new file mode 100644 index 00000000..cb1efacb --- /dev/null +++ b/src/pages/options_src/Services/Services.svelte @@ -0,0 +1,188 @@ + + +
+ + + (selectedService = e.detail.value)} + items={[ + ...Object.entries(_config.services).map(([serviceKey, service]) => { + return { value: serviceKey, label: service.name } + }), + ]} + > +
+ + {item.label} +
+
+ + {selection.label} +
+
+
+ +
+ + { + serviceOptions.enabled = e.target.checked + options.set(_options) + }} + /> + +
+ { + if (e.target.checked && !_options.popupServices.includes(selectedService)) { + _options.popupServices.push(selectedService) + } else if (_options.popupServices.includes(selectedService)) { + const index = _options.popupServices.indexOf(selectedService) + if (index !== -1) _options.popupServices.splice(index, 1) + } + options.set(_options) + }} + /> + + + + + { + serviceOptions.frontend = e.detail.value + options.set(_options) + }} + items={[ + ...Object.entries(serviceConf.frontends).map(([frontendId, frontend]) => ({ + value: frontendId, + label: frontend.name, + })), + ]} + > +
+ + {item.label} +
+
+ + {selection.label} +
+
+
+ + + + { + serviceOptions.unsupportedUrls = e.target.options[e.target.options.selectedIndex].value + options.set(_options) + }} + values={[ + { value: "bypass", name: "Bypass" }, + { value: "block", name: "Block" }, + ]} + /> + + {#if selectedService == "search"} + + + + {/if} + + + + +
+
+ + diff --git a/src/pages/options_src/Sidebar.svelte b/src/pages/options_src/Sidebar.svelte new file mode 100644 index 00000000..ff44995f --- /dev/null +++ b/src/pages/options_src/Sidebar.svelte @@ -0,0 +1,43 @@ + + +
+ page.set("general")} style={$page == "general" && "color: var(--active);"}> + + General + + page.set("services")} style={$page == "services" && "color: var(--active);"}> + + Services + + + + About + +
+ + diff --git a/src/pages/options_src/main.js b/src/pages/options_src/main.js new file mode 100644 index 00000000..c4012f4a --- /dev/null +++ b/src/pages/options_src/main.js @@ -0,0 +1,7 @@ +import App from "./App.svelte" + +const app = new App({ + target: document.body, +}) + +export default app diff --git a/src/pages/options_src/stores.js b/src/pages/options_src/stores.js new file mode 100644 index 00000000..782f6064 --- /dev/null +++ b/src/pages/options_src/stores.js @@ -0,0 +1,5 @@ +import { writable } from "svelte/store" + +export const options = writable(null) +export const config = writable(null) +export const page = writable("general") -- cgit 1.4.1 From 2cb60e91cd33ea63dc43b7afb2ce7a261bce6512 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Fri, 26 Jul 2024 17:39:22 +0300 Subject: Added mobile support in Svelte --- package.json | 2 +- src/assets/javascripts/utils.js | 8 -- src/pages/components/Input.svelte | 5 ++ src/pages/components/RowCheckbox.svelte | 14 ---- src/pages/components/RowSelect.svelte | 19 ----- src/pages/fonts/Inter-VariableFont_slnt,wght.ttf | Bin 0 -> 803384 bytes src/pages/fonts/Vazirmatn-VariableFont_wght.ttf | Bin 0 -> 285620 bytes src/pages/fonts/styles.css | 13 +++ src/pages/options/index.html | 1 + src/pages/options_src/App.svelte | 20 ++++- src/pages/options_src/General/General.svelte | 89 ++++++++++++--------- src/pages/options_src/Services/Instances.svelte | 5 +- src/pages/options_src/Services/RedirectType.svelte | 23 +++--- src/pages/options_src/Services/Services.svelte | 71 ++++++++-------- src/pages/options_src/Sidebar.svelte | 14 ++++ src/pages/popup/index.html | 2 +- .../stylesheets/Inter-VariableFont_slnt,wght.ttf | Bin 803384 -> 0 bytes .../stylesheets/Vazirmatn-VariableFont_wght.ttf | Bin 285620 -> 0 bytes src/pages/stylesheets/styles.css | 88 -------------------- 19 files changed, 157 insertions(+), 217 deletions(-) delete mode 100644 src/pages/components/RowCheckbox.svelte delete mode 100644 src/pages/components/RowSelect.svelte create mode 100644 src/pages/fonts/Inter-VariableFont_slnt,wght.ttf create mode 100644 src/pages/fonts/Vazirmatn-VariableFont_wght.ttf create mode 100644 src/pages/fonts/styles.css delete mode 100644 src/pages/stylesheets/Inter-VariableFont_slnt,wght.ttf delete mode 100644 src/pages/stylesheets/Vazirmatn-VariableFont_wght.ttf delete mode 100644 src/pages/stylesheets/styles.css (limited to 'src/pages/options_src') diff --git a/package.json b/package.json index d0669a69..0f89cbdb 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "start": "web-ext run", "nightly": "web-ext run --firefox=/home/esmail/software/firefox_nightly/firefox", - "android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.fenix", + "android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.fenix ", "build": "web-ext build", "test": "web-ext lint", "html": "rollup -c --config-popup && rollup -c --config-options" diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index 439826dd..18168e90 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -20,13 +20,6 @@ function getNextInstance(currentInstanceUrl, instances) { return instances[nextInstanceIndex] } -/** - * @param {string} str - */ -function camelCase(str) { - return str.charAt(0).toUpperCase() + str.slice(1) -} - /** * @param {URL} url */ @@ -178,7 +171,6 @@ export default { protocolHost, getList, getBlacklist, - camelCase, getConfig, getOptions, getPingCache, diff --git a/src/pages/components/Input.svelte b/src/pages/components/Input.svelte index d963233c..97a47e6d 100644 --- a/src/pages/components/Input.svelte +++ b/src/pages/components/Input.svelte @@ -38,4 +38,9 @@ input:focus { outline-color: var(--active); } + @media (max-width: 715px) { + input { + width: 200px; + } + } diff --git a/src/pages/components/RowCheckbox.svelte b/src/pages/components/RowCheckbox.svelte deleted file mode 100644 index b7ccab93..00000000 --- a/src/pages/components/RowCheckbox.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/src/pages/components/RowSelect.svelte b/src/pages/components/RowSelect.svelte deleted file mode 100644 index d685803e..00000000 --- a/src/pages/components/RowSelect.svelte +++ /dev/null @@ -1,19 +0,0 @@ - - - - - { + _options.theme = e.target.options[e.target.options.selectedIndex].value + options.set(_options) + }} + ariaLabel="select theme" + /> + - { - _options["fetchInstances"] = e.target.options[e.target.options.selectedIndex].value - options.set(_options) - }} - ariaLabel="Select fetch public instances" - values={[ - { value: "github", name: "GitHub" }, - { value: "codeberg", name: "Codeberg" }, - { value: "disable", name: "Disable" }, - ]} - /> + + + { + serviceOptions.redirectType = e.target.options[e.target.options.selectedIndex].value + options.set(_options) + }} + {values} + /> + {#if serviceConf.frontends[frontendName].desktopApp && serviceOptions.redirectType != "main_frame"} diff --git a/src/pages/options_src/Services/Services.svelte b/src/pages/options_src/Services/Services.svelte index cb1efacb..9c4e6c97 100644 --- a/src/pages/options_src/Services/Services.svelte +++ b/src/pages/options_src/Services/Services.svelte @@ -1,6 +1,4 @@ diff --git a/src/pages/stylesheets/Inter-VariableFont_slnt,wght.ttf b/src/pages/stylesheets/Inter-VariableFont_slnt,wght.ttf deleted file mode 100644 index 969a990f..00000000 Binary files a/src/pages/stylesheets/Inter-VariableFont_slnt,wght.ttf and /dev/null differ diff --git a/src/pages/stylesheets/Vazirmatn-VariableFont_wght.ttf b/src/pages/stylesheets/Vazirmatn-VariableFont_wght.ttf deleted file mode 100644 index f4b97c01..00000000 Binary files a/src/pages/stylesheets/Vazirmatn-VariableFont_wght.ttf and /dev/null differ diff --git a/src/pages/stylesheets/styles.css b/src/pages/stylesheets/styles.css deleted file mode 100644 index 9e8fedb3..00000000 --- a/src/pages/stylesheets/styles.css +++ /dev/null @@ -1,88 +0,0 @@ -@font-face { - font-family: "Inter"; - src: url("Inter-VariableFont_slnt,wght.ttf"); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: "Vazirmatn"; - src: url("Vazirmatn-VariableFont_wght.ttf"); - font-weight: normal; - font-style: normal; -} - -/* - -@media (max-width: 1250px) { - body.option { - flex-direction: column; - width: 95vw; - align-items: center; - padding: 40px 0px; - } - - section.links { - flex-direction: row; - width: 95vw; - padding: 0 55px; - } - - section.block-option { - width: 95vw; - } - - div.checklist div x { - overflow: hidden; - } -} - -html.mobile img, -html.mobile svg { - margin-right: 10px; - height: 30px; - width: 30px; - color: var(--text); -} - -html.mobile div.block { - padding: 0 15px; - justify-content: space-between; - display: flex; - align-items: center; - margin-top: 20px; - margin-bottom: 20px; -} - -html.mobile div.block input[type="checkbox"] { - width: 58px; - height: 30px; -} - -html.mobile div.block input[type="checkbox"]::before { - width: 24px; - height: 24px; - top: 3px; - left: 3.5px; -} - -html.mobile div.block input[type="checkbox"]:checked::before { - left: 30px; -} - -html.mobile body.option { - flex-direction: column; - width: 100%; - padding: 0; - align-items: center; -} - -html.mobile section.links { - flex-direction: row; - width: 100%; - padding: 0 55px; -} - -html.mobile section.block-option { - width: 100%; -} */ \ No newline at end of file -- cgit 1.4.1 From e97b618660094491013d9d4999ac4802429f3dc7 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Fri, 26 Jul 2024 23:53:31 +0300 Subject: Added translation support to Svelte --- package.json | 1 + src/assets/javascripts/localise.js | 34 ------ src/pages/components/Checkbox.svelte | 19 ++-- src/pages/icons/ExportIcon.svelte | 9 +- src/pages/icons/ImportIcon.svelte | 17 ++- src/pages/icons/PingIcon.svelte | 9 +- src/pages/icons/ResetIcon.svelte | 1 + src/pages/options/init.js | 8 -- src/pages/options_src/App.svelte | 9 +- src/pages/options_src/General/Exceptions.svelte | 10 +- src/pages/options_src/General/General.svelte | 18 ++-- .../options_src/General/SettingsButtons.svelte | 31 ++++-- src/pages/options_src/Services/Instances.svelte | 32 +++--- src/pages/options_src/Services/RedirectType.svelte | 12 ++- src/pages/options_src/Services/Services.svelte | 115 +++++++++++---------- src/pages/options_src/Sidebar.svelte | 23 +++-- src/pages/popup_src/App.svelte | 2 +- src/pages/popup_src/Buttons.svelte | 94 +++++++++-------- src/pages/popup_src/components/Switch.svelte | 13 ++- 19 files changed, 251 insertions(+), 206 deletions(-) delete mode 100644 src/assets/javascripts/localise.js delete mode 100644 src/pages/options/init.js (limited to 'src/pages/options_src') diff --git a/package.json b/package.json index 0f89cbdb..2a79b660 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "scripts": { "start": "web-ext run", "nightly": "web-ext run --firefox=/home/esmail/software/firefox_nightly/firefox", + "start_ar": "web-ext run --firefox=/home/esmail/software/firefox_ar/firefox", "android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.fenix ", "build": "web-ext build", "test": "web-ext lint", diff --git a/src/assets/javascripts/localise.js b/src/assets/javascripts/localise.js deleted file mode 100644 index d26d07d4..00000000 --- a/src/assets/javascripts/localise.js +++ /dev/null @@ -1,34 +0,0 @@ -window.browser = window.browser || window.chrome - -function localisePage() { - /** - * @param {string} tag - */ - function getMessage(tag) { - return tag.replace(/__MSG_(\w+)__/g, (_match, v1) => { - return v1 ? browser.i18n.getMessage(v1) : null - }) - } - - const elements = document.querySelectorAll("[data-localise]") - for (let i in elements) - if (elements.hasOwnProperty(i)) { - const obj = elements[i] - const tag = obj.getAttribute("data-localise").toString() - const msg = getMessage(tag) - if (msg && msg !== tag) obj.textContent = msg - } - - const placeholders = document.querySelectorAll("[data-localise-placeholder]") - for (let i in placeholders) - if (placeholders.hasOwnProperty(i)) { - const obj = placeholders[i] - const tag = obj.getAttribute("data-localise-placeholder").toString() - const msg = getMessage(tag) - if (msg && msg !== tag) obj.placeholder = msg - } -} - -export default { - localisePage, -} diff --git a/src/pages/components/Checkbox.svelte b/src/pages/components/Checkbox.svelte index dbefd7e9..9ba9c56c 100644 --- a/src/pages/components/Checkbox.svelte +++ b/src/pages/components/Checkbox.svelte @@ -1,9 +1,10 @@ - + diff --git a/src/pages/icons/ExportIcon.svelte b/src/pages/icons/ExportIcon.svelte index 196726a8..d155e5c5 100644 --- a/src/pages/icons/ExportIcon.svelte +++ b/src/pages/icons/ExportIcon.svelte @@ -1,4 +1,11 @@ - + diff --git a/src/pages/icons/ImportIcon.svelte b/src/pages/icons/ImportIcon.svelte index f022b4f0..f64d0ff6 100644 --- a/src/pages/icons/ImportIcon.svelte +++ b/src/pages/icons/ImportIcon.svelte @@ -1,5 +1,12 @@ - - - \ No newline at end of file + + + diff --git a/src/pages/icons/PingIcon.svelte b/src/pages/icons/PingIcon.svelte index 8fcfe27b..34c4a37d 100644 --- a/src/pages/icons/PingIcon.svelte +++ b/src/pages/icons/PingIcon.svelte @@ -1,4 +1,11 @@ - + - let browser = window.browser || window.chrome + const browser = window.browser || window.chrome import General from "./General/General.svelte" import utils from "../../assets/javascripts/utils.js" @@ -67,12 +67,15 @@ cssVariables = light } } + + const dir = ["ar", "iw", "ku", "fa", "ur"].includes(browser.i18n.getUILanguage()) ? "rtl" : "ltr" + document.body.dir = dir {#if _options && _config}
-
- - - + + + +
- let browser = window.browser || window.chrome + const browser = window.browser || window.chrome import Exceptions from "./Exceptions.svelte" import SettingsButtons from "./SettingsButtons.svelte" @@ -26,12 +26,12 @@
- + { _options.fetchInstances = e.target.options[e.target.options.selectedIndex].value @@ -60,7 +60,7 @@ - + { @@ -71,7 +71,7 @@ - + diff --git a/src/pages/options_src/General/SettingsButtons.svelte b/src/pages/options_src/General/SettingsButtons.svelte index c37a3702..3ea46a2d 100644 --- a/src/pages/options_src/General/SettingsButtons.svelte +++ b/src/pages/options_src/General/SettingsButtons.svelte @@ -1,5 +1,5 @@ - + { @@ -130,8 +136,8 @@ options.set(_options) }} values={[ - { value: "bypass", name: "Bypass" }, - { value: "block", name: "Block" }, + { value: "bypass", name: browser.i18n.getMessage("bypass") || "Bypass" }, + { value: "block", name: browser.i18n.getMessage("block") || "Block" }, ]} /> @@ -139,13 +145,14 @@ {#if selectedService == "search"} {/if} @@ -184,8 +191,10 @@ justify-content: start; align-items: center; } + :global(.svelte_select img, .svelte_select svg) { margin-right: 10px; + margin-left: 0; height: 26px; width: 26px; color: var(--text); diff --git a/src/pages/options_src/Sidebar.svelte b/src/pages/options_src/Sidebar.svelte index 4a808268..fb515f53 100644 --- a/src/pages/options_src/Sidebar.svelte +++ b/src/pages/options_src/Sidebar.svelte @@ -1,4 +1,6 @@ -{#if redirect} - browser.runtime.sendMessage("redirectTab")}> - - - -{/if} - -{#if switchInstance} - browser.tabs.update({ url: await servicesHelper.switchInstance(url) })} - > - - - -{/if} +
+ {#if redirect} + browser.runtime.sendMessage("redirectTab")}> + + + + {/if} -{#if redirectToOriginal} - servicesHelper.copyRaw(url)}> - - - - browser.runtime.sendMessage("reverseTab")}> - - - -{/if} + {#if switchInstance} + browser.tabs.update({ url: await servicesHelper.switchInstance(url) })} + > + + + + {/if} -{#if redirect || switchInstance || redirectToOriginal} -
-{/if} + {#if redirectToOriginal} + servicesHelper.copyRaw(url)}> + + + + browser.runtime.sendMessage("reverseTab")}> + + + + {/if} -{#if currentService} - -
-{/if} + {#if redirect || switchInstance || redirectToOriginal} +
+ {/if} -{#each _options.popupServices as serviceKey} - {#if currentService !== serviceKey} - + {#if currentService} + +
{/if} -{/each} -
+ {#each _options.popupServices as serviceKey} + {#if currentService !== serviceKey} + + {/if} + {/each} + +
- window.open(browser.runtime.getURL("pages/options/index.html"), "_blank")}> - - - + window.open(browser.runtime.getURL("pages/options/index.html"), "_blank")}> + + + +
diff --git a/src/pages/popup_src/components/Switch.svelte b/src/pages/popup_src/components/Switch.svelte index f420caa1..e581e5f4 100644 --- a/src/pages/popup_src/components/Switch.svelte +++ b/src/pages/popup_src/components/Switch.svelte @@ -1,5 +1,5 @@ +
diff --git a/src/pages/options_src/General/General.svelte b/src/pages/options_src/General/General.svelte index 732ad83b..37c38a0a 100644 --- a/src/pages/options_src/General/General.svelte +++ b/src/pages/options_src/General/General.svelte @@ -38,7 +38,6 @@ _options.theme = e.target.options[e.target.options.selectedIndex].value options.set(_options) }} - ariaLabel="select theme" /> @@ -55,7 +54,6 @@ _options.fetchInstances = e.target.options[e.target.options.selectedIndex].value options.set(_options) }} - ariaLabel={"Select fetch public instances"} /> @@ -75,7 +73,7 @@ - + - +
diff --git a/src/pages/options_src/General/SettingsButtons.svelte b/src/pages/options_src/General/SettingsButtons.svelte index 3ea46a2d..2f574199 100644 --- a/src/pages/options_src/General/SettingsButtons.svelte +++ b/src/pages/options_src/General/SettingsButtons.svelte @@ -14,24 +14,18 @@ const unsubscribe = options.subscribe(val => (_options = val)) onDestroy(unsubscribe) - let disableButtons = false - let importSettingsInput let importSettingsFiles $: if (importSettingsFiles) { - disableButtons = true const reader = new FileReader() reader.readAsText(importSettingsFiles[0]) reader.onload = async () => { const data = JSON.parse(reader.result) if ("theme" in data && data.version == browser.runtime.getManifest().version) { browser.storage.local.clear(async () => { - console.log("clearing") options.set(data) - disableButtons = false }) } else { - console.log("incompatible settings") alert("Incompatible settings") } } @@ -42,26 +36,21 @@ } async function exportSettings() { - disableButtons = true _options.version = browser.runtime.getManifest().version const resultString = JSON.stringify(_options, null, " ") const anchor = document.createElement("a") anchor.href = "data:application/json;base64," + btoa(resultString) anchor.download = `libredirect-settings-v${_options.version}.json` anchor.click() - disableButtons = false } async function exportSettingsSync() { - disableButtons = true _options.version = browser.runtime.getManifest().version await servicesHelper.initDefaults() browser.storage.sync.set({ options: _options }) - disableButtons = false } async function importSettingsSync() { - disableButtons = true browser.storage.sync.get({ options }, r => { const optionsSync = r.options if (optionsSync.version == browser.runtime.getManifest().version) { @@ -69,24 +58,21 @@ } else { alert("Error") } - disableButtons = false }) } async function resetSettings() { - disableButtons = true browser.storage.local.clear(async () => { await servicesHelper.initDefaults() options.set(await utils.getOptions()) - disableButtons = false }) }
- - - - -
diff --git a/src/pages/options_src/Sidebar.svelte b/src/pages/options_src/Sidebar.svelte index fb515f53..97780b15 100644 --- a/src/pages/options_src/Sidebar.svelte +++ b/src/pages/options_src/Sidebar.svelte @@ -10,15 +10,15 @@ -- cgit 1.4.1 From a9ecaf4ac0d97510b95fe965eebd543d53e3e5ac Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Fri, 2 Aug 2024 16:27:54 +0300 Subject: Improved mobile support. Fixed https://github.com/libredirect/browser_extension/issues/956 --- package.json | 2 +- src/pages/background/background.js | 404 ++++++++++++------------ src/pages/components/Checkbox.svelte | 1 - src/pages/options_src/General/General.svelte | 39 ++- src/pages/options_src/Services/Instances.svelte | 1 - src/pages/options_src/Services/Services.svelte | 10 +- src/pages/popup_src/Buttons.svelte | 30 +- src/pages/popup_src/components/Switch.svelte | 5 +- 8 files changed, 273 insertions(+), 219 deletions(-) (limited to 'src/pages/options_src') diff --git a/package.json b/package.json index 2a79b660..2895734d 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "start": "web-ext run", "nightly": "web-ext run --firefox=/home/esmail/software/firefox_nightly/firefox", "start_ar": "web-ext run --firefox=/home/esmail/software/firefox_ar/firefox", - "android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.fenix ", + "android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.firefox --adb-remove-old-artifacts", "build": "web-ext build", "test": "web-ext lint", "html": "rollup -c --config-popup && rollup -c --config-options" diff --git a/src/pages/background/background.js b/src/pages/background/background.js index e3d9fb31..d42e5027 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -91,221 +91,233 @@ browser.tabs.onRemoved.addListener(tabId => { } }) -browser.commands.onCommand.addListener(async command => { - browser.tabs.query({ active: true, currentWindow: true }, async tabs => { - const url = new URL(tabs[0].url) - switch (command) { - case "switchInstance": { - const newUrl = await servicesHelper.switchInstance(url) - if (newUrl) browser.tabs.update({ url: newUrl }) - break - } - case "copyRaw": - servicesHelper.copyRaw(url) - break - case "redirect": - browser.tabs.query({ active: true, currentWindow: true }, async tabs => { - if (tabs[0].url) { - const url = new URL(tabs[0].url) - const newUrl = servicesHelper.redirect(url, "main_frame", null, true) - if (newUrl) { - browser.tabs.update(tabs[0].id, { url: newUrl }, () => { - tabIdRedirects[tabs[0].id] = true - }) - } - } - }) - break - case "reverse": - browser.tabs.query({ active: true, currentWindow: true }, async tabs => { - if (tabs[0].url) { - const url = new URL(tabs[0].url) - const newUrl = await servicesHelper.reverse(url) - if (newUrl) { - browser.tabs.update(tabs[0].id, { url: newUrl }, () => { - tabIdRedirects[tabs[0].id] = false - }) - } +browser.runtime.getPlatformInfo(r => { + if (r.os != "fuchsia" && r.os != "ios" && r.os != "android") { + browser.commands.onCommand.addListener(async command => { + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + const url = new URL(tabs[0].url) + switch (command) { + case "switchInstance": { + const newUrl = await servicesHelper.switchInstance(url) + if (newUrl) browser.tabs.update({ url: newUrl }) + break } - }) - break - } - }) -}) - -browser.contextMenus.create({ - id: "settingsTab", - title: browser.i18n.getMessage("settings"), - contexts: ["browser_action"], -}) -browser.contextMenus.create({ - id: "switchInstanceTab", - title: browser.i18n.getMessage("switchInstance"), - contexts: ["browser_action"], -}) -browser.contextMenus.create({ id: "copyReverseTab", title: "Copy Original", contexts: ["browser_action"] }) -browser.contextMenus.create({ id: "redirectTab", title: "Redirect", contexts: ["browser_action"] }) -browser.contextMenus.create({ id: "reverseTab", title: "Redirect To Original", contexts: ["browser_action"] }) + case "copyRaw": + servicesHelper.copyRaw(url) + break + case "redirect": + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + if (tabs[0].url) { + const url = new URL(tabs[0].url) + const newUrl = servicesHelper.redirect(url, "main_frame", null, true) + if (newUrl) { + browser.tabs.update(tabs[0].id, { url: newUrl }, () => { + tabIdRedirects[tabs[0].id] = true + }) + } + } + }) + break + case "reverse": + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + if (tabs[0].url) { + const url = new URL(tabs[0].url) + const newUrl = await servicesHelper.reverse(url) + if (newUrl) { + browser.tabs.update(tabs[0].id, { url: newUrl }, () => { + tabIdRedirects[tabs[0].id] = false + }) + } + } + }) + break + } + }) + }) -browser.contextMenus.create({ id: "redirectLink", title: "Redirect", contexts: ["link"] }) -browser.contextMenus.create({ id: "redirectLinkInNewTab", title: "Redirect In New Tab", contexts: ["link"] }) -browser.contextMenus.create({ id: "reverseLink", title: "Redirect To Original", contexts: ["link"] }) -browser.contextMenus.create({ id: "reverseLinkInNewTab", title: "Redirect To Original In New Tab", contexts: ["link"] }) -browser.contextMenus.create({ id: "copyReverseLink", title: "Copy Original", contexts: ["link"] }) -browser.contextMenus.create({ id: "bypassLink", title: "Bypass", contexts: ["link"] }) -browser.contextMenus.create({ id: "bypassLinkInNewTab", title: "Bypass In New Tab", contexts: ["link"] }) + browser.contextMenus.create({ + id: "settingsTab", + title: browser.i18n.getMessage("settings"), + contexts: ["browser_action"], + }) + browser.contextMenus.create({ + id: "switchInstanceTab", + title: browser.i18n.getMessage("switchInstance"), + contexts: ["browser_action"], + }) + browser.contextMenus.create({ id: "copyReverseTab", title: "Copy Original", contexts: ["browser_action"] }) + browser.contextMenus.create({ id: "redirectTab", title: "Redirect", contexts: ["browser_action"] }) + browser.contextMenus.create({ id: "reverseTab", title: "Redirect To Original", contexts: ["browser_action"] }) -if (!isChrome) { - browser.contextMenus.create({ id: "redirectBookmark", title: "Redirect", contexts: ["bookmark"] }) - browser.contextMenus.create({ id: "redirectBookmarkInNewTab", title: "Redirect In New Tab", contexts: ["bookmark"] }) - browser.contextMenus.create({ id: "reverseBookmark", title: "Redirect To Original", contexts: ["bookmark"] }) - browser.contextMenus.create({ - id: "reverseBookmarkInNewTab", - title: "Redirect To Original In New Tab", - contexts: ["bookmark"], - }) - browser.contextMenus.create({ id: "copyReverseBookmark", title: "Copy Original", contexts: ["bookmark"] }) - browser.contextMenus.create({ id: "bypassBookmark", title: "Bypass", contexts: ["bookmark"] }) - browser.contextMenus.create({ id: "bypassBookmarkInNewTab", title: "Bypass In New Tab", contexts: ["bookmark"] }) -} + browser.contextMenus.create({ id: "redirectLink", title: "Redirect", contexts: ["link"] }) + browser.contextMenus.create({ id: "redirectLinkInNewTab", title: "Redirect In New Tab", contexts: ["link"] }) + browser.contextMenus.create({ id: "reverseLink", title: "Redirect To Original", contexts: ["link"] }) + browser.contextMenus.create({ + id: "reverseLinkInNewTab", + title: "Redirect To Original In New Tab", + contexts: ["link"], + }) + browser.contextMenus.create({ id: "copyReverseLink", title: "Copy Original", contexts: ["link"] }) + browser.contextMenus.create({ id: "bypassLink", title: "Bypass", contexts: ["link"] }) + browser.contextMenus.create({ id: "bypassLinkInNewTab", title: "Bypass In New Tab", contexts: ["link"] }) -browser.contextMenus.onClicked.addListener(async info => { - switch (info.menuItemId) { - case "switchInstanceTab": { - const url = new URL(info.pageUrl) - const newUrl = await servicesHelper.switchInstance(url) - if (newUrl) browser.tabs.update({ url: newUrl }) - return + if (!isChrome) { + browser.contextMenus.create({ id: "redirectBookmark", title: "Redirect", contexts: ["bookmark"] }) + browser.contextMenus.create({ + id: "redirectBookmarkInNewTab", + title: "Redirect In New Tab", + contexts: ["bookmark"], + }) + browser.contextMenus.create({ id: "reverseBookmark", title: "Redirect To Original", contexts: ["bookmark"] }) + browser.contextMenus.create({ + id: "reverseBookmarkInNewTab", + title: "Redirect To Original In New Tab", + contexts: ["bookmark"], + }) + browser.contextMenus.create({ id: "copyReverseBookmark", title: "Copy Original", contexts: ["bookmark"] }) + browser.contextMenus.create({ id: "bypassBookmark", title: "Bypass", contexts: ["bookmark"] }) + browser.contextMenus.create({ id: "bypassBookmarkInNewTab", title: "Bypass In New Tab", contexts: ["bookmark"] }) } - case "settingsTab": - browser.runtime.openOptionsPage() - return - case "copyReverseTab": - browser.tabs.query({ active: true, currentWindow: true }, async tabs => { - if (tabs[0].url) { - const url = new URL(tabs[0].url) - servicesHelper.copyRaw(url) + + browser.contextMenus.onClicked.addListener(async info => { + switch (info.menuItemId) { + case "switchInstanceTab": { + const url = new URL(info.pageUrl) + const newUrl = await servicesHelper.switchInstance(url) + if (newUrl) browser.tabs.update({ url: newUrl }) + return } - }) - return - case "reverseTab": - browser.tabs.query({ active: true, currentWindow: true }, async tabs => { - if (tabs[0].url) { - const url = new URL(tabs[0].url) - const newUrl = await servicesHelper.reverse(url) - if (newUrl) { - browser.tabs.update(tabs[0].id, { url: newUrl }, () => { - tabIdRedirects[tabs[0].id] = false - }) - } + case "settingsTab": + browser.runtime.openOptionsPage() + return + case "copyReverseTab": + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + if (tabs[0].url) { + const url = new URL(tabs[0].url) + servicesHelper.copyRaw(url) + } + }) + return + case "reverseTab": + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + if (tabs[0].url) { + const url = new URL(tabs[0].url) + const newUrl = await servicesHelper.reverse(url) + if (newUrl) { + browser.tabs.update(tabs[0].id, { url: newUrl }, () => { + tabIdRedirects[tabs[0].id] = false + }) + } + } + }) + return + case "redirectTab": + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + if (tabs[0].url) { + const url = new URL(tabs[0].url) + const newUrl = servicesHelper.redirect(url, "main_frame", null, true) + if (newUrl) { + browser.tabs.update(tabs[0].id, { url: newUrl }, () => { + tabIdRedirects[tabs[0].id] = true + }) + } + } + }) + return + case "copyReverseLink": { + const url = new URL(info.linkUrl) + await servicesHelper.copyRaw(url) + return } - }) - return - case "redirectTab": - browser.tabs.query({ active: true, currentWindow: true }, async tabs => { - if (tabs[0].url) { - const url = new URL(tabs[0].url) + case "redirectLink": + case "redirectLinkInNewTab": { + const url = new URL(info.linkUrl) const newUrl = servicesHelper.redirect(url, "main_frame", null, true) if (newUrl) { - browser.tabs.update(tabs[0].id, { url: newUrl }, () => { - tabIdRedirects[tabs[0].id] = true - }) + if (info.menuItemId == "redirectLink") browser.tabs.update({ url: newUrl }) + else browser.tabs.create({ url: newUrl }) } + return } - }) - return - case "copyReverseLink": { - const url = new URL(info.linkUrl) - await servicesHelper.copyRaw(url) - return - } - case "redirectLink": - case "redirectLinkInNewTab": { - const url = new URL(info.linkUrl) - const newUrl = servicesHelper.redirect(url, "main_frame", null, true) - if (newUrl) { - if (info.menuItemId == "redirectLink") browser.tabs.update({ url: newUrl }) - else browser.tabs.create({ url: newUrl }) - } - return - } - case "reverseLink": - case "reverseLinkInNewTab": { - const url = new URL(info.linkUrl) - const newUrl = await servicesHelper.reverse(url) - if (newUrl) { - if (info.menuItemId == "reverseLink") { - browser.tabs.update({ url: newUrl }, tab => { - tabIdRedirects[tab.id] = false - }) - } else { - browser.tabs.create({ url: newUrl }, tab => { - tabIdRedirects[tab.id] = false - }) - } - } - return - } - case "bypassLink": - case "bypassLinkInNewTab": { - const url = new URL(info.linkUrl) - if (info.menuItemId == "bypassLink") { - browser.tabs.update({ url: url.href }, tab => { - tabIdRedirects[tab.id] = false - }) - } else { - browser.tabs.create({ url: url.href }, tab => { - tabIdRedirects[tab.id] = false - }) - } - return - } - case "copyReverseBookmark": - browser.bookmarks.get(info.bookmarkId, bookmarks => { - const url = new URL(bookmarks[0].url) - servicesHelper.copyRaw(url) - }) - return - case "redirectBookmark": - case "redirectBookmarkInNewTab": - browser.bookmarks.get(info.bookmarkId, bookmarks => { - const url = new URL(bookmarks[0].url) - const newUrl = servicesHelper.redirect(url, "main_frame", null, true) - if (newUrl) { - if (info.menuItemId == "redirectBookmark") browser.tabs.update({ url: newUrl }) - else browser.tabs.create({ url: newUrl }) + case "reverseLink": + case "reverseLinkInNewTab": { + const url = new URL(info.linkUrl) + const newUrl = await servicesHelper.reverse(url) + if (newUrl) { + if (info.menuItemId == "reverseLink") { + browser.tabs.update({ url: newUrl }, tab => { + tabIdRedirects[tab.id] = false + }) + } else { + browser.tabs.create({ url: newUrl }, tab => { + tabIdRedirects[tab.id] = false + }) + } + } + return } - }) - return - case "reverseBookmark": - case "reverseBookmarkInNewTab": - browser.bookmarks.get(info.bookmarkId, async bookmarks => { - const url = new URL(bookmarks[0].url) - const newUrl = await servicesHelper.reverse(url) - if (newUrl) { - if (info.menuItemId == "reverseBookmark") { - browser.tabs.update({ url: newUrl }, tab => { + case "bypassLink": + case "bypassLinkInNewTab": { + const url = new URL(info.linkUrl) + if (info.menuItemId == "bypassLink") { + browser.tabs.update({ url: url.href }, tab => { tabIdRedirects[tab.id] = false }) } else { - browser.tabs.create({ url: newUrl }, tab => { + browser.tabs.create({ url: url.href }, tab => { tabIdRedirects[tab.id] = false }) } + return } - }) - return - case "bypassBookmark": - case "bypassBookmarkInNewTab": - browser.bookmarks.get(info.bookmarkId, async bookmarks => { - const url = new URL(bookmarks[0].url) - if (info.menuItemId == "bypassBookmark") { - browser.tabs.update({ url: url.href }, tab => (tabIdRedirects[tab.id] = false)) - } else { - browser.tabs.create({ url: url.href }, tab => (tabIdRedirects[tab.id] = false)) - } - return - }) + case "copyReverseBookmark": + browser.bookmarks.get(info.bookmarkId, bookmarks => { + const url = new URL(bookmarks[0].url) + servicesHelper.copyRaw(url) + }) + return + case "redirectBookmark": + case "redirectBookmarkInNewTab": + browser.bookmarks.get(info.bookmarkId, bookmarks => { + const url = new URL(bookmarks[0].url) + const newUrl = servicesHelper.redirect(url, "main_frame", null, true) + if (newUrl) { + if (info.menuItemId == "redirectBookmark") browser.tabs.update({ url: newUrl }) + else browser.tabs.create({ url: newUrl }) + } + }) + return + case "reverseBookmark": + case "reverseBookmarkInNewTab": + browser.bookmarks.get(info.bookmarkId, async bookmarks => { + const url = new URL(bookmarks[0].url) + const newUrl = await servicesHelper.reverse(url) + if (newUrl) { + if (info.menuItemId == "reverseBookmark") { + browser.tabs.update({ url: newUrl }, tab => { + tabIdRedirects[tab.id] = false + }) + } else { + browser.tabs.create({ url: newUrl }, tab => { + tabIdRedirects[tab.id] = false + }) + } + } + }) + return + case "bypassBookmark": + case "bypassBookmarkInNewTab": + browser.bookmarks.get(info.bookmarkId, async bookmarks => { + const url = new URL(bookmarks[0].url) + if (info.menuItemId == "bypassBookmark") { + browser.tabs.update({ url: url.href }, tab => (tabIdRedirects[tab.id] = false)) + } else { + browser.tabs.create({ url: url.href }, tab => (tabIdRedirects[tab.id] = false)) + } + return + }) + } + }) } }) diff --git a/src/pages/components/Checkbox.svelte b/src/pages/components/Checkbox.svelte index 9ba9c56c..d42a4f10 100644 --- a/src/pages/components/Checkbox.svelte +++ b/src/pages/components/Checkbox.svelte @@ -1,7 +1,6 @@ diff --git a/src/pages/options_src/General/General.svelte b/src/pages/options_src/General/General.svelte index 37c38a0a..b6ed1b46 100644 --- a/src/pages/options_src/General/General.svelte +++ b/src/pages/options_src/General/General.svelte @@ -14,13 +14,30 @@ const unsubscribe = options.subscribe(val => (_options = val)) onDestroy(unsubscribe) + let disableBookmarks = null + browser.runtime.getPlatformInfo(r => { + switch (r.os) { + case "fuchsia": + case "ios": + case "android": + disableBookmarks = true + break + default: + disableBookmarks = false + } + if (!disableBookmarks) { + browser.permissions.contains({ permissions: ["bookmarks"] }, r => (bookmarksPermission = r)) + } + }) + let bookmarksPermission - browser.permissions.contains({ permissions: ["bookmarks"] }, r => (bookmarksPermission = r)) - $: if (bookmarksPermission) { - browser.permissions.request({ permissions: ["bookmarks"] }, r => (bookmarksPermission = r)) - } else { - browser.permissions.remove({ permissions: ["bookmarks"] }) - bookmarksPermission = false + $: if (disableBookmarks !== null && disableBookmarks === false) { + if (bookmarksPermission) { + browser.permissions.request({ permissions: ["bookmarks"] }, r => (bookmarksPermission = r)) + } else { + browser.permissions.remove({ permissions: ["bookmarks"] }) + bookmarksPermission = false + } } @@ -68,10 +85,12 @@ /> - - - - + {#if disableBookmarks === false} + + + + + {/if} diff --git a/src/pages/options_src/Services/Instances.svelte b/src/pages/options_src/Services/Instances.svelte index 862bbf7e..3b870c4b 100644 --- a/src/pages/options_src/Services/Instances.svelte +++ b/src/pages/options_src/Services/Instances.svelte @@ -59,7 +59,6 @@ async function pingInstances() { pingCache = {} for (const instance of allInstances) { - console.log("pinging...", instance) pingCache[instance] = { color: "lightblue", value: "pinging..." } const time = await utils.ping(instance) pingCache[instance] = colorTime(time) diff --git a/src/pages/options_src/Services/Services.svelte b/src/pages/options_src/Services/Services.svelte index 4e719447..b0f0d5e3 100644 --- a/src/pages/options_src/Services/Services.svelte +++ b/src/pages/options_src/Services/Services.svelte @@ -32,8 +32,9 @@
diff --git a/src/pages/popup_src/Buttons.svelte b/src/pages/popup_src/Buttons.svelte index bfa162f8..0b454675 100644 --- a/src/pages/popup_src/Buttons.svelte +++ b/src/pages/popup_src/Buttons.svelte @@ -41,7 +41,14 @@
{#if redirect} - browser.runtime.sendMessage("redirectTab")}> + { + browser.runtime.sendMessage("redirectTab", () => { + window.close() + }) + }} + > @@ -50,7 +57,10 @@ {#if switchInstance} browser.tabs.update({ url: await servicesHelper.switchInstance(url) })} + on:click={async () => + browser.tabs.update({ url: await servicesHelper.switchInstance(url) }, () => { + window.close() + })} > @@ -62,7 +72,13 @@ - browser.runtime.sendMessage("reverseTab")}> + + browser.runtime.sendMessage("reverseTab", () => { + window.close() + })} + > @@ -85,7 +101,13 @@
- window.open(browser.runtime.getURL("pages/options/index.html"), "_blank")}> + + browser.tabs.create({ url: browser.runtime.getURL("pages/options/index.html") }, () => { + window.close() + })} + > diff --git a/src/pages/popup_src/components/Switch.svelte b/src/pages/popup_src/components/Switch.svelte index e581e5f4..42a86403 100644 --- a/src/pages/popup_src/components/Switch.svelte +++ b/src/pages/popup_src/components/Switch.svelte @@ -28,7 +28,10 @@
window.open(browser.runtime.getURL(_config.services[serviceKey].url), "_blank")} + on:click={() => + browser.tabs.create({ url: browser.runtime.getURL(_config.services[serviceKey].url) }, () => { + window.close() + })} > -- cgit 1.4.1 From e3517b107678ff1fd1fce3fd88da716516c0cf4e Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Wed, 7 Aug 2024 18:32:57 +0300 Subject: Allowed switching service by hovering https://github.com/libredirect/browser_extension/issues/961 --- src/pages/options_src/Services/Services.svelte | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/pages/options_src') diff --git a/src/pages/options_src/Services/Services.svelte b/src/pages/options_src/Services/Services.svelte index b0f0d5e3..16bf7b92 100644 --- a/src/pages/options_src/Services/Services.svelte +++ b/src/pages/options_src/Services/Services.svelte @@ -27,6 +27,8 @@ $: serviceConf = _config.services[selectedService] $: serviceOptions = _options[selectedService] $: frontendWebsite = serviceConf.frontends[serviceOptions.frontend].url + $: servicesEntries = Object.entries(_config.services) + $: frontendEntries = Object.entries(serviceConf.frontends)
@@ -41,9 +43,10 @@ clearable={false} class="svelte_select" value={selectedService} + on:hoverItem={e => (selectedService = servicesEntries[e.detail][0])} on:change={e => (selectedService = e.detail.value)} items={[ - ...Object.entries(_config.services).map(([serviceKey, service]) => { + ...servicesEntries.map(([serviceKey, service]) => { return { value: serviceKey, label: service.name } }), ]} @@ -102,12 +105,16 @@ dir="ltr" class="svelte_select" value={serviceOptions.frontend} + on:hoverItem={e => { + serviceOptions.frontend = frontendEntries[e.detail][0] + options.set(_options) + }} on:change={e => { serviceOptions.frontend = e.detail.value options.set(_options) }} items={[ - ...Object.entries(serviceConf.frontends).map(([frontendId, frontend]) => ({ + ...frontendEntries.map(([frontendId, frontend]) => ({ value: frontendId, label: frontend.name, })), -- cgit 1.4.1 From feca205994a6d5def48233c115cd3d50f2568506 Mon Sep 17 00:00:00 2001 From: Monstorix Date: Sat, 10 Aug 2024 21:47:55 +0800 Subject: Fix sidebar layouts and font fallbacks for CJK --- src/pages/options_src/App.svelte | 2 +- src/pages/options_src/Sidebar.svelte | 3 ++- src/pages/popup_src/App.svelte | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/pages/options_src') diff --git a/src/pages/options_src/App.svelte b/src/pages/options_src/App.svelte index dfafe1f0..b5a44856 100644 --- a/src/pages/options_src/App.svelte +++ b/src/pages/options_src/App.svelte @@ -110,7 +110,7 @@ margin: 0; padding-top: 50px; justify-content: center; - font-family: "Inter"; + font-family: "Inter", sans-serif; box-sizing: border-box; font-size: 16px; background-color: var(--bg-main); diff --git a/src/pages/options_src/Sidebar.svelte b/src/pages/options_src/Sidebar.svelte index 97780b15..5e2f4931 100644 --- a/src/pages/options_src/Sidebar.svelte +++ b/src/pages/options_src/Sidebar.svelte @@ -14,7 +14,7 @@ page.set("services")} style={$page == "services" && "color: var(--active);"}> - {browser.i18n.getMessage("general") || "Services"} + {browser.i18n.getMessage("services") || "Services"} @@ -37,6 +37,7 @@ color: var(--text); transition: 0.1s; margin: 10px; + min-width: max-content; } a:hover { diff --git a/src/pages/popup_src/App.svelte b/src/pages/popup_src/App.svelte index df37d55d..52aadc74 100644 --- a/src/pages/popup_src/App.svelte +++ b/src/pages/popup_src/App.svelte @@ -106,7 +106,7 @@ margin: 0; padding: 10px; padding-top: 20px; - font-family: "Inter"; + font-family: "Inter", sans-serif; font-size: 16px; background-color: var(--bg-main); color: var(--text); -- cgit 1.4.1 From 3043541b5305ec0ed4fd01fa06da495f55c3053c Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Thu, 15 Aug 2024 09:41:12 +0300 Subject: Removed select by hover https://github.com/libredirect/browser_extension/issues/961 --- package.json | 4 ++-- src/pages/options_src/Services/FrontendIcon.svelte | 4 +--- src/pages/options_src/Services/Services.svelte | 5 ----- 3 files changed, 3 insertions(+), 10 deletions(-) (limited to 'src/pages/options_src') diff --git a/package.json b/package.json index 9288b04b..7b9fbd11 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ }, "scripts": { "start": "web-ext run", - "nightly": "web-ext run --firefox=/home/esmail/software/firefox_nightly/firefox", - "start_ar": "web-ext run --firefox=/home/esmail/software/firefox_ar/firefox", + "firefox": "web-ext run --firefox=/home/manerakai/software/firefox/firefox", + "start_ar": "web-ext run --firefox=/home/manerakai/software/firefox_ar/firefox", "android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.firefox --adb-remove-old-artifacts", "build": "web-ext build -i pages/options_src -i pages/popup_src pages/icons -i pages/popup_src -i pages/components", "build_chromium": "brave-browser --pack-extension=src/ --pack-extension-key=src.pem", diff --git a/src/pages/options_src/Services/FrontendIcon.svelte b/src/pages/options_src/Services/FrontendIcon.svelte index 24942fd6..4b392676 100644 --- a/src/pages/options_src/Services/FrontendIcon.svelte +++ b/src/pages/options_src/Services/FrontendIcon.svelte @@ -1,6 +1,7 @@ diff --git a/src/pages/options_src/Services/Services.svelte b/src/pages/options_src/Services/Services.svelte index 16bf7b92..a78ff0b6 100644 --- a/src/pages/options_src/Services/Services.svelte +++ b/src/pages/options_src/Services/Services.svelte @@ -43,7 +43,6 @@ clearable={false} class="svelte_select" value={selectedService} - on:hoverItem={e => (selectedService = servicesEntries[e.detail][0])} on:change={e => (selectedService = e.detail.value)} items={[ ...servicesEntries.map(([serviceKey, service]) => { @@ -105,10 +104,6 @@ dir="ltr" class="svelte_select" value={serviceOptions.frontend} - on:hoverItem={e => { - serviceOptions.frontend = frontendEntries[e.detail][0] - options.set(_options) - }} on:change={e => { serviceOptions.frontend = e.detail.value options.set(_options) -- cgit 1.4.1 From ef9b247a916cb1e6fdaf275f0bcdfe7d104b1b2b Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Fri, 16 Aug 2024 13:44:31 +0300 Subject: Faided disabled services https://github.com/libredirect/browser_extension/issues/961 --- src/pages/options_src/Services/Services.svelte | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/pages/options_src') diff --git a/src/pages/options_src/Services/Services.svelte b/src/pages/options_src/Services/Services.svelte index a78ff0b6..7c4a92b3 100644 --- a/src/pages/options_src/Services/Services.svelte +++ b/src/pages/options_src/Services/Services.svelte @@ -50,11 +50,11 @@ }), ]} > -
+
{item.label}
-
+
{selection.label}
@@ -181,10 +181,10 @@ --width: 210px; --background: var(--bg-secondary); --list-background: var(--bg-secondary); - --item-active-background: red; --item-is-active-bg: grey; --item-hover-bg: grey; --item-is-active-color: var(--text); + --list-max-height: 400px; --padding: 0 0 0 10px; --item-color: var(--text); } @@ -201,4 +201,8 @@ width: 26px; color: var(--text); } + + :global(.svelte_select .disabled) { + opacity: 0.4; + } -- cgit 1.4.1 From 6bd542f858ceaa392e11a526c713359d8f667399 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Fri, 16 Aug 2024 15:53:53 +0300 Subject: Added arrow icon to dropdowns. Added settings button to each service in the popup https://github.com/libredirect/browser_extension/issues/961 --- src/pages/icons/SettingsIcon.svelte | 3 ++ src/pages/options_src/App.svelte | 10 +++---- src/pages/options_src/Services/Services.svelte | 13 +++++++-- src/pages/options_src/Sidebar.svelte | 6 ++-- src/pages/options_src/stores.js | 1 - src/pages/options_src/url.js | 38 ++++++++++++++++++++++++++ src/pages/popup_src/App.svelte | 2 +- src/pages/popup_src/Buttons.svelte | 4 +-- src/pages/popup_src/components/Switch.svelte | 8 ++++++ 9 files changed, 69 insertions(+), 16 deletions(-) create mode 100644 src/pages/options_src/url.js (limited to 'src/pages/options_src') diff --git a/src/pages/icons/SettingsIcon.svelte b/src/pages/icons/SettingsIcon.svelte index f47d078a..00798289 100644 --- a/src/pages/icons/SettingsIcon.svelte +++ b/src/pages/icons/SettingsIcon.svelte @@ -1,10 +1,13 @@ (_page = val)) - const dark = { text: "#fff", bgMain: "#121212", @@ -85,9 +83,9 @@ --light-grey: {cssVariables.lightGrey};" > - {#if _page == "general"} + {#if !$url.hash || $url.hash == "#general"} - {:else if _page == "services"} + {:else if $url.hash.startsWith("#services")} {/if}
diff --git a/src/pages/options_src/Services/Services.svelte b/src/pages/options_src/Services/Services.svelte index 7c4a92b3..93afcded 100644 --- a/src/pages/options_src/Services/Services.svelte +++ b/src/pages/options_src/Services/Services.svelte @@ -1,6 +1,7 @@
- page.set("general")} style={$page == "general" && "color: var(--active);"}> + {browser.i18n.getMessage("general") || "General"} - page.set("services")} style={$page == "services" && "color: var(--active);"}> + {browser.i18n.getMessage("services") || "Services"} diff --git a/src/pages/options_src/stores.js b/src/pages/options_src/stores.js index 782f6064..7ae0f8c7 100644 --- a/src/pages/options_src/stores.js +++ b/src/pages/options_src/stores.js @@ -2,4 +2,3 @@ import { writable } from "svelte/store" export const options = writable(null) export const config = writable(null) -export const page = writable("general") diff --git a/src/pages/options_src/url.js b/src/pages/options_src/url.js new file mode 100644 index 00000000..010e5b21 --- /dev/null +++ b/src/pages/options_src/url.js @@ -0,0 +1,38 @@ +// https://svelte.dev/repl/5abaac000b164aa1aacc6051d5c4f584?version=3.59.2 + +import { derived, writable } from 'svelte/store' + +export function createUrlStore(ssrUrl) { + // Ideally a bundler constant so that it's tree-shakable + if (typeof window === 'undefined') { + const { subscribe } = writable(ssrUrl) + return { subscribe } + } + + const href = writable(window.location.href) + + const originalPushState = history.pushState + const originalReplaceState = history.replaceState + + const updateHref = () => href.set(window.location.href) + + history.pushState = () => { + originalPushState.apply(this, arguments) + updateHref() + } + + history.replaceState = () => { + originalReplaceState.apply(this, arguments) + updateHref() + } + + window.addEventListener('popstate', updateHref) + window.addEventListener('hashchange', updateHref) + + return { + subscribe: derived(href, ($href) => new URL($href)).subscribe + } +} + +// If you're using in a pure SPA, you can return a store directly and share it everywhere +export default createUrlStore() diff --git a/src/pages/popup_src/App.svelte b/src/pages/popup_src/App.svelte index 52aadc74..3409052d 100644 --- a/src/pages/popup_src/App.svelte +++ b/src/pages/popup_src/App.svelte @@ -88,7 +88,7 @@ diff --git a/src/pages/popup_src/components/Switch.svelte b/src/pages/popup_src/components/Switch.svelte index f3df9317..6485f875 100644 --- a/src/pages/popup_src/components/Switch.svelte +++ b/src/pages/popup_src/components/Switch.svelte @@ -9,6 +9,7 @@ import { onDestroy } from "svelte" import servicesHelper from "../../../assets/javascripts/services" import { options, config } from "../stores" + import SettingsIcon from "../../icons/SettingsIcon.svelte" let _options let _config @@ -53,6 +54,13 @@ window.close() })} /> + + browser.tabs.create({ url: browser.runtime.getURL(`pages/options/index.html#services:${serviceKey}`) }, () => { + window.close() + })} + />
-- cgit 1.4.1 From f8af807d724e748efda71148e9a5733b36e453ee Mon Sep 17 00:00:00 2001 From: Monstorix Date: Sat, 17 Aug 2024 17:41:03 +0800 Subject: Complete translation keys and fix Simplified Chinese translations --- src/_locales/ar/messages.json | 40 +++++- src/_locales/bn/messages.json | 146 +++++++++++++------- src/_locales/bs/messages.json | 48 ++++++- src/_locales/cs/messages.json | 39 +++++- src/_locales/de/messages.json | 39 +++++- src/_locales/delete.py | 18 ++- src/_locales/en/messages.json | 43 +++++- src/_locales/eo/messages.json | 146 +++++++++++++++++++- src/_locales/es/messages.json | 39 +++++- src/_locales/fi/messages.json | 153 +++++++++++++-------- src/_locales/filter.py | 5 + src/_locales/fr/messages.json | 43 +++++- src/_locales/gl/messages.json | 39 +++++- src/_locales/hr/messages.json | 39 +++++- src/_locales/id/messages.json | 39 +++++- src/_locales/it/messages.json | 39 +++++- src/_locales/ja/messages.json | 39 +++++- src/_locales/jv/messages.json | 135 +++++++++++++++++- src/_locales/ko/messages.json | 46 ++++++- src/_locales/nb_NO/messages.json | 46 ++++++- src/_locales/nl/messages.json | 39 +++++- src/_locales/pl/messages.json | 39 +++++- src/_locales/pt/messages.json | 48 ++++++- src/_locales/pt_BR/messages.json | 45 +++++- src/_locales/ro/messages.json | 39 +++++- src/_locales/ru/messages.json | 39 +++++- src/_locales/sr/messages.json | 48 ++++++- src/_locales/tr/messages.json | 39 +++++- src/_locales/uk/messages.json | 39 +++++- src/_locales/vi/messages.json | 39 +++++- src/_locales/zh_Hans/messages.json | 47 ++++++- src/_locales/zh_Hant/messages.json | 86 +++++++++--- src/pages/options_src/Services/RedirectType.svelte | 6 +- 33 files changed, 1509 insertions(+), 225 deletions(-) (limited to 'src/pages/options_src') diff --git a/src/_locales/ar/messages.json b/src/_locales/ar/messages.json index 516d07d2..10413b84 100644 --- a/src/_locales/ar/messages.json +++ b/src/_locales/ar/messages.json @@ -83,9 +83,8 @@ "message": "أضف نظرائك المفضلين", "description": "used in the settings page" }, - "copyRaw": { - "message": "الرابط الأصلي", - "description": "used in the popup" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "تم النسخ", @@ -110,5 +109,38 @@ }, "disable": { "message": "عطّل" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/bn/messages.json b/src/_locales/bn/messages.json index cdde0c45..60b91d65 100644 --- a/src/_locales/bn/messages.json +++ b/src/_locales/bn/messages.json @@ -1,22 +1,42 @@ { - "dark": { - "message": "অন্ধকার", + "extensionName": { + "message": "লিবরিডাইরেক্ট", + "description": "name of the extension" + }, + "extensionDescription": { + "message": "একটি ওয়েব এক্সটেনশন যা জনপ্রিয় সাইটগুলোকে বিকল্প গোপনীয়তা-বান্ধব ফ্রন্টএন্ড এবং ব্যাকএন্ডে পুনর্নির্দেশ করে", + "description": "description of the extension" + }, + "switchInstance": { + "message": "ইন্সট্যান্স পাল্টাও", + "description": "used in manifest.json as shortcut description" + }, + "settings": { + "message": "পছন্দসমূহ", + "description": "used in the popup" + }, + "general": { + "message": "সাধারণ", "description": "used in the settings page" }, - "auto": { - "message": "স্বয়ংক্রিয়", + "theme": { + "message": "রঙ", "description": "used in the settings page" }, - "enable": { - "message": "সক্রিয়", + "light": { + "message": "সাদা", "description": "used in the settings page" }, - "frontend": { - "message": "সামনের অংশ", + "dark": { + "message": "অন্ধকার", "description": "used in the settings page" }, - "both": { - "message": "উভয়", + "auto": { + "message": "স্বয়ংক্রিয়", + "description": "used in the settings page" + }, + "excludeFromRedirecting": { + "message": "পুনঃনির্দেশ থেকে বাদ দেওয়া", "description": "used in the settings page" }, "importSettings": { @@ -31,73 +51,95 @@ "message": "পছন্দসমূহ সহজাত অবস্থায় ফিরত নাও", "description": "used in the settings page" }, + "enable": { + "message": "সক্রিয়", + "description": "used in the settings page" + }, + "showInPopup": { + "message": "পপআপে দেখাও", + "description": "used in the settings page" + }, + "frontend": { + "message": "সামনের অংশ", + "description": "used in the settings page" + }, "redirectType": { "message": "পুনঃনির্দেশ ধরণ", "description": "used in the settings page" }, - "excludeFromRedirecting": { - "message": "পুনঃনির্দেশ থেকে বাদ দেওয়া", + "both": { + "message": "উভয়", "description": "used in the settings page" }, - "showInPopup": { - "message": "পপআপে দেখাও", + "onlyEmbedded": { + "message": "শুধু এমবেডকৃত", "description": "used in the settings page" }, - "copyRaw": { - "message": "কাঁচা অনুলিপি" - }, "onlyNotEmbedded": { "message": "এমবেডকৃত নয়", "description": "used in the settings page" }, - "about": { - "message": "আমাদের সম্পর্কে" + "addYourFavoriteInstances": { + "message": "পছন্দের ইন্সট্যান্স যোগ করো", + "description": "used in the settings page" + }, + "copyOriginal": { + "message": "Copy Original" + }, + "copied": { + "message": "অনুলিপিত" + }, + "redirectToOriginal": { + "message": "আসলটায় পুনঃনির্দেশ করো", + "description": "Used in context menus when right clicking on a page/tab" }, "redirectLink": { "message": "পুনঃনির্দেশ করার চেষ্টা করো", "description": "Used in context menus when right clicking on a hyperlink" }, - "extensionName": { - "message": "লিবরিডাইরেক্ট", - "description": "name of the extension" + "about": { + "message": "আমাদের সম্পর্কে" }, - "theme": { - "message": "রঙ", - "description": "used in the settings page" + "unsupportedIframesHandling": { + "message": "Unsupported embeds handling" }, - "light": { - "message": "সাদা", - "description": "used in the settings page" + "fetchPublicInstances": { + "message": "Fetch public instances" }, - "copied": { - "message": "অনুলিপিত" + "disable": { + "message": "Disable" }, - "extensionDescription": { - "message": "একটি ওয়েব এক্সটেনশন যা জনপ্রিয় সাইটগুলোকে বিকল্প গোপনীয়তা-বান্ধব ফ্রন্টএন্ড এবং ব্যাকএন্ডে পুনর্নির্দেশ করে", - "description": "description of the extension" + "pingInstances": { + "message": "Ping Instances" }, - "redirectToOriginal": { - "message": "আসলটায় পুনঃনির্দেশ করো", - "description": "Used in context menus when right clicking on a page/tab" + "exportSettingsToSync": { + "message": "Export Settings to Sync" }, - "addYourFavoriteInstances": { - "message": "পছন্দের ইন্সট্যান্স যোগ করো", - "description": "used in the settings page" + "importSettingsFromSync": { + "message": "Import Settings from Sync" }, - "settings": { - "message": "পছন্দসমূহ", - "description": "used in the popup" + "services": { + "message": "Services" }, - "general": { - "message": "সাধারণ", - "description": "used in the settings page" + "service": { + "message": "Service" }, - "switchInstance": { - "message": "ইন্সট্যান্স পাল্টাও", - "description": "used in manifest.json as shortcut description" + "bookmarksMenu": { + "message": "Bookmarks menu" }, - "onlyEmbedded": { - "message": "শুধু এমবেডকৃত", - "description": "used in the settings page" + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/bs/messages.json b/src/_locales/bs/messages.json index 06c50c34..3f3039b6 100644 --- a/src/_locales/bs/messages.json +++ b/src/_locales/bs/messages.json @@ -83,8 +83,8 @@ "message": "Dodajte vaše omiljene instance", "description": "used in the settings page" }, - "copyRaw": { - "message": "Kopirajte neobrađenu kodu" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Kopirano" @@ -99,5 +99,47 @@ }, "about": { "message": "O" + }, + "unsupportedIframesHandling": { + "message": "Unsupported iframes handling" + }, + "fetchPublicInstances": { + "message": "Fetch public instances" + }, + "disable": { + "message": "Disable" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/cs/messages.json b/src/_locales/cs/messages.json index 245eb285..3ae7d793 100644 --- a/src/_locales/cs/messages.json +++ b/src/_locales/cs/messages.json @@ -83,8 +83,8 @@ "message": "Přidejte své oblíbené instance", "description": "used in the settings page" }, - "copyRaw": { - "message": "Zkopírovat surové" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Zkopírováno" @@ -108,5 +108,38 @@ }, "disable": { "message": "Zakázat" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/de/messages.json b/src/_locales/de/messages.json index dbd4b53c..f7f58875 100644 --- a/src/_locales/de/messages.json +++ b/src/_locales/de/messages.json @@ -83,8 +83,8 @@ "message": "Eigene Instanz hinzufügen", "description": "used in the settings page" }, - "copyRaw": { - "message": "Original-Link kopieren" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Kopiert" @@ -108,5 +108,38 @@ }, "disable": { "message": "Deaktivieren" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/delete.py b/src/_locales/delete.py index 13bfe546..486ab76f 100644 --- a/src/_locales/delete.py +++ b/src/_locales/delete.py @@ -11,15 +11,21 @@ with open('./en/messages.json') as data: keys = ['extensionName', 'extensionDescription', 'general', + 'services', + 'service', 'theme', 'auto', 'light', 'dark', 'excludeFromRedirecting', + 'fetchPublicInstances', 'importSettings', 'exportSettings', + 'exportSettingsToSync', + 'importSettingsFromSync', 'resetSettings', 'enable', + 'disable', 'showInPopup', 'frontend', 'redirectType', @@ -28,12 +34,22 @@ keys = ['extensionName', 'onlyNotEmbedded', 'addYourFavoriteInstances', 'switchInstance', - 'copyRaw', + 'copyOriginal', 'copied', 'settings', 'about', 'redirectToOriginal', 'redirectLink', + 'redirectOnlyInIncognito', + 'bookmarksMenu', + 'showInPopup', + 'unsupportedIframesHandling', + 'bypass', + 'block', + 'searchHint', + 'excludeFromRedirecting', + 'pingInstances', + 'redirect', ] tmp = {} diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 251bbebe..32f4b706 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -83,8 +83,8 @@ "message": "Add your favorite instances", "description": "used in the settings page" }, - "copyRaw": { - "message": "Copy Raw" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Copied" @@ -101,12 +101,45 @@ "message": "About" }, "unsupportedIframesHandling": { - "message": "Unsupported iframes handling" + "message": "Unsupported embeds handling" }, "fetchPublicInstances": { "message": "Fetch public instances" }, "disable": { "message": "Disable" - } -} \ No newline at end of file + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" + } +} diff --git a/src/_locales/eo/messages.json b/src/_locales/eo/messages.json index 0967ef42..885c7802 100644 --- a/src/_locales/eo/messages.json +++ b/src/_locales/eo/messages.json @@ -1 +1,145 @@ -{} +{ + "extensionName": { + "message": "LibRedirect", + "description": "name of the extension" + }, + "extensionDescription": { + "message": "A web extension that redirects popular sites to alternative privacy-friendly frontends and backends", + "description": "description of the extension" + }, + "switchInstance": { + "message": "Switch Instance", + "description": "used in manifest.json as shortcut description" + }, + "settings": { + "message": "Settings", + "description": "used in the popup" + }, + "general": { + "message": "General", + "description": "used in the settings page" + }, + "theme": { + "message": "Theme", + "description": "used in the settings page" + }, + "light": { + "message": "Light", + "description": "used in the settings page" + }, + "dark": { + "message": "Dark", + "description": "used in the settings page" + }, + "auto": { + "message": "Auto", + "description": "used in the settings page" + }, + "excludeFromRedirecting": { + "message": "Excluded from redirecting", + "description": "used in the settings page" + }, + "importSettings": { + "message": "Import Settings", + "description": "used in the settings page" + }, + "exportSettings": { + "message": "Export Settings", + "description": "used in the settings page" + }, + "resetSettings": { + "message": "Reset Settings", + "description": "used in the settings page" + }, + "enable": { + "message": "Enable", + "description": "used in the settings page" + }, + "showInPopup": { + "message": "Show in popup", + "description": "used in the settings page" + }, + "frontend": { + "message": "Frontend", + "description": "used in the settings page" + }, + "redirectType": { + "message": "Redirect Type", + "description": "used in the settings page" + }, + "both": { + "message": "both", + "description": "used in the settings page" + }, + "onlyEmbedded": { + "message": "only embedded", + "description": "used in the settings page" + }, + "onlyNotEmbedded": { + "message": "only not embedded", + "description": "used in the settings page" + }, + "addYourFavoriteInstances": { + "message": "Add your favorite instances", + "description": "used in the settings page" + }, + "copyOriginal": { + "message": "Copy Original" + }, + "copied": { + "message": "Copied" + }, + "redirectToOriginal": { + "message": "Redirect to original", + "description": "Used in context menus when right clicking on a page/tab" + }, + "redirectLink": { + "message": "Attempt to redirect", + "description": "Used in context menus when right clicking on a hyperlink" + }, + "about": { + "message": "About" + }, + "unsupportedIframesHandling": { + "message": "Unsupported embeds handling" + }, + "fetchPublicInstances": { + "message": "Fetch public instances" + }, + "disable": { + "message": "Disable" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" + } +} \ No newline at end of file diff --git a/src/_locales/es/messages.json b/src/_locales/es/messages.json index 8ebe7844..71b01de4 100644 --- a/src/_locales/es/messages.json +++ b/src/_locales/es/messages.json @@ -83,8 +83,8 @@ "message": "Añade tus instancias preferidas", "description": "used in the settings page" }, - "copyRaw": { - "message": "Copiar Original" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Copiado" @@ -108,5 +108,38 @@ }, "disable": { "message": "Desactivar" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/fi/messages.json b/src/_locales/fi/messages.json index 0b6b797b..7e88f79c 100644 --- a/src/_locales/fi/messages.json +++ b/src/_locales/fi/messages.json @@ -1,21 +1,43 @@ { - "excludeFromRedirecting": { - "message": "Poissuljettu uudelleenohjaukselta", - "description": "used in the settings page" - }, - "copyRaw": { - "message": "Kopioi alkuperäinen" + "extensionName": { + "message": "LibRedirect", + "description": "name of the extension" }, - "both": { - "message": "molemmat", - "description": "used in the settings page" + "extensionDescription": { + "message": "Selainlaajennus joka uudelleenohjaa suositut sivustot vaihtoehtoisiin yksityisyysystävällisiin käyttöliittymiin", + "description": "description of the extension" }, "switchInstance": { "message": "Vaihda instanssi", "description": "used in manifest.json as shortcut description" }, - "unsupportedIframesHandling": { - "message": "Tukemattomien iframejen käsittely" + "settings": { + "message": "Asetukset", + "description": "used in the popup" + }, + "general": { + "message": "Yleiset", + "description": "used in the settings page" + }, + "theme": { + "message": "Teema", + "description": "used in the settings page" + }, + "light": { + "message": "Vaalea", + "description": "used in the settings page" + }, + "dark": { + "message": "Tumma", + "description": "used in the settings page" + }, + "auto": { + "message": "Automaattinen", + "description": "used in the settings page" + }, + "excludeFromRedirecting": { + "message": "Poissuljettu uudelleenohjaukselta", + "description": "used in the settings page" }, "importSettings": { "message": "Tuo asetukset", @@ -25,88 +47,99 @@ "message": "Vie asetukset", "description": "used in the settings page" }, - "fetchPublicInstances": { - "message": "Hae julkiset instanssit" - }, - "addYourFavoriteInstances": { - "message": "Lisää suosikki-instanssisi", + "resetSettings": { + "message": "Nollaa asetukset", "description": "used in the settings page" }, - "extensionName": { - "message": "LibRedirect", - "description": "name of the extension" + "enable": { + "message": "Ota käyttöön", + "description": "used in the settings page" }, "showInPopup": { "message": "Näytä ponnahdusvalikossa", "description": "used in the settings page" }, - "theme": { - "message": "Teema", + "frontend": { + "message": "Käyttöliittymä", + "description": "used in the settings page" + }, + "redirectType": { + "message": "Uudelleenohjauksen tyyppi", + "description": "used in the settings page" + }, + "both": { + "message": "molemmat", "description": "used in the settings page" }, "onlyEmbedded": { "message": "vain upotteet", "description": "used in the settings page" }, - "light": { - "message": "Vaalea", + "onlyNotEmbedded": { + "message": "vain muut kuin upotteet", "description": "used in the settings page" }, - "frontend": { - "message": "Käyttöliittymä", + "addYourFavoriteInstances": { + "message": "Lisää suosikki-instanssisi", "description": "used in the settings page" }, - "extensionDescription": { - "message": "Selainlaajennus joka uudelleenohjaa suositut sivustot vaihtoehtoisiin yksityisyysystävällisiin käyttöliittymiin", - "description": "description of the extension" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Kopioitu" }, - "onlyNotEmbedded": { - "message": "vain muut kuin upotteet", - "description": "used in the settings page" - }, - "about": { - "message": "Tietoja" + "redirectToOriginal": { + "message": "Uudelleenohjaa alkuperäiseen", + "description": "Used in context menus when right clicking on a page/tab" }, "redirectLink": { "message": "Yritä uudelleenohjata", "description": "Used in context menus when right clicking on a hyperlink" }, - "redirectType": { - "message": "Uudelleenohjauksen tyyppi", - "description": "used in the settings page" - }, - "dark": { - "message": "Tumma", - "description": "used in the settings page" + "about": { + "message": "Tietoja" }, - "general": { - "message": "Yleiset", - "description": "used in the settings page" + "unsupportedIframesHandling": { + "message": "Tukemattomien iframejen käsittely" }, - "enable": { - "message": "Ota käyttöön", - "description": "used in the settings page" + "fetchPublicInstances": { + "message": "Hae julkiset instanssit" }, "disable": { "message": "Poista käytöstä" }, - "redirectToOriginal": { - "message": "Uudelleenohjaa alkuperäiseen", - "description": "Used in context menus when right clicking on a page/tab" + "pingInstances": { + "message": "Ping Instances" }, - "auto": { - "message": "Automaattinen", - "description": "used in the settings page" + "exportSettingsToSync": { + "message": "Export Settings to Sync" }, - "settings": { - "message": "Asetukset", - "description": "used in the popup" + "importSettingsFromSync": { + "message": "Import Settings from Sync" }, - "resetSettings": { - "message": "Nollaa asetukset", - "description": "used in the settings page" + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/filter.py b/src/_locales/filter.py index c60a6a4b..f9f03a1d 100644 --- a/src/_locales/filter.py +++ b/src/_locales/filter.py @@ -3,16 +3,20 @@ import json langs = [ 'ar', + 'bn', 'bs', 'cs', 'de', + 'eo', 'es', + 'fi', 'fr', 'gl', 'hr', 'id', 'it', 'ja', + 'jv', 'ko', 'nb_NO', 'nl', @@ -26,6 +30,7 @@ langs = [ 'uk', 'vi', 'zh_Hans', + 'zh_Hant', ] en_json = {} diff --git a/src/_locales/fr/messages.json b/src/_locales/fr/messages.json index b24f6fcc..03fbc927 100644 --- a/src/_locales/fr/messages.json +++ b/src/_locales/fr/messages.json @@ -83,8 +83,8 @@ "message": "Ajoutez vos instances favorites", "description": "used in the settings page" }, - "copyRaw": { - "message": "Copier le lien original" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Copié" @@ -100,13 +100,46 @@ "about": { "message": "À propos" }, + "unsupportedIframesHandling": { + "message": "Gestion des iframes non prises en charge" + }, "fetchPublicInstances": { "message": "Rechercher des instances publiques" }, "disable": { "message": "Désactiver" }, - "unsupportedIframesHandling": { - "message": "Gestion des iframes non prises en charge" + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/gl/messages.json b/src/_locales/gl/messages.json index 0df4ab9d..7ea16955 100644 --- a/src/_locales/gl/messages.json +++ b/src/_locales/gl/messages.json @@ -83,8 +83,8 @@ "message": "Engade as túas instancias favoritas", "description": "used in the settings page" }, - "copyRaw": { - "message": "Copiar Orixinal" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Copiouse" @@ -108,5 +108,38 @@ }, "disable": { "message": "Desactivar" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/hr/messages.json b/src/_locales/hr/messages.json index 838a2af0..25c738c8 100644 --- a/src/_locales/hr/messages.json +++ b/src/_locales/hr/messages.json @@ -83,8 +83,8 @@ "message": "Dodajte svoje omiljene instance", "description": "used in the settings page" }, - "copyRaw": { - "message": "Kopiraj original" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Kopirano" @@ -108,5 +108,38 @@ }, "disable": { "message": "Deaktiviraj" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/id/messages.json b/src/_locales/id/messages.json index 8db8ba91..c78c9b39 100644 --- a/src/_locales/id/messages.json +++ b/src/_locales/id/messages.json @@ -83,8 +83,8 @@ "message": "Tambahkan server favorit Anda", "description": "used in the settings page" }, - "copyRaw": { - "message": "Salin Mentah" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Disalin" @@ -108,5 +108,38 @@ }, "disable": { "message": "Nonaktifkan" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/it/messages.json b/src/_locales/it/messages.json index 3507fe28..0ad02c44 100644 --- a/src/_locales/it/messages.json +++ b/src/_locales/it/messages.json @@ -83,8 +83,8 @@ "message": "Aggiungi le tue istanze preferite", "description": "used in the settings page" }, - "copyRaw": { - "message": "Copia grezza" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Copiato" @@ -108,5 +108,38 @@ }, "disable": { "message": "Disattiva" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/ja/messages.json b/src/_locales/ja/messages.json index 3c77cf98..7ee234ec 100644 --- a/src/_locales/ja/messages.json +++ b/src/_locales/ja/messages.json @@ -83,8 +83,8 @@ "message": "好きなインスタンスを追加", "description": "used in the settings page" }, - "copyRaw": { - "message": "元のURIをコピー" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "コピーしました" @@ -108,5 +108,38 @@ }, "disable": { "message": "無効" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/jv/messages.json b/src/_locales/jv/messages.json index 40fb052b..90a2fc45 100644 --- a/src/_locales/jv/messages.json +++ b/src/_locales/jv/messages.json @@ -1,4 +1,24 @@ { + "extensionName": { + "message": "LibRedirect", + "description": "name of the extension" + }, + "extensionDescription": { + "message": "A web extension that redirects popular sites to alternative privacy-friendly frontends and backends", + "description": "description of the extension" + }, + "switchInstance": { + "message": "Switch Instance", + "description": "used in manifest.json as shortcut description" + }, + "settings": { + "message": "Settings", + "description": "used in the popup" + }, + "general": { + "message": "General", + "description": "used in the settings page" + }, "theme": { "message": "Téma", "description": "used in the settings page" @@ -11,8 +31,115 @@ "message": "Peteng", "description": "used in the settings page" }, - "extensionName": { - "message": "LibRedirect", - "description": "name of the extension" + "auto": { + "message": "Auto", + "description": "used in the settings page" + }, + "excludeFromRedirecting": { + "message": "Excluded from redirecting", + "description": "used in the settings page" + }, + "importSettings": { + "message": "Import Settings", + "description": "used in the settings page" + }, + "exportSettings": { + "message": "Export Settings", + "description": "used in the settings page" + }, + "resetSettings": { + "message": "Reset Settings", + "description": "used in the settings page" + }, + "enable": { + "message": "Enable", + "description": "used in the settings page" + }, + "showInPopup": { + "message": "Show in popup", + "description": "used in the settings page" + }, + "frontend": { + "message": "Frontend", + "description": "used in the settings page" + }, + "redirectType": { + "message": "Redirect Type", + "description": "used in the settings page" + }, + "both": { + "message": "both", + "description": "used in the settings page" + }, + "onlyEmbedded": { + "message": "only embedded", + "description": "used in the settings page" + }, + "onlyNotEmbedded": { + "message": "only not embedded", + "description": "used in the settings page" + }, + "addYourFavoriteInstances": { + "message": "Add your favorite instances", + "description": "used in the settings page" + }, + "copyOriginal": { + "message": "Copy Original" + }, + "copied": { + "message": "Copied" + }, + "redirectToOriginal": { + "message": "Redirect to original", + "description": "Used in context menus when right clicking on a page/tab" + }, + "redirectLink": { + "message": "Attempt to redirect", + "description": "Used in context menus when right clicking on a hyperlink" + }, + "about": { + "message": "About" + }, + "unsupportedIframesHandling": { + "message": "Unsupported embeds handling" + }, + "fetchPublicInstances": { + "message": "Fetch public instances" + }, + "disable": { + "message": "Disable" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/ko/messages.json b/src/_locales/ko/messages.json index 85b72c93..c9774988 100644 --- a/src/_locales/ko/messages.json +++ b/src/_locales/ko/messages.json @@ -83,8 +83,8 @@ "message": "Add your favorite instances", "description": "used in the settings page" }, - "copyRaw": { - "message": "Raw 복사" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "복사됨" @@ -99,5 +99,47 @@ }, "about": { "message": "About" + }, + "unsupportedIframesHandling": { + "message": "Unsupported iframes handling" + }, + "fetchPublicInstances": { + "message": "Fetch public instances" + }, + "disable": { + "message": "Disable" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } } \ No newline at end of file diff --git a/src/_locales/nb_NO/messages.json b/src/_locales/nb_NO/messages.json index 46860019..ac7accd4 100644 --- a/src/_locales/nb_NO/messages.json +++ b/src/_locales/nb_NO/messages.json @@ -83,8 +83,8 @@ "message": "Add your favorite instances", "description": "used in the settings page" }, - "copyRaw": { - "message": "Kopier originallenke" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Kopiert" @@ -99,5 +99,47 @@ }, "about": { "message": "About" + }, + "unsupportedIframesHandling": { + "message": "Unsupported iframes handling" + }, + "fetchPublicInstances": { + "message": "Fetch public instances" + }, + "disable": { + "message": "Disable" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } } \ No newline at end of file diff --git a/src/_locales/nl/messages.json b/src/_locales/nl/messages.json index a4c6fbba..07dd6ec7 100644 --- a/src/_locales/nl/messages.json +++ b/src/_locales/nl/messages.json @@ -83,8 +83,8 @@ "message": "Toevoegen aan favoriete instanties", "description": "used in the settings page" }, - "copyRaw": { - "message": "Onbewerkte code kopiëren" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Gekopieerd" @@ -108,5 +108,38 @@ }, "disable": { "message": "Uitschakelen" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/pl/messages.json b/src/_locales/pl/messages.json index d9cb8cde..818c1fb9 100644 --- a/src/_locales/pl/messages.json +++ b/src/_locales/pl/messages.json @@ -83,8 +83,8 @@ "message": "Dodaj ulubione instancje", "description": "used in the settings page" }, - "copyRaw": { - "message": "Skopiuj nieprzetworzony" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Skopiowano" @@ -108,5 +108,38 @@ }, "disable": { "message": "Wyłącz" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/pt/messages.json b/src/_locales/pt/messages.json index 5340cb1b..a29c9a07 100644 --- a/src/_locales/pt/messages.json +++ b/src/_locales/pt/messages.json @@ -83,8 +83,8 @@ "message": "Adicionar a sua instância favorita", "description": "used in the settings page" }, - "copyRaw": { - "message": "Copiar URL original" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Copiado" @@ -99,5 +99,47 @@ }, "about": { "message": "Sobre" + }, + "unsupportedIframesHandling": { + "message": "Unsupported iframes handling" + }, + "fetchPublicInstances": { + "message": "Fetch public instances" + }, + "disable": { + "message": "Disable" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/pt_BR/messages.json b/src/_locales/pt_BR/messages.json index f0fc4e8a..2fd4383e 100644 --- a/src/_locales/pt_BR/messages.json +++ b/src/_locales/pt_BR/messages.json @@ -83,8 +83,8 @@ "message": "Adicione sua instância favorita", "description": "used in the settings page" }, - "copyRaw": { - "message": "Copiar URL original" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Copiado" @@ -100,7 +100,46 @@ "about": { "message": "Sobre" }, + "unsupportedIframesHandling": { + "message": "Unsupported iframes handling" + }, + "fetchPublicInstances": { + "message": "Fetch public instances" + }, "disable": { "message": "Desativar" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/ro/messages.json b/src/_locales/ro/messages.json index 6c530d3b..1bf62182 100644 --- a/src/_locales/ro/messages.json +++ b/src/_locales/ro/messages.json @@ -83,8 +83,8 @@ "message": "Add your favorite instances", "description": "used in the settings page" }, - "copyRaw": { - "message": "Copiați Raw" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Copiat" @@ -108,5 +108,38 @@ }, "disable": { "message": "Dezactivează" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/ru/messages.json b/src/_locales/ru/messages.json index a8920dd6..a958bb5d 100644 --- a/src/_locales/ru/messages.json +++ b/src/_locales/ru/messages.json @@ -83,8 +83,8 @@ "message": "Добавить в избранное", "description": "used in the settings page" }, - "copyRaw": { - "message": "Копировать изначальную" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Скопировано" @@ -108,5 +108,38 @@ }, "disable": { "message": "Выключить" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/sr/messages.json b/src/_locales/sr/messages.json index b14cb2dc..e4a71835 100644 --- a/src/_locales/sr/messages.json +++ b/src/_locales/sr/messages.json @@ -83,8 +83,8 @@ "message": "Додајте своје омиљене инстанце", "description": "used in the settings page" }, - "copyRaw": { - "message": "Копирајте необрађену коду" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Копирано" @@ -99,5 +99,47 @@ }, "about": { "message": "О" + }, + "unsupportedIframesHandling": { + "message": "Unsupported iframes handling" + }, + "fetchPublicInstances": { + "message": "Fetch public instances" + }, + "disable": { + "message": "Disable" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/tr/messages.json b/src/_locales/tr/messages.json index e350a9fa..c77210c0 100644 --- a/src/_locales/tr/messages.json +++ b/src/_locales/tr/messages.json @@ -83,8 +83,8 @@ "message": "Sevdiğiniz örnekleri ekleyin", "description": "used in the settings page" }, - "copyRaw": { - "message": "Ham Kopyala" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Kopyalandı" @@ -108,5 +108,38 @@ }, "disable": { "message": "Devre dışı bırak" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/uk/messages.json b/src/_locales/uk/messages.json index 0b3b7f0f..14763b6b 100644 --- a/src/_locales/uk/messages.json +++ b/src/_locales/uk/messages.json @@ -83,8 +83,8 @@ "message": "Додати свої улюблені сервери", "description": "used in the settings page" }, - "copyRaw": { - "message": "Копіювати оригінал посилання" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Скопійовано" @@ -108,5 +108,38 @@ }, "disable": { "message": "Вимкнути" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/vi/messages.json b/src/_locales/vi/messages.json index dac9e4a7..1ad0a2e8 100644 --- a/src/_locales/vi/messages.json +++ b/src/_locales/vi/messages.json @@ -83,8 +83,8 @@ "message": "Thêm những instance bạn yêu thích", "description": "used in the settings page" }, - "copyRaw": { - "message": "Sao chép liên kết gốc" + "copyOriginal": { + "message": "Copy Original" }, "copied": { "message": "Đã Sao Chép" @@ -108,5 +108,38 @@ }, "disable": { "message": "Tắt" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/_locales/zh_Hans/messages.json b/src/_locales/zh_Hans/messages.json index 7cb1f511..0584edf0 100644 --- a/src/_locales/zh_Hans/messages.json +++ b/src/_locales/zh_Hans/messages.json @@ -56,7 +56,7 @@ "description": "used in the settings page" }, "showInPopup": { - "message": "显示于弹出窗口", + "message": "显示在弹窗中", "description": "used in the settings page" }, "frontend": { @@ -68,22 +68,22 @@ "description": "used in the settings page" }, "both": { - "message": "两者", + "message": "所有页面", "description": "used in the settings page" }, "onlyEmbedded": { - "message": "仅当嵌入时", + "message": "仅嵌入页面", "description": "used in the settings page" }, "onlyNotEmbedded": { - "message": "仅当非嵌入时", + "message": "仅常规页面", "description": "used in the settings page" }, "addYourFavoriteInstances": { "message": "添加您喜欢的实例", "description": "used in the settings page" }, - "copyRaw": { + "copyOriginal": { "message": "复制原始链接" }, "copied": { @@ -94,19 +94,52 @@ "description": "Used in context menus when right clicking on a page/tab" }, "redirectLink": { - "message": "尝试重定向", + "message": "尝试进行重定向", "description": "Used in context menus when right clicking on a hyperlink" }, "about": { "message": "关于" }, "unsupportedIframesHandling": { - "message": "对不支持的 iframe 的处理方式" + "message": "处理未支持的嵌入页面的方式" }, "fetchPublicInstances": { "message": "获取公共实例" }, "disable": { "message": "禁用" + }, + "pingInstances": { + "message": "对实例进行测速" + }, + "exportSettingsToSync": { + "message": "导出设置到同步服务" + }, + "importSettingsFromSync": { + "message": "从同步服务导入设置" + }, + "services": { + "message": "服务" + }, + "service": { + "message": "服务" + }, + "bookmarksMenu": { + "message": "书签菜单" + }, + "redirectOnlyInIncognito": { + "message": "仅在隐私模式下重定向" + }, + "bypass": { + "message": "绕过" + }, + "block": { + "message": "屏蔽" + }, + "searchHint": { + "message": "请将 LibRedirect 设为默认搜索引擎。对于 Chromium 的操作方法,点击此处了解。" + }, + "redirect": { + "message": "重定向" } } diff --git a/src/_locales/zh_Hant/messages.json b/src/_locales/zh_Hant/messages.json index 86675479..12218d75 100644 --- a/src/_locales/zh_Hant/messages.json +++ b/src/_locales/zh_Hant/messages.json @@ -1,15 +1,12 @@ { - "both": { - "message": "全部", - "description": "used in the settings page" - }, - "copied": { - "message": "已複製" - }, "extensionName": { "message": "LibRedirect", "description": "name of the extension" }, + "extensionDescription": { + "message": "WebExtension 擴充套件,可將熱門網站重新導向至隱私友好的替代服務", + "description": "description of the extension" + }, "switchInstance": { "message": "切換執行個體", "description": "used in manifest.json as shortcut description" @@ -18,10 +15,6 @@ "message": "設定", "description": "used in the popup" }, - "extensionDescription": { - "message": "WebExtension 擴充套件,可將熱門網站重新導向至隱私友好的替代服務", - "description": "description of the extension" - }, "general": { "message": "一般", "description": "used in the settings page" @@ -42,14 +35,14 @@ "message": "自動", "description": "used in the settings page" }, - "importSettings": { - "message": "匯入設定", - "description": "used in the settings page" - }, "excludeFromRedirecting": { "message": "不作重新導向", "description": "used in the settings page" }, + "importSettings": { + "message": "匯入設定", + "description": "used in the settings page" + }, "exportSettings": { "message": "匯出設定", "description": "used in the settings page" @@ -74,6 +67,14 @@ "message": "重新導向類型", "description": "used in the settings page" }, + "both": { + "message": "全部", + "description": "used in the settings page" + }, + "onlyEmbedded": { + "message": "僅內嵌", + "description": "used in the settings page" + }, "onlyNotEmbedded": { "message": "非內嵌", "description": "used in the settings page" @@ -82,6 +83,12 @@ "message": "新增常用執行個體", "description": "used in the settings page" }, + "copyOriginal": { + "message": "Copy Original" + }, + "copied": { + "message": "已複製" + }, "redirectToOriginal": { "message": "重新導向到原網址", "description": "Used in context menus when right clicking on a page/tab" @@ -90,14 +97,49 @@ "message": "嘗試重新導向", "description": "Used in context menus when right clicking on a hyperlink" }, - "copyRaw": { - "message": "複製原始網址" - }, "about": { "message": "關於" }, - "onlyEmbedded": { - "message": "僅內嵌", - "description": "used in the settings page" + "unsupportedIframesHandling": { + "message": "Unsupported iframes handling" + }, + "fetchPublicInstances": { + "message": "Fetch public instances" + }, + "disable": { + "message": "Disable" + }, + "pingInstances": { + "message": "Ping Instances" + }, + "exportSettingsToSync": { + "message": "Export Settings to Sync" + }, + "importSettingsFromSync": { + "message": "Import Settings from Sync" + }, + "services": { + "message": "Services" + }, + "service": { + "message": "Service" + }, + "bookmarksMenu": { + "message": "Bookmarks menu" + }, + "redirectOnlyInIncognito": { + "message": "Redirect Only in Incognito" + }, + "bypass": { + "message": "Bypass" + }, + "block": { + "message": "Block" + }, + "searchHint": { + "message": "Set LibRedirect as Default Search Engine. For how to do in chromium browsers, click here." + }, + "redirect": { + "message": "Redirect" } -} +} \ No newline at end of file diff --git a/src/pages/options_src/Services/RedirectType.svelte b/src/pages/options_src/Services/RedirectType.svelte index 29c169bc..69ea2b73 100644 --- a/src/pages/options_src/Services/RedirectType.svelte +++ b/src/pages/options_src/Services/RedirectType.svelte @@ -37,15 +37,15 @@ Object.values(serviceConf.frontends).some(frontend => frontend.embeddable) ) { values = [ - { value: "both", name: "both" }, - { value: "main_frame", name: "Only Not Embedded" }, + { value: "both", name: browser.i18n.getMessage("both") || "Both" }, + { value: "main_frame", name: browser.i18n.getMessage("onlyNotEmbedded") || "Only Not Embedded" }, ] if (serviceOptions.redirectType == "sub_frame") { serviceOptions.redirectType = "main_frame" options.set(_options) } } else { - values = [{ value: "main_frame", name: "Only Not Embedded" }] + values = [{ value: "main_frame", name: browser.i18n.getMessage("onlyNotEmbedded") || "Only Not Embedded" }] serviceOptions.redirectType = "main_frame" options.set(_options) } -- cgit 1.4.1 From 7c9a23503783a6397b628541b50e3081901cd96f Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sat, 17 Aug 2024 21:59:56 +0300 Subject: Added Dropdown is searchable hint https://github.com/libredirect/browser_extension/issues/961 --- src/pages/options_src/Services/Services.svelte | 34 ++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'src/pages/options_src') diff --git a/src/pages/options_src/Services/Services.svelte b/src/pages/options_src/Services/Services.svelte index 93afcded..481afb83 100644 --- a/src/pages/options_src/Services/Services.svelte +++ b/src/pages/options_src/Services/Services.svelte @@ -24,6 +24,8 @@ unsubscribeConfig() }) let selectedService = $url.hash.startsWith("#services:") ? $url.hash.split(":")[1] : "youtube" + let hideServiceSelection = false + let hideFrontendSelection = false $: serviceConf = _config.services[selectedService] $: serviceOptions = _options[selectedService] $: frontendWebsite = serviceConf.frontends[serviceOptions.frontend].url @@ -38,7 +40,7 @@ {browser.i18n.getMessage("service") || "Service"} -
+
(hideServiceSelection = true)} on:keydown={null}> { selectedService = e.detail.value window.location.hash = `services:${e.detail.value}` + hideServiceSelection = false }} + on:focus={() => (hideServiceSelection = true)} + on:blur={() => (hideServiceSelection = false)} items={[ ...servicesEntries.map(([serviceKey, service]) => { return { value: serviceKey, label: service.name } @@ -58,9 +63,17 @@ {item.label}
-
- - {selection.label} +
+ {#if !hideServiceSelection} + + {selection.label} + {:else} + {browser.i18n.getMessage("search_service") || "Search Service"} + {/if}
🮦
@@ -103,7 +116,7 @@ {browser.i18n.getMessage("frontend") || "Frontend"} -
+
(hideFrontendSelection = true)} on:keydown={null}> { serviceOptions.frontend = e.detail.value options.set(_options) + hideFrontendSelection = false }} + on:focus={() => (hideFrontendSelection = true)} + on:blur={() => (hideFrontendSelection = false)} items={[ ...frontendEntries.map(([frontendId, frontend]) => ({ value: frontendId, @@ -126,8 +142,12 @@ {item.label}
- - {selection.label} + {#if !hideFrontendSelection} + + {selection.label} + {:else} + {browser.i18n.getMessage("search_frontend") || "Search Frontend"} + {/if}
🮦
-- cgit 1.4.1 From a94ad51a346d58f090e4d9a26fe5e78f15474acd Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sun, 18 Aug 2024 13:00:57 +0300 Subject: Allowing to import from previous version https://github.com/libredirect/browser_extension/issues/961 --- src/assets/javascripts/services.js | 134 +++++++++------------ src/pages/background/background.js | 8 +- .../options_src/General/SettingsButtons.svelte | 28 ++--- src/pages/options_src/Services/Services.svelte | 2 +- src/pages/popup_src/App.svelte | 2 +- 5 files changed, 76 insertions(+), 98 deletions(-) (limited to 'src/pages/options_src') diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 417f66c3..9b6ef325 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -831,99 +831,86 @@ const defaultInstances = { ytify: ["https://ytify.netlify.app"], } +async function getDefaults() { + let config = await utils.getConfig() + let options = {} + for (const service in config.services) { + options[service] = {} + for (const defaultOption in config.services[service].options) { + options[service][defaultOption] = config.services[service].options[defaultOption] + } + for (const frontend in config.services[service].frontends) { + if (config.services[service].frontends[frontend].instanceList) { + options[frontend] = [] + } + } + } + options.exceptions = { + url: [], + regex: [], + } + options.theme = "detect" + options.popupServices = ["youtube", "tiktok", "imgur", "reddit", "quora", "translate", "maps"] + options.fetchInstances = "github" + options.redirectOnlyInIncognito = false + options = { ...options, ...defaultInstances } + return options +} + function initDefaults() { return new Promise(resolve => { browser.storage.local.clear(async () => { - let config = await utils.getConfig() - let options = {} - for (const service in config.services) { - options[service] = {} - for (const defaultOption in config.services[service].options) { - options[service][defaultOption] = config.services[service].options[defaultOption] - } - for (const frontend in config.services[service].frontends) { - if (config.services[service].frontends[frontend].instanceList) { - options[frontend] = [] - } - } - } - options.exceptions = { - url: [], - regex: [], - } - options.theme = "detect" - options.popupServices = ["youtube", "tiktok", "imgur", "reddit", "quora", "translate", "maps"] - options.fetchInstances = "github" - options.redirectOnlyInIncognito = false - - options = { ...options, ...defaultInstances } - + options = await getDefaults() browser.storage.local.set({ options }, () => resolve()) }) }) } -function upgradeOptions() { - return new Promise(async resolve => { - let options = await utils.getOptions() - - browser.storage.local.clear(() => { - browser.storage.local.set({ options }, () => { - resolve() - }) - }) - }) -} - -function processUpdate() { +function processUpdate(_options) { return new Promise(async resolve => { - let frontends = [] const config = await utils.getConfig() - let options = await utils.getOptions() - for (const service in config.services) { - if (!options[service]) options[service] = {} + let options = _options ?? await utils.getOptions() - if (!(options[service].frontend in config.services[service].frontends)) { - options[service] = config.services[service].options // Reset settings for service - delete options[options[service].frontend] // Remove deprecated frontend - } + const defaults = await getDefaults() - for (const defaultOption in config.services[service].options) { - if (!(defaultOption in options[service])) { - options[service][defaultOption] = config.services[service].options[defaultOption] + // Remove any unknown option or subOption + for (const optionName in options) { + if (!(optionName in defaults)) delete options[optionName] + else if (typeof optionName === 'object' && optionName !== null) { + for (const subOptionName in options[optionName]) { + if (!(subOptionName in defaults[optionName])) delete options[optionName][subOptionName] } } + } + + // Remove any unknwon popupService + options.popupServices = options.popupServices.filter(service => service in config.services) + + // Add missing options + for (const [defaultName, defaultValue] of Object.entries(defaults)) { + if (!(defaultName in options)) { + options[defaultName] = defaultValue + } + } - for (const frontend in config.services[service].frontends) { - frontends.push(frontend) - if (!(frontend in options) && config.services[service].frontends[frontend].instanceList) { - options[frontend] = defaultInstances[frontend] || [] - } + for (const [serviceName, serviceValue] of Object.entries(config.services)) { + // Reset service options if selected frontend is deprecated + if (!(options[serviceName].frontend in serviceValue.frontends)) { + options[serviceName] = serviceValue.options } - for (const frontend of options.popupServices) { - if (!Object.keys(config.services).includes(frontend)) { - const i = options.popupServices.indexOf(frontend) - if (i > -1) options.popupServices.splice(i, 1) + // Add a default service option if it's not present + for (const optionName in serviceValue.options) { + if (!(optionName in options[serviceName])) { + options[serviceName][optionName] = serviceValue.options[optionName] } } } - const general = ["theme", "popupServices", "fetchInstances", "redirectOnlyInIncognito"] - const combined = [ - ...Object.keys(config.services), - ...frontends, - ...general, - "exceptions", - "popupServices", - "version", - ] - for (const key in options) { - if (combined.indexOf(key) < 0) { - delete options[key] // Remove any unknown settings in options - } - } - browser.storage.local.set({ options }, () => { - resolve() + + browser.storage.local.clear(() => { + browser.storage.local.set({ options }, () => { + resolve(options) + }) }) }) } @@ -973,7 +960,6 @@ export default { computeService, reverse, initDefaults, - upgradeOptions, processUpdate, copyRaw, switchInstance, diff --git a/src/pages/background/background.js b/src/pages/background/background.js index d42e5027..576365bd 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -13,14 +13,8 @@ browser.runtime.onInstalled.addListener(async details => { if (!(await utils.getOptions())) { await servicesHelper.initDefaults() } - browser.runtime.openOptionsPage() } else if (details.reason == "update") { - if (details.previousVersion == "2.5.2") { - await servicesHelper.upgradeOptions() - await servicesHelper.processUpdate() - } else { - await servicesHelper.processUpdate() - } + await servicesHelper.processUpdate() } } }) diff --git a/src/pages/options_src/General/SettingsButtons.svelte b/src/pages/options_src/General/SettingsButtons.svelte index 2f574199..29b756d2 100644 --- a/src/pages/options_src/General/SettingsButtons.svelte +++ b/src/pages/options_src/General/SettingsButtons.svelte @@ -20,14 +20,12 @@ const reader = new FileReader() reader.readAsText(importSettingsFiles[0]) reader.onload = async () => { - const data = JSON.parse(reader.result) - if ("theme" in data && data.version == browser.runtime.getManifest().version) { - browser.storage.local.clear(async () => { - options.set(data) - }) - } else { - alert("Incompatible settings") + let data = JSON.parse(reader.result) + if (data.version != browser.runtime.getManifest().version) { + alert("Importing from a previous version. Be careful") } + data = await servicesHelper.processUpdate(data) + options.set(data) } reader.onerror = error => { console.log("error", error) @@ -51,20 +49,20 @@ } async function importSettingsSync() { - browser.storage.sync.get({ options }, r => { - const optionsSync = r.options - if (optionsSync.version == browser.runtime.getManifest().version) { - options.set(optionsSync) - } else { - alert("Error") + browser.storage.sync.get({ options }, async r => { + let data = r.options + if (data.version != browser.runtime.getManifest().version) { + alert("Importing from a previous version. Be careful") } + data = await servicesHelper.processUpdate(data) + options.set(data) }) } async function resetSettings() { browser.storage.local.clear(async () => { - await servicesHelper.initDefaults() - options.set(await utils.getOptions()) + const data = await servicesHelper.initDefaults() + options.set(data) }) } diff --git a/src/pages/options_src/Services/Services.svelte b/src/pages/options_src/Services/Services.svelte index 481afb83..6b16e824 100644 --- a/src/pages/options_src/Services/Services.svelte +++ b/src/pages/options_src/Services/Services.svelte @@ -72,7 +72,7 @@ {selection.label} {:else} - {browser.i18n.getMessage("search_service") || "Search Service"} + {browser.i18n.getMessage("searchService") || "Search Service"} {/if}
🮦
diff --git a/src/pages/popup_src/App.svelte b/src/pages/popup_src/App.svelte index 3409052d..2bd16169 100644 --- a/src/pages/popup_src/App.svelte +++ b/src/pages/popup_src/App.svelte @@ -88,7 +88,7 @@ diff --git a/src/pages/messages/index.html b/src/pages/messages/index.html new file mode 100644 index 00000000..8701c152 --- /dev/null +++ b/src/pages/messages/index.html @@ -0,0 +1,14 @@ + + + + + + + Settings + + + + + + + diff --git a/src/pages/messages/no_instance.html b/src/pages/messages/no_instance.html deleted file mode 100644 index 55e5fac7..00000000 --- a/src/pages/messages/no_instance.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - No instances found - - - - -
-

LibRedirect: You have no instance selected for this frontend

-
- - diff --git a/src/pages/messages_src/App.svelte b/src/pages/messages_src/App.svelte new file mode 100644 index 00000000..b08a143b --- /dev/null +++ b/src/pages/messages_src/App.svelte @@ -0,0 +1,132 @@ + + +{#if _options && _config} +
+ {#if window.location.search.includes("message=disabled")} +
+

You disabled redirections for this service

+ +
+ {:else if window.location.search.includes("message=no_instance")} +
+

You have no instance selected for this frontend

+ +
+ {/if} +
+{:else} +

Loading...

+{/if} + + diff --git a/src/pages/messages_src/main.js b/src/pages/messages_src/main.js new file mode 100644 index 00000000..c4012f4a --- /dev/null +++ b/src/pages/messages_src/main.js @@ -0,0 +1,7 @@ +import App from "./App.svelte" + +const app = new App({ + target: document.body, +}) + +export default app diff --git a/src/pages/messages_src/stores.js b/src/pages/messages_src/stores.js new file mode 100644 index 00000000..782f6064 --- /dev/null +++ b/src/pages/messages_src/stores.js @@ -0,0 +1,5 @@ +import { writable } from "svelte/store" + +export const options = writable(null) +export const config = writable(null) +export const page = writable("general") diff --git a/src/pages/options_src/App.svelte b/src/pages/options_src/App.svelte index 565aacef..1c4830bf 100644 --- a/src/pages/options_src/App.svelte +++ b/src/pages/options_src/App.svelte @@ -2,7 +2,7 @@ const browser = window.browser || window.chrome import General from "./General/General.svelte" - import url from './url' + import url from "./url" import utils from "../../assets/javascripts/utils.js" import { onDestroy } from "svelte" import servicesHelper from "../../assets/javascripts/services.js" @@ -37,51 +37,15 @@ config.set(await utils.getConfig()) }) - const dark = { - text: "#fff", - bgMain: "#121212", - bgSecondary: "#202020", - active: "#fbc117", - danger: "#f04141", - lightGrey: "#c3c3c3", - } - const light = { - text: "black", - bgMain: "white", - bgSecondary: "#e4e4e4", - active: "#fb9817", - danger: "#f04141", - lightGrey: "#c3c3c3", - } - let cssVariables - $: if (_options) { - if (_options.theme == "dark") { - cssVariables = dark - } else if (_options.theme == "light") { - cssVariables = light - } else if (window.matchMedia("(prefers-color-scheme: dark)").matches) { - cssVariables = dark - } else { - cssVariables = light - } - } + let style + $: if (_options) style = utils.style(_options, window) const dir = ["ar", "iw", "ku", "fa", "ur"].includes(browser.i18n.getUILanguage()) ? "rtl" : "ltr" document.body.dir = dir {#if _options && _config} -
+
{#if !$url.hash || $url.hash == "#general"} diff --git a/src/pages/options_src/Services/Instances.svelte b/src/pages/options_src/Services/Instances.svelte index 32425b80..4e5d1e7d 100644 --- a/src/pages/options_src/Services/Instances.svelte +++ b/src/pages/options_src/Services/Instances.svelte @@ -64,16 +64,9 @@ pingCache[instance] = colorTime(time) } } - function randomInstances(n) { - let instances = [] - for (let i = 0; i < n; i++) { - instances.push(redirects[selectedFrontend]["clearnet"][Math.floor(Math.random() * allInstances.length)]) - } - return instances - } async function autoPickInstance() { - const instances = randomInstances(5) + const instances = utils.randomInstances(redirects[selectedFrontend]["clearnet"], 5) const myInstancesCache = [] for (const instance of instances) { pingCache[instance] = { color: "lightblue", value: "pinging..." } @@ -81,9 +74,7 @@ pingCache[instance] = colorTime(time) myInstancesCache.push([instance, time]) } - myInstancesCache.sort(function (a, b) { - return a[1] - b[1] - }) + myInstancesCache.sort((a, b) => a[1] - b[1]) _options[selectedFrontend].push(myInstancesCache[0][0]) options.set(_options) diff --git a/src/pages/popup_src/App.svelte b/src/pages/popup_src/App.svelte index 8f958a3e..f6699312 100644 --- a/src/pages/popup_src/App.svelte +++ b/src/pages/popup_src/App.svelte @@ -38,48 +38,12 @@ let _page page.subscribe(val => (_page = val)) - const dark = { - text: "#fff", - bgMain: "#121212", - bgSecondary: "#202020", - active: "#fbc117", - danger: "#f04141", - lightGrey: "#c3c3c3", - } - const light = { - text: "black", - bgMain: "white", - bgSecondary: "#e4e4e4", - active: "#fb9817", - danger: "#f04141", - lightGrey: "#c3c3c3", - } - let cssVariables - $: if (_options) { - if (_options.theme == "dark") { - cssVariables = dark - } else if (_options.theme == "light") { - cssVariables = light - } else if (window.matchMedia("(prefers-color-scheme: dark)").matches) { - cssVariables = dark - } else { - cssVariables = light - } - } + let style + $: if (_options) style = utils.style(_options, window) {#if _options && _config} -
+
{:else} -- cgit 1.4.1 From 79e134a1873e6897107b1f2acb4437030cea2425 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sat, 31 Aug 2024 11:47:11 +0300 Subject: small UI improvements --- src/pages/background/background.js | 29 +++++++++++++++++--------- src/pages/messages_src/App.svelte | 8 +++---- src/pages/options_src/Services/Services.svelte | 2 ++ 3 files changed, 25 insertions(+), 14 deletions(-) (limited to 'src/pages/options_src') diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 2bb6cb57..0d558b01 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -71,17 +71,21 @@ browser.webRequest.onBeforeRequest.addListener( const url = new URL(newUrl) const frontend = url.searchParams.get("frontend") const oldUrl = new URL(url.searchParams.get("url")) - - newUrl = browser.runtime.getURL( - `/pages/messages/index.html?message=no_instance&url=${encodeURIComponent(oldUrl)}&frontend=${encodeURIComponent(frontend)}` - ) + const params = new URLSearchParams({ + message: "no_instance", + url: oldUrl, + frontend: frontend, + }) + newUrl = browser.runtime.getURL(`/pages/messages/index.html?${params.toString()}`) } if (!newUrl) { if (url.href.match(/^https?:\/{2}(.*\.)?libredirect\.invalid.*/)) { - newUrl = browser.runtime.getURL( - `/pages/messages/index.html?message=disabled&url=${encodeURIComponent(url.href)}` - ) + const params = new URLSearchParams({ + message: "disabled", + url: url.href, + }) + newUrl = browser.runtime.getURL(`/pages/messages/index.html?${params.toString()}`) } } @@ -110,10 +114,15 @@ browser.webRequest.onHeadersReceived.addListener( const url = new URL(details.url) const { service, frontend } = servicesHelper.computeFrontend(url) if (!service) return + const params = new URLSearchParams({ + message: "server_error", + code: details.statusCode, + url: url.href, + frontend: frontend, + service: service, + }) browser.tabs.update({ - url: browser.runtime.getURL( - `/pages/messages/index.html?message=server_error&code=${details.statusCode}=&url=${encodeURIComponent(url.href)}&frontend=${encodeURIComponent(frontend)}&service=${encodeURIComponent(service)}` - ), + url: browser.runtime.getURL(`/pages/messages/index.html?${params.toString()}`), }) } }, diff --git a/src/pages/messages_src/App.svelte b/src/pages/messages_src/App.svelte index 05a78044..6d68ff5f 100644 --- a/src/pages/messages_src/App.svelte +++ b/src/pages/messages_src/App.svelte @@ -112,17 +112,17 @@ {#if _options && _config}
- {#if window.location.search.includes("message=disabled")} + {#if params.get("message") == "disabled"}

You disabled redirections for this service

- {:else if window.location.search.includes("message=server_error")} + {:else if params.get("message") == "server_error"}
-

Your selected instance gave out an error

+

Your selected instance gave out an error: {params.get("code")}

{#if _options[params.get("frontend")].length > 1} {/if}
- {:else if window.location.search.includes("message=no_instance")} + {:else if params.get("message") == "no_instance"}

You have no instance selected for this frontend