Merge branch 'main' into CustomNumberFormat

This commit is contained in:
Dmitrii Selivanov authored and GitHub committed 2022-03-20 20:32:21 +03:00
commit e97b4a75af
29 files changed
+520 -91

No files matched your search

+11 -1
View File
@@ -29,6 +29,10 @@ function isMobile() {
return location.hostname == "m.youtube.com";
}
function isShorts() {
return location.pathname.startsWith("/shorts")
}
function isVideoLiked() {
if (isMobile()) {
return (
@@ -74,7 +78,7 @@ function setDislikes(dislikesCount) {
}
getButtons().children[1].querySelector("#text").innerText = dislikesCount;
} else {
cLog("likes count diabled by creator");
cLog("likes count disabled by creator");
if (isMobile()) {
getButtons().children[1].querySelector(
".button-renderer-text"
@@ -87,6 +91,11 @@ function setDislikes(dislikesCount) {
}
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;
}
let likesStr = getLikeButton()
.querySelector("button")
.getAttribute("aria-label")
@@ -181,6 +190,7 @@ function initializeNumberDisplayFormat() {
export {
isMobile,
isShorts,
isVideoDisliked,
isVideoLiked,
getState,