mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-22 14:23:01 +01:00
Mobile Extensions: Supports YouTube Shorts
This commit is contained in:
1 parent
0630627d3b
commit
73e58beac4
3 files changed
+5
-3
No files matched your search
@@ -37,11 +37,11 @@ let jsInitChecktimer = null;
|
||||
function setEventListeners(evt) {
|
||||
function checkForJS_Finish() {
|
||||
if (isShorts() || getButtons()?.offsetParent && isVideoLoaded()) {
|
||||
clearInterval(jsInitChecktimer);
|
||||
jsInitChecktimer = null;
|
||||
addLikeDislikeEventListener();
|
||||
setInitialState();
|
||||
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
||||
clearInterval(jsInitChecktimer);
|
||||
jsInitChecktimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { isInViewport } from "./utils";
|
||||
function getButtons() {
|
||||
//--- If Watching Youtube Shorts: ---//
|
||||
if(isShorts()) {
|
||||
let elements=document.querySelectorAll("#like-button > ytd-like-button-renderer")
|
||||
let elements=document.querySelectorAll(isMobile() ? "ytm-like-button-renderer" : "#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)
|
||||
|
||||
@@ -100,6 +100,8 @@ function addLikeDislikeEventListener() {
|
||||
if (!window.returnDislikeButtonlistenersSet) {
|
||||
buttons.children[0].addEventListener("click", likeClicked);
|
||||
buttons.children[1].addEventListener("click", dislikeClicked);
|
||||
buttons.children[0].addEventListener("touchstart", likeClicked);
|
||||
buttons.children[1].addEventListener("touchstart", dislikeClicked);
|
||||
window.returnDislikeButtonlistenersSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user