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:
1 parent
c1085de1a0
commit
7a2880b65d
33 files changed
+367
-56
No files matched your search
@@ -26,7 +26,7 @@ const { pageKey, pageTitle } = Astro.props;
|
||||
lib?.init({
|
||||
el: '#artalk-container',
|
||||
server: 'https://wait4x.online/artalk',
|
||||
site: 'wait4x',
|
||||
site: 'wait4x.online', // 须与 Artalk 服务端 site_default 一致(曾因此 404)
|
||||
pageKey: el.dataset.pageKey,
|
||||
pageTitle: el.dataset.pageTitle,
|
||||
locale: 'zh-CN',
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -131,6 +131,7 @@ const first = cards[0];
|
||||
<div class="lb-meta">
|
||||
<strong id="lb-title">{first?.title}</strong>
|
||||
<span id="lb-exif">{first?.exif}</span>
|
||||
<span id="lb-count">1 / {cards.length}</span>
|
||||
<span class="lb-orig">
|
||||
<a id="lb-original" href={first?.original} target="_blank" rel="noopener">{t('gallery_lightbox_original', locale)}</a>
|
||||
<a id="lb-download" href={first?.original} download>{t('gallery_lightbox_download', locale)}</a>
|
||||
@@ -164,8 +165,13 @@ const first = cards[0];
|
||||
const btn = shots[idx]!;
|
||||
img.src = btn.dataset.full ?? '';
|
||||
img.alt = btn.ariaLabel ?? '';
|
||||
titleEl.textContent = btn.dataset.title ?? '';
|
||||
const title = btn.dataset.title ?? '';
|
||||
titleEl.textContent = title;
|
||||
titleEl.style.display = title ? '' : 'none';
|
||||
exifEl.textContent = btn.dataset.exif ?? '';
|
||||
exifEl.style.display = btn.dataset.exif ? '' : 'none';
|
||||
const countEl = document.getElementById('lb-count');
|
||||
if (countEl) countEl.textContent = `${idx + 1} / ${shots.length}`;
|
||||
const orig = btn.dataset.original ?? '';
|
||||
(document.getElementById('lb-original') as HTMLAnchorElement).href = orig;
|
||||
const dl = document.getElementById('lb-download') as HTMLAnchorElement;
|
||||
@@ -297,6 +303,9 @@ const first = cards[0];
|
||||
}
|
||||
|
||||
/* 灯箱:全屏原生 dialog,高度用 dvh(规避 100vh 移动端地址栏陷阱) */
|
||||
/* 关闭态显式 none:UA 对 dialog:not([open]) 的默认隐藏会被上面的
|
||||
display:flex 覆盖——灯箱页面加载即全屏盖住图库的根因 */
|
||||
#lb:not([open]) { display: none; }
|
||||
#lb {
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
@@ -317,7 +326,7 @@ const first = cards[0];
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: var(--space-5) var(--space-4) var(--space-2);
|
||||
padding: var(--space-5) var(--space-3) var(--space-2);
|
||||
}
|
||||
#lb-img {
|
||||
max-width: 100%;
|
||||
@@ -344,7 +353,7 @@ const first = cards[0];
|
||||
.lb-orig a {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
color: var(--accent);
|
||||
color: #9db4ff; /* 灯箱恒为暗底:用亮蓝替代主题 --accent(亮色态下对比不足) */
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 0.2em;
|
||||
}
|
||||
@@ -373,9 +382,11 @@ const first = cards[0];
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.18);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border: 1px solid rgba(255, 255, 255, 0.22);
|
||||
background: rgba(20, 24, 30, 0.55);
|
||||
color: #e6e9ee;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
.lbnav:hover { background: rgba(255, 255, 255, 0.12); }
|
||||
#lb-close {
|
||||
@@ -393,7 +404,7 @@ const first = cards[0];
|
||||
.lb-orig a {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
color: var(--accent);
|
||||
color: #9db4ff; /* 灯箱恒为暗底:用亮蓝替代主题 --accent(亮色态下对比不足) */
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 0.2em;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user