fix: 修复评论回复按钮点击无反应和点赞数显示问题

- 将评论回复/编辑的滚动动画从 jQuery animate + easeOutCirc 改为原生 window.scrollTo
- 避免因其他插件覆盖 jQuery 导致 easing 函数丢失的问题
- 修复 .comment-upvote .btn-inner--text 样式,确保点赞数正确显示
- 添加 display: inline-block !important 强制显示点赞数文本
This commit is contained in:
2026-01-16 22:18:08 +08:00
parent ce5f7c8bfa
commit d9aafe2479
2 changed files with 25 additions and 10 deletions

View File

@@ -996,12 +996,14 @@ if (argonConfig.waterflow_columns != "1") {
$("#post_comment").addClass("post-comment-force-privatemode-off"); $("#post_comment").addClass("post-comment-force-privatemode-off");
} }
// 滚动到评论框(添加防护检查 // 滚动到评论框(使用原生 scrollTo 避免 jQuery easing 依赖问题
let postComment = $('#post_comment'); let postComment = $('#post_comment');
if (postComment.length > 0 && postComment.offset()) { if (postComment.length > 0 && postComment.offset()) {
$("body,html").animate({ let targetTop = postComment.offset().top - 100;
scrollTop: postComment.offset().top - 100 window.scrollTo({
}, 400, 'easeOutCirc'); top: targetTop,
behavior: 'smooth'
});
} }
// 使用 CSS 动画显示回复框 // 使用 CSS 动画显示回复框
@@ -1063,9 +1065,14 @@ if (argonConfig.waterflow_columns != "1") {
}else{ }else{
$("#post_comment").addClass("post-comment-force-privatemode-off"); $("#post_comment").addClass("post-comment-force-privatemode-off");
} }
$("body,html").animate({ // 使用原生 scrollTo 避免 jQuery easing 依赖问题
scrollTop: $('#post_comment').offset().top - 100 let postCommentEl = document.getElementById('post_comment');
}, 400, 'easeOutCirc'); if (postCommentEl) {
window.scrollTo({
top: postCommentEl.getBoundingClientRect().top + window.pageYOffset - 100,
behavior: 'smooth'
});
}
$("#post_comment_content").focus(); $("#post_comment_content").focus();
} }
function cancelEdit(clear){ function cancelEdit(clear){
@@ -1080,9 +1087,14 @@ if (argonConfig.waterflow_columns != "1") {
edit(this.getAttribute("data-id")); edit(this.getAttribute("data-id"));
}); });
$(document).on("click", "#post_comment_edit_cancel", function(){ $(document).on("click", "#post_comment_edit_cancel", function(){
$("body,html").animate({ // 使用原生 scrollTo 避免 jQuery easing 依赖问题
scrollTop: $("#comment-" + editID).offset().top - 100 let commentEl = document.getElementById("comment-" + editID);
}, 400, 'easeOutCirc'); if (commentEl) {
window.scrollTo({
top: commentEl.getBoundingClientRect().top + window.pageYOffset - 100,
behavior: 'smooth'
});
}
cancelEdit(true); cancelEdit(true);
}); });
$(document).on("pjax:click", function(){ $(document).on("pjax:click", function(){

View File

@@ -5411,12 +5411,15 @@ html.darkmode .comment-operations {
.comment-upvote .btn-inner--text { .comment-upvote .btn-inner--text {
margin-left: 0 !important; margin-left: 0 !important;
margin-right: 0 !important;
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
display: inline-block !important;
} }
.comment-upvote .comment-upvote-num { .comment-upvote .comment-upvote-num {
min-width: 12px; min-width: 12px;
text-align: center; text-align: center;
display: inline-block;
} }
html.darkmode .comment-upvote { html.darkmode .comment-upvote {