From 03d8d8c471625a143de7cb7199bb45e362558bf9 Mon Sep 17 00:00:00 2001 From: albert Date: Thu, 21 Feb 2013 14:37:36 -0500 Subject: [PATCH] add comment highlighting to post/show page --- app/assets/javascripts/comments.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/assets/javascripts/comments.js b/app/assets/javascripts/comments.js index 582edecf1..831103b40 100644 --- a/app/assets/javascripts/comments.js +++ b/app/assets/javascripts/comments.js @@ -7,6 +7,10 @@ this.initialize_reply_links(); this.initialize_expand_links(); } + + if ($("#c-posts").length && $("#a-show").length) { + Danbooru.Comment.highlight_threshold_comments(Danbooru.meta("post-id")); + } } Danbooru.Comment.quote_message = function(data) { @@ -63,6 +67,17 @@ } }) } + + Danbooru.Comment.hide_threshold_comments = function(post_id) { + var threshold = parseInt(Danbooru.meta("user-comment-threshold")); + var articles = $("article.comment[data-post-id=" + post_id + "]"); + articles.each(function(i, v) { + var $comment = $(v); + if (parseInt($comment.data("score")) < threshold) { + $comment.hide(); + } + }) + } })(); $(document).ready(function() {