From 15fadaad4119f70e3d625acbb57caa7651f81c20 Mon Sep 17 00:00:00 2001 From: ashley Date: Mon, 10 Jun 2024 21:33:40 +0000 Subject: [PATCH] ehe --- html/poketube.ejs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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