Merge branch 'inline-editable-posts'

This commit is contained in:
Toks
2013-06-14 12:44:18 -04:00
8 changed files with 71 additions and 11 deletions

View File

@@ -6,6 +6,10 @@
this.initialize_response_link();
this.initialize_reply_links();
this.initialize_expand_links();
if (!$("#a-edit").length) {
this.initialize_edit_links();
}
}
if ($("#c-posts").length && $("#a-show").length) {
@@ -63,6 +67,16 @@
$("div.new-comment form").hide();
}
Danbooru.Comment.initialize_edit_links = function() {
$(".edit_comment").hide();
$(".edit_comment_link").click(function(e) {
var link_id = $(this).attr("id");
var comment_id = link_id.match(/^edit_comment_link_(\d+)$/)[1];
$("#edit_comment_" + comment_id).fadeToggle("fast");
e.preventDefault();
});
}
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 + "]");

View File

@@ -0,0 +1,31 @@
(function() {
Danbooru.ForumPost = {};
Danbooru.ForumPost.initialize_all = function() {
if ($("#c-forum-topics").length && $("#a-show").length) {;
this.initialize_edit_links();
}
}
Danbooru.ForumPost.initialize_edit_links = function() {
$(".edit_forum_post, .edit_forum_topic").hide();
$(".edit_forum_post_link").click(function(e) {
var link_id = $(this).attr("id");
var forum_post_id = link_id.match(/^edit_forum_post_link_(\d+)$/)[1];
$("#edit_forum_post_" + forum_post_id).fadeToggle("fast");
e.preventDefault();
});
$(".edit_forum_topic_link").click(function(e) {
var link_id = $(this).attr("id");
var forum_topic_id = link_id.match(/^edit_forum_topic_link_(\d+)$/)[1];
$("#edit_forum_topic_" + forum_topic_id).fadeToggle("fast");
e.preventDefault();
});
}
})();
$(document).ready(function() {
Danbooru.ForumPost.initialize_all();
});