From 3ee7201f5d1eb9655fc11f0f377529ec71a3b834 Mon Sep 17 00:00:00 2001
From: Omar Roth
Date: Sat, 20 Oct 2018 13:52:06 -0500
Subject: [PATCH] Comma seperate comment scores
---
assets/js/watch.js | 7 -------
src/invidious/comments.cr | 4 ++--
src/invidious/views/watch.ecr | 9 ++++++++-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/assets/js/watch.js b/assets/js/watch.js
index 4a84769e..99500686 100644
--- a/assets/js/watch.js
+++ b/assets/js/watch.js
@@ -28,13 +28,6 @@ function swap_comments(source) {
}
}
-function commaSeparateNumber(val) {
- while (/(\d+)(\d{3})/.test(val.toString())) {
- val = val.toString().replace(/(\d+)(\d{3})/, "$1" + "," + "$2");
- }
- return val;
-}
-
String.prototype.supplant = function(o) {
return this.replace(/{([^{}]*)}/g, function(a, b) {
var r = o[b];
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index 98062f4e..6a42701c 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -115,7 +115,7 @@ def template_youtube_comments(comments)
#{child["contentHtml"]}
#{recode_date(Time.epoch(child["published"].as_i64))} ago
|
- #{child["likeCount"]}
+ #{number_with_separator(child["likeCount"])}
#{replies_html}
@@ -158,7 +158,7 @@ def template_reddit_comments(root)
[ - ]
#{author}
- #{score} points
+ #{number_with_separator(score)} points
#{recode_date(child.created_utc)} ago
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 4fbd4d5b..9424bd10 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -152,6 +152,13 @@