generated from JohnBra/vite-web-extension
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #482 from YouTube-Enhancer/dev
Dev
Showing
56 changed files
with
935 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+2.38 KB
...ranslation context screenshots/Miscellaneous Settings/Hide_End_Screen_Cards.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.08 KB
...ranslation context screenshots/Miscellaneous Settings/Hide_Live_Stream_Chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.95 KB
...on context screenshots/Miscellaneous Settings/Hide_Translate_Comment_Button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.5 KB
assets/translation context screenshots/YouTube Page/Buttons/Decrease_Limit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-6.83 KB
...anslation context screenshots/YouTube Page/Buttons/Decrease_Speed_By_Amount.png
Binary file not shown.
Binary file added
BIN
+4.22 KB
...anslation context screenshots/YouTube Page/Buttons/Decrease_Speed_To_Amount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+43.6 KB
assets/translation context screenshots/YouTube Page/Buttons/Increase_Limit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-5.14 KB
...anslation context screenshots/YouTube Page/Buttons/Increase_Speed_By_Amount.png
Binary file not shown.
Binary file added
BIN
+4.07 KB
...anslation context screenshots/YouTube Page/Buttons/Increase_Speed_To_Amount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.yte-hide-end-screen-cards { | ||
display: none !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
})) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.yte-hide-live-stream-chat { | ||
display: none !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.yte-hide-translate-comment { | ||
display: none !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 })); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters