diff --git a/html/poketube.ejs b/html/poketube.ejs index 870499ac..ca9524c6 100644 --- a/html/poketube.ejs +++ b/html/poketube.ejs @@ -1383,10 +1383,22 @@ WIP! 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 num = parseFloat(percentage); + if (num >= 80) { + return 'green'; + } else if (num >= 50) { + return 'orange'; + } else { + return 'red'; + } + }; + + const likeColor = getLikePercentageColor(likePercentage); %> - <%= likePercentage %> of the users lieked the video!! + <%= likePercentage %> of the users lieked the video!!
RYD date created : <%=engagement.dateCreated.toLocaleString()%>
See in json