Skip to content

Commit

Permalink
Merge pull request #482 from YouTube-Enhancer/dev
Browse files Browse the repository at this point in the history
Dev
VampireChicken12 authored May 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 491fc43 + 32c094c commit 5d3d358
Showing 56 changed files with 935 additions and 224 deletions.
21 changes: 19 additions & 2 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projectName": "youtube-enhancer",
"projectOwner": "VampireChicken12",
"projectName": "extension",
"projectOwner": "YouTube-Enhancer",
"files": [
"README.md"
],
@@ -138,6 +138,23 @@
"contributions": [
"translation"
]
},
{
"login": "szaumoor",
"name": "Marcos C.R.",
"avatar_url": "https://avatars.githubusercontent.com/u/78204388?v=4",
"profile": "https://github.com/szaumoor",
"contributions": [
"ideas"
]
},
"login": "charlymoon741",
"name": "Carlos Ramos Luna",
"avatar_url": "https://avatars.githubusercontent.com/u/62484941?v=4",
"profile": "https://github.com/charlymoon741",
"contributions": [
"ideas"
]
}
]
}
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -65,6 +65,12 @@ YouTube Enhancer is a browser extension that aims to improve your YouTube experi

- **Hide shorts**: Enhance your browsing experience by hiding distracting YouTube Shorts content.

- **Hide live stream chat**: Hide the chat section of live streams.

- **Hide translate comment button**: Hides the `Translate to Language` button under comments.

- **Hide end screen cards:**: Hide the end screen cards on videos.

### Video history settings

- **Track watched videos:** Keeps track of where you left off on videos you were watching and enables resuming playback
@@ -299,6 +305,10 @@ Contributions to the YouTube Enhancer Extension are welcome! If you'd like to co
<td align="center" valign="top" width="14.28%"><a href="https://github.com/G-Ran-Berg"><img src="https://avatars.githubusercontent.com/u/12037193?v=4?s=100" width="100px;" alt="Granberg"/><br /><sub><b>Granberg</b></sub></a><br /><a href="#translation-G-Ran-Berg" title="Translation">🌍</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Secret-Peter"><img src="https://avatars.githubusercontent.com/u/166921574?v=4?s=100" width="100px;" alt="Secret-Peter"/><br /><sub><b>Secret-Peter</b></sub></a><br /><a href="#translation-Secret-Peter" title="Translation">🌍</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/charlymoon741"><img src="https://avatars.githubusercontent.com/u/62484941?v=4?s=100" width="100px;" alt="Carlos Ramos Luna"/><br /><sub><b>Carlos Ramos Luna</b></sub></a><br /><a href="#ideas-charlymoon741" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/szaumoor"><img src="https://avatars.githubusercontent.com/u/78204388?v=4?s=100" width="100px;" alt="Marcos C.R."/><br /><sub><b>Marcos C.R.</b></sub></a><br /><a href="#ideas-szaumoor" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
</tbody>
</table>

@@ -325,7 +335,7 @@ We welcome contributions to improve translations and make the extension accessib

The YouTube Enhancer Extension is open-source and available under the [MIT License](LICENSE). Feel free to explore, modify, and share it as needed.

