diff --git a/src/components/comment/comment.js b/src/components/comment/comment.js
index 43e43940..eed862a9 100644
--- a/src/components/comment/comment.js
+++ b/src/components/comment/comment.js
@@ -42,15 +42,59 @@ export default function main(_) {
$(feedbackItem[feedbackItem.length - 1]).css('padding-bottom', '0');
}
}
- $(document).ajaxSuccess(function (event, xhr, settings) {
- if (settings.url.includes("GetComments.aspx")) {
- _.__tools.clearIntervalTimeId(_.__timeIds.commentTId);
- }
- });
+
+
+ let addComment = () => {
+ let userBlogAddress = $(".comment_my_posted a").attr('href'),
+ userName = $(".comment_my_posted a").text(),
+ commentInfo = $(".bq_post_comment").text();
+
+
+ let comment = `
+
+
+ ${ window.isBlogOwner && `[楼主]`}
+
+
+
+
+
`
+
+ $("#blog-comments-placeholder").append(comment)
+ $(".comment_my_posted").remove()
+ }
+
_.__timeIds.commentTId = window.setInterval(() =>{
if ($('.feedbackItem').length > 0) {
setComment();
_.__tools.clearIntervalTimeId(_.__timeIds.commentTId);
}
- },1000);
+ }, 1000);
+
+ $(document).ajaxSuccess(function (event, xhr, settings) {
+ // 评论重新排序
+ if (settings.url.includes('GetComments.aspx')) {
+ _.__tools.clearIntervalTimeId(_.__timeIds.commentTId);
+ setComment()
+ }
+
+ // 新增评论
+ if (settings.url.includes('PostComment/Add.aspx')) addComment()
+
+ // 删除评论
+ if (settings.url.includes('comment/DeleteComment.aspx')) {
+ let commentId = JSON.parse(settings?.data)?.commentId;
+ $(`#comment_body_${commentId}`).parent().parent().remove()
+ $(".feedbackItem:last").css("padding-bottom", "0")
+ }
+ });
+
}
\ No newline at end of file
${commentInfo}
+