Skip to content

Commit

Permalink
fix for chromium<88 and firefox<86
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyhalight committed Dec 23, 2023
1 parent c6ce3d6 commit fed1366
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 22 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.5.0.1
- Фикс работы с Chromium <88 и Firefox<86. В этих браузерах (для Cent Browser и других старых браузеров)

# 1.5.0
- Добавлена эксперементальная поддержка трансляций (На 23.12.2023 не работает в РФ из-за ограничений на российский айпи от cloudflare worker (позже исправлю). С задержкой как повезет, но в большинстве случаев довольно терпимо +-0-2 секунды от оригинала, но иногда бывает отставание до 10 секунд, но перезапуск перевода помогает уменьшить задержку)
- Добавлен HLS.js
Expand Down
4 changes: 2 additions & 2 deletions dist/vot-cloudflare-min.user.js

Large diffs are not rendered by default.

31 changes: 25 additions & 6 deletions dist/vot-cloudflare.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser
// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры
// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译
// @version 1.5.0
// @version 1.5.0.1
// @author sodapng, mynovelhost, Toil, SashaXser, MrSoczekXD
// @supportURL https://github.com/ilyhalight/voice-over-translation/issues
// @match *://*.youtube.com/*
Expand Down Expand Up @@ -6029,11 +6029,30 @@ async function src_main() {
? container.parentElement
: container;
} else {
container = site.selector
? Object.values(document.querySelectorAll(site.selector)).find((e) =>
e.contains(video),
)
: video.parentElement;
const browserVersion = browserInfo.browser.version.split(".")?.[0];

if (
site.selector?.includes(":not") &&
site.selector?.includes("*") &&
browserVersion &&
((browserInfo.browser.name === "Chrome" &&
Number(browserVersion) < 88) ||
(browserInfo.browser.name === "Firefox" &&
Number(browserVersion) < 84))
) {
const selector = site.selector?.split(" *")?.[0];
container = selector
? Object.values(document.querySelectorAll(selector)).find((e) =>
e.contains(video),
)
: video.parentElement;
} else {
container = site.selector
? Object.values(document.querySelectorAll(site.selector)).find(
(e) => e.contains(video),
)
: video.parentElement;
}
}
if (!container) continue;
if (site.host === "rumble" && container.querySelector("vot-block")) {
Expand Down
4 changes: 2 additions & 2 deletions dist/vot-min.user.js

Large diffs are not rendered by default.

31 changes: 25 additions & 6 deletions dist/vot.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser
// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры
// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译
// @version 1.5.0
// @version 1.5.0.1
// @author sodapng, mynovelhost, Toil, SashaXser, MrSoczekXD
// @supportURL https://github.com/ilyhalight/voice-over-translation/issues
// @match *://*.youtube.com/*
Expand Down Expand Up @@ -6021,11 +6021,30 @@ async function src_main() {
? container.parentElement
: container;
} else {
container = site.selector
? Object.values(document.querySelectorAll(site.selector)).find((e) =>
e.contains(video),
)
: video.parentElement;
const browserVersion = browserInfo.browser.version.split(".")?.[0];

if (
site.selector?.includes(":not") &&
site.selector?.includes("*") &&
browserVersion &&
((browserInfo.browser.name === "Chrome" &&
Number(browserVersion) < 88) ||
(browserInfo.browser.name === "Firefox" &&
Number(browserVersion) < 84))
) {
const selector = site.selector?.split(" *")?.[0];
container = selector
? Object.values(document.querySelectorAll(selector)).find((e) =>
e.contains(video),
)
: video.parentElement;
} else {
container = site.selector
? Object.values(document.querySelectorAll(site.selector)).find(
(e) => e.contains(video),
)
: video.parentElement;
}
}
if (!container) continue;
if (site.host === "rumble" && container.querySelector("vot-block")) {
Expand Down
2 changes: 1 addition & 1 deletion src/headers.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "[VOT] - Voice Over Translation",
"description": "A small extension that adds a Yandex Browser video translation to other browsers",
"version": "1.5.0",
"version": "1.5.0.1",
"author": "sodapng, mynovelhost, Toil, SashaXser, MrSoczekXD",
"namespace": "vot",
"icon": "https://translate.yandex.ru/icons/favicon.ico",
Expand Down
29 changes: 24 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2165,11 +2165,30 @@ async function main() {
? container.parentElement
: container;
} else {
container = site.selector
? Object.values(document.querySelectorAll(site.selector)).find((e) =>
e.contains(video),
)
: video.parentElement;
const browserVersion = browserInfo.browser.version.split(".")?.[0];

if (
site.selector?.includes(":not") &&
site.selector?.includes("*") &&
browserVersion &&
((browserInfo.browser.name === "Chrome" &&
Number(browserVersion) < 88) ||
(browserInfo.browser.name === "Firefox" &&
Number(browserVersion) < 84))
) {
const selector = site.selector?.split(" *")?.[0];
container = selector
? Object.values(document.querySelectorAll(selector)).find((e) =>
e.contains(video),
)
: video.parentElement;
} else {
container = site.selector
? Object.values(document.querySelectorAll(site.selector)).find(
(e) => e.contains(video),
)
: video.parentElement;
}
}
if (!container) continue;
if (site.host === "rumble" && container.querySelector("vot-block")) {
Expand Down

0 comments on commit fed1366

Please sign in to comment.