mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 02:58:55 +01:00
ehe
This commit is contained in:
parent
2301392ba4
commit
15fadaad41
1 changed files with 14 additions and 2 deletions
|
@ -1383,10 +1383,22 @@ WIP! </a>
|
||||||
const total = likes + dislikes;
|
const total = likes + dislikes;
|
||||||
|
|
||||||
const likePercentage = total > 0 ? ((likes / total) * 100).toFixed(2) + '%' : '0%';
|
const likePercentage = total > 0 ? ((likes / total) * 100).toFixed(2) + '%' : '0%';
|
||||||
const dislikePercentage = total > 0 ? ((dislikes / total) * 100).toFixed(2) + '%' : '0%';
|
|
||||||
|
const getPercentageColor = (percentage) => {
|
||||||
|
const num = parseFloat(percentage);
|
||||||
|
if (num >= 80) {
|
||||||
|
return 'green';
|
||||||
|
} else if (num >= 50) {
|
||||||
|
return 'orange';
|
||||||
|
} else {
|
||||||
|
return 'red';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const likeColor = getLikePercentageColor(likePercentage);
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<span><%= likePercentage %></span> of the users lieked the video!!
|
<span style="color: <%= likeColor %>;"><%= likePercentage %></span> of the users lieked the video!! <br>
|
||||||
RYD date created : <%=engagement.dateCreated.toLocaleString()%> <br>
|
RYD date created : <%=engagement.dateCreated.toLocaleString()%> <br>
|
||||||
<a href="https://returnyoutubedislikeapi.com/votes?videoId=<%=inv_vid.videoId%>">See in json</a>
|
<a href="https://returnyoutubedislikeapi.com/votes?videoId=<%=inv_vid.videoId%>">See in json</a>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue