Adding langFrom, langTo to settings translation. changing naming schemes
This commit is contained in:
parent
f49ef64d88
commit
8db3a300fe
|
@ -71,7 +71,7 @@
|
|||
"message": "Search Engine Redirects",
|
||||
"description": "Label for enable/disable Search Engine redirects option (options & pop-up)."
|
||||
},
|
||||
"disableTranslate": {
|
||||
"disable": {
|
||||
"message": "SimplyTranslate Redirects",
|
||||
"description": "Label for enable/disable SimplyTranslate redirects option (options & pop-up)."
|
||||
},
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
"message": "Redirecciones de Buscador",
|
||||
"description": "Etiqueta para activar/desactivar la opción de redirecciones de Buscador (opciones y pop-up)."
|
||||
},
|
||||
"disableTranslate": {
|
||||
"disable": {
|
||||
"message": "Redirecciones de SimplyTranslate",
|
||||
"description": "Etiqueta para activar/desactivar la opción de redirecciones de SimplyTranslate (opciones y pop-up)."
|
||||
},
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
"message": "Reindirizzamenti motore di ricerca",
|
||||
"description": "Label for enable/disable Search Engine redirects option (options & pop-up)."
|
||||
},
|
||||
"disableTranslate": {
|
||||
"disable": {
|
||||
"message": "Reindirizzamenti SimplyTranslate",
|
||||
"description": "Label for enable/disable SimplyTranslate redirects option (options & pop-up)."
|
||||
},
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
"message": "Перенаправление поисковой системы",
|
||||
"description": "Название настройки для включения/выключения перенаправления поисковой системы (в настройках и всплывающем окне)."
|
||||
},
|
||||
"disableTranslate": {
|
||||
"disable": {
|
||||
"message": "Перенаправление на SimplyTranslate",
|
||||
"description": "Название настройки для включения/выключения перенаправления на SimplyTranslate (в настройках и всплывающем окне)."
|
||||
},
|
||||
|
@ -87,7 +87,7 @@
|
|||
"message": "Всегда включать темный режим Invidious",
|
||||
"description": "Название настройки для 'Всегда включать темный режим Invidious' (в настройках)."
|
||||
},
|
||||
"invidiousVolume": {
|
||||
"volume": {
|
||||
"message": "Громкость Invidious",
|
||||
"description": "Название настройки для 'Громкость Invidious' (в настройках)."
|
||||
},
|
||||
|
@ -99,7 +99,7 @@
|
|||
"message": "Субтитры Invidious - коды языков (разделяются запятой)",
|
||||
"description": "Название настройки для 'Субтитры Invidious - коды языков (разделяются запятой)' (в настройках)."
|
||||
},
|
||||
"invidiousAutoplay": {
|
||||
"autoplay": {
|
||||
"message": "Автоматически воспроизводить видео Invidious при загрузке",
|
||||
"description": "Название настройки для 'Автоматически воспроизводить видео Invidious при загрузке' (в настройках)."
|
||||
},
|
||||
|
|
|
@ -78,7 +78,6 @@ function setSimplyTranslateCustomRedirects(val) {
|
|||
console.log("simplyTranslateCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
|
||||
function setLingvaRedirects(val) {
|
||||
redirects.lingva = val;
|
||||
browser.storage.sync.set({ translateRedirects: redirects })
|
||||
|
@ -107,45 +106,62 @@ function setLingvaCustomRedirects(val) {
|
|||
console.log("lingvaCustomRedirects: ", val)
|
||||
}
|
||||
|
||||
|
||||
let disableTranslate;
|
||||
const getDisableTranslate = () => disableTranslate;
|
||||
function setDisableTranslate(val) {
|
||||
disableTranslate = val;
|
||||
browser.storage.sync.set({ disableTranslate })
|
||||
console.log("disableTranslate: ", disableTranslate)
|
||||
let disable;
|
||||
const getDisable = () => disable;
|
||||
function setDisable(val) {
|
||||
disable = val;
|
||||
browser.storage.sync.set({ translateDisable: disable })
|
||||
console.log("disable: ", disable)
|
||||
}
|
||||
|
||||
let translateFrontend;
|
||||
const getFrontend = () => translateFrontend;
|
||||
let frontend;
|
||||
const getFrontend = () => frontend;
|
||||
function setFrontend(val) {
|
||||
translateFrontend = val;
|
||||
browser.storage.sync.set({ translateFrontend })
|
||||
console.log("Translate frontend: ", val)
|
||||
frontend = val;
|
||||
browser.storage.sync.set({ translateFrontend: frontend })
|
||||
console.log("translateFrontend: ", frontend)
|
||||
}
|
||||
|
||||
let from;
|
||||
const getFrom = () => from;
|
||||
function setFrom(val) {
|
||||
from = val;
|
||||
browser.storage.sync.set({ translateFrom: from })
|
||||
console.log("from: ", from)
|
||||
}
|
||||
|
||||
let to;
|
||||
const getTo = () => to;
|
||||
function setTo(val) {
|
||||
to = val;
|
||||
browser.storage.sync.set({ translateTo: to })
|
||||
console.log("to: ", to)
|
||||
}
|
||||
|
||||
function isTranslate(url) {
|
||||
if (disable) return null;
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
function redirect(url, initiator) {
|
||||
if (disableTranslate) {
|
||||
console.log("SimplyTranslate disabled")
|
||||
return null
|
||||
};
|
||||
|
||||
if (translateFrontend == 'simplyTranslate') {
|
||||
|
||||
let params_arr = url.search.split('&');
|
||||
params_arr[0] = params_arr[0].substring(1);
|
||||
let myMap = {};
|
||||
for (let i = 0; i < params_arr.length; i++) {
|
||||
let pair = params_arr[i].split('=');
|
||||
myMap[pair[0]] = pair[1];
|
||||
}
|
||||
if (frontend == 'simplyTranslate') {
|
||||
let instancesList = [...simplyTranslateRedirectsChecks, ...simplyTranslateCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
|
||||
return `${randomInstance}/${url.search}`;
|
||||
if (myMap.sl && myMap.tl && myMap.text)
|
||||
return `${randomInstance}/${url.search}`;
|
||||
else
|
||||
return `${randomInstance}/?sl=${from}&tl=${to}`
|
||||
}
|
||||
else if (translateFrontend == 'lingva') {
|
||||
let params_arr = url.search.split('&');
|
||||
params_arr[0] = params_arr[0].substring(1);
|
||||
let myMap = {};
|
||||
for (let i = 0; i < params_arr.length; i++) {
|
||||
let pair = params_arr[i].split('=');
|
||||
myMap[pair[0]] = pair[1];
|
||||
}
|
||||
else if (frontend == 'lingva') {
|
||||
let instancesList = [...lingvaRedirectsChecks, ...lingvaCustomRedirects];
|
||||
if (instancesList.length === 0) return null;
|
||||
let randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||
|
@ -158,26 +174,28 @@ function redirect(url, initiator) {
|
|||
|
||||
}
|
||||
|
||||
function isTranslate(url) {
|
||||
return targets.includes(url.host)
|
||||
}
|
||||
|
||||
async function init() {
|
||||
return new Promise((resolve) => {
|
||||
browser.storage.sync.get(
|
||||
[
|
||||
"disableTranslate",
|
||||
"translateDisable",
|
||||
"translateFrontend",
|
||||
"translateRedirects",
|
||||
"simplyTranslateRedirectsChecks",
|
||||
"simplyTranslateCustomRedirects",
|
||||
"lingvaRedirectsChecks",
|
||||
"lingvaCustomRedirects",
|
||||
], (result) => {
|
||||
disableTranslate = result.disableTranslate ?? false;
|
||||
translateFrontend = result.translateFrontend ?? "simplyTranslate";
|
||||
if (result.translateRedirects)
|
||||
redirects = result.translateRedirects
|
||||
"translateFrom",
|
||||
"translateTo",
|
||||
],
|
||||
(result) => {
|
||||
disable = result.translateDisable ?? false;
|
||||
frontend = result.translateFrontend ?? "simplyTranslate";
|
||||
|
||||
from = result.translateFrom ?? "auto";
|
||||
to = result.translateTo ?? 'en';
|
||||
|
||||
if (result.translateRedirects) redirects = result.translateRedirects
|
||||
|
||||
simplyTranslateRedirectsChecks = result.simplyTranslateRedirectsChecks ?? [...redirects.simplyTranslate.normal];
|
||||
simplyTranslateCustomRedirects = result.simplyTranslateCustomRedirects ?? [];
|
||||
|
@ -199,12 +217,17 @@ export default {
|
|||
|
||||
isTranslate,
|
||||
|
||||
getDisableTranslate,
|
||||
setDisableTranslate,
|
||||
getDisable,
|
||||
setDisable,
|
||||
|
||||
getFrontend,
|
||||
setFrontend,
|
||||
|
||||
getFrom,
|
||||
setFrom,
|
||||
getTo,
|
||||
setTo,
|
||||
|
||||
getSimplyTranslateRedirectsChecks,
|
||||
setSimplyTranslateRedirectsChecks,
|
||||
|
||||
|
|
|
@ -18,20 +18,20 @@ browser.storage.sync.get(
|
|||
"invidiousVideoQuality",
|
||||
"invidiousDarkMode",
|
||||
"OnlyEmbeddedVideo",
|
||||
"invidiousVolume",
|
||||
"volume",
|
||||
"invidiousPlayerStyle",
|
||||
"invidiousSubtitles",
|
||||
"invidiousAutoplay",
|
||||
"autoplay",
|
||||
], (result) => {
|
||||
const prefs = getCookie();
|
||||
|
||||
prefs.local = result.invidiousAlwaysProxy;
|
||||
prefs.quality = result.invidiousVideoQuality;
|
||||
prefs.dark_mode = result.invidiousDarkMode;
|
||||
prefs.volume = result.invidiousVolume;
|
||||
prefs.volume = result.volume;
|
||||
prefs.player_style = result.invidiousPlayerStyle;
|
||||
prefs.subtitles = result.invidiousSubtitles;
|
||||
prefs.autoplay = result.invidiousAutoplay;
|
||||
prefs.autoplay = result.autoplay;
|
||||
|
||||
document.cookie = `PREFS=${encodeURIComponent(JSON.stringify(prefs))}`;
|
||||
}
|
||||
|
|
|
@ -141,20 +141,20 @@ function setInvidiousVideoQuality(val) {
|
|||
}
|
||||
const getInvidiousVideoQuality = () => invidiousVideoQuality;
|
||||
|
||||
let invidiousTheme;
|
||||
const getInvidiousTheme = () => invidiousTheme;
|
||||
function setInvidiousTheme(val) {
|
||||
invidiousTheme = val;
|
||||
browser.storage.sync.set({ invidiousTheme })
|
||||
console.log("invidiousTheme: ", invidiousTheme)
|
||||
let theme;
|
||||
const getTheme = () => theme;
|
||||
function setTheme(val) {
|
||||
theme = val;
|
||||
browser.storage.sync.set({ youtubeTheme: theme })
|
||||
console.log("theme: ", theme)
|
||||
}
|
||||
|
||||
let invidiousVolume;
|
||||
const getInvidiousVolume = () => invidiousVolume;
|
||||
function setInvidiousVolume(val) {
|
||||
invidiousVolume = val;
|
||||
browser.storage.sync.set({ invidiousVolume })
|
||||
console.log("invidiousVolume: ", invidiousVolume)
|
||||
let volume;
|
||||
const getVolume = () => volume;
|
||||
function setVolume(val) {
|
||||
volume = val;
|
||||
browser.storage.sync.set({ youtubeVolume: volume })
|
||||
console.log("youtubeVolume: ", volume)
|
||||
}
|
||||
|
||||
let invidiousPlayerStyle;
|
||||
|
@ -173,12 +173,12 @@ function setInvidiousSubtitles(val) {
|
|||
console.log("invidiousSubtitles: ", invidiousSubtitles)
|
||||
}
|
||||
|
||||
let invidiousAutoplay;
|
||||
const getInvidiousAutoplay = () => invidiousAutoplay;
|
||||
function setInvidiousAutoplay(val) {
|
||||
invidiousAutoplay = val;
|
||||
browser.storage.sync.set({ invidiousAutoplay })
|
||||
console.log("invidiousAutoplay: ", invidiousAutoplay)
|
||||
let autoplay;
|
||||
const getAutoplay = () => autoplay;
|
||||
function setAutoplay(val) {
|
||||
autoplay = val;
|
||||
browser.storage.sync.set({ youtubeAutoplay: autoplay })
|
||||
console.log("autoplay: ", autoplay)
|
||||
}
|
||||
|
||||
let frontend;
|
||||
|
@ -262,14 +262,14 @@ async function init() {
|
|||
[
|
||||
"invidiousAlwaysProxy",
|
||||
"invidiousVideoQuality",
|
||||
"invidiousTheme",
|
||||
"youtubeTheme",
|
||||
"persistInvidiousPrefs",
|
||||
"disableYoutube",
|
||||
"OnlyEmbeddedVideo",
|
||||
"invidiousVolume",
|
||||
"youtubeVolume",
|
||||
"invidiousPlayerStyle",
|
||||
"invidiousSubtitles",
|
||||
"invidiousAutoplay",
|
||||
"youtubeAutoplay",
|
||||
"youtubeRedirects",
|
||||
"youtubeFrontend",
|
||||
"invidiousRedirectsChecks",
|
||||
|
@ -287,11 +287,11 @@ async function init() {
|
|||
invidiousAlwaysProxy = result.invidiousAlwaysProxy ?? 'DEFAULT';
|
||||
OnlyEmbeddedVideo = result.OnlyEmbeddedVideo ?? 'both';
|
||||
invidiousVideoQuality = result.invidiousVideoQuality ?? 'DEFAULT';
|
||||
invidiousTheme = result.invidiousTheme ?? 'DEFAULT';
|
||||
invidiousVolume = result.invidiousVolume ?? '--';
|
||||
theme = result.youtubeTheme ?? 'DEFAULT';
|
||||
volume = result.youtubeVolume ?? '--';
|
||||
invidiousPlayerStyle = result.invidiousPlayerStyle ?? 'DEFAULT';
|
||||
invidiousSubtitles = result.invidiousSubtitles || '';
|
||||
invidiousAutoplay = result.invidiousAutoplay ?? 'DEFAULT';
|
||||
autoplay = result.youtubeAutoplay ?? 'DEFAULT';
|
||||
|
||||
invidiousRedirectsChecks = result.invidiousRedirectsChecks ?? [...redirects.invidious.normal];
|
||||
invidiousCustomRedirects = result.invidiousCustomRedirects ?? [];
|
||||
|
@ -318,9 +318,6 @@ function invidiousInitCookies(tabId) {
|
|||
}
|
||||
|
||||
function redirect(url, type) {
|
||||
|
||||
console.log("type", type);
|
||||
|
||||
if (frontend == 'freeTube' && type === "main_frame")
|
||||
return `freetube://${url}`;
|
||||
|
||||
|
@ -335,11 +332,11 @@ function redirect(url, type) {
|
|||
|
||||
if (invidiousAlwaysProxy != "DEFAULT") url.searchParams.append("local", invidiousAlwaysProxy);
|
||||
if (invidiousVideoQuality != "DEFAULT") url.searchParams.append("quality", invidiousVideoQuality);
|
||||
if (invidiousTheme != "DEFAULT") url.searchParams.append("dark_mode", invidiousTheme);
|
||||
if (invidiousVolume != "--") url.searchParams.append("volume", invidiousVolume);
|
||||
if (theme != "DEFAULT") url.searchParams.append("dark_mode", theme);
|
||||
if (volume != "--") url.searchParams.append("volume", volume);
|
||||
if (autoplay != "DEFAULT") url.searchParams.append("autoplay", autoplay);
|
||||
if (invidiousPlayerStyle != "DEFAULT") url.searchParams.append("player_style", invidiousPlayerStyle);
|
||||
if (invidiousSubtitles.trim() != '') url.searchParams.append("subtitles", invidiousSubtitles);
|
||||
if (invidiousAutoplay != "DEFAULT") url.searchParams.append("autoplay", invidiousAutoplay);
|
||||
|
||||
return `${randomInstance}${url.pathname.replace("/shorts/", "/watch?v=")}${url.search}`;
|
||||
|
||||
|
@ -352,9 +349,9 @@ function redirect(url, type) {
|
|||
if (OnlyEmbeddedVideo == 'onlyEmbedded' && type !== "sub_frame") return null
|
||||
if (OnlyEmbeddedVideo == 'onlyNotEmbedded' && type !== "main_frame") return null;
|
||||
|
||||
if (invidiousTheme != "DEFAULT") url.searchParams.append("theme", invidiousTheme);
|
||||
if (invidiousVolume != "--") url.searchParams.append("volume", invidiousVolume / 100);
|
||||
if (invidiousAutoplay != "DEFAULT") url.searchParams.append("playerAutoPlay", invidiousAutoplay);
|
||||
if (theme != "DEFAULT") url.searchParams.append("theme", theme);
|
||||
if (volume != "--") url.searchParams.append("volume", volume / 100);
|
||||
if (autoplay != "DEFAULT") url.searchParams.append("playerAutoPlay", autoplay);
|
||||
|
||||
return `${randomInstance}${url.pathname.replace("/shorts/", "/watch?v=")}${url.search}`;
|
||||
}
|
||||
|
@ -387,11 +384,11 @@ export default {
|
|||
setInvidiousVideoQuality,
|
||||
getInvidiousVideoQuality,
|
||||
|
||||
setInvidiousTheme,
|
||||
getInvidiousTheme,
|
||||
setTheme,
|
||||
getTheme,
|
||||
|
||||
setInvidiousVolume,
|
||||
getInvidiousVolume,
|
||||
setVolume,
|
||||
getVolume,
|
||||
|
||||
setInvidiousPlayerStyle,
|
||||
getInvidiousPlayerStyle,
|
||||
|
@ -399,8 +396,8 @@ export default {
|
|||
setInvidiousSubtitles,
|
||||
getInvidiousSubtitles,
|
||||
|
||||
setInvidiousAutoplay,
|
||||
getInvidiousAutoplay,
|
||||
setAutoplay,
|
||||
getAutoplay,
|
||||
|
||||
getPersistInvidiousPrefs,
|
||||
setPersistInvidiousPrefs,
|
||||
|
|
|
@ -122,6 +122,237 @@
|
|||
|
||||
<hr>
|
||||
|
||||
<div id="simplyTranslate-lingva">
|
||||
<div class="some-block option-block">
|
||||
<h4>From</h4>
|
||||
<select id="from">
|
||||
<option value="auto">Auto</option>
|
||||
<option value="af">Afrikaans</option>
|
||||
<option value="sq">Albanian</option>
|
||||
<option value="am">Amharic</option>
|
||||
<option value="ar">Arabic</option>
|
||||
<option value="hy">Armenian</option>
|
||||
<option value="az">Azerbaijani</option>
|
||||
<option value="eu">Basque</option>
|
||||
<option value="be">Belarusian</option>
|
||||
<option value="bn">Bengali</option>
|
||||
<option value="bs">Bosnian</option>
|
||||
<option value="bg">Bulgarian</option>
|
||||
<option value="ca">Catalan</option>
|
||||
<option value="ceb">Cebuano</option>
|
||||
<option value="ny">Chichewa</option>
|
||||
<option value="zh-CN">Chinese</option>
|
||||
<option value="co">Corsican</option>
|
||||
<option value="hr">Croatian</option>
|
||||
<option value="cs">Czech</option>
|
||||
<option value="da">Danish</option>
|
||||
<option value="nl">Dutch</option>
|
||||
<option value="en">English</option>
|
||||
<option value="eo">Esperanto</option>
|
||||
<option value="et">Estonian</option>
|
||||
<option value="tl">Filipino</option>
|
||||
<option value="fi">Finnish</option>
|
||||
<option value="fr">French</option>
|
||||
<option value="fy">Frisian</option>
|
||||
<option value="gl">Galician</option>
|
||||
<option value="ka">Georgian</option>
|
||||
<option value="de">German</option>
|
||||
<option value="el">Greek</option>
|
||||
<option value="gu">Gujarati</option>
|
||||
<option value="ht">Haitian Creole</option>
|
||||
<option value="ha">Hausa</option>
|
||||
<option value="haw">Hawaiian</option>
|
||||
<option value="iw">Hebrew</option>
|
||||
<option value="hi">Hindi</option>
|
||||
<option value="hmn">Hmong</option>
|
||||
<option value="hu">Hungarian</option>
|
||||
<option value="is">Icelandic</option>
|
||||
<option value="ig">Igbo</option>
|
||||
<option value="id">Indonesian</option>
|
||||
<option value="ga">Irish</option>
|
||||
<option value="it">Italian</option>
|
||||
<option value="ja">Japanese</option>
|
||||
<option value="jw">Javanese</option>
|
||||
<option value="kn">Kannada</option>
|
||||
<option value="kk">Kazakh</option>
|
||||
<option value="km">Khmer</option>
|
||||
<option value="rw">Kinyarwanda</option>
|
||||
<option value="ko">Korean</option>
|
||||
<option value="ku">Kurdish (Kurmanji)</option>
|
||||
<option value="ky">Kyrgyz</option>
|
||||
<option value="lo">Lao</option>
|
||||
<option value="la">Latin</option>
|
||||
<option value="lv">Latvian</option>
|
||||
<option value="lt">Lithuanian</option>
|
||||
<option value="lb">Luxembourgish</option>
|
||||
<option value="mk">Macedonian</option>
|
||||
<option value="mg">Malagasy</option>
|
||||
<option value="ms">Malay</option>
|
||||
<option value="ml">Malayalam</option>
|
||||
<option value="mt">Maltese</option>
|
||||
<option value="mi">Maori</option>
|
||||
<option value="mr">Marathi</option>
|
||||
<option value="mn">Mongolian</option>
|
||||
<option value="my">Myanmar (Burmese)</option>
|
||||
<option value="ne">Nepali</option>
|
||||
<option value="no">Norwegian</option>
|
||||
<option value="or">Odia (Oriya)</option>
|
||||
<option value="ps">Pashto</option>
|
||||
<option value="fa">Persian</option>
|
||||
<option value="pl">Polish</option>
|
||||
<option value="pt">Portuguese</option>
|
||||
<option value="pa">Punjabi</option>
|
||||
<option value="ro">Romanian</option>
|
||||
<option value="ru">Russian</option>
|
||||
<option value="sm">Samoan</option>
|
||||
<option value="gd">Scots Gaelic</option>
|
||||
<option value="sr">Serbian</option>
|
||||
<option value="st">Sesotho</option>
|
||||
<option value="sn">Shona</option>
|
||||
<option value="sd">Sindhi</option>
|
||||
<option value="si">Sinhala</option>
|
||||
<option value="sk">Slovak</option>
|
||||
<option value="sl">Slovenian</option>
|
||||
<option value="so">Somali</option>
|
||||
<option value="es">Spanish</option>
|
||||
<option value="su">Sundanese</option>
|
||||
<option value="sw">Swahili</option>
|
||||
<option value="sv">Swedish</option>
|
||||
<option value="tg">Tajik</option>
|
||||
<option value="ta">Tamil</option>
|
||||
<option value="tt">Tatar</option>
|
||||
<option value="te">Telugu</option>
|
||||
<option value="th">Thai</option>
|
||||
<option value="tr">Turkish</option>
|
||||
<option value="tk">Turkmen</option>
|
||||
<option value="uk">Ukrainian</option>
|
||||
<option value="ur">Urdu</option>
|
||||
<option value="ug">Uyghur</option>
|
||||
<option value="uz">Uzbek</option>
|
||||
<option value="vi">Vietnamese</option>
|
||||
<option value="cy">Welsh</option>
|
||||
<option value="xh">Xhosa</option>
|
||||
<option value="yi">Yiddish</option>
|
||||
<option value="yo">Yoruba</option>
|
||||
<option value="zu">Zulu</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="some-block option-block">
|
||||
<h4>To</h4>
|
||||
<select id="to">
|
||||
<option value="af">Afrikaans</option>
|
||||
<option value="sq">Albanian</option>
|
||||
<option value="am">Amharic</option>
|
||||
<option value="ar">Arabic</option>
|
||||
<option value="hy">Armenian</option>
|
||||
<option value="az">Azerbaijani</option>
|
||||
<option value="eu">Basque</option>
|
||||
<option value="be">Belarusian</option>
|
||||
<option value="bn">Bengali</option>
|
||||
<option value="bs">Bosnian</option>
|
||||
<option value="bg">Bulgarian</option>
|
||||
<option value="ca">Catalan</option>
|
||||
<option value="ceb">Cebuano</option>
|
||||
<option value="ny">Chichewa</option>
|
||||
<option value="zh-CN">Chinese</option>
|
||||
<option value="co">Corsican</option>
|
||||
<option value="hr">Croatian</option>
|
||||
<option value="cs">Czech</option>
|
||||
<option value="da">Danish</option>
|
||||
<option value="nl">Dutch</option>
|
||||
<option value="en">English</option>
|
||||
<option value="eo">Esperanto</option>
|
||||
<option value="et">Estonian</option>
|
||||
<option value="tl">Filipino</option>
|
||||
<option value="fi">Finnish</option>
|
||||
<option value="fr">French</option>
|
||||
<option value="fy">Frisian</option>
|
||||
<option value="gl">Galician</option>
|
||||
<option value="ka">Georgian</option>
|
||||
<option value="de">German</option>
|
||||
<option value="el">Greek</option>
|
||||
<option value="gu">Gujarati</option>
|
||||
<option value="ht">Haitian Creole</option>
|
||||
<option value="ha">Hausa</option>
|
||||
<option value="haw">Hawaiian</option>
|
||||
<option value="iw">Hebrew</option>
|
||||
<option value="hi">Hindi</option>
|
||||
<option value="hmn">Hmong</option>
|
||||
<option value="hu">Hungarian</option>
|
||||
<option value="is">Icelandic</option>
|
||||
<option value="ig">Igbo</option>
|
||||
<option value="id">Indonesian</option>
|
||||
<option value="ga">Irish</option>
|
||||
<option value="it">Italian</option>
|
||||
<option value="ja">Japanese</option>
|
||||
<option value="jw">Javanese</option>
|
||||
<option value="kn">Kannada</option>
|
||||
<option value="kk">Kazakh</option>
|
||||
<option value="km">Khmer</option>
|
||||
<option value="rw">Kinyarwanda</option>
|
||||
<option value="ko">Korean</option>
|
||||
<option value="ku">Kurdish (Kurmanji)</option>
|
||||
<option value="ky">Kyrgyz</option>
|
||||
<option value="lo">Lao</option>
|
||||
<option value="la">Latin</option>
|
||||
<option value="lv">Latvian</option>
|
||||
<option value="lt">Lithuanian</option>
|
||||
<option value="lb">Luxembourgish</option>
|
||||
<option value="mk">Macedonian</option>
|
||||
<option value="mg">Malagasy</option>
|
||||
<option value="ms">Malay</option>
|
||||
<option value="ml">Malayalam</option>
|
||||
<option value="mt">Maltese</option>
|
||||
<option value="mi">Maori</option>
|
||||
<option value="mr">Marathi</option>
|
||||
<option value="mn">Mongolian</option>
|
||||
<option value="my">Myanmar (Burmese)</option>
|
||||
<option value="ne">Nepali</option>
|
||||
<option value="no">Norwegian</option>
|
||||
<option value="or">Odia (Oriya)</option>
|
||||
<option value="ps">Pashto</option>
|
||||
<option value="fa">Persian</option>
|
||||
<option value="pl">Polish</option>
|
||||
<option value="pt">Portuguese</option>
|
||||
<option value="pa">Punjabi</option>
|
||||
<option value="ro">Romanian</option>
|
||||
<option value="ru">Russian</option>
|
||||
<option value="sm">Samoan</option>
|
||||
<option value="gd">Scots Gaelic</option>
|
||||
<option value="sr">Serbian</option>
|
||||
<option value="st">Sesotho</option>
|
||||
<option value="sn">Shona</option>
|
||||
<option value="sd">Sindhi</option>
|
||||
<option value="si">Sinhala</option>
|
||||
<option value="sk">Slovak</option>
|
||||
<option value="sl">Slovenian</option>
|
||||
<option value="so">Somali</option>
|
||||
<option value="es">Spanish</option>
|
||||
<option value="su">Sundanese</option>
|
||||
<option value="sw">Swahili</option>
|
||||
<option value="sv">Swedish</option>
|
||||
<option value="tg">Tajik</option>
|
||||
<option value="ta">Tamil</option>
|
||||
<option value="tt">Tatar</option>
|
||||
<option value="te">Telugu</option>
|
||||
<option value="th">Thai</option>
|
||||
<option value="tr">Turkish</option>
|
||||
<option value="tk">Turkmen</option>
|
||||
<option value="uk">Ukrainian</option>
|
||||
<option value="ur">Urdu</option>
|
||||
<option value="ug">Uyghur</option>
|
||||
<option value="uz">Uzbek</option>
|
||||
<option value="vi">Vietnamese</option>
|
||||
<option value="cy">Welsh</option>
|
||||
<option value="xh">Xhosa</option>
|
||||
<option value="yi">Yiddish</option>
|
||||
<option value="yo">Yoruba</option>
|
||||
<option value="zu">Zulu</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="simplyTranslate">
|
||||
<div class="some-block option-block">
|
||||
<h4>Default Instances</h4>
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
import translateHelper from "../../../assets/javascripts/helpers/translate.js";
|
||||
import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
||||
|
||||
let disableTranslateElement = document.getElementById("disable-simplyTranslate");
|
||||
disableTranslateElement.addEventListener("change",
|
||||
(event) => translateHelper.setDisableTranslate(!event.target.checked)
|
||||
let disableElement = document.getElementById("disable-simplyTranslate");
|
||||
disableElement.addEventListener("change",
|
||||
(event) => translateHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
|
||||
let simplyTranslateLingvaDivElement = document.getElementById("simplyTranslate-lingva")
|
||||
let simplyTranslateDivElement = document.getElementById("simplyTranslate")
|
||||
let lingvaDivElement = document.getElementById("lingva")
|
||||
|
||||
|
||||
function changeFrontendsSettings(frontend) {
|
||||
if (frontend == 'simplyTranslate') {
|
||||
simplyTranslateLingvaDivElement.style.display = 'block';
|
||||
simplyTranslateDivElement.style.display = 'block';
|
||||
lingvaDivElement.style.display = 'none';
|
||||
}
|
||||
else if (frontend == 'lingva') {
|
||||
simplyTranslateLingvaDivElement.style.display = 'block';
|
||||
simplyTranslateDivElement.style.display = 'none';
|
||||
lingvaDivElement.style.display = 'block';
|
||||
}
|
||||
|
@ -30,11 +32,29 @@ translateFrontendElement.addEventListener("change",
|
|||
}
|
||||
);
|
||||
|
||||
let fromElement = document.getElementById("from");
|
||||
fromElement.addEventListener("change",
|
||||
(event) => {
|
||||
let from = event.target.options[fromElement.selectedIndex].value;
|
||||
translateHelper.setFrom(from);
|
||||
}
|
||||
);
|
||||
|
||||
let toElement = document.getElementById("to");
|
||||
toElement.addEventListener("change",
|
||||
(event) => {
|
||||
let to = event.target.options[toElement.selectedIndex].value;
|
||||
translateHelper.setTo(to);
|
||||
}
|
||||
);
|
||||
|
||||
translateHelper.init().then(() => {
|
||||
disableTranslateElement.checked = !translateHelper.getDisableTranslate();
|
||||
disableElement.checked = !translateHelper.getDisable();
|
||||
let frontend = translateHelper.getFrontend();
|
||||
translateFrontendElement.value = frontend;
|
||||
changeFrontendsSettings(frontend);
|
||||
fromElement.value = translateHelper.getFrom();
|
||||
toElement.value = translateHelper.getTo();
|
||||
|
||||
commonHelper.processDefaultCustomInstances(
|
||||
'simplyTranslate',
|
||||
|
|
|
@ -36,31 +36,31 @@ disableYoutubeElement.addEventListener("change",
|
|||
(event) => youtubeHelper.setDisableYoutube(!event.target.checked)
|
||||
);
|
||||
|
||||
let invidiousThemeElement = document.getElementById("invidious-theme");
|
||||
invidiousThemeElement.addEventListener("change",
|
||||
(event) => youtubeHelper.setInvidiousTheme(event.target.options[invidiousThemeElement.selectedIndex].value)
|
||||
let themeElement = document.getElementById("invidious-theme");
|
||||
themeElement.addEventListener("change",
|
||||
(event) => youtubeHelper.setTheme(event.target.options[themeElement.selectedIndex].value)
|
||||
);
|
||||
|
||||
let invidiousVolumeElement = document.getElementById("invidious-volume");
|
||||
let invidiousVolumeValueElement = document.querySelector("#volume-value");
|
||||
invidiousVolumeElement.addEventListener("input",
|
||||
let volumeElement = document.getElementById("invidious-volume");
|
||||
let volumeValueElement = document.querySelector("#volume-value");
|
||||
volumeElement.addEventListener("input",
|
||||
() => {
|
||||
youtubeHelper.setInvidiousVolume(invidiousVolumeElement.value);
|
||||
invidiousVolumeValueElement.textContent = `${invidiousVolumeElement.value}%`;
|
||||
youtubeHelper.setVolume(volumeElement.value);
|
||||
volumeValueElement.textContent = `${volumeElement.value}%`;
|
||||
}
|
||||
);
|
||||
let invidiousClearVolumeElement = document.getElementById("clear-invidious-volume");
|
||||
invidiousClearVolumeElement.addEventListener("click",
|
||||
(_) => {
|
||||
youtubeHelper.setInvidiousVolume('--');
|
||||
invidiousVolumeValueElement.textContent = `--%`;
|
||||
invidiousVolumeElement.value = 50;
|
||||
youtubeHelper.setVolume('--');
|
||||
volumeValueElement.textContent = `--%`;
|
||||
volumeElement.value = 50;
|
||||
}
|
||||
);
|
||||
|
||||
let invidiousAutoplayElement = document.getElementById("invidious-autoplay");
|
||||
invidiousAutoplayElement.addEventListener("change",
|
||||
(event) => youtubeHelper.setInvidiousAutoplay(event.target.options[invidiousAutoplayElement.selectedIndex].value)
|
||||
let autoplayElement = document.getElementById("invidious-autoplay");
|
||||
autoplayElement.addEventListener("change",
|
||||
(event) => youtubeHelper.setAutoplay(event.target.options[autoplayElement.selectedIndex].value)
|
||||
);
|
||||
|
||||
let OnlyEmbeddedVideoElement = document.getElementById("only-embed");
|
||||
|
@ -75,12 +75,12 @@ alwaysUsePreferredElement.addEventListener("change",
|
|||
|
||||
youtubeHelper.init().then(() => {
|
||||
disableYoutubeElement.checked = !youtubeHelper.getDisableYoutube();
|
||||
invidiousThemeElement.checked = youtubeHelper.getInvidiousTheme();
|
||||
invidiousVolumeElement.value = youtubeHelper.getInvidiousVolume();
|
||||
invidiousVolumeValueElement.textContent = `${youtubeHelper.getInvidiousVolume()}%`;
|
||||
themeElement.checked = youtubeHelper.getTheme();
|
||||
volumeElement.value = youtubeHelper.getVolume();
|
||||
volumeValueElement.textContent = `${youtubeHelper.getVolume()}%`;
|
||||
OnlyEmbeddedVideoElement.value = youtubeHelper.getOnlyEmbeddedVideo();
|
||||
alwaysUsePreferredElement.checked = youtubeHelper.getAlwaysusePreferred();
|
||||
invidiousAutoplayElement.checked = youtubeHelper.getInvidiousAutoplay();
|
||||
autoplayElement.checked = youtubeHelper.getAutoplay();
|
||||
let frontend = youtubeHelper.getFrontend();
|
||||
youtubeFrontendElement.value = frontend;
|
||||
changeFrontendsSettings(frontend);
|
||||
|
|
|
@ -20,7 +20,7 @@ let disableInstagramElement = document.querySelector("#disable-bibliogram");
|
|||
let disableMapsElement = document.querySelector("#disable-osm");
|
||||
let disableRedditElement = document.querySelector("#disable-reddit");
|
||||
let disableSearchElement = document.querySelector("#disable-search");
|
||||
let disableTranslateElement = document.querySelector("#disable-simplyTranslate");
|
||||
let disableElement = document.querySelector("#disable-simplyTranslate");
|
||||
let disableWikipediaElement = document.querySelector("#disable-wikipedia");
|
||||
let disableMediumElement = document.querySelector("#disable-medium");
|
||||
let disableImgurElement = document.querySelector("#disable-imgur");
|
||||
|
@ -47,7 +47,7 @@ wholeInit().then(() => {
|
|||
disableMapsElement.checked = !mapsHelper.getDisableMaps();
|
||||
disableRedditElement.checked = !redditHelper.getDisableReddit();
|
||||
disableSearchElement.checked = !searchHelper.getDisableSearch();
|
||||
disableTranslateElement.checked = !translateHelper.getDisableTranslate();
|
||||
disableElement.checked = !translateHelper.getDisable();
|
||||
disableWikipediaElement.checked = !wikipediaHelper.getDisableWikipedia();
|
||||
disableImgurElement.checked = !imgurHelper.getDisableImgur();
|
||||
disableTiktokElement.checked = !tiktokHelper.getDisableTiktok();
|
||||
|
@ -78,8 +78,8 @@ disableSearchElement.addEventListener("change",
|
|||
(event) => searchHelper.setDisableSearch(!event.target.checked)
|
||||
);
|
||||
|
||||
disableTranslateElement.addEventListener("change",
|
||||
(event) => translateHelper.setDisableTranslate(!event.target.checked)
|
||||
disableElement.addEventListener("change",
|
||||
(event) => translateHelper.setDisable(!event.target.checked)
|
||||
);
|
||||
|
||||
disableWikipediaElement.addEventListener("change",
|
||||
|
|
Loading…
Reference in New Issue