![Alt](https://repobeats.axiom.co/api/embed/5f047f2fde5309f072dda1602645f76bb8e74cdc.svg "Repobeats analytics image")
![Alt](https://repobeats.axiom.co/api/embed/262a11c40b9db9e119db0a64a23049ead4eaed96.svg "Repobeats analytics image")

## 🌟 Star History

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
368 changes: 274 additions & 94 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -29,12 +29,12 @@
"@tanstack/react-query": "^5.18.0",
"dotenv": "^16.3.1",
"i18next": "^23.7.3",
"monaco-editor": "^0.47.0",
"monaco-editor": "^0.48.0",
"react": "^18.2.0",
"react-colorful": "^5.6.1",
"react-dom": "^18.2.0",
"react-icons": "^5.0.1",
"tailwindcss-multi": "^0.3.30",
"tailwindcss-multi": "^0.4.0",
"use-debouncy": "^5.0.1",
"vite-plugin-css-injected-by-js": "^3.3.0",
"webextension-polyfill": "^0.11.0"
@@ -46,7 +46,7 @@
"@thedutchcoder/postcss-rem-to-px": "^0.0.2",
"@total-typescript/ts-reset": "^0.5.1",
"@types/archiver": "^6.0.1",
"@types/chrome": "^0.0.266",
"@types/chrome": "^0.0.268",
"@types/node": "^20.9.0",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
@@ -63,7 +63,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-no-secrets": "^0.9.1",
"eslint-plugin-no-secrets": "^1.0.2",
"eslint-plugin-perfectionist": "^2.3.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-promise": "^6.1.1",
3 changes: 2 additions & 1 deletion privacy.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# YouTube Enhancer Extension 🚀

Thank you for choosing YouTube Enhancer! This Privacy Policy outlines how we collect, use, and safeguard your information when you use our browser extension.

## Information We Collect
@@ -35,4 +36,4 @@ If you have any questions or concerns about this Privacy Policy or the practices

By using YouTube Enhancer, you signify your acceptance of this Privacy Policy. If you do not agree to this Privacy Policy, please do not use the extension.

This Privacy Policy was last updated on March 20th 2024.
This Privacy Policy was last updated on March 20th 2024.
16 changes: 15 additions & 1 deletion public/locales/ca-ES.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatic theater mode",
"title": "Automatically enables theater mode when you load a video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Hide scrollbar",
"title": "Hides the pages scrollbar"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Loop button",
"title": "Adds a button to the feature menu to loop the video you're watching"
16 changes: 15 additions & 1 deletion public/locales/cs-CZ.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatic theater mode",
"title": "Automatically enables theater mode when you load a video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Hide scrollbar",
"title": "Hides the pages scrollbar"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Loop button",
"title": "Adds a button to the feature menu to loop the video you're watching"
16 changes: 15 additions & 1 deletion public/locales/de-DE.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatischer Theatermodus",
"title": "Automatisch den Theatermodus aktivieren, wenn ein Video geladen wird"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Scrollbar ausblenden",
"title": "Versteckt die Scrollleiste"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Dauerschleife-Button",
"title": "Adds a button to the feature menu to loop the video you're watching"
16 changes: 15 additions & 1 deletion public/locales/en-GB.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatic theatre mode",
"title": "Automatically enables theatre mode when you load a video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Hide scrollbar",
"title": "Hides the pages scrollbar"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Loop button",
"title": "Adds a button to the feature menu to loop the video you're watching"
16 changes: 15 additions & 1 deletion public/locales/en-US.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatic theater mode",
"title": "Automatically enables theater mode when you load a video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Hide scrollbar",
"title": "Hides the pages scrollbar"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Loop button",
"title": "Adds a button to the feature menu to loop the video you're watching"
11 changes: 11 additions & 0 deletions public/locales/en-US.json.d.ts
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ interface EnUS {
decreasePlaybackSpeedButton: { label: "Decrease Speed to {{SPEED}}" };
increasePlaybackSpeedButton: { label: "Increase Speed to {{SPEED}}" };
};
decreaseLimit: "Can't decrease further ({{SPEED}})";
increaseLimit: "Can't increase further ({{SPEED}})";
};
screenshotButton: {
button: { label: "Screenshot" };
@@ -143,8 +145,17 @@ interface EnUS {
label: "Automatic theater mode";
title: "Automatically enables theater mode when you load a video";
};
hideEndScreenCards: {
label: "Hide end screen cards";
title: "Hides the cards at the end of the video";
};
hideLiveStreamChat: { label: "Hide live stream chat"; title: "Hides the live stream chat" };
hideScrollbar: { label: "Hide scrollbar"; title: "Hides the pages scrollbar" };
hideShorts: { label: "Hide shorts"; title: "Hides all shorts" };
hideTranslateComment: {
label: "Hide translate comment button";
title: "Hides 'Translate to Language' button under comments";
};
loopButton: {
label: "Loop button";
title: "Adds a button to the feature menu to loop the video you're watching";
16 changes: 15 additions & 1 deletion public/locales/es-ES.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Modo cine automático",
"title": "Activar automáticamente el modo cine al cargar un vídeo"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Ocultar barra de desplazamiento",
"title": "Oculta la barra de desplazamiento de la página"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Botón de bucle",
"title": "Añade un botón al menú para poner en bucle el vídeo que estás viendo"
16 changes: 15 additions & 1 deletion public/locales/fa-IR.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatic theater mode",
"title": "Automatically enables theater mode when you load a video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Hide scrollbar",
"title": "Hides the pages scrollbar"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Loop button",
"title": "Adds a button to the feature menu to loop the video you're watching"
16 changes: 15 additions & 1 deletion public/locales/fr-FR.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Mode cinéma automatique",
"title": "Activer automatiquement le mode cinéma lorsque vous chargez une vidéo"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Cacher la barre de défilement",
"title": "Cache la barre de défilement des pages"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Bouton de boucle",
"title": "Ajoute un bouton au menu de fonctionnalité pour regarder la vidéo en boucle"
16 changes: 15 additions & 1 deletion public/locales/he-IL.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatic theater mode",
"title": "Automatically enables theater mode when you load a video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Hide scrollbar",
"title": "Hides the pages scrollbar"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Loop button",
"title": "Adds a button to the feature menu to loop the video you're watching"
16 changes: 15 additions & 1 deletion public/locales/hi-IN.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatic theater mode",
"title": "Automatically enables theater mode when you load a video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Hide scrollbar",
"title": "Hides the pages scrollbar"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Loop button",
"title": "Adds a button to the feature menu to loop the video you're watching"
16 changes: 15 additions & 1 deletion public/locales/it-IT.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Aumenta velocità di {{SPEED}}"
}
}
},
"decreaseLimit": "Impossibile diminuire ulteriormente ({{SPEED}})",
"increaseLimit": "Impossibile aumentare ulteriormente ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Modalità teatro automatica",
"title": "Attiva automaticamente la modalità teatro quando carichi un video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Nascondi chat live stream",
"title": "Nasconde la chat live stream"
},
"hideScrollbar": {
"label": "Nascondi barra scorrimento",
"title": "Nasconde la barra di scorrimento delle pagine"
@@ -217,6 +227,10 @@
"label": "Nascondi blocchi",
"title": "Nasconde tutti i blocchi"
},
"hideTranslateComment": {
"label": "Nascondi pulsante \"Traduci commento\"",
"title": "Nasconde il pulsante 'Traduci in…' sotto i commenti"
},
"loopButton": {
"label": "Pulsante Ripeti",
"title": "Aggiunge un pulsante al menu' funzioni per ripetere il video che stai guardando"
16 changes: 15 additions & 1 deletion public/locales/ja-JP.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "再生速度を{{SPEED}}で上げする"
}
}
},
"decreaseLimit": "再生速度を下げるはできまっせん ({{SPEED}})",
"increaseLimit": "再生速度を上げるはできまっせん ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "自動シアターモード",
"title": "動画の読み込み時に自動的にシアターモードを有効にする"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "配信チャットを隠す",
"title": "配信チャットを隠する"
},
"hideScrollbar": {
"label": "スクロールバー隠す機能",
"title": "ページのスクロールバーを隠す"
@@ -217,6 +227,10 @@
"label": "ショートを隠す",
"title": "全ショートを隠す"
},
"hideTranslateComment": {
"label": "コメント翻訳ボタンを隠す",
"title": "コメントの下で「言語に翻訳する」ボタンを隠する"
},
"loopButton": {
"label": "動画ループボタン",
"title": "動画をループするボタンをフィーチャー・メニューに追加する"
16 changes: 15 additions & 1 deletion public/locales/pl-PL.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatic theater mode",
"title": "Automatically enables theater mode when you load a video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Hide scrollbar",
"title": "Hides the pages scrollbar"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Loop button",
"title": "Adds a button to the feature menu to loop the video you're watching"
16 changes: 15 additions & 1 deletion public/locales/pt-BR.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Modo teatro automático",
"title": "Ativar automaticamente o modo teatro quando você carregar um vídeo"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Ocultar a barra de rolagem",
"title": "Oculta a barra de rolagem da página"
@@ -217,6 +227,10 @@
"label": "Hide shorts",
"title": "Hides all shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Botão de Repetir",
"title": "Adiciona um botão ao menu do recurso para repetir o vídeo que você está assistindo"
16 changes: 15 additions & 1 deletion public/locales/ru-RU.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Увеличить скорость на {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Включить автоматический режим кинотеатра",
"title": "Автоматически включать режим кинотеатра при загрузке видео"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Включить скрытие полосы прокрутки страницы",
"title": "Скрывает полосу прокрутки страницы"
@@ -217,6 +227,10 @@
"label": "Скрыть Shorts",
"title": "Скрывает все Shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Включить кнопку «Зациклить»",
"title": "Добавляет кнопку в меню функций для автоматического повтора просмотренного видео (зацикливание)"
16 changes: 15 additions & 1 deletion public/locales/sv-SE.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Öka hastigheten med {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Automatiskt teaterläge",
"title": "Aktiverar automatiskt teaterläge när du startar en video"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Hide live stream chat",
"title": "Hides the live stream chat"
},
"hideScrollbar": {
"label": "Dölj rullningslisten",
"title": "Döljer sidornas rullningsfält"
@@ -217,6 +227,10 @@
"label": "Dölj shorts",
"title": "Döljer alla shorts"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Slingknapp",
"title": "Lägger till en knapp i funktionsmenyn för att slinga videon du tittar på"
16 changes: 15 additions & 1 deletion public/locales/tr-TR.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "Increase Speed to {{SPEED}}"
}
}
},
"decreaseLimit": "Can't decrease further ({{SPEED}})",
"increaseLimit": "Can't increase further ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "Otomatik tiyatro modu",
"title": "Video yüklediğinizde tiyatro modunu otomatik olarak etkinleştirir"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "Canlı yayın sohbetini gizle",
"title": "Canlı yayın sohbetini gizler"
},
"hideScrollbar": {
"label": "Kaydırma çubuğu gizlemeyi etkinleştir",
"title": "Sayfa kaydırma çubuğunu gizler"
@@ -217,6 +227,10 @@
"label": "Kısa videoları gizle",
"title": "Tüm kısa videoları gizler"
},
"hideTranslateComment": {
"label": "Hide translate comment button",
"title": "Hides 'Translate to Language' button under comments"
},
"loopButton": {
"label": "Tekrarlama düğmesi",
"title": "İzlediğiniz videoyu döngüye almak için özellik menüsüne bir düğme ekler"
16 changes: 15 additions & 1 deletion public/locales/zh-CN.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "增加播放速度至 {{SPEED}}"
}
}
},
"decreaseLimit": "不能继续降低({{SPEED}})",
"increaseLimit": "不能继续增加({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "自动启用剧场模式",
"title": "当视频打开时,自动启用剧场模式"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "隐藏直播聊天",
"title": "隐藏直播聊天"
},
"hideScrollbar": {
"label": "启用隐藏滚动条",
"title": "隐藏页面滚动条"
@@ -217,6 +227,10 @@
"label": "隐藏短视频",
"title": "隐藏所有短视频"
},
"hideTranslateComment": {
"label": "隐藏翻译评论按钮",
"title": "隐藏评论下方的“翻译至当前语言”按钮"
},
"loopButton": {
"label": "循环按钮",
"title": "在功能菜单中添加一个按钮来循环你正在观看的视频"
16 changes: 15 additions & 1 deletion public/locales/zh-TW.json
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@
"increasePlaybackSpeedButton": {
"label": "加快播放速度 {{SPEED}}"
}
}
},
"decreaseLimit": "無法再減速 ({{SPEED}})",
"increaseLimit": "無法再加速 ({{SPEED}})"
},
"screenshotButton": {
"button": {
@@ -209,6 +211,14 @@
"label": "自動啟用劇院模式",
"title": "載入影片時自動啟用劇院模式"
},
"hideEndScreenCards": {
"label": "Hide end screen cards",
"title": "Hides the cards at the end of the video"
},
"hideLiveStreamChat": {
"label": "隱藏直播聊天室",
"title": "隱藏直播的聊天室"
},
"hideScrollbar": {
"label": "隱藏捲軸",
"title": "隱藏頁面捲軸"
@@ -217,6 +227,10 @@
"label": "隱藏 Shorts",
"title": "隱藏全部 Shorts"
},
"hideTranslateComment": {
"label": "隱藏翻譯留言按鈕",
"title": "隱藏留言下的翻譯按鈕"
},
"loopButton": {
"label": "循環按鈕",
"title": "加入按鈕循環播放當前影片"
2 changes: 1 addition & 1 deletion src/components/Inputs/CSSEditor/ExpandButton/index.tsx
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ const ExpandButton = forwardRef<HTMLInputElement, ExpandButtonProps>(({ isExpand

return (
<input
className={cn("my-2 flex self-start rounded-md bg-[rgba(43,43,43,1)] p-2 text-sm dark:hover:bg-[rgba(43,43,43,0.5)] sm:text-base md:text-lg", {
className={cn("my-2 flex self-start rounded-md bg-[rgba(43,43,43,1)] p-2 text-sm sm:text-base md:text-lg dark:hover:bg-[rgba(43,43,43,0.5)]", {
"ml-2": isExpanded
})}
onClick={onToggle}
36 changes: 30 additions & 6 deletions src/components/Settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -656,6 +656,30 @@ export default function Settings() {
title={t("settings.sections.miscellaneous.features.hideShorts.title")}
type="checkbox"
/>
<Setting
checked={settings.enable_hide_live_stream_chat?.toString() === "true"}
id="enable_hide_live_stream_chat"
label={t("settings.sections.miscellaneous.features.hideLiveStreamChat.label")}
onChange={setCheckboxOption("enable_hide_live_stream_chat")}
title={t("settings.sections.miscellaneous.features.hideLiveStreamChat.title")}
type="checkbox"
/>
<Setting
checked={settings.enable_hide_translate_comment?.toString() === "true"}
id="enable_hide_translate_comment"
label={t("settings.sections.miscellaneous.features.hideTranslateComment.label")}
onChange={setCheckboxOption("enable_hide_translate_comment")}
title={t("settings.sections.miscellaneous.features.hideTranslateComment.title")}
type="checkbox"
/>
<Setting
checked={settings.enable_hide_end_screen_cards?.toString() === "true"}
id="enable_hide_end_screen_cards"
label={t("settings.sections.miscellaneous.features.hideEndScreenCards.label")}
onChange={setCheckboxOption("enable_hide_end_screen_cards")}
title={t("settings.sections.miscellaneous.features.hideEndScreenCards.title")}
type="checkbox"
/>
</SettingSection>
<SettingSection>
<SettingTitle title={t("settings.sections.videoHistory.title")} />
@@ -1087,15 +1111,15 @@ export default function Settings() {
</SettingSection>
<div className="sticky bottom-0 left-0 z-10 flex justify-between gap-1 bg-[#f5f5f5] p-2 dark:bg-[#181a1b]">
<input
className="danger p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
className="danger p-2 text-sm sm:text-base md:text-lg dark:hover:bg-[rgba(24,26,27,0.5)]"
id="clear_data_button"
onClick={clearData}
title={t("settings.sections.bottomButtons.clear.title")}
type="button"
value={t("settings.sections.bottomButtons.clear.value")}
/>
<input
className="accent p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
className="accent p-2 text-sm sm:text-base md:text-lg dark:hover:bg-[rgba(24,26,27,0.5)]"
id="import_settings_button"
onClick={importSettings}
title={t("settings.sections.importExportSettings.importButton.title")}
@@ -1104,7 +1128,7 @@ export default function Settings() {
/>
{isPopup && (
<button
className="accent flex items-center justify-center p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
className="accent flex items-center justify-center p-2 text-sm sm:text-base md:text-lg dark:hover:bg-[rgba(24,26,27,0.5)]"
id="openinnewtab_button"
onClick={() => openInNewTab("src/pages/options/index.html")}
title={t("settings.sections.bottomButtons.openTab.title")}
@@ -1114,7 +1138,7 @@ export default function Settings() {
</button>
)}
<input
className="accent p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
className="accent p-2 text-sm sm:text-base md:text-lg dark:hover:bg-[rgba(24,26,27,0.5)]"
id="export_settings_button"
onClick={exportSettings}
title={t("settings.sections.importExportSettings.exportButton.title")}
@@ -1123,7 +1147,7 @@ export default function Settings() {
/>
{notifications.filter((n) => n.action === "reset_settings").length > 0 ?
<input
className="danger p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
className="danger p-2 text-sm sm:text-base md:text-lg dark:hover:bg-[rgba(24,26,27,0.5)]"
id="confirm_button"
onClick={() => {
const notificationToRemove = notifications.find((n) => n.action === "reset_settings");
@@ -1146,7 +1170,7 @@ export default function Settings() {
value={t("settings.sections.bottomButtons.confirm.value")}
/>
: <input
className="warning p-2 text-sm dark:hover:bg-[rgba(24,26,27,0.5)] sm:text-base md:text-lg"
className="warning p-2 text-sm sm:text-base md:text-lg dark:hover:bg-[rgba(24,26,27,0.5)]"
id="reset_button"
onClick={resetOptions}
title={t("settings.sections.bottomButtons.reset.title")}
2 changes: 1 addition & 1 deletion src/features/automaticTheaterMode/index.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import type { YouTubePlayerDiv } from "@/src/types";

import { isWatchPage, waitForSpecificMessage } from "@/src/utils/utilities";

export async function automaticTheaterMode() {
export async function enableAutomaticTheaterMode() {
// Wait for the "options" message from the content script
const optionsData = await waitForSpecificMessage("options", "request_data", "content");
const {
2 changes: 1 addition & 1 deletion src/features/buttonPlacement/utils.ts
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ export function makeFeatureButton<Name extends AllButtonNames, Placement extends
direction: placement === "below_player" ? "down" : "up",
element: button,
featureName,
id: `yte-feature-${featureName}-tooltip`
id: `yte-feature-${buttonName}-tooltip`
});
if (buttonExists) {
eventManager.removeEventListener(button, "click", featureName);
3 changes: 3 additions & 0 deletions src/features/hideEndScreenCards/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.yte-hide-end-screen-cards {
display: none !important;
}
31 changes: 31 additions & 0 deletions src/features/hideEndScreenCards/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { modifyElementsClassList, waitForAllElements, waitForSpecificMessage } from "@/src/utils/utilities";

import "./index.css";
export async function enableHideEndScreenCards() {
const {
data: {
options: { enable_hide_end_screen_cards: enableHideEndScreenCards }
}
} = await waitForSpecificMessage("options", "request_data", "content");
if (!enableHideEndScreenCards) return;

await waitForAllElements(["div#player", "div#player-wide-container", "div#video-container", "div#player-container"]);
modifyElementsClassList(
"add",
Array.from(document.querySelectorAll(".ytp-ce-element")).map((element) => ({
className: "yte-hide-end-screen-cards",
element
}))
);
}

export async function disableHideEndScreenCards() {
await waitForAllElements(["div#player", "div#player-wide-container", "div#video-container", "div#player-container"]);
modifyElementsClassList(
"remove",
Array.from(document.querySelectorAll(".ytp-ce-element")).map((element) => ({
className: "yte-hide-end-screen-cards",
element
}))
);
}
3 changes: 3 additions & 0 deletions src/features/hideLiveStreamChat/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.yte-hide-live-stream-chat {
display: none !important;
}
54 changes: 54 additions & 0 deletions src/features/hideLiveStreamChat/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import type { YouTubePlayerDiv } from "@/src/types";

import { modifyElementsClassList, waitForAllElements, waitForSpecificMessage } from "@/src/utils/utilities";

import "./index.css";

export async function enableHideLiveStreamChat() {
const {
data: {
options: { enable_hide_live_stream_chat: enableHideLiveStreamChat }
}
} = await waitForSpecificMessage("options", "request_data", "content");
if (!enableHideLiveStreamChat) return;
await waitForAllElements(["div#player", "div#player-wide-container", "div#video-container", "div#player-container"]);
const player = document.querySelector<YouTubePlayerDiv>("div#movie_player");
if (!player) return;
const playerData = await player.getVideoData();
if (!playerData.isLive) return;
modifyElementsClassList("add", [
{
className: "yte-hide-live-stream-chat",
element: document.querySelector("div#chat-container")
},
{
className: "yte-hide-live-stream-chat",
element: document.querySelector("div#chat-container #chat")
},
{
className: "yte-hide-live-stream-chat",
element: document.querySelector("#full-bleed-container #panels-full-bleed-container")
}
]);
}

export async function disableHideLiveStreamChat() {
const player = document.querySelector<YouTubePlayerDiv>("div#movie_player");
if (!player) return;
const playerData = await player.getVideoData();
if (!playerData.isLive) return;
modifyElementsClassList("remove", [
{
className: "yte-hide-live-stream-chat",
element: document.querySelector("div#chat-container")
},
{
className: "yte-hide-live-stream-chat",
element: document.querySelector("div#chat-container #chat")
},
{
className: "yte-hide-live-stream-chat",
element: document.querySelector("#full-bleed-container #panels-full-bleed-container")
}
]);
}
3 changes: 3 additions & 0 deletions src/features/hideTranslateComment/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.yte-hide-translate-comment {
display: none !important;
}
27 changes: 27 additions & 0 deletions src/features/hideTranslateComment/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Nullable } from "@/src/types";

import { observeTranslateComment, translateButtonSelector } from "@/src/features/hideTranslateComment/utils";
import { modifyElementClassList, waitForAllElements, waitForSpecificMessage } from "@/src/utils/utilities";

import "./index.css";
let translateCommentObserver: Nullable<MutationObserver> = null;
export async function enableHideTranslateComment() {
const {
data: {
options: { enable_hide_translate_comment }
}
} = await waitForSpecificMessage("options", "request_data", "content");
if (!enable_hide_translate_comment) return;
await waitForAllElements(["ytd-item-section-renderer.ytd-comments div#header div#leading-section"]);
const translateCommentButtons = document.querySelectorAll(translateButtonSelector);
translateCommentButtons.forEach((button) => modifyElementClassList("add", { className: "yte-hide-translate-comment", element: button }));
translateCommentObserver = observeTranslateComment();
}

export async function disableHideTranslateComment() {
await waitForAllElements(["ytd-item-section-renderer.ytd-comments div#header div#leading-section"]);
translateCommentObserver?.disconnect();
translateCommentObserver = null;
const translateCommentButtons = document.querySelectorAll(translateButtonSelector);
translateCommentButtons.forEach((button) => modifyElementClassList("remove", { className: "yte-hide-translate-comment", element: button }));
}
26 changes: 26 additions & 0 deletions src/features/hideTranslateComment/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { modifyElementClassList } from "@/src/utils/utilities";
export const translateButtonSelector = "ytd-tri-state-button-view-model.translate-button";

export function observeTranslateComment() {
const observer = new MutationObserver((mutationList) => {
mutationList.forEach((mutation) => {
const translateButtons = Array.from(mutation.addedNodes).some(
(addedNode) =>
addedNode instanceof Element &&
addedNode.matches("ytd-comment-thread-renderer") &&
addedNode.querySelector(translateButtonSelector) !== null
);
if (mutation.type !== "childList" || !mutation.addedNodes.length || !translateButtons) return;
mutation.addedNodes.forEach((addedNode) => {
modifyElementClassList("add", {
className: "yte-hide-translate-comment",
element: (addedNode as Element).querySelector(translateButtonSelector)
});
});
});
});
const commentsSection = document.querySelector("ytd-item-section-renderer.ytd-comments div#contents");
if (!commentsSection) return null;
observer.observe(commentsSection, { childList: true, subtree: true });
return observer;
}
4 changes: 2 additions & 2 deletions src/features/pauseBackgroundPlayers/index.ts
Original file line number Diff line number Diff line change
@@ -14,8 +14,8 @@ export async function enablePauseBackgroundPlayers() {
}
} = optionsData;
if (!pauseBackgroundPlayersEnabled) return;
// ignore home page
if (window.location.href.match(/^https?:\/\/(?:www\.)?youtube\.com\/?$/gm)) return;
// ignore home page and channel pages
if (window.location.href.match(/^https?:\/\/(?:www\.)?youtube\.com(\/?|\/channel\/.+|\/\@.+)$/gm)) return;
browserColorLog("Enabling pauseBackgroundPlayers", "FgMagenta");

let videoPlayerContainer: HTMLVideoElement | null = null;
44 changes: 20 additions & 24 deletions src/features/playbackSpeedButtons/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { YouTubePlayerDiv } from "@/src/types";

import { addFeatureButton, removeFeatureButton } from "@/src/features/buttonPlacement";
import { getFeatureButton, updateFeatureButtonTitle } from "@/src/features/buttonPlacement/utils";
import { getFeatureButton } from "@/src/features/buttonPlacement/utils";
import { setPlayerSpeed } from "@/src/features/playerSpeed";
import { getFeatureIcon } from "@/src/icons";
import eventManager from "@/src/utils/EventManager";
@@ -13,7 +13,7 @@ let currentPlaybackSpeed = 1;

async function updateTooltip<ButtonName extends "decreasePlaybackSpeedButton" | "increasePlaybackSpeedButton">(
buttonName: ButtonName,
speed: string
speed: number
) {
const optionsData = await waitForSpecificMessage("options", "request_data", "content");
const {
@@ -22,31 +22,34 @@ async function updateTooltip<ButtonName extends "decreasePlaybackSpeedButton" |
button_placements: {
decreasePlaybackSpeedButton: decreasePlaybackSpeedButtonPlacement,
increasePlaybackSpeedButton: increasePlaybackSpeedButtonPlacement
}
},
playback_buttons_speed: playbackSpeedPerClick
}
}
} = optionsData;
const featureName = "playbackSpeedButtons";
const button = getFeatureButton(buttonName);
if (!button) return;
const placement = buttonName == "increasePlaybackSpeedButton" ? increasePlaybackSpeedButtonPlacement : decreasePlaybackSpeedButtonPlacement;
const { remove } = createTooltip({
const { update } = createTooltip({
direction: placement === "below_player" ? "down" : "up",
element: button,
featureName,
id: `yte-feature-${featureName}-tooltip`
id: `yte-feature-${buttonName}-tooltip`
});
remove();
updateFeatureButtonTitle(
buttonName,
window.i18nextInstance.t(
button.dataset.title = window.i18nextInstance.t(
speed == 4 && buttonName == "increasePlaybackSpeedButton" ? `pages.content.features.playbackSpeedButtons.increaseLimit`
: speed == 0.25 && buttonName == "decreasePlaybackSpeedButton" ? `pages.content.features.playbackSpeedButtons.decreaseLimit`
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
`pages.content.features.playbackSpeedButtons.buttons.${buttonName as "decreasePlaybackSpeedButton" | "increasePlaybackSpeedButton"}.label`,
{
SPEED: speed
}
)
: `pages.content.features.playbackSpeedButtons.buttons.${buttonName as "decreasePlaybackSpeedButton" | "increasePlaybackSpeedButton"}.label`,
{
SPEED:
speed == 4 || speed == 0.25 ? String(speed)
: buttonName == "decreasePlaybackSpeedButton" ? String(speed - playbackSpeedPerClick)
: String(speed + playbackSpeedPerClick)
}
);
update();
}

function playbackSpeedButtonClickListener(amount: number): () => void {
@@ -67,14 +70,7 @@ function playbackSpeedButtonClickListener(amount: number): () => void {
const optionsData = await waitForSpecificMessage("options", "request_data", "content");
const {
data: {
options: {
osd_display_color,
osd_display_hide_time,
osd_display_opacity,
osd_display_padding,
osd_display_position,
playback_buttons_speed: playbackSpeedPerClick
}
options: { osd_display_color, osd_display_hide_time, osd_display_opacity, osd_display_padding, osd_display_position }
}
} = optionsData;
new OnScreenDisplayManager(
@@ -96,8 +92,8 @@ function playbackSpeedButtonClickListener(amount: number): () => void {
);
const speed = currentPlaybackSpeed + amount;
await setPlayerSpeed(speed);
await updateTooltip("increasePlaybackSpeedButton", String(speed + playbackSpeedPerClick));
await updateTooltip("decreasePlaybackSpeedButton", String(speed - playbackSpeedPerClick));
await updateTooltip("increasePlaybackSpeedButton", speed);
await updateTooltip("decreasePlaybackSpeedButton", speed);
} catch (error) {
console.error(error);
}
2 changes: 1 addition & 1 deletion src/features/removeRedirect/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Nullable } from "@/src/types";
import { browserColorLog, waitForSpecificMessage } from "@/src/utils/utilities";

export default async function removeRedirect() {
export default async function enableRemoveRedirect() {
const optionsData = await waitForSpecificMessage("options", "request_data", "content");
const {
data: {
1 change: 0 additions & 1 deletion src/features/shareShortener/index.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ function cleanAndUpdateUrl() {
}
if (input) {
if (!input.value.match(regexp)) return;
console.log("cleanAndUpdateUrl");
input.value = cleanUrl(input.value);
}
}, 50);
76 changes: 38 additions & 38 deletions src/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -2,46 +2,46 @@ import { type Resource, createInstance } from "i18next";

import { waitForSpecificMessage } from "../utils/utilities";
export const availableLocales = [
"ca-ES",
"cs-CZ",
"de-DE",
"en-GB",
"en-US",
"es-ES",
"fa-IR",
"fr-FR",
"he-IL",
"hi-IN",
"it-IT",
"ja-JP",
"pl-PL",
"pt-BR",
"ru-RU",
"sv-SE",
"tr-TR",
"zh-CN",
"zh-TW"
"ca-ES",
"cs-CZ",
"de-DE",
"en-GB",
"en-US",
"es-ES",
"fa-IR",
"fr-FR",
"he-IL",
"hi-IN",
"it-IT",
"ja-JP",
"pl-PL",
"pt-BR",
"ru-RU",
"sv-SE",
"tr-TR",
"zh-CN",
"zh-TW"
] as const;
export const localePercentages: Record<AvailableLocales, number> = {
"en-US": 100,
"ca-ES": 0,
"cs-CZ": 0,
"de-DE": 36,
"en-GB": 2,
"es-ES": 63,
"fa-IR": 0,
"fr-FR": 67,
"he-IL": 0,
"hi-IN": 0,
"it-IT": 100,
"ja-JP": 100,
"pl-PL": 0,
"pt-BR": 74,
"ru-RU": 100,
"sv-SE": 98,
"tr-TR": 75,
"zh-CN": 100,
"zh-TW": 95
"ca-ES": 0,
"cs-CZ": 0,
"de-DE": 34,
"en-GB": 2,
"en-US": 100,
"es-ES": 61,
"fa-IR": 0,
"fr-FR": 64,
"he-IL": 0,
"hi-IN": 0,
"it-IT": 98,
"ja-JP": 98,
"pl-PL": 0,
"pt-BR": 71,
"ru-RU": 96,
"sv-SE": 94,
"tr-TR": 72,
"zh-CN": 98,
"zh-TW": 94
};
export const localeDirection: Record<AvailableLocales, "ltr" | "rtl"> = {
"ca-ES": "ltr",
8 changes: 3 additions & 5 deletions src/pages/background/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>YouTube Enhancer Background</title>
<script src="./index.ts" type="module"></script>
</head>

</html>
15 changes: 15 additions & 0 deletions src/pages/content/index.ts
Original file line number Diff line number Diff line change
@@ -275,6 +275,16 @@ const storageChangeHandler = async (changes: StorageChanges, areaName: string) =
playerSpeed: options.player_speed
});
},
enable_hide_end_screen_cards: (__oldValue, newValue) => {
sendExtensionOnlyMessage("hideEndScreenCardsChange", {
hideEndScreenCardsEnabled: newValue
});
},
enable_hide_live_stream_chat: (__oldValue, newValue) => {
sendExtensionOnlyMessage("hideLiveStreamChatChange", {
hideLiveStreamChatEnabled: newValue
});
},
enable_hide_scrollbar: (__oldValue, newValue) => {
sendExtensionOnlyMessage("hideScrollBarChange", {
hideScrollBarEnabled: newValue
@@ -285,6 +295,11 @@ const storageChangeHandler = async (changes: StorageChanges, areaName: string) =
hideShortsEnabled: newValue
});
},
enable_hide_translate_comment: (__oldValue, newValue) => {
sendExtensionOnlyMessage("hideTranslateCommentChange", {
hideTranslateCommentEnabled: newValue
});
},
enable_loop_button: (__oldValue, newValue) => {
sendExtensionOnlyMessage("loopButtonChange", {
loopButtonEnabled: newValue
56 changes: 43 additions & 13 deletions src/pages/embedded/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
import { deepDarkPresets } from "@/src/deepDarkPresets";
import { type FeatureFuncRecord, featureButtonFunctions } from "@/src/features";
import { automaticTheaterMode } from "@/src/features/automaticTheaterMode";
import { enableAutomaticTheaterMode } from "@/src/features/automaticTheaterMode";
import { featuresInControls } from "@/src/features/buttonPlacement";
import { checkIfFeatureButtonExists, getFeatureButton, updateFeatureButtonTitle } from "@/src/features/buttonPlacement/utils";
import { disableCustomCSS, enableCustomCSS } from "@/src/features/customCSS";
@@ -10,9 +10,12 @@ import { disableDeepDarkCSS, enableDeepDarkCSS } from "@/src/features/deepDarkCS
import { deepDarkCSSExists, getDeepDarkCustomThemeStyle, updateDeepDarkCSS } from "@/src/features/deepDarkCSS/utils";
import { enableFeatureMenu, setupFeatureMenuEventListeners } from "@/src/features/featureMenu";
import { featuresInMenu, getFeatureMenuItem, updateFeatureMenuItemLabel, updateFeatureMenuTitle } from "@/src/features/featureMenu/utils";
import { disableHideEndScreenCards, enableHideEndScreenCards } from "@/src/features/hideEndScreenCards";
import { disableHideLiveStreamChat, enableHideLiveStreamChat } from "@/src/features/hideLiveStreamChat";
import { enableHideScrollBar } from "@/src/features/hideScrollBar";
import { hideScrollBar, showScrollBar } from "@/src/features/hideScrollBar/utils";
import { disableHideShorts, enableHideShorts } from "@/src/features/hideShorts";
import { disableHideTranslateComment, enableHideTranslateComment } from "@/src/features/hideTranslateComment";
import { addLoopButton, removeLoopButton } from "@/src/features/loopButton";
import { addMaximizePlayerButton, removeMaximizePlayerButton } from "@/src/features/maximizePlayerButton";
import { maximizePlayer } from "@/src/features/maximizePlayerButton/utils";
@@ -28,9 +31,9 @@ import {
} from "@/src/features/playbackSpeedButtons";
import setPlayerQuality from "@/src/features/playerQuality";
import { restorePlayerSpeed, setPlayerSpeed, setupPlaybackSpeedChangeListener } from "@/src/features/playerSpeed";
import { removeRemainingTimeDisplay, setupRemainingTime } from "@/src/features/remainingTime";
import { setupRemainingTime as enableRemainingTime, removeRemainingTimeDisplay } from "@/src/features/remainingTime";
import enableRememberVolume from "@/src/features/rememberVolume";
import removeRedirect from "@/src/features/removeRedirect";
import enableRemoveRedirect from "@/src/features/removeRedirect";
import { addScreenshotButton, removeScreenshotButton } from "@/src/features/screenshotButton";
import adjustSpeedOnScrollWheel from "@/src/features/scrollWheelSpeedControl";
import adjustVolumeOnScrollWheel from "@/src/features/scrollWheelVolumeControl";
@@ -119,13 +122,14 @@ const alwaysShowProgressBar = async function () {
};

const enableFeatures = () => {
browserColorLog(`Enabling features...`, "FgMagenta");
void (async () => {
// Wait for the specified container selectors to be available on the page
await waitForAllElements(["div#player", "div#player-wide-container", "div#video-container", "div#player-container"]);
eventManager.removeAllEventListeners(["featureMenu"]);
void Promise.all([
enableHideShorts(),
removeRedirect(),
enableRemoveRedirect(),
enableShareShortener(),
enableSkipContinueWatching(),
enablePauseBackgroundPlayers(),
@@ -143,14 +147,17 @@ const enableFeatures = () => {
setupPlaybackSpeedChangeListener(),
enableShortsAutoScroll(),
enableOpenYouTubeSettingsOnHover(),
enableHideLiveStreamChat(),
enableRememberVolume(),
automaticTheaterMode(),
setupRemainingTime(),
enableAutomaticTheaterMode(),
enableRemainingTime(),
volumeBoost(),
setPlayerQuality(),
setPlayerSpeed(),
adjustVolumeOnScrollWheel(),
adjustSpeedOnScrollWheel()
adjustSpeedOnScrollWheel(),
enableHideTranslateComment(),
enableHideEndScreenCards()
]);
// Enable feature menu before calling button functions
await enableFeatureMenu();
@@ -173,11 +180,9 @@ window.addEventListener("DOMContentLoaded", function () {
} = response;
const i18nextInstance = await i18nService(language);
window.i18nextInstance = i18nextInstance;

// Listen to YouTube's soft navigate event
document.addEventListener("yt-navigate-finish", enableFeatures);
document.addEventListener("yt-player-updated", enableFeatures);

/**
* Listens for the "yte-message-from-youtube" event and handles incoming messages from the YouTube page.
*
@@ -231,10 +236,8 @@ window.addEventListener("DOMContentLoaded", function () {
}
case "per_video": {
const volumeBoostButton = getFeatureMenuItem("volumeBoostButton") ?? getFeatureButton("volumeBoostButton");
console.log(volumeBoostButton);
if (!volumeBoostButton) return;
const volumeBoostForVideoEnabled = volumeBoostButton.ariaChecked === "true";
console.log(volumeBoostForVideoEnabled, volumeBoostButton.ariaChecked);
if (volumeBoostForVideoEnabled) applyVolumeBoost(volumeBoostAmount);
}
}
@@ -262,6 +265,14 @@ window.addEventListener("DOMContentLoaded", function () {
}
break;
}
case "hideEndScreenCardsChange": {
const {
data: { hideEndScreenCardsEnabled }
} = message;
if (hideEndScreenCardsEnabled) await enableHideEndScreenCards();
else await disableHideEndScreenCards();
break;
}
case "maximizeButtonChange": {
const {
data: { maximizePlayerButtonEnabled }
@@ -300,7 +311,7 @@ window.addEventListener("DOMContentLoaded", function () {
data: { remainingTimeEnabled }
} = message;
if (remainingTimeEnabled) {
await setupRemainingTime();
await enableRemainingTime();
} else {
removeRemainingTimeDisplay();
}
@@ -363,6 +374,14 @@ window.addEventListener("DOMContentLoaded", function () {
}
break;
}
case "hideTranslateCommentChange": {
const {
data: { hideTranslateCommentEnabled }
} = message;
if (hideTranslateCommentEnabled) await enableHideTranslateComment();
else await disableHideTranslateComment();
break;
}
case "hideScrollBarChange": {
const scrollBarHidden = document.getElementById("yte-hide-scroll-bar") !== null;
const {
@@ -390,6 +409,17 @@ window.addEventListener("DOMContentLoaded", function () {
}
break;
}
case "hideLiveStreamChatChange": {
const {
data: { hideLiveStreamChatEnabled }
} = message;
if (hideLiveStreamChatEnabled) {
await enableHideLiveStreamChat();
} else {
await disableHideLiveStreamChat();
}
break;
}
case "languageChange": {
const {
data: { language }
@@ -495,7 +525,7 @@ window.addEventListener("DOMContentLoaded", function () {
data: { removeRedirectEnabled }
} = message;
if (removeRedirectEnabled) {
await removeRedirect();
await enableRemoveRedirect();
}
break;
}
6 changes: 6 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -273,8 +273,11 @@ export type ExtensionSendOnlyMessageMappings = {
{ deepDarkCustomThemeColors: DeepDarkCustomThemeColors; deepDarkPreset: DeepDarkPreset; deepDarkThemeEnabled: boolean }
>;
featureMenuOpenTypeChange: DataResponseMessage<"featureMenuOpenTypeChange", { featureMenuOpenType: FeatureMenuOpenType }>;
hideEndScreenCardsChange: DataResponseMessage<"hideEndScreenCardsChange", { hideEndScreenCardsEnabled: boolean }>;
hideLiveStreamChatChange: DataResponseMessage<"hideLiveStreamChatChange", { hideLiveStreamChatEnabled: boolean }>;
hideScrollBarChange: DataResponseMessage<"hideScrollBarChange", { hideScrollBarEnabled: boolean }>;
hideShortsChange: DataResponseMessage<"hideShortsChange", { hideShortsEnabled: boolean }>;
hideTranslateCommentChange: DataResponseMessage<"hideTranslateCommentChange", { hideTranslateCommentEnabled: boolean }>;
languageChange: DataResponseMessage<"languageChange", { language: AvailableLocales }>;
loopButtonChange: DataResponseMessage<"loopButtonChange", { loopButtonEnabled: boolean }>;
maximizeButtonChange: DataResponseMessage<"maximizeButtonChange", { maximizePlayerButtonEnabled: boolean }>;
@@ -352,8 +355,11 @@ export type configuration = {
enable_custom_css: boolean;
enable_deep_dark_theme: boolean;
enable_forced_playback_speed: boolean;
enable_hide_end_screen_cards: boolean;
enable_hide_live_stream_chat: boolean;
enable_hide_scrollbar: boolean;
enable_hide_shorts: boolean;
enable_hide_translate_comment: boolean;
enable_loop_button: boolean;
enable_maximize_player_button: boolean;
enable_open_transcript_button: boolean;
6 changes: 6 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -46,8 +46,11 @@ export const defaultConfiguration = {
enable_custom_css: false,
enable_deep_dark_theme: false,
enable_forced_playback_speed: false,
enable_hide_end_screen_cards: false,
enable_hide_live_stream_chat: false,
enable_hide_scrollbar: false,
enable_hide_shorts: false,
enable_hide_translate_comment: false,
enable_loop_button: false,
enable_maximize_player_button: false,
enable_open_transcript_button: false,
@@ -126,8 +129,11 @@ export const configurationImportSchema: TypeToPartialZodSchema<
enable_custom_css: z.boolean().optional(),
enable_deep_dark_theme: z.boolean().optional(),
enable_forced_playback_speed: z.boolean().optional(),
enable_hide_end_screen_cards: z.boolean().optional(),
enable_hide_live_stream_chat: z.boolean().optional(),
enable_hide_scrollbar: z.boolean().optional(),
enable_hide_shorts: z.boolean().optional(),
enable_hide_translate_comment: z.boolean().optional(),
enable_loop_button: z.boolean().optional(),
enable_maximize_player_button: z.boolean().optional(),
enable_open_transcript_button: z.boolean().optional(),
25 changes: 15 additions & 10 deletions src/utils/utilities.ts
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ import type {
Selector,
SendDataMessage,
SingleButtonFeatureNames,
SingleButtonNames,
YoutubePlayerQualityLevel
} from "../types";
import type { SVGElementAttributes } from "./SVGElementAttributes";
@@ -52,15 +53,13 @@ export function chooseClosestQuality(
if (availableQualities.length === 0) {
return null;
}

// If the selected quality is available, return it
if (availableQualities.includes(selectedQuality)) {
return selectedQuality;
}
// Find the index of the selected quality in the array
const selectedIndex = youtubePlayerQualityLevels.indexOf(selectedQuality);

// If the selected quality is not in the array, return null
if (selectedIndex === -1) {
return null;
}

// Find the available quality levels that are closest to the selected quality level
const closestQualities = availableQualities.reduce(
(acc, quality) => {
@@ -73,9 +72,6 @@ export function chooseClosestQuality(
[] as { difference: number; quality: YoutubePlayerQualityLevel }[]
);

// Sort the closest qualities by difference in ascending order
closestQualities.sort((a, b) => a.difference - b.difference);

// Return the quality level with the minimum difference
return closestQualities[0].quality;
}
@@ -467,7 +463,7 @@ export function createTooltip({
direction?: "down" | "left" | "right" | "up";
element: HTMLElement;
featureName: FeatureName;
id: `yte-feature-${FeatureName}-tooltip`;
id: `yte-feature-${AllButtonNames | Exclude<FeatureName, SingleButtonNames>}-tooltip`;
text?: string;
}): {
listener: () => void;
@@ -654,6 +650,15 @@ export function getPathValue<T, P extends Path<T>>(obj: T, path: P): PathValue<T

return value as PathValue<T, P>;
}
export type ModifyElementAction = "add" | "remove";
export type ElementClassPair = { className: string; element: Nullable<Element> };
export function modifyElementClassList(action: ModifyElementAction, elementPair: ElementClassPair) {
const { className, element } = elementPair;
element?.classList[action](className);
}
export function modifyElementsClassList(action: ModifyElementAction, elements: ElementClassPair[]) {
elements.forEach((element) => modifyElementClassList(action, element));
}
export function findKeyByValue(value: Exclude<AllButtonNames, SingleButtonFeatureNames>) {
for (const [key, values] of featureToMultiButtonsMap.entries()) {
if (values.includes(value)) {

0 comments on commit 5d3d358

Please sign in to comment.