Extensions: Supports YouTube Shorts

This commit is contained in:
RyanBurgert219 committed 2022-03-20 05:54:20 -04:00
1 parent 39c3b49c7c
commit 1cc579d00d
5 files changed
+43 -4

No files matched your search

+14 -1
View File
@@ -1,6 +1,19 @@
import { isMobile } from "./state";
import { isMobile, isShorts } from "./state";
import { isInViewport } from "./utils";
function getButtons() {
//--- If Watching Youtube Shorts: ---//
if(isShorts()) {
let elements=document.querySelectorAll("#like-button > ytd-like-button-renderer")
for(let element of elements) {
//Youtube Shorts can have multiple like/dislike buttons when scrolling through videos
//However, only one of them should be visible (no matter how you zoom)
if(isInViewport(element)) {
return element;
}
}
}
//--- If Watching On Mobile: ---//
if (isMobile()) {
return document.querySelector(".slim-video-action-bar-actions");
}