feat(digest): просмотр картинок как галерея (по примеру reportCardEmbedGallery)

- Миниатюры вложений и превью обёрнуты в кнопки .digest-shot с data-img
- Класс digest-card-thumb на миниатюрах, иконка maximize-2 при наведении
- Клик по миниатюре открывает полноразмерное изображение в imgModal (лайтбокс)
- Добавлена модалка imgModal на страницу digest.html
This commit is contained in:
dev
2026-11-04 01:02:51 +03:00
parent 9a14edbd87
commit 505b678cad
2 changed files with 12 additions and 4 deletions
+6 -1
View File
@@ -30,7 +30,10 @@
.digest-none { color: var(--muted); font-size: .85rem; font-style: italic; }
.digest-head-img { margin: 8px 0 10px 0; }
.digest-images-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.digest-card-thumb { width: 70px; height: 55px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; flex-shrink: 0; }
.digest-card-thumb { width: 70px; height: 55px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; flex-shrink: 0; display: block; }
.digest-shot { position: relative; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; padding: 0; cursor: pointer; border-radius: 6px; overflow: hidden; }
.digest-shot-zoom { position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff; border-radius: 4px; padding: 2px 5px; font-size: .65rem; opacity: 0; transition: opacity .15s; }
.digest-shot:hover .digest-shot-zoom { opacity: 1; }
.digest-hidden { opacity: 0.72; }
</style>
</head>
@@ -105,6 +108,8 @@
</div>
</div>
<div class="modal-overlay" id="imgModal"><img id="imgModalSrc" alt=""></div>
<div class="toast" id="toast"></div>
<script src="vendor/lucide.min.js"></script>
+6 -3
View File
@@ -139,14 +139,17 @@
if (d.hide_at) badge.push('<span class="digest-badge">Скрыть ' + fmtDigestDate(d.hide_at) + '</span>');
const preview = d.preview_path
? '<div class="digest-head-img"><img class="digest-preview-img" src="' + esc(thumbSrc(d.preview_path)) + '" data-img="' + esc(d.preview_path) + '" alt="превью"></div>'
? '<div class="digest-head-img"><button type="button" class="digest-shot" data-img="' + esc(d.preview_path) + '" title="Открыть превью"><img class="digest-preview-img" src="' + esc(thumbSrc(d.preview_path)) + '" alt="превью"></button></div>'
: '';
const images = Array.isArray(d.images) ? d.images : [];
let imagesHtml = '';
if (images.length) {
imagesHtml = '<div class="digest-images-row">' + images.slice(0, 4).map(function(img) {
return '<img src="' + esc(thumbSrc(img.path)) + '" data-img="' + esc(img.path) + '" class="digest-card-thumb" alt="">';
imagesHtml = '<div class="digest-images-row">' + images.slice(0, 4).map(function(img, i) {
return '<button type="button" class="digest-shot" data-img="' + esc(img.path) + '" data-gal-index="' + i + '" title="' + esc(img.name || '') + '" aria-label="' + esc(img.name || '') + '">' +
'<img class="digest-card-thumb" src="' + esc(thumbSrc(img.path)) + '" alt="' + esc(img.name || '') + '" loading="lazy" decoding="async">' +
'<span class="digest-shot-zoom" aria-hidden="true"><i data-lucide="maximize-2"></i></span>' +
'</button>';
}).join('') + (images.length > 4 ? '<span class="digest-none">+ ' + (images.length - 4) + '</span>' : '') + '</div>';
}