diff --git a/src/assets/javascripts/helpers/translate.js b/src/assets/javascripts/helpers/translate.js index 1f92bb7..43da9ef 100644 --- a/src/assets/javascripts/helpers/translate.js +++ b/src/assets/javascripts/helpers/translate.js @@ -176,6 +176,14 @@ function setTo(val) { console.log("to: ", to) } +let simplyTranslateEngine; +const getSimplyTranslateEngine = () => simplyTranslateEngine; +function setSimplyTranslateEngine(val) { + simplyTranslateEngine = val; + browser.storage.local.set({ simplyTranslateEngine: val }) + console.log("simplyTranslateEngine: ", val) +} + function isTranslate(url, initiator) { if (disable) return false; return targets.includes(url.host) @@ -201,6 +209,7 @@ function redirect(url) { else { if (from != "DEFAULT") url.searchParams.append("sl", from); if (to != "DEFAULT") url.searchParams.append("tl", to); + if (simplyTranslateEngine != "DEFAULT") url.searchParams.append("engine", simplyTranslateEngine); return `${randomInstance}/${url.search}` } @@ -283,6 +292,7 @@ async function init() { "translateFrom", "translateTo", + "simplyTranslateEngine", ], (result) => { disable = result.translateDisable ?? false; @@ -291,6 +301,7 @@ async function init() { from = result.translateFrom ?? "DEFAULT"; to = result.translateTo ?? 'DEFAULT'; + simplyTranslateEngine = result.simplyTranslateEngine ?? 'DEFAULT'; redirects.simplyTranslate = dataJson.simplyTranslate; redirects.lingva = dataJson.lingva; @@ -336,6 +347,9 @@ export default { getTo, setTo, + getSimplyTranslateEngine, + setSimplyTranslateEngine, + getSimplyTranslateNormalRedirectsChecks, setSimplyTranslateNormalRedirectsChecks, getSimplyTranslateTorRedirectsChecks, diff --git a/src/pages/options/general/general.js b/src/pages/options/general/general.js index 2796bba..0a0d41c 100644 --- a/src/pages/options/general/general.js +++ b/src/pages/options/general/general.js @@ -32,9 +32,9 @@ document.querySelector("#update-instances").addEventListener("click", () => { document.querySelector("#update-instances").innerHTML = 'Failed Miserabely'; }); -document.querySelector("#export-settings").addEventListener("click", () => { - browser.storage.local.get(null, result => console.log(result)) -}); +// document.querySelector("#export-settings").addEventListener("click", () => { +// browser.storage.local.get(null, result => console.log(result)) +// }); let nameCustomInstanceInput = document.getElementById("exceptions-custom-instance"); let instanceTypeElement = document.getElementById("exceptions-custom-instance-type"); diff --git a/src/pages/options/translate/translate.html b/src/pages/options/translate/translate.html index a51b459..0438098 100644 --- a/src/pages/options/translate/translate.html +++ b/src/pages/options/translate/translate.html @@ -134,7 +134,7 @@