mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-21 22:03:01 +01:00
Merge pull request #594 from cyrildtm/fixLikeUpdated
Fix like numbers re-format
This commit is contained in:
4 files changed
+30
-5
No files matched your search
@@ -204,10 +204,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;
|
||||
@@ -399,6 +399,12 @@ function likeClicked() {
|
||||
createRateBar(likesvalue, dislikesvalue);
|
||||
previousState = 1;
|
||||
}
|
||||
if (extConfig.numberDisplayReformatLikes === true) {
|
||||
const nativeLikes = getLikeCountFromButton();
|
||||
if (nativeLikes !== false) {
|
||||
setLikes(numberFormat(nativeLikes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,6 +426,12 @@ function dislikeClicked() {
|
||||
setDislikes(numberFormat(dislikesvalue));
|
||||
createRateBar(likesvalue, dislikesvalue);
|
||||
previousState = 2;
|
||||
if (extConfig.numberDisplayReformatLikes === true) {
|
||||
const nativeLikes = getLikeCountFromButton();
|
||||
if (nativeLikes !== false) {
|
||||
setLikes(numberFormat(nativeLikes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user