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:
1 parent
251fe86527
commit
e1f176429b
15 files changed
+1286
-1439
No files matched your search
@@ -145,7 +145,9 @@
|
||||
if (submit) submit.disabled = false;
|
||||
});
|
||||
} else {
|
||||
setActionText('回复评论');
|
||||
var nameEl = comm ? comm.querySelector('.comment-header name') : null;
|
||||
var author = nameEl ? (nameEl.textContent || '').trim() : '';
|
||||
setActionText(author ? ('回复 @' + author) : '回复评论');
|
||||
ensureEditField(respond, 0);
|
||||
if (textarea) {
|
||||
textarea.focus();
|
||||
@@ -195,25 +197,22 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Dropup toggles (guest / expand).
|
||||
// Dropup / dropdown toggles (guest info, expand toolbar, action menu).
|
||||
document.addEventListener('click', function (e) {
|
||||
var t = e.target && e.target.closest ? e.target.closest('[data-toggle-class="open"]') : null;
|
||||
var t = e.target && e.target.closest ? e.target.closest('[data-toggle-class="open"], span.dropup > a.but, [data-toggle="dropdown"]') : null;
|
||||
if (!t) return;
|
||||
var targetSel = t.getAttribute('data-target');
|
||||
if (!targetSel) return;
|
||||
var wrap = t.closest('span.dropup, span.dropdown');
|
||||
if (!wrap) return;
|
||||
// 点击已在打开的下拉内部(表情/快捷项等)不切换
|
||||
if (wrap.classList.contains('open') && t.parentElement !== wrap) return;
|
||||
e.preventDefault();
|
||||
var wrap = t.closest('.dropup, .input-expand-wrap, #comment-user-info') || t.parentElement;
|
||||
var panel = targetSel.charAt(0) === '#' || targetSel.charAt(0) === '.'
|
||||
? (wrap && wrap.querySelector(targetSel)) || document.querySelector(targetSel)
|
||||
: null;
|
||||
if (wrap) wrap.classList.toggle('open');
|
||||
if (panel && panel !== wrap) panel.classList.toggle('open');
|
||||
wrap.classList.toggle('open');
|
||||
});
|
||||
|
||||
// Close dropups on outside click.
|
||||
document.addEventListener('click', function (e) {
|
||||
if (e.target.closest && e.target.closest('.dropup, .input-expand-wrap, [data-toggle-class="open"]')) return;
|
||||
document.querySelectorAll('.dropup.open, .input-expand-wrap.open, #comment-user-info.open').forEach(function (n) {
|
||||
if (e.target.closest && e.target.closest('span.dropup.open, span.dropdown.open')) return;
|
||||
document.querySelectorAll('span.dropup.open, span.dropdown.open').forEach(function (n) {
|
||||
n.classList.remove('open');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user