Skip to content

Commit 46cd8f7

Browse files
committed
refactor: streamline lightbox initialization and remove redundant status updates
1 parent f6598be commit 46cd8f7

File tree

3 files changed

+1
-10
lines changed

3 files changed

+1
-10
lines changed

layout/_partial/after-footer.ejs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,8 @@
234234
const pswp = () => {
235235
initPswp('.article-entry', 'a.article-gallery-item');
236236
initPswp('.article-gallery', 'a.article-gallery-item');
237-
window.lightboxStatus = 'done';
238-
window.removeEventListener('lightbox:ready', pswp);
239-
}
240-
if(window.lightboxStatus === 'ready') {
241-
pswp()
242-
} else {
243-
window.addEventListener('lightbox:ready', pswp);
244237
}
238+
pswp();
245239
})();
246240
</script>
247241
<%_ if (page.comments !== false) { _%>

source/js/pjax.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ window.addEventListener("pjax:complete", () => {
216216
}
217217
});
218218
window.addEventListener("pjax:send", () => {
219-
window.lightboxStatus = "loading";
220219
// destroy panZoom
221220
if (window.__panZoomList) {
222221
window.__panZoomList.forEach((panZoom) => panZoom.destroy());

source/js/pjax_script.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ _$$(".article-entry img").forEach((element) => {
7575
element.parentNode.removeChild(element);
7676
a.appendChild(element);
7777
});
78-
window.lightboxStatus = "ready";
79-
window.dispatchEvent(new Event("lightbox:ready"));
8078

8179
// table wrap
8280
_$$(".article-entry table").forEach((element) => {

0 commit comments

Comments
 (0)