feat(comments): 评论区按 Zibll 1:1 全量复刻

- 评论项/表单/工具栏/筛选/分页/空状态 DOM 全部替换为 zibll 原始类名
  (li.comment、comt-main、comt-meta、list-inline、dropup 工具栏、
  theme-pagination/pagenav、post_ajax_loader 骨架等)
- 移植 zibll main.css L9412–9751 桌面 + 移动端评论样式,
  缺失基础组件(title-theme/dropdown-menu/line-form/tab-nav-theme 等)
  以 #comments 作用域补齐
- 删除全部 aksrt-comment__* 旧类名与旧样式,无兼容层
- JS 选择器对齐 zibll DOM:片段整块替换 #postcomments、骨架加载、
  跳页输入、prepend 插入、addComment onclick 剥离,
  移除 WP comment-reply enqueue 避免双 moveForm
- 表情资源替换为 zibll 全套 gif(内容逐字节一致,git 无差异)
- REST 后端 (CommentActions) 不变

验证:php -l 全部通过;5 个改动 JS 语法校验通过;
node --test tests/widget-system/post-visual-contract.test.cjs 12/12 通过
This commit is contained in:
2026-08-22 13:29:51 +08:00
parent 251fe86527
commit e1f176429b
15 changed files with 1286 additions and 1439 deletions
+171 -108
View File
@@ -1,112 +1,175 @@
/* Zibll 1:1 FixedInput / virtual-input / item chrome */
.virtual-input { display: none; }
@media (max-width: 767.98px) {
.virtual-input {
display: flex; align-items: center; gap: 10px;
padding: 10px 12px; margin-bottom: 12px; border-radius: 999px;
background: var(--surface-1, #fff);
box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,.06));
cursor: pointer;
}
.virtual-input .avatar-img { width: 32px; height: 32px; border-radius: 50%; }
.virtual-input .simulation { flex: 1; color: var(--color-ink-4, #999); font-size: 13px; }
#respond.mobile-fixed {
position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050;
background: var(--surface-1, #fff);
border-radius: 12px 12px 0 0;
box-shadow: 0 -8px 28px rgba(0,0,0,.12);
padding: 12px 14px max(12px, env(safe-area-inset-bottom));
transform: translateY(110%); transition: transform .25s ease;
max-height: 85vh; overflow: auto;
}
#respond.mobile-fixed.show { transform: translateY(0); }
#respond.mobile-fixed .fixed-body {
position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: -1;
opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
#respond.mobile-fixed.show .fixed-body { opacity: 1; pointer-events: auto; }
#respond.mobile-fixed .comt-title { display: none; }
}
.comment-header .author-box { display: flex; align-items: center; gap: 8px; width: 100%; }
.comment-header .author-box name,
.comment-header .author-box .flex1 { flex: 1; min-width: 0; }
/* Keep name + level badge on one line; clamp the name so the badge never wraps. */
.comment-header .author-box name { flex-wrap: nowrap; }
.comment-header .author-box .aksrt-comment__author { max-width: 14em; }
.comment-header .aksrt-comment__like,
.comment-header .action-comment-like {
margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
color: var(--color-ink-3, #888); text-decoration: none; font-size: 13px;
}
.comment-header .aksrt-comment__like.is-active { color: var(--color-primary, #2060ef); }
.comt-meta {
display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
font-size: 12px; margin-top: 6px;
}
.comt-meta .reply-link a, .comt-meta .comment-reply-link { color: var(--color-ink-3, #777); }
.comment-action-dropdown .dropdown-menu { min-width: 140px; padding: 6px 0; }
.comment-action-dropdown .dropdown-menu a {
display: block; padding: 6px 14px; color: var(--color-ink, #333);
text-decoration: none; font-size: 13px;
}
.comment-action-dropdown .dropdown-menu a:hover { background: var(--surface-2, #f5f5f5); }
.smilie-icon { width: 30px; height: 30px; vertical-align: -8px; display: inline-block; }
.comment-inline-img, .comment-content .box-img {
max-width: 260px; max-height: 350px; border-radius: 6px; display: block; margin: 6px 0;
}
.comment-code {
background: var(--surface-2, #f6f8fa); padding: 10px 12px; border-radius: 6px;
overflow: auto; font-size: 12px;
}
.commentlist .children { margin-left: 86px; padding-left: 0; list-style: none; }
.commentlist .children .children { margin-left: 23px; }
.commentlist .children .comt-avatar,
.commentlist .children .avatar-img.comt-avatar { width: 26px !important; height: 26px !important; }
.input-expand-wrap { display: inline-block; position: relative; }
.input-expand-wrap .dropdown-menu,
.input-expand-wrap .dropdown-smilie {
display: none; position: absolute; bottom: 100%; left: 0; z-index: 20;
background: var(--surface-1, #fff); box-shadow: 0 6px 24px rgba(0,0,0,.12);
border-radius: 8px; padding: 8px;
}
.input-expand-wrap.open > .dropdown-menu,
.input-expand-wrap.open .dropdown-smilie,
.dropup.open > .dropdown-menu { display: block; }
.dropdown-smilie {
display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
max-width: 280px; max-height: 200px; overflow: auto;
}
.dropdown-smilie a img { width: 28px; height: 28px; }
.quick-reply-item {
display: block; padding: 6px 10px; color: var(--color-ink, #333);
text-decoration: none; font-size: 13px;
}
.quick-reply-item:hover { background: var(--surface-2, #f5f5f5); }
.comt-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.comt-tips-left { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1; }
.comt-tips-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#comments .comt-title { width: 90px; }
#comments .comt-title .comt-avatar img,
#comments .comt-avatar .avatar-img { width: 60px; height: 60px; border-radius: 50%; }
#comments .comt-box #comment { min-height: 88px; resize: vertical; }
@media (min-width: 768px) { .hide-pc { display: none !important; } }
/* ============================================================
* AKSRT Comments — Zibll 1:1 移动端 + FixedInput / virtual-input
*
* 移动端规则来源:zibll/css/main.css 移动端媒体查询中的评论段。
* ============================================================ */
/* IP geo badges */
.comt-meta .comment-city-badge,
.comt-meta .aksrt-ip-geo-badge {
margin-left: 0.35em;
vertical-align: middle;
.virtual-input {
display: none;
}
.aksrt-author-hero__identity .aksrt-ip-geo-badge,
.uc-header__meta .aksrt-ip-geo-badge,
.article-avatar .aksrt-ip-geo-badge {
margin: 2px 0;
vertical-align: middle;
/* 移动端虚拟输入条 + 吸底表单(FixedInput) */
@media (max-width: 767.98px) {
.virtual-input {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 12px;
margin-bottom: 12px;
border-radius: 999px;
background: var(--surface-1, #fff);
box-shadow: var(--shadow-sm, 0 1px 4px rgba(0, 0, 0, .06));
cursor: pointer;
}
.virtual-input .avatar,
.virtual-input .avatar-img {
width: 32px;
height: 32px;
border-radius: 50%;
}
.virtual-input .simulation {
flex: 1;
color: var(--color-ink-4, #999);
font-size: 13px;
}
#respond.mobile-fixed {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 1050;
background: var(--surface-1, #fff);
border-radius: 12px 12px 0 0;
box-shadow: 0 -8px 28px rgba(0, 0, 0, .12);
padding: 12px 14px max(12px, env(safe-area-inset-bottom));
transform: translateY(110%);
transition: transform .25s ease;
max-height: 85vh;
overflow: auto;
}
#respond.mobile-fixed.show {
transform: translateY(0);
}
#respond.mobile-fixed .fixed-body {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, .35);
z-index: -1;
opacity: 0;
pointer-events: none;
transition: opacity .2s ease;
}
#respond.mobile-fixed.show .fixed-body {
opacity: 1;
pointer-events: auto;
}
#respond.mobile-fixed .comt-title {
display: none;
}
/* ---- zibll 移动端评论规则 ---- */
#comments .comt-title {
display: none;
}
#comments .comt-box {
width: 100%;
padding: 0;
}
#comments .list-inline {
padding: 15px 0;
margin: 0;
}
#comments .comment-signarea h3 {
font-size: 13px;
}
#comments .comt-tips-left .but svg,
#comments .comt-tips-left .but .fa {
margin: 0;
}
#comments .hide-sm {
display: none !important;
}
#comments .btn-input-expand {
width: 31px;
padding: 0;
height: 31px;
line-height: 31px;
}
#postcomments .comment-header {
font-size: 14px;
}
#postcomments .comt-meta {
font-size: 12px;
}
#postcomments .comment .list-inline > li {
padding: 0;
}
#postcomments .comment .list-inline > li + li {
padding-left: 10px;
}
#postcomments .avatar-img {
--this-size: 36px;
margin-right: 10px;
}
#postcomments .commentlist > .comment > .list-inline .comment-footer {
margin-left: 45px;
margin-top: -15px;
}
#postcomments .children {
margin-left: 0;
}
#postcomments .children .children {
margin-left: 13px;
}
#postcomments .children .list-inline {
padding: 15px;
}
#comments .pagenav a,
#comments .pagination ul > li {
display: none;
}
#comments .pagenav a.next,
#comments .pagenav a.prev {
display: inline-block;
}
#comments .pagenav .page-numbers {
font-size: 12px;
margin: 2px;
min-width: 28px;
}
#postcomments .post_ajax_loader .ml20 {
margin-left: 5px;
}
}
.aksrt-author-hero__identity {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.35rem;
margin-top: 0.35rem;
@media (min-width: 768px) {
.hide-pc {
display: none !important;
}
}