调整打开画廊不改变URL避免pjax执行重新加载

This commit is contained in:
j m 2024-12-27 08:00:23 +08:00
parent 16611fce54
commit 7344bff617
5 changed files with 6 additions and 6 deletions

View File

@ -61,7 +61,7 @@ const commonContext = {
// 用链接和标题包装图像
$('.main-content img:not(.not-gallery)').each(function () {
if ($(this).parents('[data-fancybox],mew-photos').length === 0) {
$(this).wrap(`<div class="gallery-item"><div data-fancybox="gallery" ${this.alt ? `data-caption="${this.alt}"` : ''} href="${$(this).attr('src')
$(this).wrap(`<div class="gallery-item"><div data-fancybox="gallery" data-options='{"hash": false}' ${this.alt ? `data-caption="${this.alt}"` : ''} href="${$(this).attr('src')
}"></div>${(this.alt && DreamConfig.show_img_name) ? `<p>${this.alt}</p>` : ''}</div>`)
}
})

View File

@ -462,7 +462,7 @@ document.addEventListener('DOMContentLoaded', () => {
margins: this.getAttribute('margins') || '4'
}
$(this).find('img').each((i, elem) => {
$(elem).wrap(`<div data-fancybox="gallery" ${elem.alt ? 'data-caption="' + elem.alt + '"' : ''} href="${elem.src}"></div>`)
$(elem).wrap(`<div data-fancybox="gallery" data-options='{"hash": false}' ${elem.alt ? 'data-caption="' + elem.alt + '"' : ''} href="${elem.src}"></div>`)
})
$(this).justifiedGallery({captions: this.options.captions, margins: this.options.margins})
this.drawComplete()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@
</div>
</div>
<div class="photos-gallery load-block loading">
<div th:each="photo : ${photos.items}" th:href="${photo.spec.url}" data-fancybox="gallery" th:data-caption="${#strings.defaultString(photo.spec.description, photo.spec.displayName)}">
<div th:each="photo : ${photos.items}" th:href="${photo.spec.url}" data-fancybox="gallery" data-options='{"hash": false}' th:data-caption="${#strings.defaultString(photo.spec.description, photo.spec.displayName)}">
<img width="100%" height="100%" th:src="${photo.spec.url}"
th:srcset="|${thumbnail.gen(photo.spec.url, 's')} 400w,
${thumbnail.gen(photo.spec.url, 'm')} 800w,