Skip to content

Commit

Permalink
调整打开画廊不改变URL避免pjax执行重新加载
Browse files Browse the repository at this point in the history
  • Loading branch information
mjsoftking committed Dec 27, 2024
1 parent 16611fc commit 7344bff
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>`)
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/js/mew-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading

0 comments on commit 7344bff

Please sign in to comment.