Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Anarios/return-youtube-dislike.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Extensions/combined/src/buttons.js')
-rw-r--r--Extensions/combined/src/buttons.js23
1 files changed, 18 insertions, 5 deletions
diff --git a/Extensions/combined/src/buttons.js b/Extensions/combined/src/buttons.js
index 3b8cab4..6b344d9 100644
--- a/Extensions/combined/src/buttons.js
+++ b/Extensions/combined/src/buttons.js
@@ -33,7 +33,10 @@ function getButtons() {
}
function getLikeButton() {
- return getButtons().children[0];
+ return getButtons().children[0].tagName ===
+ "YTD-SEGMENTED-LIKE-DISLIKE-BUTTON-RENDERER"
+ ? getButtons().children[0].children[0]
+ : getButtons().children[0];
}
function getLikeTextContainer() {
@@ -44,14 +47,24 @@ function getLikeTextContainer() {
}
function getDislikeButton() {
- return getButtons().children[1];
+ return getButtons().children[0].tagName ===
+ "YTD-SEGMENTED-LIKE-DISLIKE-BUTTON-RENDERER"
+ ? getButtons().children[0].children[1]
+ : getButtons().children[1];
}
function getDislikeTextContainer() {
- return (
+ let result =
getDislikeButton().querySelector("#text") ??
- getDislikeButton().getElementsByTagName("yt-formatted-string")[0]
- );
+ getDislikeButton().getElementsByTagName("yt-formatted-string")[0];
+ if (result == null) {
+ let textSpan = document.createElement("span");
+ textSpan.id = "text";
+ getDislikeButton().querySelector("button").appendChild(textSpan);
+ getDislikeButton().querySelector("button").style.width = "auto";
+ result = getDislikeButton().querySelector("#text");
+ }
+ return result;
}
function checkForSignInButton() {