Skip to content

Commit

Permalink
Merge pull request #998 from ilyhalight/dev
Browse files Browse the repository at this point in the history
Update 1.8.3
  • Loading branch information
ilyhalight authored Dec 28, 2024
2 parents bd52570 + 10124a5 commit 0a1155a
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 23 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
<!-- Придумать как нормально реализовать отображение кнопки в Google Drive -->
<!-- - Исправлена работа Google Drive (#888, #883, #912) -->

# 1.8.3

- Исправлена ошибка из-за которой кнопка могла не появляться без переустановки расширения (#995, #997)
- Исправлена работа слайдеров громкости в меню расширения (#996)
- Исправлено ускорение видео при зажатие на меню расширения

# 1.8.2

- Добавлена возможность выбрать несколько языков для параметра "Не переводить с родного языка" (#818 в #975)
Expand Down
8 changes: 4 additions & 4 deletions dist/vot-min.user.js

Large diffs are not rendered by default.

32 changes: 23 additions & 9 deletions dist/vot.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
// @connect speed.cloudflare.com
// @connect porntn.com
// @namespace vot
// @version 1.8.2
// @version 1.8.3
// @icon https://translate.yandex.ru/icons/favicon.ico
// @author sodapng, mynovelhost, Toil, SashaXser, MrSoczekXD
// @homepageURL https://github.com/ilyhalight/voice-over-translation
Expand Down Expand Up @@ -2309,12 +2309,14 @@ const proxyOnlyExtensions = [

;// ./src/utils/storage.ts

async function convertData(data, option, oldValue, newValue) {
if (data[option] === oldValue) {
data[option] = newValue;
await votStorage.set(option, newValue);
console.log(`[VOT] Old ${option} converted to new ${newValue}`);
async function convertData(data, option, oldValue, newValue, optionValue = undefined) {
const optionVal = optionValue ?? data[option];
if (optionVal !== oldValue) {
return;
}
data[option] = newValue;
await votStorage.set(option, newValue);
console.log(`[VOT] Old ${option} converted to new ${newValue}`);
}
const votStorage = new (class {
gmSupport;
Expand Down Expand Up @@ -10070,6 +10072,13 @@ class VideoHandler {
"yandex",
defaultTranslationService,
);
await convertData(
this.data,
"dontTranslateLanguage",
false,
[this.data.dontTranslateLanguage],
Array.isArray(this.data.dontTranslateLanguage),
);

if (
!this.translateProxyEnabled &&
Expand Down Expand Up @@ -11590,9 +11599,14 @@ class VideoHandler {
addExtraEventListener(this.votButton.container, "pointerdown", (e) => {
e.stopImmediatePropagation();
});
addExtraEventListener(this.votMenu.container, "pointerdown", (e) => {
e.stopImmediatePropagation();
});
// don't change mousedown, otherwise it may break on youtube
addExtraEventListeners(
this.votMenu.container,
["pointerdown", "mousedown"],
(e) => {
e.stopImmediatePropagation();
},
);

// fix draggable menu in youtube (#394, #417)
if (this.site.host === "youtube") {
Expand Down
42 changes: 41 additions & 1 deletion scripts/wiki-gen/SITES-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ Available (sub)domains:
Available paths:

- /video-xxxxxxxxx_xxxxxxxxx
- ?z=VIDEO_ID
- ?z=video-xxxxxxxxx_xxxxxxxxx
- /video_ext.php?oid=VIDEO_ID_PART_ONE&id=VIDEO_ID_PART_TWO
- .../playlist/PLAYLIST_ID/video-xxxxxxxxx_xxxxxxxxx

## 9GAG

Expand Down Expand Up @@ -223,6 +224,18 @@ Limitations:

- The translation in the feed doesn't work (It only works in open videos)

## Douyin

Status: [] Working

Available (sub)domains:

- `(www.)?douyin.com`

Limitations:

- To ensure that the script works, you need to [enable the "Bypass Media CSP" setting](https://github.com/ilyhalight/voice-over-translation/wiki/%5BEN%5D-FAQ) in the extension or delete the CSP in another way

## Vimeo

Status: [] Working
Expand Down Expand Up @@ -804,6 +817,33 @@ Available (sub)domains:

- `dzen.ru`

## Cloudflarestream

Status: [] Working

Available (sub)domains:

- `watch.cloudflarestream.com`
- `embed.cloudflarestream.com`
- `iframe.cloudflarestream.com`
- `customer-[^.]+.cloudflarestream.com`

## Loom

Status: [] Working

Available (sub)domains:

- `(www.)?loom.com`

## Artstation

Status: [] Working

Available (sub)domains:

- `(www.)?artstation.com`

## Direct link to MP4/WEBM

Status: [] Working
Expand Down
42 changes: 41 additions & 1 deletion scripts/wiki-gen/SITES-RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@
Доступные пути:

- /video-xxxxxxxxx_xxxxxxxxx
- ?z=VIDEO_ID
- ?z=video-xxxxxxxxx_xxxxxxxxx
- /video_ext.php?oid=VIDEO_ID_PART_ONE&id=VIDEO_ID_PART_TWO
- .../playlist/PLAYLIST_ID/video-xxxxxxxxx_xxxxxxxxx

## 9GAG

Expand Down Expand Up @@ -223,6 +224,18 @@

- Не работает перевод в ленте (Работает только в открытых видео)

## Douyin

Статус: [] Работает

Доступные (под)домены:

- `(www.)?douyin.com`

Ограничения:

- Для гарантированной работы скрипта необходимо [включить настройку "Обход Media CSP"](https://github.com/ilyhalight/voice-over-translation/wiki/%5BRU%5D-FAQ) в расширение или удалить CSP другим способом

## Vimeo

Статус: [] Работает
Expand Down Expand Up @@ -804,6 +817,33 @@

- `dzen.ru`

## Cloudflarestream

Статус: [] Работает

Доступные (под)домены:

- `watch.cloudflarestream.com`
- `embed.cloudflarestream.com`
- `iframe.cloudflarestream.com`
- `customer-[^.]+.cloudflarestream.com`

## Loom

Статус: [] Работает

Доступные (под)домены:

- `(www.)?loom.com`

## Artstation

Статус: [] Работает

Доступные (под)домены:

- `(www.)?artstation.com`

## Direct link to MP4/WEBM

Статус: [] Работает
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.8.2",
"version": "1.8.3",
"author": "sodapng, mynovelhost, Toil, SashaXser, MrSoczekXD",
"namespace": "vot",
"icon": "https://translate.yandex.ru/icons/favicon.ico",
Expand Down
18 changes: 15 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,13 @@ class VideoHandler {
"yandex",
defaultTranslationService,
);
await convertData(
this.data,
"dontTranslateLanguage",
false,
[this.data.dontTranslateLanguage],
Array.isArray(this.data.dontTranslateLanguage),
);

if (
!this.translateProxyEnabled &&
Expand Down Expand Up @@ -1985,9 +1992,14 @@ class VideoHandler {
addExtraEventListener(this.votButton.container, "pointerdown", (e) => {
e.stopImmediatePropagation();
});
addExtraEventListener(this.votMenu.container, "pointerdown", (e) => {
e.stopImmediatePropagation();
});
// don't change mousedown, otherwise it may break on youtube
addExtraEventListeners(
this.votMenu.container,
["pointerdown", "mousedown"],
(e) => {
e.stopImmediatePropagation();
},
);

// fix draggable menu in youtube (#394, #417)
if (this.site.host === "youtube") {
Expand Down
12 changes: 8 additions & 4 deletions src/utils/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ export async function convertData(
option: string,
oldValue: unknown,
newValue: string | number | boolean,
optionValue: string | undefined = undefined,
) {
if (data[option] === oldValue) {
data[option] = newValue;
await votStorage.set(option, newValue);
console.log(`[VOT] Old ${option} converted to new ${newValue}`);
const optionVal = optionValue ?? data[option];
if (optionVal !== oldValue) {
return;
}

data[option] = newValue;
await votStorage.set(option, newValue);
console.log(`[VOT] Old ${option} converted to new ${newValue}`);
}

export const votStorage = new (class {
Expand Down

0 comments on commit 0a1155a

Please sign in to comment.