|
@@ -133,10 +133,12 @@ function getState(storedData) {
|
|
|
|
|
|
//--- Sets The Likes And Dislikes Values ---//
|
|
//--- Sets The Likes And Dislikes Values ---//
|
|
function setLikes(likesCount) {
|
|
function setLikes(likesCount) {
|
|
|
|
+ cLog(`SET likes ${likesCount}`)
|
|
getLikeTextContainer().innerText = likesCount;
|
|
getLikeTextContainer().innerText = likesCount;
|
|
}
|
|
}
|
|
|
|
|
|
function setDislikes(dislikesCount) {
|
|
function setDislikes(dislikesCount) {
|
|
|
|
+ cLog(`SET dislikes ${dislikesCount}`)
|
|
getDislikeTextContainer()?.removeAttribute('is-empty');
|
|
getDislikeTextContainer()?.removeAttribute('is-empty');
|
|
if (!isLikesDisabled()) {
|
|
if (!isLikesDisabled()) {
|
|
if (isMobile()) {
|
|
if (isMobile()) {
|
|
@@ -161,13 +163,15 @@ function setDislikes(dislikesCount) {
|
|
function getLikeCountFromButton() {
|
|
function getLikeCountFromButton() {
|
|
try {
|
|
try {
|
|
if (isShorts()) {
|
|
if (isShorts()) {
|
|
- //Youtube Shorts don't work with this query. It's not nessecary; we can skip it and still see the results.
|
|
|
|
|
|
+ //Youtube Shorts don't work with this query. It's not necessary; we can skip it and still see the results.
|
|
//It should be possible to fix this function, but it's not critical to showing the dislike count.
|
|
//It should be possible to fix this function, but it's not critical to showing the dislike count.
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- let likesStr = getLikeButton()
|
|
|
|
- .querySelector("yt-formatted-string#text")
|
|
|
|
- .getAttribute("aria-label")
|
|
|
|
|
|
+ let likeButton = getLikeButton()
|
|
|
|
+ .querySelector("yt-formatted-string#text") ??
|
|
|
|
+ getLikeButton().querySelector("button");
|
|
|
|
+
|
|
|
|
+ let likesStr = likeButton.getAttribute("aria-label")
|
|
.replace(/\D/g, "");
|
|
.replace(/\D/g, "");
|
|
return likesStr.length > 0 ? parseInt(likesStr) : false;
|
|
return likesStr.length > 0 ? parseInt(likesStr) : false;
|
|
}
|
|
}
|
|
@@ -191,7 +195,7 @@ function processResponse(response, storedData) {
|
|
createRateBar(storedData.likes, storedData.dislikes);
|
|
createRateBar(storedData.likes, storedData.dislikes);
|
|
if (extConfig.coloredThumbs === true) {
|
|
if (extConfig.coloredThumbs === true) {
|
|
if (isShorts()) {
|
|
if (isShorts()) {
|
|
- // for shorts, leave deactived buttons in default color
|
|
|
|
|
|
+ // for shorts, leave deactivated buttons in default color
|
|
let shortLikeButton = getLikeButton().querySelector(
|
|
let shortLikeButton = getLikeButton().querySelector(
|
|
"tp-yt-paper-button#button"
|
|
"tp-yt-paper-button#button"
|
|
);
|
|
);
|