mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-21 13:53:01 +01:00
Merge pull request #710 from shadoxxhd/main
fix dislike text box not being found for some users
This commit is contained in:
3 files changed
+37
-8
No files matched your search
@@ -94,10 +94,25 @@ function getLikeButton() {
|
||||
return getButtons().children[0];
|
||||
}
|
||||
|
||||
function getLikeTextContainer() {
|
||||
return (
|
||||
getLikeButton().querySelector("#text") ??
|
||||
getLikeButton().getElementsByTagName("yt-formatted-string")[0]
|
||||
);
|
||||
}
|
||||
|
||||
function getDislikeButton() {
|
||||
return getButtons().children[1];
|
||||
}
|
||||
|
||||
function getDislikeTextContainer() {
|
||||
return (
|
||||
getDislikeButton().querySelector("#text") ??
|
||||
getDislikeButton().getElementsByTagName("yt-formatted-string")[0]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
let mutationObserver = new Object();
|
||||
|
||||
if (isShorts() && mutationObserver.exists !== true) {
|
||||
@@ -197,7 +212,7 @@ function setLikes(likesCount) {
|
||||
likesCount;
|
||||
return;
|
||||
}
|
||||
getButtons().children[0].querySelector("#text").innerText = likesCount;
|
||||
getLikeTextContainer().innerText = likesCount;
|
||||
}
|
||||
|
||||
function setDislikes(dislikesCount) {
|
||||
@@ -205,7 +220,7 @@ function setDislikes(dislikesCount) {
|
||||
mobileDislikes = dislikesCount;
|
||||
return;
|
||||
}
|
||||
getButtons().children[1].querySelector("#text").innerText = dislikesCount;
|
||||
getDislikeTextContainer().innerText = dislikesCount;
|
||||
}
|
||||
|
||||
function getLikeCountFromButton() {
|
||||
|
||||
@@ -36,10 +36,25 @@ function getLikeButton() {
|
||||
return getButtons().children[0];
|
||||
}
|
||||
|
||||
function getLikeTextContainer() {
|
||||
return (
|
||||
getLikeButton().querySelector("#text") ??
|
||||
getLikeButton().getElementsByTagName("yt-formatted-string")[0]
|
||||
);
|
||||
}
|
||||
|
||||
function getDislikeButton() {
|
||||
return getButtons().children[1];
|
||||
}
|
||||
|
||||
function getDislikeTextContainer() {
|
||||
return (
|
||||
getDislikeButton().querySelector("#text") ??
|
||||
getDislikeButton().getElementsByTagName("yt-formatted-string")[0]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function checkForSignInButton() {
|
||||
if (
|
||||
document.querySelector(
|
||||
@@ -52,4 +67,4 @@ function checkForSignInButton() {
|
||||
}
|
||||
}
|
||||
|
||||
export { getButtons, getLikeButton, getDislikeButton, checkForSignInButton };
|
||||
export { getButtons, getLikeButton, getDislikeButton, getLikeTextContainer, getDislikeTextContainer, checkForSignInButton };
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getLikeButton, getDislikeButton, getButtons } from "./buttons";
|
||||
import { getLikeButton, getDislikeButton, getButtons, getLikeTextContainer, getDislikeTextContainer } from "./buttons";
|
||||
import { createRateBar } from "./bar";
|
||||
import {
|
||||
getBrowser,
|
||||
@@ -127,7 +127,7 @@ function getState(storedData) {
|
||||
|
||||
//--- Sets The Likes And Dislikes Values ---//
|
||||
function setLikes(likesCount) {
|
||||
getButtons().children[0].querySelector("#text").innerText = likesCount;
|
||||
getLikeTextContainer().innerText = likesCount;
|
||||
}
|
||||
|
||||
function setDislikes(dislikesCount) {
|
||||
@@ -138,7 +138,7 @@ function setDislikes(dislikesCount) {
|
||||
).innerText = dislikesCount;
|
||||
return;
|
||||
}
|
||||
getButtons().children[1].querySelector("#text").innerText = dislikesCount;
|
||||
getDislikeTextContainer().innerText = dislikesCount;
|
||||
} else {
|
||||
cLog("likes count disabled by creator");
|
||||
if (isMobile()) {
|
||||
@@ -147,8 +147,7 @@ function setDislikes(dislikesCount) {
|
||||
).innerText = localize("TextLikesDisabled");
|
||||
return;
|
||||
}
|
||||
getButtons().children[1].querySelector("#text").innerText =
|
||||
localize("TextLikesDisabled");
|
||||
getDislikeTextContainer().innerText = localize("TextLikesDisabled");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user