fixed comment hiding

This commit is contained in:
albert
2011-09-11 16:40:58 -04:00
parent 7483ad2e28
commit 3395c97c65
8 changed files with 60 additions and 7 deletions

View File

@@ -5,6 +5,7 @@
$("div.dtext-preview").hide();
this.initialize_response_link();
this.initialize_preview_button();
this.hide_threshold_comments();
}
Danbooru.Comment.initialize_response_link = function() {
@@ -31,6 +32,37 @@
});
});
}
Danbooru.Comment.highlight_threshold_comments = function(post_id) {
var threshold = parseInt(Danbooru.meta("user-comment-threshold"));
var articles = $("article.comment[data-post-id=" + post_id + "]");
console.log("articles=%o", articles);
articles.each(function(i, v) {
var $comment = $(v);
console.log("testing %o", $comment);
if (parseInt($comment.data("score")) < threshold) {
$comment.addClass("below-threshold");
}
})
}
Danbooru.Comment.hide_threshold_comments = function(post_id) {
var threshold = parseInt(Danbooru.meta("user-comment-threshold"));
var articles = null;
if (post_id) {
articles = $("article.comment[data-post-id=" + post_id + "]");
} else {
articles = $("article.comment");
}
articles.each(function(i, v) {
var $comment = $(v);
if (parseInt($comment.data("score")) < threshold) {
$comment.hide();
}
});
}
})();
$(document).ready(function() {