changes to comment expansion link in comment listing

This commit is contained in:
albert
2011-09-14 17:55:32 -04:00
parent 348d801db9
commit b817da8d82
3 changed files with 2 additions and 28 deletions

View File

@@ -5,7 +5,6 @@
$("div.dtext-preview").hide(); $("div.dtext-preview").hide();
this.initialize_response_link(); this.initialize_response_link();
this.initialize_preview_button(); this.initialize_preview_button();
this.hide_threshold_comments();
this.initialize_reply_links(); this.initialize_reply_links();
} }
@@ -61,33 +60,13 @@
Danbooru.Comment.highlight_threshold_comments = function(post_id) { Danbooru.Comment.highlight_threshold_comments = function(post_id) {
var threshold = parseInt(Danbooru.meta("user-comment-threshold")); var threshold = parseInt(Danbooru.meta("user-comment-threshold"));
var articles = $("article.comment[data-post-id=" + post_id + "]"); var articles = $("article.comment[data-post-id=" + post_id + "]");
console.log("articles=%o", articles);
articles.each(function(i, v) { articles.each(function(i, v) {
var $comment = $(v); var $comment = $(v);
console.log("testing %o", $comment);
if (parseInt($comment.data("score")) < threshold) { if (parseInt($comment.data("score")) < threshold) {
$comment.addClass("below-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() { $(document).ready(function() {

View File

@@ -602,7 +602,7 @@ div.comments-for-post {
} }
article.comment.below-threshold { article.comment.below-threshold {
opacity: 0.2; opacity: 0.3;
} }
article.comment.below-threshold:hover { article.comment.below-threshold:hover {

View File

@@ -31,14 +31,9 @@
<% end %> <% end %>
</div> </div>
<div class="row notices"> <div class="row notices">
<% if post.comments.count > 6 %>
<span class="info" id="hidden-comments-notice-for-<%= post.id %>"%>
<%= link_to "#{pluralize(post.comments.count - 6, 'more comment')}", comments_path(:post_id => post.id), :remote => true %>
</span>
<% end %>
<% if post.comments.hidden(CurrentUser.user).count > 0 %> <% if post.comments.hidden(CurrentUser.user).count > 0 %>
<span class="info" id="threshold-comments-notice-for-<%= post.id %>"%> <span class="info" id="threshold-comments-notice-for-<%= post.id %>"%>
<%= link_to "#{pluralize(post.comments.hidden(CurrentUser.user).count, 'comment')} below threshold", comments_path(:post_id => post.id, :include_below_threshold => true), :remote => true %> <%= link_to "Show all comments", comments_path(:post_id => post.id, :include_below_threshold => true), :remote => true %>
</span> </span>
<% end %> <% end %>
</div> </div>