fix(polish): 上线四缺陷修复——明暗委托/灯箱常开/评论站点名/书评宋体

- 明暗切换:document 级委托(软导航换 DOM 后元素级监听全丢);
  E2E 再抓一坑:SVGElement 非 HTMLElement 实例,守卫用 Element 基类
- 图库:#lb 无条件 display:flex 覆盖 UA 隐藏 → 灯箱"永远打开"盖全页;
  改 #lb:not([open]) 显式 none;时间戳标题清空;灯箱打磨(切换钮
  实底阴影/n/21 计数器/空标题隐藏/原图链接暗底亮蓝)
- 评论:site 'wait4x'→'wait4x.online' 对齐 Artalk 服务端(404 根因)
- 书评字体:文楷→思源宋(@fontsource 预分片);文楷降级金句 --font-kai
- 数据:21 张照片组修正 street→landscape(迁移器收到内部组 id 的坑)
- 新增 tests/e2e.mjs:Playwright 30 项全功能 E2E

验证: node tests/e2e.mjs 30/30 PASS(含软导航后明暗切换回归项)

Spec: 2026-10-25_fix-site-polish

Co-authored-by: GLM-5.3
This commit is contained in:
wait4xandGLM-5.3 committed 2026-10-25 10:46:03 +08:00
1 parent c1085de1a0
commit 7a2880b65d
33 files changed
+367 -56

No files matched your search

+7 -2
View File
@@ -61,8 +61,13 @@ const switchLabel = curLocale === 'zh' ? 'EN' : '中';
</header>
<script>
// 与 geek/Keyboard.ts 的 t 键同一逻辑与 key,双入口不改行为
document.querySelector('[data-theme-toggle]')?.addEventListener('click', () => {
// document 级委托:ClientRouter 软导航会整体换 DOM,元素级监听在换页后
// 全部丢失(明暗按钮"失效"的根因);document 挂载点跨导航持久
document.addEventListener('click', (e) => {
// 用 Element 基类:按钮内是 SVG 图标,SVGElement 不是 HTMLElement 的实例
//(E2E 实测抓到的坑:instanceof HTMLElement 会拦掉所有点在图标上的点击)
if (!(e.target instanceof Element)) return;
if (!e.target.closest('[data-theme-toggle]')) return;
const root = document.documentElement;
const next = root.dataset.theme === 'dark' ? 'light' : 'dark';
root.dataset.theme = next;