(userscript) additional like number fixes

synchronize with extension
This commit is contained in:
Aneimytis committed 2022-05-08 05:55:44 -05:00
1 parent 1d3f71170b
commit 013bb5d37d
1 file changed
+2 -6
@@ -203,10 +203,10 @@ function getLikeCountFromButton() {
if (isShorts()) {
//Youtube Shorts don't work with this query. It's not nessecary; 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.
return 0;
return false;
}
let likesStr = getLikeButton()
.querySelector("button")
.querySelector("yt-formatted-string#text")
.getAttribute("aria-label")
.replace(/\D/g, "");
return likesStr.length > 0 ? parseInt(likesStr) : false;
@@ -376,8 +376,6 @@ function likeClicked() {
const nativeLikes = getLikeCountFromButton();
if (nativeLikes !== false) {
setLikes(numberFormat(nativeLikes));
} else {
setLikes(numberFormat(storedData.likes));
}
}
}
@@ -405,8 +403,6 @@ function dislikeClicked() {
const nativeLikes = getLikeCountFromButton();
if (nativeLikes !== false) {
setLikes(numberFormat(nativeLikes));
} else {
setLikes(numberFormat(storedData.likes));
}
}
}