mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 02:41:22 +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();
|
initExtConfig();
|
||||||
|
|
||||||
let jsInitChecktimer = null;
|
let jsInitChecktimer = null;
|
||||||
|
let isSetInitialStateDone = false;
|
||||||
|
|
||||||
function setEventListeners(evt) {
|
function setEventListeners(evt) {
|
||||||
function checkForJS_Finish() {
|
function checkForJS_Finish() {
|
||||||
if (isShorts() || (getButtons()?.offsetParent && isVideoLoaded())) {
|
try {
|
||||||
addLikeDislikeEventListener();
|
if (isShorts() || (getButtons()?.offsetParent && isVideoLoaded())) {
|
||||||
setInitialState();
|
addLikeDislikeEventListener();
|
||||||
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
setInitialState();
|
||||||
clearInterval(jsInitChecktimer);
|
isSetInitialStateDone = true;
|
||||||
jsInitChecktimer = null;
|
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
||||||
|
clearInterval(jsInitChecktimer);
|
||||||
|
jsInitChecktimer = null;
|
||||||
|
}
|
||||||
|
} catch(exception) {
|
||||||
|
if(!isSetInitialStateDone) {
|
||||||
|
setInitialState();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
jsInitChecktimer = setInterval(checkForJS_Finish, 111);
|
jsInitChecktimer = setInterval(checkForJS_Finish, 111);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,9 +85,11 @@ function dislikeClicked() {
|
|||||||
function addLikeDislikeEventListener() {
|
function addLikeDislikeEventListener() {
|
||||||
if (!window.returnDislikeButtonlistenersSet) {
|
if (!window.returnDislikeButtonlistenersSet) {
|
||||||
getLikeButton().addEventListener("click", likeClicked);
|
getLikeButton().addEventListener("click", likeClicked);
|
||||||
getDislikeButton().addEventListener("click", dislikeClicked);
|
|
||||||
getLikeButton().addEventListener("touchstart", likeClicked);
|
getLikeButton().addEventListener("touchstart", likeClicked);
|
||||||
getLikeButton().addEventListener("touchstart", dislikeClicked);
|
if(getDislikeButton()) {
|
||||||
|
getDislikeButton().addEventListener("click", dislikeClicked);
|
||||||
|
getDislikeButton().addEventListener("touchstart", dislikeClicked);
|
||||||
|
}
|
||||||
window.returnDislikeButtonlistenersSet = true;
|
window.returnDislikeButtonlistenersSet = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user