Skip to content

Commit

Permalink
Big ternary replaced with if-else
Browse files Browse the repository at this point in the history
  • Loading branch information
Anarios committed Nov 5, 2023
1 parent adbd0fd commit 6239453
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Extensions/combined/src/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ function getLikeTextContainer() {
}

function getDislikeButton() {
return getButtons().children[0].tagName ===
"YTD-SEGMENTED-LIKE-DISLIKE-BUTTON-RENDERER"
? (getButtons().children[0].children[1] === undefined ? document.querySelector("#segmented-dislike-button") : getButtons().children[0].children[1])

: getButtons().children[0].tagName === "segmented-like-dislike-button-view-model"
? getButtons().children[0].querySelector("dislike-button-view-model")
: getButtons().children[1];
if (getButtons().children[0].tagName === 'YTD-SEGMENTED-LIKE-DISLIKE-BUTTON-RENDERER') {
if (getButtons().children[0].children[1] === undefined) {
return document.querySelector('#segmented-dislike-button');
} else {
return getButtons().children[0].children[1];
}
} else {
return getButtons().children[1];
}
}

function createDislikeTextContainer() {
Expand Down

0 comments on commit 6239453

Please sign in to comment.