diff --git a/README.md b/README.md index 3dcc5cc..d76eb3a 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## 特点 1. **响应式设计** — 适配桌面端与移动端,支持暗色模式,移动端使用动态视口单位适配地址栏 -2. **插件兼容性** — 适配 10 款常用 Halo 插件,安装即用;提供页面布局契约,插件前台页面自动复用主题外观 +2. **插件兼容性** — 适配 11 款常用 Halo 插件,安装即用;提供页面布局契约,插件前台页面自动复用主题外观 3. **内置灯箱** — 主题内置 LightGallery 灯箱,支持 EXIF 信息展示;安装 lightgallery.js 插件后自动禁用 4. **可配置性** — 17 个设置分组、122 个配置项,几乎所有模块可独立开关 5. **性能优化** — 服务端字数统计(API 扩展包)、图片懒加载与响应式缩略图、滚动吸附、CSS/HTML 压缩 @@ -34,6 +34,7 @@ | [Steam 信息展示](https://github.com/Tim0x0/halo-plugin-steam) | `PluginSteam` | `/steam` | Steam 游戏库页面,含用户资料、统计数据、最近游玩、游戏库分页 | | [微信读书](https://github.com/yeora26/halo-weread-plugin) | `halo-weread-plugin` | 自定义页面 | 书架展示页面,见下方「自定义页面模板」 | | [记得](https://github.com/yyliucha/plugin-important-dates) | `plugin-important-dates` | `/important-dates` | 重要日期 / 牵挂的人 / 爱车双视图页面,见下方「扩展页面」 | +| [文章组件](https://github.com/acanyo/plugin-content-widgets) | `plugin-content-widgets` | 文章内 | 提示框、标签页、时间线等内容组件,主题已映射 `--xhhao-com-*` 变量,自动跟随明暗模式 | | [API 扩展包](https://github.com/HowieHz/halo-plugin-extra-api) | `extra-api` | 全站 | 服务端字数统计、中英文混排排版、可选服务端代码高亮 | > **注意**:插件需要单独安装,安装后主题会自动适配对应页面。若未安装某插件,对应页面或功能自动隐藏/降级,不会报错。 diff --git a/package.json b/package.json index da47109..513fdef 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.1.11", + "version": "1.1.12", "type": "module", "engines": { "node": ">=22.12.0" diff --git a/src/components/LightGallery.astro b/src/components/LightGallery.astro index 154c88f..9235645 100644 --- a/src/components/LightGallery.astro +++ b/src/components/LightGallery.astro @@ -236,24 +236,17 @@ } function processMomentsMedia(container) { + // 注意:不要用 包裹瞬间图片。九宫格布局依赖 + // .wi-moments-page__card-media 的直接子元素数量(:has/:nth-child/:only-child), + // 每张图各自包一层 后,img 永远是「唯一子元素」,全部图片都会退化成单列大图。 + // 直接把 img 本身作为 lightgallery 项即可(data-src 提供原图)。 var images = container.querySelectorAll('img'); images.forEach(function(img) { var src = img.getAttribute('src'); if (!src) return; - - var parentA = img.closest('a'); - if (parentA) { - parentA.classList.add('wi-lightgallery-item'); - if (!parentA.getAttribute('data-src')) { - parentA.setAttribute('data-src', src); - } - } else { - var a = document.createElement('a'); - a.setAttribute('href', src); - a.setAttribute('data-src', src); - a.classList.add('wi-lightgallery-item'); - img.parentNode.insertBefore(a, img); - a.appendChild(img); + img.classList.add('wi-lightgallery-item'); + if (!img.getAttribute('data-src')) { + img.setAttribute('data-src', src); } }); } diff --git a/src/components/ThemeSwitcher.astro b/src/components/ThemeSwitcher.astro index 078eaec..1f0919a 100644 --- a/src/components/ThemeSwitcher.astro +++ b/src/components/ThemeSwitcher.astro @@ -58,7 +58,7 @@ document.documentElement.setAttribute("data-color-scheme", isDark ? "dark" : "light"); localStorage.setItem("wi-theme", isDark ? "dark" : "light"); var tc = document.querySelector('meta[name="theme-color"]'); - if (tc) tc.setAttribute("content", isDark ? "#1a1614" : "#faf7f2"); + if (tc) tc.setAttribute("content", isDark ? "#1e1c1a" : "#faf7f2"); updateIcons(); setTimeout(function() { document.documentElement.classList.remove("wi-theme-transition"); diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 38c3e62..d7f6607 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -56,7 +56,7 @@ const fragmentAttr = layoutFragment ? "html (head, content)" : undefined; document.documentElement.classList.add("dark"); document.documentElement.setAttribute("data-color-scheme", "dark"); var tc = document.querySelector('meta[name="theme-color"]'); - if (tc) tc.setAttribute("content", "#1a1614"); + if (tc) tc.setAttribute("content", "#1e1c1a"); } else { document.documentElement.classList.remove("dark"); document.documentElement.setAttribute("data-color-scheme", "light"); diff --git a/src/pages/important-dates.astro b/src/pages/important-dates.astro index 18a57b9..a4b2f36 100644 --- a/src/pages/important-dates.astro +++ b/src/pages/important-dates.astro @@ -150,7 +150,7 @@ import Layout from "../layouts/Layout.astro";
@@ -732,14 +728,14 @@ import Layout from "../layouts/Layout.astro"; .wi-id__title { font-size: var(--text-4xl); - margin-bottom: var(--space-xs); + margin-bottom: var(--space-sm); } .wi-id__subtitle { font-size: var(--text-sm); color: var(--ink-3); letter-spacing: var(--tracking-wide); - margin-block-end: 0; + margin-bottom: var(--space-sm); } .wi-page-accent { @@ -879,10 +875,22 @@ import Layout from "../layouts/Layout.astro"; .wi-id__grid { display: grid; - grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); + grid-template-columns: repeat(3, 1fr); gap: var(--space-md); } + @media (max-width: 900px) { + .wi-id__grid { + grid-template-columns: repeat(2, 1fr); + } + } + + @media (max-width: 640px) { + .wi-id__grid { + grid-template-columns: 1fr; + } + } + /* ===== 便签卡片(重要日期 / 人) ===== */ .wi-id__memo { position: relative; @@ -984,6 +992,11 @@ import Layout from "../layouts/Layout.astro"; color: var(--ink-3); } + .wi-id__memo--person .wi-id__person { + /* 右上角是倒计时数字,人物行留出空间避免重叠 */ + padding-right: 56px; + } + .wi-id__person { display: flex; align-items: center; @@ -1022,23 +1035,12 @@ import Layout from "../layouts/Layout.astro"; font-size: 1rem; } - .wi-id__memo-foot { - display: flex; - align-items: baseline; - justify-content: space-between; - gap: 10px; - margin-top: 10px; - } - - .wi-id__memo-foot .wi-id__memo-date { - margin: 0; - } - - .wi-id__memo-count { - flex: none; - font-size: var(--text-sm); - font-weight: 700; - color: var(--accent); + /* 生日一行放下:日期本身不折行,放不下时整行换行而不是把日期拆开 */ + .wi-id__memo-date--foot { + margin: 12px 0 0; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } .wi-id__badges { @@ -1206,53 +1208,53 @@ import Layout from "../layouts/Layout.astro"; } /* 皮肤(插件设置「座驾卡片皮肤」开启时生效) */ - .wi-id__car--cool { + .wi-id-skin-cool { background: linear-gradient(150deg, #111827, #0f172a 55%, #1e3a8a); color: #e5e7eb; border-color: rgba(148, 163, 184, 0.4); } - .wi-id__car--cool .wi-id__car-name, - .wi-id__car--cool .wi-id__car-sub, - .wi-id__car--cool .wi-id__badge { + .wi-id-skin-cool .wi-id__car-name, + .wi-id-skin-cool .wi-id__car-sub, + .wi-id-skin-cool .wi-id__badge { color: #e5e7eb; border-color: rgba(147, 197, 253, 0.6); } - .wi-id__car--cool .wi-id__event { + .wi-id-skin-cool .wi-id__event { background: rgba(96, 165, 250, 0.18); color: #bfdbfe; } - .wi-id__car--cool .wi-id__event.is-soon { + .wi-id-skin-cool .wi-id__event.is-soon { background: rgba(251, 191, 36, 0.18); color: #fde68a; } - .wi-id__car--cool .wi-id__event.is-overdue { + .wi-id-skin-cool .wi-id__event.is-overdue { background: rgba(248, 113, 113, 0.2); color: #fecaca; } - .wi-id__car--cute { + .wi-id-skin-cute { background: linear-gradient(150deg, #fff1f7, #ffe4ef 55%, #fdf2f8); color: #831843; border-color: rgba(244, 114, 182, 0.4); } - .wi-id__car--cute .wi-id__car-name, - .wi-id__car--cute .wi-id__car-sub, - .wi-id__car--cute .wi-id__badge { + .wi-id-skin-cute .wi-id__car-name, + .wi-id-skin-cute .wi-id__car-sub, + .wi-id-skin-cute .wi-id__badge { color: #831843; border-color: rgba(236, 72, 153, 0.55); } - .wi-id__car--cute .wi-id__event { + .wi-id-skin-cute .wi-id__event { background: rgba(236, 72, 153, 0.12); color: #9d174d; } - .wi-id__car--neutral { + .wi-id-skin-neutral { background: var(--bg-raised); } @@ -1348,7 +1350,6 @@ import Layout from "../layouts/Layout.astro"; } @media (max-width: 640px) { - .wi-id__grid, .wi-id__cars { grid-template-columns: 1fr; } @@ -1356,5 +1357,9 @@ import Layout from "../layouts/Layout.astro"; .wi-id__memo-title { margin-right: 56px; } + + .wi-id__memo--person .wi-id__memo-title { + margin-right: 0; + } } diff --git a/src/pages/links.astro b/src/pages/links.astro index 0731814..b33e064 100644 --- a/src/pages/links.astro +++ b/src/pages/links.astro @@ -53,23 +53,39 @@ import Layout from "../layouts/Layout.astro"; target="_blank" rel="noopener noreferrer" class="wi-links__card" + th:with="verification=${link.status?.verification}, + accessState=${verification?.access?.state != null ? verification.access.state.name() : null}, + backlinkState=${verification?.backlink != null and verification.backlink.state != null ? verification.backlink.state.name() : null}" > @@ -330,15 +346,18 @@ import Layout from "../layouts/Layout.astro"; margin-bottom: var(--space-md); } - .wi-links__apply-result--ok { + .wi-links__apply-result--ok, + .wi-links-check-ok { color: var(--accent); } - .wi-links__apply-result--error { + .wi-links__apply-result--error, + .wi-links-check-error { color: #e6162d; } - html.dark .wi-links__apply-result--error { + html.dark .wi-links__apply-result--error, + html.dark .wi-links-check-error { color: #ff6b6b; } @@ -549,6 +568,13 @@ import Layout from "../layouts/Layout.astro"; border-color: color-mix(in srgb, var(--accent) 40%, var(--glass-border)); } + .wi-links__avatar-wrap { + position: relative; + flex: none; + display: inline-flex; + line-height: 1; + } + .wi-links__avatar { width: 48px; height: 48px; @@ -559,6 +585,26 @@ import Layout from "../layouts/Layout.astro"; transition: transform var(--duration-normal) var(--ease-out-expo); } + /* 反链 / 可达性检测徽章:绿色正常,红色异常 */ + .wi-links__check { + position: absolute; + right: -3px; + bottom: -3px; + width: 12px; + height: 12px; + border-radius: 50%; + border: 2px solid var(--bg); + box-shadow: var(--shadow-sm); + } + + .wi-links__check--ok { + background: #22c55e; + } + + .wi-links__check--bad { + background: #ef4444; + } + .wi-links__card:hover .wi-links__avatar { transform: scale(1.08); } diff --git a/src/pages/moments.astro b/src/pages/moments.astro index 3f4930c..35a58d9 100644 --- a/src/pages/moments.astro +++ b/src/pages/moments.astro @@ -715,8 +715,9 @@ import LightGallery from "../components/LightGallery.astro"; grid-template-columns: repeat(2, 1fr); } - .wi-moments-page__masonry-media:has(.wi-moments-page__masonry-image:nth-child(4)) { - grid-template-columns: repeat(3, 1fr); + /* 微信九宫格规则:4 张时 2x2 排布 */ + .wi-moments-page__masonry-media:has(.wi-moments-page__masonry-image:nth-child(4)):not(:has(.wi-moments-page__masonry-image:nth-child(5))) { + grid-template-columns: repeat(2, 1fr); } .wi-moments-page__masonry-footer { diff --git a/src/pages/page_messageboard.astro b/src/pages/page_messageboard.astro index 8f84264..acbf572 100644 --- a/src/pages/page_messageboard.astro +++ b/src/pages/page_messageboard.astro @@ -45,8 +45,6 @@ import Layout from "../layouts/Layout.astro"; .wi-messageboard { display: grid; gap: var(--space-lg); - margin-top: calc(-1 * 100px - var(--space-lg)); - padding-top: 100px; padding-block-end: 1rem; } @@ -70,8 +68,8 @@ import Layout from "../layouts/Layout.astro"; color: var(--accent); opacity: 0.18; position: absolute; - top: -0.15em; - left: 0.15em; + top: 0.05em; + left: 0.2em; pointer-events: none; user-select: none; } diff --git a/src/pages/post.astro b/src/pages/post.astro index 24ac4f9..7393e6f 100644 --- a/src/pages/post.astro +++ b/src/pages/post.astro @@ -897,15 +897,15 @@ import LightGallery from "../components/LightGallery.astro"; .wi-post__body { width: 100%; - font-size: 1.05rem; - line-height: 1.8; + font-size: clamp(1.05rem, 1rem + 0.25vw, 1.15rem); + line-height: 1.85; color: #3d3530; overflow-wrap: break-word; word-wrap: break-word; } html.dark .wi-post__body { - color: #d4cdc4; + color: #d9d2c9; } /* 正文本身及内部元素样式统一放在全局样式 src/styles/_content.scss, diff --git a/src/pages/weread.astro b/src/pages/weread.astro index 890af09..52728a7 100644 --- a/src/pages/weread.astro +++ b/src/pages/weread.astro @@ -94,7 +94,7 @@ import Layout from "../layouts/Layout.astro";