mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-30 09:57:52 +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];
|
return getButtons().children[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLikeTextContainer() {
|
||||||
|
return (
|
||||||
|
getLikeButton().querySelector("#text") ??
|
||||||
|
getLikeButton().getElementsByTagName("yt-formatted-string")[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function getDislikeButton() {
|
function getDislikeButton() {
|
||||||
return getButtons().children[1];
|
return getButtons().children[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDislikeTextContainer() {
|
||||||
|
return (
|
||||||
|
getDislikeButton().querySelector("#text") ??
|
||||||
|
getDislikeButton().getElementsByTagName("yt-formatted-string")[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let mutationObserver = new Object();
|
let mutationObserver = new Object();
|
||||||
|
|
||||||
if (isShorts() && mutationObserver.exists !== true) {
|
if (isShorts() && mutationObserver.exists !== true) {
|
||||||
@@ -197,7 +212,7 @@ function setLikes(likesCount) {
|
|||||||
likesCount;
|
likesCount;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getButtons().children[0].querySelector("#text").innerText = likesCount;
|
getLikeTextContainer().innerText = likesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDislikes(dislikesCount) {
|
function setDislikes(dislikesCount) {
|
||||||
@@ -205,7 +220,7 @@ function setDislikes(dislikesCount) {
|
|||||||
mobileDislikes = dislikesCount;
|
mobileDislikes = dislikesCount;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getButtons().children[1].querySelector("#text").innerText = dislikesCount;
|
getDislikeTextContainer().innerText = dislikesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLikeCountFromButton() {
|
function getLikeCountFromButton() {
|
||||||
|
|||||||
@@ -36,10 +36,25 @@ function getLikeButton() {
|
|||||||
return getButtons().children[0];
|
return getButtons().children[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLikeTextContainer() {
|
||||||
|
return (
|
||||||
|
getLikeButton().querySelector("#text") ??
|
||||||
|
getLikeButton().getElementsByTagName("yt-formatted-string")[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function getDislikeButton() {
|
function getDislikeButton() {
|
||||||
return getButtons().children[1];
|
return getButtons().children[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDislikeTextContainer() {
|
||||||
|
return (
|
||||||
|
getDislikeButton().querySelector("#text") ??
|
||||||
|
getDislikeButton().getElementsByTagName("yt-formatted-string")[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function checkForSignInButton() {
|
function checkForSignInButton() {
|
||||||
if (
|
if (
|
||||||
document.querySelector(
|
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 { createRateBar } from "./bar";
|
||||||
import {
|
import {
|
||||||
getBrowser,
|
getBrowser,
|
||||||
@@ -127,7 +127,7 @@ function getState(storedData) {
|
|||||||
|
|
||||||
//--- Sets The Likes And Dislikes Values ---//
|
//--- Sets The Likes And Dislikes Values ---//
|
||||||
function setLikes(likesCount) {
|
function setLikes(likesCount) {
|
||||||
getButtons().children[0].querySelector("#text").innerText = likesCount;
|
getLikeTextContainer().innerText = likesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDislikes(dislikesCount) {
|
function setDislikes(dislikesCount) {
|
||||||
@@ -138,7 +138,7 @@ function setDislikes(dislikesCount) {
|
|||||||
).innerText = dislikesCount;
|
).innerText = dislikesCount;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getButtons().children[1].querySelector("#text").innerText = dislikesCount;
|
getDislikeTextContainer().innerText = dislikesCount;
|
||||||
} else {
|
} else {
|
||||||
cLog("likes count disabled by creator");
|
cLog("likes count disabled by creator");
|
||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
@@ -147,8 +147,7 @@ function setDislikes(dislikesCount) {
|
|||||||
).innerText = localize("TextLikesDisabled");
|
).innerText = localize("TextLikesDisabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getButtons().children[1].querySelector("#text").innerText =
|
getDislikeTextContainer().innerText = localize("TextLikesDisabled");
|
||||||
localize("TextLikesDisabled");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user