unified js for dtext previews

This commit is contained in:
albert
2011-10-20 18:50:16 -04:00
parent f630365c3b
commit e8808987d5
21 changed files with 101 additions and 190 deletions

View File

@@ -2,9 +2,7 @@
Danbooru.Comment = {};
Danbooru.Comment.initialize_all = function() {
$("div.dtext-preview").hide();
this.initialize_response_link();
this.initialize_preview_button();
this.initialize_reply_links();
}
@@ -42,21 +40,6 @@
$("div.new-comment form").hide();
}
Danbooru.Comment.initialize_preview_button = function() {
$("div.new-comment input[type=submit][value=Preview]").click(function(e) {
e.preventDefault();
$.ajax("/dtext_preview", {
type: "post",
data: {
body: $(e.target).closest("form").find("textarea").val()
},
success: function(data) {
$(e.target).closest("div.new-comment").find("div.comment-preview").show().html(data);
}
});
});
}
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 + "]");