mirror of
https://github.com/SrIzan10/return-youtube-dislike.git
synced 2026-05-01 10:55:27 +00:00
@@ -219,6 +219,13 @@ function createRateBar(likes, dislikes) {
|
||||
likes + dislikes > 0 ? (likes / (likes + dislikes)) * 100 : 50;
|
||||
|
||||
if (!rateBar && !isMobile) {
|
||||
let colorLikeStyle = "";
|
||||
let colorDislikeStyle = "";
|
||||
if (extConfig.coloredBar) {
|
||||
colorLikeStyle = "; background-color: " + getColorFromTheme(true);
|
||||
colorDislikeStyle = "; background-color: " + getColorFromTheme(false);
|
||||
}
|
||||
|
||||
document.getElementById("menu-container").insertAdjacentHTML(
|
||||
"beforeend",
|
||||
`
|
||||
@@ -226,11 +233,11 @@ function createRateBar(likes, dislikes) {
|
||||
<div class="ryd-tooltip-bar-container">
|
||||
<div
|
||||
id="return-youtube-dislike-bar-container"
|
||||
style="width: 100%; height: 2px;"
|
||||
style="width: 100%; height: 2px;${colorDislikeStyle}"
|
||||
>
|
||||
<div
|
||||
id="return-youtube-dislike-bar"
|
||||
style="width: ${widthPercent}%; height: 100%"
|
||||
style="width: ${widthPercent}%; height: 100%${colorDislikeStyle}"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -250,6 +257,13 @@ function createRateBar(likes, dislikes) {
|
||||
document.querySelector(
|
||||
"#ryd-dislike-tooltip > #tooltip"
|
||||
).innerHTML = `${likes.toLocaleString()} / ${dislikes.toLocaleString()}`;
|
||||
|
||||
if (extConfig.coloredBar) {
|
||||
document.getElementById("return-youtube-dislike-bar-container").style.backgroundColor =
|
||||
getColorFromTheme(false);
|
||||
document.getElementById("return-youtube-dislike-bar").style.backgroundColor =
|
||||
getColorFromTheme(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,6 +282,10 @@ function setState() {
|
||||
dislikesvalue = dislikes;
|
||||
setDislikes(numberFormat(dislikes));
|
||||
createRateBar(likes, dislikes);
|
||||
if (extConfig.coloredThumbs === true) {
|
||||
getLikeButton().style.color = getColorFromTheme(true);
|
||||
getDislikeButton().style.color = getColorFromTheme(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -402,6 +420,34 @@ function getNumberFormatter(optionSelect) {
|
||||
return formatter;
|
||||
}
|
||||
|
||||
function getColorFromTheme(voteIsLike) {
|
||||
let colorString;
|
||||
switch (extConfig.colorTheme) {
|
||||
case "accessible":
|
||||
if (voteIsLike === true) {
|
||||
colorString = "dodgerblue";
|
||||
} else {
|
||||
colorString = "gold";
|
||||
}
|
||||
break;
|
||||
case "neon":
|
||||
if (voteIsLike === true) {
|
||||
colorString = "aqua";
|
||||
} else {
|
||||
colorString = "magenta";
|
||||
}
|
||||
break;
|
||||
case "classic":
|
||||
default:
|
||||
if (voteIsLike === true) {
|
||||
colorString = "lime";
|
||||
} else {
|
||||
colorString = "red";
|
||||
}
|
||||
}
|
||||
return colorString;
|
||||
}
|
||||
|
||||
function setEventListeners(evt) {
|
||||
let jsInitChecktimer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user