comments.js: fix thresholded comments.
* Restore behavior of thresholded comments being greyed out (lost in 6fa0ae2cf).
* Set the `below-threshold` class for thresholded comments in the html instead of in javascript.
* Remove `include_below_threshold` param; it was always true when clicking "Show all comments".
This commit is contained in:
@@ -11,16 +11,8 @@ Comment.initialize_all = function() {
|
||||
this.initialize_expand_links();
|
||||
}
|
||||
|
||||
if ($("#c-posts").length && $("#a-show").length) {
|
||||
Comment.highlight_threshold_comments(Utility.meta("post-id"));
|
||||
}
|
||||
|
||||
$(window).on("danbooru:index_for_post", (_event, post_id, current_comment_section, include_below_threshold) => {
|
||||
if (include_below_threshold) {
|
||||
$("#threshold-comments-notice-for-" + post_id).hide();
|
||||
} else {
|
||||
Comment.highlight_threshold_comments(post_id);
|
||||
}
|
||||
$(window).on("danbooru:index_for_post", (_event, post_id, current_comment_section) => {
|
||||
$("#threshold-comments-notice-for-" + post_id).hide();
|
||||
Dtext.initialize_expandables(current_comment_section);
|
||||
});
|
||||
}
|
||||
@@ -67,17 +59,6 @@ Comment.show_edit_form = function(e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
Comment.highlight_threshold_comments = function(post_id) {
|
||||
var threshold = parseInt(Utility.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.addClass("below-threshold");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Comment.hide_threshold_comments = function(post_id) {
|
||||
var threshold = parseInt(Utility.meta("user-comment-threshold"));
|
||||
var articles = $("article.comment[data-post-id=" + post_id + "]");
|
||||
|
||||
Reference in New Issue
Block a user