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() {