mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-04-17 11:30:08 +02:00
add pageshow handler
This commit is contained in:
@@ -15,6 +15,7 @@ class PhotoGallery {
|
|||||||
this.insertPath = this.insertPath.bind(this);
|
this.insertPath = this.insertPath.bind(this);
|
||||||
this.lightMode = this.lightMode.bind(this);
|
this.lightMode = this.lightMode.bind(this);
|
||||||
this.onLoad = this.onLoad.bind(this);
|
this.onLoad = this.onLoad.bind(this);
|
||||||
|
this.onPageShow = this.onPageShow.bind(this);
|
||||||
this.openSwipe = this.openSwipe.bind(this);
|
this.openSwipe = this.openSwipe.bind(this);
|
||||||
this.parseHierarchicalTags = this.parseHierarchicalTags.bind(this);
|
this.parseHierarchicalTags = this.parseHierarchicalTags.bind(this);
|
||||||
this.prefetch = this.prefetch.bind(this);
|
this.prefetch = this.prefetch.bind(this);
|
||||||
@@ -191,7 +192,6 @@ class PhotoGallery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.detectDarkMode();
|
|
||||||
document.querySelectorAll(".tagtoggle").forEach((toggle) => {
|
document.querySelectorAll(".tagtoggle").forEach((toggle) => {
|
||||||
toggle.addEventListener("mouseup", (event) => {
|
toggle.addEventListener("mouseup", (event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -208,6 +208,10 @@ class PhotoGallery {
|
|||||||
window.addEventListener("scroll", this.scrollFunction);
|
window.addEventListener("scroll", this.scrollFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPageShow() {
|
||||||
|
this.detectDarkMode();
|
||||||
|
}
|
||||||
|
|
||||||
openSwipe(imgIndex) {
|
openSwipe(imgIndex) {
|
||||||
const options = { index: imgIndex };
|
const options = { index: imgIndex };
|
||||||
const gallery = new PhotoSwipe(this.pswpElement, PhotoSwipeUI_Default, this.shown, options);
|
const gallery = new PhotoSwipe(this.pswpElement, PhotoSwipeUI_Default, this.shown, options);
|
||||||
@@ -528,6 +532,11 @@ class PhotoGallery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
if (window.addEventListener) {
|
||||||
|
window.addEventListener("pageshow", this.onPageShow, false);
|
||||||
|
} else if (window.attachEvent) {
|
||||||
|
window.attachEvent("pageshow", this.onPageShow);
|
||||||
|
}
|
||||||
if (window.addEventListener) {
|
if (window.addEventListener) {
|
||||||
window.addEventListener("load", this.onLoad, false);
|
window.addEventListener("load", this.onLoad, false);
|
||||||
} else if (window.attachEvent) {
|
} else if (window.attachEvent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user