fixes #820
This commit is contained in:
@@ -25,9 +25,13 @@
|
||||
var $link = $(e.target);
|
||||
var $div = $link.closest("div.comments-for-post");
|
||||
var $textarea = $div.find("textarea")
|
||||
$textarea.val($textarea.val() + "\n\n" + Danbooru.Comment.quote_message(data));
|
||||
var msg = Danbooru.Comment.quote_message(data);
|
||||
if ($textarea.val().length > 0) {
|
||||
msg = $textarea.val() + "\n\n" + msg;
|
||||
}
|
||||
$textarea.val(msg);
|
||||
$div.find("a.expand-comment-response").trigger("click");
|
||||
$textarea.focus();
|
||||
$textarea.selectEnd();
|
||||
}
|
||||
);
|
||||
e.preventDefault();
|
||||
@@ -51,7 +55,7 @@
|
||||
$("a.expand-comment-response").click(function(e) {
|
||||
$(e.target).hide();
|
||||
var $form = $(e.target).closest("div.new-comment").find("form");
|
||||
$form.slideDown("fast");
|
||||
$form.show();
|
||||
Danbooru.scroll_to($form);
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
@@ -73,4 +73,24 @@
|
||||
});
|
||||
return filtered;
|
||||
}
|
||||
|
||||
$.fn.selectRange = function(start, end) {
|
||||
return this.each(function() {
|
||||
if (this.setSelectionRange) {
|
||||
this.focus();
|
||||
this.setSelectionRange(start, end);
|
||||
} else if (this.createTextRange) {
|
||||
var range = this.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', end);
|
||||
range.moveStart('character', start);
|
||||
range.select();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.selectEnd = function(){
|
||||
this.selectRange(this.val().length, this.val().length);
|
||||
return this;
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
$("#forum_post_body").val($("#forum_post_body").val() + "\n\n" + <%= raw @forum_post.body.to_json %>);
|
||||
var msg = <%= raw @forum_post.body.to_json %>;
|
||||
if ($("#forum_post_body").val().length > 0) {
|
||||
msg = $("#forum_post_body").val() + "\n\n" + msg;
|
||||
}
|
||||
$("#forum_post_body").val(msg);
|
||||
$("#topic-response").show();
|
||||
|
||||
$('html, body').animate({
|
||||
scrollTop: $("#forum_post_body").offset().top - 100
|
||||
}, 500);
|
||||
$("#forum_post_body").selectEnd();
|
||||
Reference in New Issue
Block a user