mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-23 14:53:01 +01:00
fix get count dislikes on mobile version of youtube (#888)
* fix (ryd.content.script.js, events.js) fix get count likes on mobile version of yt (tested on android device) * fix fallback solution for get dislikes
This commit is contained in:
1 parent
9a44acf89d
commit
a6c945a4eb
2 files changed
+19
-8
No files matched your search
@@ -44,18 +44,27 @@ import {
|
||||
initExtConfig();
|
||||
|
||||
let jsInitChecktimer = null;
|
||||
let isSetInitialStateDone = false;
|
||||
|
||||
function setEventListeners(evt) {
|
||||
function checkForJS_Finish() {
|
||||
if (isShorts() || (getButtons()?.offsetParent && isVideoLoaded())) {
|
||||
addLikeDislikeEventListener();
|
||||
setInitialState();
|
||||
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
||||
clearInterval(jsInitChecktimer);
|
||||
jsInitChecktimer = null;
|
||||
try {
|
||||
if (isShorts() || (getButtons()?.offsetParent && isVideoLoaded())) {
|
||||
addLikeDislikeEventListener();
|
||||
setInitialState();
|
||||
isSetInitialStateDone = true;
|
||||
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
||||
clearInterval(jsInitChecktimer);
|
||||
jsInitChecktimer = null;
|
||||
}
|
||||
} catch(exception) {
|
||||
if(!isSetInitialStateDone) {
|
||||
setInitialState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jsInitChecktimer = setInterval(checkForJS_Finish, 111);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,11 @@ function dislikeClicked() {
|
||||
function addLikeDislikeEventListener() {
|
||||
if (!window.returnDislikeButtonlistenersSet) {
|
||||
getLikeButton().addEventListener("click", likeClicked);
|
||||
getDislikeButton().addEventListener("click", dislikeClicked);
|
||||
getLikeButton().addEventListener("touchstart", likeClicked);
|
||||
getLikeButton().addEventListener("touchstart", dislikeClicked);
|
||||
if(getDislikeButton()) {
|
||||
getDislikeButton().addEventListener("click", dislikeClicked);
|
||||
getDislikeButton().addEventListener("touchstart", dislikeClicked);
|
||||
}
|
||||
window.returnDislikeButtonlistenersSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user