This commit is contained in:
lychang
2026-07-19 23:56:28 +08:00
parent 34bcd67682
commit 36969a4fa0
16 changed files with 1925 additions and 350 deletions

View File

@@ -262,7 +262,7 @@ async function loadAlbum(albumId) {
function updateAlbumInfo() {
document.getElementById('album-title').textContent = currentAlbum.title;
let infoHtml = `<i class="fas fa-images"></i> 共 ${images.length} 张图片`;
let infoHtml = `${images.length} 张图片`;
document.getElementById('album-info').innerHTML = infoHtml;
// 显示相册元数据(人名 + 标签)
@@ -316,7 +316,7 @@ function getTagCategory(tag) {
return 'default';
}
// 更新相册元数据(人名 + 标签)点击可搜索
// 更新相册元数据(人名 + 标签)简洁版:只用颜色区分,不写分类名
function updateAlbumMeta() {
const metaContainer = document.getElementById('album-meta-tags');
if (!metaContainer) return;
@@ -337,7 +337,6 @@ function updateAlbumMeta() {
if (currentAlbum.tags) {
let tagList = [];
try {
// 格式1: JSON数组 [["标签名", "分类"], ...]
const parsed = JSON.parse(currentAlbum.tags);
if (Array.isArray(parsed)) {
parsed.forEach(item => {
@@ -353,7 +352,6 @@ function updateAlbumMeta() {
});
}
} catch (e) {
// 格式2: 逗号分隔字符串
currentAlbum.tags.split(',').forEach(tag => {
const t = tag.trim();
if (t) tagList.push({ text: t, category: getTagCategory(t) });
@@ -378,9 +376,8 @@ function updateAlbumMeta() {
metaContainer.style.display = 'flex';
metaContainer.innerHTML = chips.map(chip => {
const icon = chip.type === 'person' ? 'fa-user' : 'fa-tag';
// 生成 CSS 类名:人物用 person,标签用 tag-{category}
const cssClass = chip.type === 'person' ? 'meta-chip-person' : `meta-chip-tag-${chip.category || 'default'}`;
return `<span class="meta-chip ${cssClass}" data-meta-type="${chip.type}" data-meta-query="${encodeURIComponent(chip.query)}">
return `<span class="meta-chip ${cssClass}" data-meta-type="${chip.type}" data-meta-query="${encodeURIComponent(chip.query)}" title="点击搜索: ${chip.text}">
<i class="fas ${icon}"></i> ${chip.text}
</span>`;
}).join('');
@@ -446,7 +443,7 @@ function displayImages() {
// 检查图片是否已被收藏
isImageFavorited(image.id || image.original_url);
return `
<div class="image-item ${orientation}" onclick="openLightbox(${index})">
<div class="image-item ${orientation}">
<img
src="${imageUrl}"
${image.id ? `data-image-id="${image.id}"` : ''}
@@ -454,6 +451,7 @@ function displayImages() {
class="lazy"
loading="lazy"
onerror="this.src='/assets/placeholder.svg'"
onclick="openLightbox(${index})"
>
<div class="image-caption">
${image.width ? `<small>${image.width}×${image.height}</small>` : ''}