mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-11-23 10:46:02 +00:00
Merged in iss83 (pull request #44)
Показывать добавленный комментарий; Fixes #83
This commit is contained in:
commit
7b4e3f250a
|
@ -8,9 +8,9 @@ function AjaxComments() {
|
|||
if (comments) {
|
||||
this._comments = comments;
|
||||
this.listen(comments);
|
||||
}
|
||||
|
||||
this.listenFirstComments();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,15 +165,7 @@ AjaxCommentProcessor.prototype.onSuccess = function(data, textStatus) {
|
|||
if (data.error) {
|
||||
this.onError(null, null, data.error);
|
||||
} else {
|
||||
// Creating the comment HTML
|
||||
create_comment_elements({
|
||||
id: data.comment_id,
|
||||
toId: this._commentId || null,
|
||||
postId: this._postId,
|
||||
author: $('#name h1').text(),
|
||||
text: this._text,
|
||||
fadeOut: true
|
||||
}, this.insertComment.bind(this));
|
||||
this.createComment(data);
|
||||
|
||||
this.hideForm();
|
||||
|
||||
|
@ -184,6 +176,17 @@ AjaxCommentProcessor.prototype.onSuccess = function(data, textStatus) {
|
|||
}
|
||||
};
|
||||
|
||||
AjaxCommentProcessor.prototype.createComment = function(data) {
|
||||
create_comment_elements({
|
||||
id: data.comment_id,
|
||||
toId: this._commentId || null,
|
||||
postId: this._postId,
|
||||
author: $('#name h1').text(),
|
||||
text: this._text,
|
||||
fadeOut: true
|
||||
}, this.insertComment.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Вставляет комментарий в DOM
|
||||
* @param {jQuery} $comment
|
||||
|
@ -212,6 +215,14 @@ AjaxCommentProcessor.prototype.insertComment = function($comment) {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.showComment($comment);
|
||||
};
|
||||
|
||||
AjaxCommentProcessor.prototype.showComment = function($comment) {
|
||||
$('body').animate({
|
||||
scrollTop: $comment.offset().top
|
||||
}, 500);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue