mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-01 10:21:22 +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 setEventListeners(evt) {
|
||||||
function checkForJS_Finish() {
|
function checkForJS_Finish() {
|
||||||
if (isShorts() || getButtons()?.offsetParent && isVideoLoaded()) {
|
if (isShorts() || getButtons()?.offsetParent && isVideoLoaded()) {
|
||||||
clearInterval(jsInitChecktimer);
|
|
||||||
jsInitChecktimer = null;
|
|
||||||
addLikeDislikeEventListener();
|
addLikeDislikeEventListener();
|
||||||
setInitialState();
|
setInitialState();
|
||||||
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
||||||
|
clearInterval(jsInitChecktimer);
|
||||||
|
jsInitChecktimer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { isInViewport } from "./utils";
|
|||||||
function getButtons() {
|
function getButtons() {
|
||||||
//--- If Watching Youtube Shorts: ---//
|
//--- If Watching Youtube Shorts: ---//
|
||||||
if(isShorts()) {
|
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) {
|
for(let element of elements) {
|
||||||
//Youtube Shorts can have multiple like/dislike buttons when scrolling through videos
|
//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)
|
//However, only one of them should be visible (no matter how you zoom)
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ function addLikeDislikeEventListener() {
|
|||||||
if (!window.returnDislikeButtonlistenersSet) {
|
if (!window.returnDislikeButtonlistenersSet) {
|
||||||
buttons.children[0].addEventListener("click", likeClicked);
|
buttons.children[0].addEventListener("click", likeClicked);
|
||||||
buttons.children[1].addEventListener("click", dislikeClicked);
|
buttons.children[1].addEventListener("click", dislikeClicked);
|
||||||
|
buttons.children[0].addEventListener("touchstart", likeClicked);
|
||||||
|
buttons.children[1].addEventListener("touchstart", dislikeClicked);
|
||||||
window.returnDislikeButtonlistenersSet = true;
|
window.returnDislikeButtonlistenersSet = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user