添加 Gallery 页面,上传图片;新增文章“记录墨青的第一次三维化”

This commit is contained in:
2026-11-15 21:11:18 +08:00
parent 779a3ea27d
commit 9f940fd2a0
26 changed files with 573 additions and 46 deletions
+3
View File
@@ -25,3 +25,6 @@ pnpm-debug.log*
# 归档文件 # 归档文件
*.tar.gz *.tar.gz
# Windows 目录配置文件
desktop.ini
Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

-10
View File
@@ -1,10 +0,0 @@
# 每行一个图片 URL,支持 jpg/png/webp/avif/gif后缀
# # 号开头的行为注释,空行会被忽略
# 示例:
https://s41.ax1x.com/2026/05/13/peXsfit.webp
https://s41.ax1x.com/2026/05/13/peXyh79.jpg
https://s41.ax1x.com/2026/05/13/peXshJP.webp
https://s41.ax1x.com/2026/05/13/peXyWm4.jpg
https://s41.ax1x.com/2026/05/13/peXsRII.webp
https://s41.ax1x.com/2026/05/13/peXyf0J.jpg
https://s41.ax1x.com/2026/05/13/peXs2dA.webp
Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

-10
View File
@@ -1,10 +0,0 @@
# 每行一个图片 URL,支持 jpg/png/webp/avif/gif后缀
# # 号开头的行为注释,空行会被忽略
# 示例:
https://s41.ax1x.com/2026/05/13/peXsfit.webp
https://s41.ax1x.com/2026/05/13/peXyh79.jpg
https://s41.ax1x.com/2026/05/13/peXshJP.webp
https://s41.ax1x.com/2026/05/13/peXyWm4.jpg
https://s41.ax1x.com/2026/05/13/peXsRII.webp
https://s41.ax1x.com/2026/05/13/peXyf0J.jpg
https://s41.ax1x.com/2026/05/13/peXs2dA.webp
+1 -1
View File
@@ -17,7 +17,7 @@ export const friendsPageConfig: FriendsPageConfig = {
showComment: false, showComment: false,
// 是否开启随机排序配置,如果开启,就会忽略权重,构建时进行一次随机排序 // 是否开启随机排序配置,如果开启,就会忽略权重,构建时进行一次随机排序
randomizeSort: false, randomizeSort: true,
}; };
// 友链配置 // 友链配置
+4 -17
View File
@@ -16,23 +16,10 @@ export const galleryConfig: GalleryConfig = {
// passwordHint: 密码提示,设置后在输入密码错误时显示(可选,需配合password使用) // passwordHint: 密码提示,设置后在输入密码错误时显示(可选,需配合password使用)
// 每添加一个数组项就相当于添加了一个相册,记得在 public/gallery/ 目录下创建对应的子目录并放入图片 // 每添加一个数组项就相当于添加了一个相册,记得在 public/gallery/ 目录下创建对应的子目录并放入图片
{ {
id: "firefly-2026", id: "cyans-commissions",
name: "可爱流萤", name: "墨青的稿件",
description: "飞萤之火自无梦的长夜亮起,绽放在终竟的明天。", description: "这么可爱的小摩羯,在哪里可以吃到呀",
location: "崩坏:星穹铁道", tags: ["Furry", "Black Cyan"],
date: "2026-01-01",
tags: ["崩坏星穹铁道", "流萤"],
},
{
id: "encrypted-test",
name: "加密相册示例",
description:
"这是一个加密相册的示例,设置了访问密码,只有输入正确的密码才能查看相册内容。",
location: "崩坏:星穹铁道",
date: "2026-02-01",
tags: ["加密相册", "示例"],
password: "123456",
passwordHint: "示例密码123456",
}, },
], ],
+3
View File
@@ -26,6 +26,9 @@ const getDynamicNavBarConfig = (): NavBarConfig => {
], ],
}, },
// 相册
LinkPresets.Gallery,
// 友链 // 友链
LinkPresets.Friends, LinkPresets.Friends,
+1 -1
View File
@@ -99,7 +99,7 @@ export const siteConfig: SiteConfig = {
sponsor: true, sponsor: true,
guestbook: false, guestbook: false,
bangumi: false, bangumi: false,
gallery: false, gallery: true,
anime: false, anime: false,
}, },
+9 -4
View File
@@ -1,7 +1,5 @@
{ {
"src:assets/images/firefly.png": "72d3af9ee699aced93", "src:assets/images/firefly.png": "72d3af9ee699aced93",
"public:gallery/firefly-2026/cover.avif": "7588a28a8f989e8d88",
"public:gallery/firefly-2026/1.avif": "c8bca9dde6d2babfb5",
"public:assets/images/other/beian.png": "c18975c3886cc99d5e", "public:assets/images/other/beian.png": "c18975c3886cc99d5e",
"src:assets/images/blog.jpg": "b8bde8b3bce89a9fce", "src:assets/images/blog.jpg": "b8bde8b3bce89a9fce",
"src:assets/images/MobileWallpaper/hunter.png": "7b8b9085a8bd83818d", "src:assets/images/MobileWallpaper/hunter.png": "7b8b9085a8bd83818d",
@@ -12,6 +10,13 @@
"src:content/posts/ensure-ntfs3-on-linux/paragon-ntfs3.avif": "bfc4c4c0c0bcb2b8b9", "src:content/posts/ensure-ntfs3-on-linux/paragon-ntfs3.avif": "bfc4c4c0c0bcb2b8b9",
"public:avatars/yebai.jpg": "76bfe588cef1a0b2c6", "public:avatars/yebai.jpg": "76bfe588cef1a0b2c6",
"src:content/posts/custom-screensaver-kde-plasma/screensaver.webp": "000000000000000000", "src:content/posts/custom-screensaver-kde-plasma/screensaver.webp": "000000000000000000",
"src:content/posts/custom-screensaver-kde-plasma/preview.png": "010101010101010101", "src:content/posts/custom-screensaver-kde-plasma/power-management.png": "ebeef0eaeaebedeced",
"src:content/posts/custom-screensaver-kde-plasma/power-management.png": "ebeef0eaeaebedeced" "public:gallery/cyans-commissions/05.png": "7089c94564bf757bc9",
"public:gallery/cyans-commissions/04.png": "c1c3d3c6c9d7b5b9c4",
"public:gallery/cyans-commissions/03.png": "969de5c8c8d1afc4ec",
"public:gallery/cyans-commissions/02.png": "eceff6dadfeecbd3e7",
"public:gallery/cyans-commissions/01.jpg": "d4ddfad8e0faedf1fa",
"src:content/posts/documenting-cyans-first-3d-rendering/vrm.png": "8e68478d6c4e876b44",
"src:content/posts/documenting-cyans-first-3d-rendering/unity-interface.png": "6f7781676f783e3e3d",
"src:content/posts/documenting-cyans-first-3d-rendering/unexpected.png": "3839553a3b4432333e"
} }
@@ -4,7 +4,7 @@ published: 2026-10-16
tags: ["Linux", "屏保", "ASCII", "Omarchy", "KDE Plasma"] tags: ["Linux", "屏保", "ASCII", "Omarchy", "KDE Plasma"]
category: 教程 category: 教程
description: 在 Linux (KDE Plasma) 上通过 Kitty 与 ttfx 实现如 Omarchy 般酷炫的 ASCII 字符动画屏保,并支持 Bash 与 Fish 双 Shell 兼容。 description: 在 Linux (KDE Plasma) 上通过 Kitty 与 ttfx 实现如 Omarchy 般酷炫的 ASCII 字符动画屏保,并支持 Bash 与 Fish 双 Shell 兼容。
image: "./custom-screensaver-kde-plasma/screensaver.webp" image: "./screensaver.webp"
--- ---
> [!NOTE] > [!NOTE]
@@ -208,7 +208,7 @@ chmod +x ~/.local/bin/ascii-screensaver
(或者完整绝对路径,如 `/home/black/.local/bin/ascii-screensaver`)。 (或者完整绝对路径,如 `/home/black/.local/bin/ascii-screensaver`)。
5. 点击右下角的 **应用(A)** 保存配置。 5. 点击右下角的 **应用(A)** 保存配置。
![KDE Plasma 电源管理配置](./custom-screensaver-kde-plasma/power-management.png) ![KDE Plasma 电源管理配置](./power-management.png)
配置完成后,当系统静置无操作达到设定时间(例如 5 分钟)后,KDE Plasma 便会自动唤起全屏终端屏保。 配置完成后,当系统静置无操作达到设定时间(例如 5 分钟)后,KDE Plasma 便会自动唤起全屏终端屏保。
@@ -0,0 +1,42 @@
---
title: 记录墨青的第一次三维化
published: 2026-11-15
tags: ["3D", "Blender", "Unity", "Furry"]
category: 杂谈
description: 经历两周鏖战,终于将墨青三维化
image: "./vrm.png"
---
大三开学也有两个月了,除了准备考研之外,我总还想给自己找点什么事情做。
于是我在日常逛 B 站的时候,在主页看到了 **[@左旋葡萄酸](https://space.bilibili.com/1493996813)** 大佬发布的 Furry 建模教程。我抱着试一试的心态去学习,没想到大佬的教程非常详细,从来没有学过 Blender 和 Unity 的我也能跟着他的教程一步一步做下去。
![Unity界面](unity-interface.png)
## 用来干什么?
我其实一直都想拥有一个属于自己的 3D 模型,最开始是有想当虚拟主播的梦想。但是你墨青叔叔老了,吃不上这碗饭了,声音也不咋好听,这个梦想也就此作罢了。不过我现在一直在进修各种代码和技术栈,或许我可以录制一些课程?有一个虚拟形象总归是好的,课程看起来不会太枯燥,我这个社恐也不至于直接露脸。
## 踩的一些坑
1. **獭可工具导入 Blender 报错**
我在建模的过程中,用到了獭可大佬开发的獭可工具。不过工具中的脚本有一些脏引用(可能来源于开发时编辑器加上的一些测试库?),按理来说是不会影响插件正常使用的,但是在 Blender 5.1.0 及以后的版本中导入插件会遇到一些问题。具体原因是 Blender 5.1.0 已经将内置的 Python 版本更新为 `3.13`,脚本中 `Core/Mesh.py` 导入的 `cgitb` 模块和 `05_Shape_Key_Tool.py` 导入的 `msilib.schema` 已经被弃用,导致插件导入时触发 `ModuleNotFountError`。这些模块并没有被使用,只需要手动将这些模块相应的 import 声明删除即可。
::github{repo="Takko233/Takko_Avatar_Blender_Plugin"}
2. **奇怪的脖子右拧现象**
![脖子右拧](unexpected.png)
我被这个现象困扰了很久,一遍又一遍地检查权重和顶点状态,都没有找出来是什么原因。最后我找到了一个专门检测类似异常的插件:
::github{repo="XinyiRan0001/Blender-Skin-Deformation-Validator"}
这个插件能够扫描蒙皮权重、分析当前姿态、实时变形分析、查找问题区域。基于此脚本,我进行了二次开发,为脚本实现汉化,并添加了导出分析结果的功能,最终我成功找到了问题所在:脖子上的一百六十多个顶点中,有六十多个顶点被异常绑定到了手部的骨骼上,导致播放动画时有异常拉伸。由于我的 GitHub 账号在前几天很不幸地被暂停了,我无法直接上传到仓库,所以需要此脚本的小伙伴可以[联系我](mailto:blackcyan07@outlook.com)。
---
## 指路
<iframe src="//player.bilibili.com/player.html?isOutside=true&bvid=BV1aH5a6EE4Q&p=1&autoplay=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

@@ -6,7 +6,7 @@ pinned: true
tags: ["Linux", "文件系统", "NTFS", "ntfs3", "内核模块", "NVMe"] tags: ["Linux", "文件系统", "NTFS", "ntfs3", "内核模块", "NVMe"]
category: 技术 category: 技术
description: 在 Linux 上启用 Linux 内核原生 ntfs3 驱动以替代 ntfs-3g,大幅提升 NTFS 移动硬盘读写速度,包含内核模块检查、mount 配置及双系统注意事项。 description: 在 Linux 上启用 Linux 内核原生 ntfs3 驱动以替代 ntfs-3g,大幅提升 NTFS 移动硬盘读写速度,包含内核模块检查、mount 配置及双系统注意事项。
image: "./ensure-ntfs3-on-linux/paragon-ntfs3.avif" image: "./paragon-ntfs3.avif"
--- ---
前几天突然想起来自己还有一个 256G 的 NVMe SSD,是大一的时候买来当移动硬盘用的,可惜之前两次由于对这方面知识的欠缺,购买的硬盘盒都比较差劲,硬盘就一直搁置着。现如今,我还是认为自己需要一个移动硬盘,于是又新购入了一个硬盘盒。组装好后,我尝试在 Fedora 上测试它的读写速度,发现原本理论上是 10 Gbps 的传输速度,在使用 `dd` 测试顺序写入时,平均速度只有约 142 MB/s!我查阅了大量资料,发现貌似是文件系统的原因,我的硬盘使用的文件系统是 NTFS,而我并不想改用别的文件系统,所以只能找找看有没有两全其美的办法。 前几天突然想起来自己还有一个 256G 的 NVMe SSD,是大一的时候买来当移动硬盘用的,可惜之前两次由于对这方面知识的欠缺,购买的硬盘盒都比较差劲,硬盘就一直搁置着。现如今,我还是认为自己需要一个移动硬盘,于是又新购入了一个硬盘盒。组装好后,我尝试在 Fedora 上测试它的读写速度,发现原本理论上是 10 Gbps 的传输速度,在使用 `dd` 测试顺序写入时,平均速度只有约 142 MB/s!我查阅了大量资料,发现貌似是文件系统的原因,我的硬盘使用的文件系统是 NTFS,而我并不想改用别的文件系统,所以只能找找看有没有两全其美的办法。
+182
View File
@@ -0,0 +1,182 @@
---
import { Icon } from "astro-icon/components";
import EncryptedContent from "@/components/features/EncryptedContent.astro";
import PhotoCard from "@/components/pages/gallery/PhotoCard.astro";
import { galleryConfig, siteConfig } from "@/config";
import I18nKey from "@/i18n/i18nKey";
import { i18n } from "@/i18n/translation";
import MainGridLayout from "@/layouts/MainGridLayout.astro";
import "@/styles/pages/gallery-album.css";
import { getAlbumCover, scanAlbumPhotos } from "@/utils/gallery-utils";
import { getLqipProps } from "@/utils/lqip-utils";
import { url } from "@/utils/url-utils";
// 检查页面是否启用
if (!siteConfig.pages.gallery) {
return Astro.redirect("/404/");
}
export function getStaticPaths() {
return galleryConfig.albums.map((album) => ({
params: { album: album.id },
}));
}
const { album: albumId } = Astro.params;
const albumMeta = galleryConfig.albums.find((a) => a.id === albumId);
if (!albumMeta) {
return Astro.redirect("/404/");
}
const photos = scanAlbumPhotos(albumMeta.id);
const cover = getAlbumCover(albumMeta, photos);
const columnWidth = galleryConfig.columnWidth || 240;
// LQIP 渐变占位
const coverLqipProps = cover
? getLqipProps(cover, undefined, true)
: { style: "" };
---
<MainGridLayout title={albumMeta.name} description={albumMeta.description || ""}>
<!-- 相册封面横幅 -->
<div class="w-full rounded-(--radius-large) overflow-hidden relative">
{cover ? (
<div class="relative w-full min-h-[260px] sm:min-h-[280px] md:min-h-[320px] flex flex-col justify-between p-5 sm:p-6">
<div class="lqip-placeholder absolute inset-0 pointer-events-none" style={coverLqipProps.style} aria-hidden="true"></div>
<img
src={cover}
alt={albumMeta.name}
class="absolute inset-0 w-full h-full object-cover opacity-0 transition-opacity duration-500 ease-out"
/>
<div class="absolute inset-0 bg-linear-to-t from-black/80 via-black/40 to-black/20 pointer-events-none" />
<!-- 顶部:返回按钮 -->
<div class="relative z-20 self-start">
<a
href={url("/gallery/")}
class="inline-flex items-center gap-1.5 text-sm text-white/90 hover:text-white bg-black/40 hover:bg-black/60 backdrop-blur-md px-3 py-1.5 rounded-lg transition-colors border border-white/10 active:scale-95"
>
<Icon name="material-symbols:arrow-back" class="text-base" />
{i18n(I18nKey.galleryBackToAlbums)}
</a>
</div>
<!-- 底部:封面上的信息 -->
<div class="relative z-10 pt-4">
<div class="text-2xl sm:text-3xl font-bold text-white mb-2 drop-shadow-lg">
{albumMeta.name}
</div>
{albumMeta.description && (
<p class="text-sm text-white/80 leading-relaxed mb-2 max-w-2xl line-clamp-2">
{albumMeta.description}
</p>
)}
<div class="flex items-center gap-4 text-sm text-white/80 flex-wrap">
{albumMeta.date && (
<span class="inline-flex items-center gap-1">
<Icon name="material-symbols:calendar-today" class="text-sm" />
{albumMeta.date}
</span>
)}
{albumMeta.location && (
<span class="inline-flex items-center gap-1">
<Icon name="material-symbols:location-on" class="text-sm" />
{albumMeta.location}
</span>
)}
<span class="inline-flex items-center gap-1">
<Icon name="material-symbols:photo-library" class="text-sm" />
{photos.length} {i18n(I18nKey.galleryPhotos)}
</span>
</div>
{albumMeta.tags && albumMeta.tags.length > 0 && (
<div class="flex flex-wrap gap-1.5 mt-2.5">
{albumMeta.tags.map((tag) => (
<span class="text-xs px-2 py-0.5 rounded bg-white/20 text-white/90 backdrop-blur-sm">
{tag}
</span>
))}
</div>
)}
</div>
</div>
) : (
<div class="card-base px-6 py-4">
<a
href={url("/gallery/")}
class="inline-flex items-center gap-1 text-sm text-(--primary) hover:underline mb-3"
>
<Icon name="material-symbols:arrow-back" class="text-base" />
{i18n(I18nKey.galleryBackToAlbums)}
</a>
<div class="text-2xl sm:text-3xl font-bold text-neutral-900 dark:text-neutral-100">
{albumMeta.name}
</div>
{albumMeta.description && (
<p class="text-sm text-neutral-600 dark:text-neutral-400 leading-relaxed mt-2 mb-2 max-w-2xl">
{albumMeta.description}
</p>
)}
<div class="flex items-center gap-4 text-sm text-neutral-500 dark:text-neutral-400 mt-2 flex-wrap">
{albumMeta.date && (
<span class="inline-flex items-center gap-1">
<Icon name="material-symbols:calendar-today" class="text-sm" />
{albumMeta.date}
</span>
)}
{albumMeta.location && (
<span class="inline-flex items-center gap-1">
<Icon name="material-symbols:location-on" class="text-sm" />
{albumMeta.location}
</span>
)}
<span>{photos.length} {i18n(I18nKey.galleryPhotos)}</span>
</div>
{albumMeta.tags && albumMeta.tags.length > 0 && (
<div class="flex flex-wrap gap-1.5 mt-2.5">
{albumMeta.tags.map((tag) => (
<span class="text-xs px-2 py-0.5 rounded bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400">
{tag}
</span>
))}
</div>
)}
</div>
)}
</div>
<!-- 瀑布流照片网格 -->
<div class="w-full rounded-(--radius-large) overflow-hidden relative mt-4">
<div class="card-base z-10 px-6 py-6 relative w-full">
{photos.length > 0 ? (
albumMeta.password ? (
<EncryptedContent password={albumMeta.password} slug={albumMeta.id} hint={albumMeta.passwordHint}>
<div
class="gallery-masonry"
style={`column-count: 2; column-gap: 0.75rem; --col-width: ${columnWidth}px;`}
>
{photos.map((photo) => (
<PhotoCard src={photo} albumId={albumMeta.id} />
))}
</div>
</EncryptedContent>
) : (
<div
class="gallery-masonry"
style={`column-count: 2; column-gap: 0.75rem; --col-width: ${columnWidth}px;`}
>
{photos.map((photo) => (
<PhotoCard src={photo} albumId={albumMeta.id} />
))}
</div>
)
) : (
<div class="flex flex-col items-center justify-center py-16 text-neutral-400 dark:text-neutral-500">
<Icon name="material-symbols:photo-library" class="text-6xl mb-4 opacity-50" />
<p class="text-lg">{i18n(I18nKey.galleryNoAlbums)}</p>
</div>
)}
</div>
</div>
</MainGridLayout>
+202
View File
@@ -0,0 +1,202 @@
---
import { Icon } from "astro-icon/components";
import AlbumCard from "@/components/pages/gallery/AlbumCard.astro";
import { galleryConfig, siteConfig } from "@/config";
import I18nKey from "@/i18n/i18nKey";
import { i18n } from "@/i18n/translation";
import MainGridLayout from "@/layouts/MainGridLayout.astro";
import "@/styles/pages/common.css";
import { getAlbumCover, scanAlbumPhotos } from "@/utils/gallery-utils";
import "@/styles/pages/card-grid.css";
// 检查页面是否启用
if (!siteConfig.pages.gallery) {
return Astro.redirect("/404/");
}
const title = i18n(I18nKey.gallery);
const description = i18n(I18nKey.galleryDescription);
// 构建相册数据(扫描照片、获取封面)
const albums = galleryConfig.albums.map((album) => {
const photos = scanAlbumPhotos(album.id);
const cover = getAlbumCover(album, photos);
return { ...album, cover, photoCount: photos.length };
});
// 收集所有标签用于筛选
const allTags = [...new Set(albums.flatMap((a) => a.tags || []))].sort();
---
<MainGridLayout title={title} description={description}>
<div class="page-shell">
<!-- 页面标题和描述面板(与下方相册列表分离) -->
<div class="card-base z-10 px-9 py-6 mb-4 relative w-full">
<div class="mb-4">
<div class="page-heading">
<div class="page-icon" aria-hidden="true">
<Icon name="material-symbols:photo-library" />
</div>
<div>
<h2>{title}</h2>
{description && <p>{description}</p>}
</div>
</div>
</div>
<!-- 搜索框 + 标签筛选 -->
{albums.length > 0 && (
<gallery-filter class="mb-6">
<div class="relative mb-3">
<Icon
name="material-symbols:search"
class="absolute left-3 top-1/2 -translate-y-1/2 text-neutral-400 dark:text-neutral-500 text-lg pointer-events-none"
/>
<input
type="text"
data-search
placeholder={i18n(I18nKey.searchAlbums)}
class="w-full pl-10 pr-4 py-2.5 rounded-xl border border-(--line-divider) bg-transparent text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:border-(--primary) focus:ring-1 focus:ring-(--primary) outline-none transition-all duration-200 text-sm"
/>
</div>
{allTags.length > 0 && (
<div class="flex flex-wrap gap-2">
<button
data-tag="all"
class="category-pill px-3 py-1.5 rounded-full text-sm font-medium transition-colors duration-200"
data-active
>
{i18n(I18nKey.all)}
</button>
{allTags.map((tag) => (
<button
data-tag={tag}
class="category-pill px-3 py-1.5 rounded-full text-sm font-medium transition-colors duration-200"
>
{tag}
</button>
))}
</div>
)}
</gallery-filter>
)}
</div>
<!-- 相册卡片网格(独立于标题面板) -->
{albums.length > 0 ? (
<>
<div class="card-grid" style="--card-grid-min-width: 320px">
{albums.map((album) => (
<AlbumCard
id={album.id}
name={album.name}
cover={album.cover}
description={album.description}
date={album.date}
location={album.location}
tags={album.tags}
photoCount={album.photoCount}
encrypted={!!album.password}
/>
))}
</div>
{/* 搜索无结果提示 */}
<div class="albums-empty hidden flex-col items-center justify-center py-12 text-neutral-400 dark:text-neutral-500">
<Icon name="material-symbols:search-off-rounded" class="text-4xl mb-3" />
<div class="text-sm">{i18n(I18nKey.searchNoResults)}</div>
</div>
</>
) : (
<div class="card-base flex flex-col items-center justify-center py-16 text-neutral-400 dark:text-neutral-500">
<Icon name="material-symbols:photo-library" class="text-6xl mb-4 opacity-50" />
<p class="text-lg">{i18n(I18nKey.galleryNoAlbums)}</p>
</div>
)}
</div>
<script slot="head" is:inline>
if (!customElements.get("gallery-filter")) {
class GalleryFilter extends HTMLElement {
selectedTag = "all";
constructor() {
super();
}
connectedCallback() {
this.addEventListener("click", this.handleClick);
const input = this.querySelector("[data-search]");
if (input) {
input.addEventListener("input", () => this.applyFilters());
}
}
disconnectedCallback() {
this.removeEventListener("click", this.handleClick);
}
handleClick(e) {
const target = e.target;
const button = target.closest("button");
if (!button) return;
this.selectedTag = button.dataset.tag;
const filters = this.querySelectorAll("button");
filters.forEach((f) => {
f.removeAttribute("data-active");
});
button.setAttribute("data-active", "");
this.applyFilters();
}
applyFilters() {
const container = this.closest(".page-shell");
if (!container) return;
const input = this.querySelector("[data-search]");
const query = (input?.value || "").toLowerCase().trim();
const cards = container.querySelectorAll(".album-card");
let hasVisible = false;
cards.forEach((card) => {
const cardEl = card;
const tags = (cardEl.dataset.tags || "").split(",");
const name = (cardEl.querySelector(".album-card-title")?.textContent || "").toLowerCase();
const desc = (cardEl.querySelector(".album-card-desc")?.textContent || "").toLowerCase();
const location = (cardEl.querySelector(".album-card-location")?.textContent || "").toLowerCase();
const tagMatch =
this.selectedTag === "all" ||
(this.selectedTag && tags.includes(this.selectedTag));
const searchMatch =
!query ||
name.includes(query) ||
desc.includes(query) ||
location.includes(query) ||
tags.some((t) => t.toLowerCase().includes(query));
if (tagMatch && searchMatch) {
cardEl.style.display = "";
cardEl.classList.add("animate-fade-in-up");
hasVisible = true;
} else {
cardEl.style.display = "none";
cardEl.classList.remove("animate-fade-in-up");
}
});
const emptyEl = container.querySelector(".albums-empty");
if (emptyEl) {
emptyEl.classList.toggle("hidden", hasVisible);
emptyEl.classList.toggle("flex", !hasVisible);
}
}
}
customElements.define("gallery-filter", GalleryFilter);
}
</script>
</MainGridLayout>
+9
View File
@@ -0,0 +1,9 @@
/* 卡片列表通用网格:auto-fill 自动换列,列宽下限由页面通过 --card-grid-min-width 指定 */
.card-grid {
display: grid;
grid-template-columns: repeat(
auto-fill,
minmax(var(--card-grid-min-width, 320px), 1fr)
);
gap: 1rem;
}
+107
View File
@@ -0,0 +1,107 @@
/* 页面通用外壳与页头:各列表页共用的 .page-* 骨架(按页引入) */
.page-shell {
box-sizing: border-box;
min-width: 0;
width: 100%;
max-width: 100%;
}
.page-header {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 1rem;
margin-bottom: 1rem;
padding: 1.5rem 2rem;
}
.page-heading {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.875rem;
}
.page-count {
display: inline-flex;
align-items: baseline;
gap: 0.3rem;
align-self: center;
color: var(--primary);
white-space: nowrap;
}
.page-count svg {
align-self: center;
font-size: 1.35rem;
}
.page-count strong {
font-size: 1.3rem;
font-weight: 700;
line-height: 1;
}
.page-count span {
color: var(--content-meta);
font-size: 0.8rem;
font-weight: 500;
}
.page-icon {
display: grid;
width: 3.5rem;
height: 3.5rem;
flex: 0 0 3.5rem;
place-items: center;
border-radius: var(--radius-large);
background: var(--primary);
color: white;
font-size: 2.5rem;
}
:root.dark .page-icon {
color: rgb(0 0 0 / 70%);
}
.page-heading h2 {
margin: 0;
color: rgb(0 0 0 / 90%);
font-size: 1.5rem;
font-weight: 700;
line-height: 1.25;
}
.page-heading p {
margin: 0.2rem 0 0;
color: var(--content-meta);
font-size: 0.875rem;
}
/* 更新时间等次要说明行 */
.page-heading .page-updated {
margin: 0 0 0 auto;
align-self: center;
color: var(--content-meta);
font-size: 0.75rem;
line-height: 1.5;
text-align: center;
}
.page-heading .page-updated span {
display: block;
}
:root.dark .page-heading h2 {
color: rgb(255 255 255 / 90%);
}
@media (max-width: 640px) {
.page-header {
padding: 1.25rem;
}
.page-count {
align-self: center;
}
}
+7
View File
@@ -0,0 +1,7 @@
/* Gallery masonry responsive layout */
@media (min-width: 640px) {
.gallery-masonry {
column-width: var(--col-width, 240px) !important;
column-count: auto !important;
}
}