Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(ui): keep photo thumbnails inside swiper track

longmeidaofc51a16a3d86
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 5ba05305f..8f6b28949 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -2661,6 +2661,17 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("centerThumb(this.activeIndex)")
self.assertPageContains("centerThumb(index,0)")
self.assertPageLacks("centeredSlidesBounds:true")
+ # 每一张只闭合自己的 slide;wrapper 必须等 map 完成后再闭合。
+ # 若把 wrapper 的闭合标签写进循环,浏览器会把第二张起移到轨道外,
+ # Swiper 无法切换或居中当前缩略图。
+ self.assertPageContains(
+ '<img src="${esc(item.thumb)}" alt="" loading="lazy" '
+ 'referrerpolicy="no-referrer"></div>`).join(\'\')}</div></div>`;'
+ )
+ self.assertPageLacks(
+ '<img src="${esc(item.thumb)}" alt="" loading="lazy" '
+ 'referrerpolicy="no-referrer"></div></div>`).join(\'\')}'
+ )
def test_lightbox_photo_detail_reveals_by_asset_id_without_leaking_a_path(self):
self.assertPageContains('aria-label="图片详情" title="图片详情">${icon(\'info\')}</button>')
diff --git a/web/app.js b/web/app.js
index 48a0f161d..6af216973 100644
--- a/web/app.js
+++ b/web/app.js
@@ -4476,7 +4476,7 @@ async function openPhotoLightbox(index,source=null){
<span class="srcstate" aria-live="polite"></span>
</section>
<div class="swiper photostrip"><div class="swiper-wrapper">${items.map(item=>
- `<div class="swiper-slide"><img src="${esc(item.thumb)}" alt="" loading="lazy" referrerpolicy="no-referrer"></div></div>`).join('')}</div></div>`;
+ `<div class="swiper-slide"><img src="${esc(item.thumb)}" alt="" loading="lazy" referrerpolicy="no-referrer"></div>`).join('')}</div></div>`;
document.body.appendChild(box);
document.body.classList.add('photolight-open');
const counter=box.querySelector('.photocount');