mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 10:52:20 +01:00
(userscript) additional like number fixes
synchronize with extension
This commit is contained in:
1 parent
1d3f71170b
commit
013bb5d37d
1 file changed
+2
-6
@@ -203,10 +203,10 @@ function getLikeCountFromButton() {
|
|||||||
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 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.
|
//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()
|
let likesStr = getLikeButton()
|
||||||
.querySelector("button")
|
.querySelector("yt-formatted-string#text")
|
||||||
.getAttribute("aria-label")
|
.getAttribute("aria-label")
|
||||||
.replace(/\D/g, "");
|
.replace(/\D/g, "");
|
||||||
return likesStr.length > 0 ? parseInt(likesStr) : false;
|
return likesStr.length > 0 ? parseInt(likesStr) : false;
|
||||||
@@ -376,8 +376,6 @@ function likeClicked() {
|
|||||||
const nativeLikes = getLikeCountFromButton();
|
const nativeLikes = getLikeCountFromButton();
|
||||||
if (nativeLikes !== false) {
|
if (nativeLikes !== false) {
|
||||||
setLikes(numberFormat(nativeLikes));
|
setLikes(numberFormat(nativeLikes));
|
||||||
} else {
|
|
||||||
setLikes(numberFormat(storedData.likes));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -405,8 +403,6 @@ function dislikeClicked() {
|
|||||||
const nativeLikes = getLikeCountFromButton();
|
const nativeLikes = getLikeCountFromButton();
|
||||||
if (nativeLikes !== false) {
|
if (nativeLikes !== false) {
|
||||||
setLikes(numberFormat(nativeLikes));
|
setLikes(numberFormat(nativeLikes));
|
||||||
} else {
|
|
||||||
setLikes(numberFormat(storedData.likes));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user