mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 03:48:35 +01:00
add dislikePercentage :3
This commit is contained in:
parent
bccb0a3928
commit
038b1f610f
1 changed files with 18 additions and 2 deletions
|
@ -1383,8 +1383,9 @@ WIP! </a>
|
|||
const total = likes + dislikes;
|
||||
|
||||
const likePercentage = total > 0 ? ((likes / total) * 100).toFixed(2) + '%' : '0%';
|
||||
const dislikePercentage = total > 0 ? ((dislikes / total) * 100).toFixed(2) + '%' : '0%';
|
||||
|
||||
const getPercentageColor = (percentage) => {
|
||||
const getLikePercentageColor = (percentage) => {
|
||||
const num = parseFloat(percentage);
|
||||
if (num >= 80) {
|
||||
return 'green';
|
||||
|
@ -1395,10 +1396,25 @@ WIP! </a>
|
|||
}
|
||||
};
|
||||
|
||||
const likeColor = getPercentageColor(likePercentage);
|
||||
const getDislikePercentageColor = (percentage) => {
|
||||
const num = parseFloat(percentage);
|
||||
if (num >= 50) {
|
||||
return 'red';
|
||||
} else if (num >= 20) {
|
||||
return 'orange';
|
||||
} else {
|
||||
return 'green';
|
||||
}
|
||||
};
|
||||
|
||||
const likeColor = getLikePercentageColor(likePercentage);
|
||||
const dislikeColor = getDislikePercentageColor(dislikePercentage);
|
||||
|
||||
%>
|
||||
|
||||
<span style="color: <%= likeColor %>;"><%= likePercentage %></span> of the users lieked the video!! <br>
|
||||
<span style="color: <%= dislikeColor %>;"><%= dislikePercentage %></span> of the users dislieked the video!! <br>
|
||||
|
||||
RYD date created : <%=engagement.dateCreated.toLocaleString()%> <br>
|
||||
<a href="https://returnyoutubedislikeapi.com/votes?videoId=<%=inv_vid.videoId%>">See in json</a>
|
||||
|
||||
|
|
Loading…
Reference in a new issue