add a feature for showing upvote ratio in posts #147

This commit is contained in:
teddit
2021-03-18 18:31:41 +01:00
parent bd4bc75298
commit 465e599dee
6 changed files with 31 additions and 0 deletions
+6
View File
@@ -41,6 +41,9 @@ html
.score
div.arrow
span #{kFormatter(post.ups)}
if user_preferences.show_upvoted_percentage === 'true'
- let downvoted = parseInt(post.ups * (1 - post.upvote_ratio))
span.ratio(title="~"+ downvoted +" downvoted") #{post.upvote_ratio * 100}%
div.arrow.down
.title
a(href="" + post.url + "", rel="noopener noreferrer")
@@ -80,6 +83,9 @@ html
.score
div.arrow
span #{kFormatter(post.crosspost.ups)}
if user_preferences.show_upvoted_percentage === 'true'
- let downvoted = parseInt(post.ups * (1 - post.upvote_ratio))
span.ratio(title="~"+ downvoted +" downvoted") #{post.upvote_ratio * 100}%
div.arrow.down
p.submitted
span(title="" + toUTCString(post.crosspost.created) + "") submitted #{timeDifference(post.crosspost.created)} by
+6
View File
@@ -71,6 +71,12 @@ html
input(type="checkbox", name="collapse_child_comments", id="collapse_child_comments", checked="checked")
else
input(type="checkbox", name="collapse_child_comments", id="collapse_child_comments")
.setting
label(for="show_upvoted_percentage") Show upvote ratio percentage in posts:
if(user_preferences.show_upvoted_percentage == 'true')
input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage", checked="checked")
else
input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage")
legend Subscribed subreddits
.setting
details