diff --git a/templates/functionality.js b/templates/functionality.js index 6343165..cb1a882 100644 --- a/templates/functionality.js +++ b/templates/functionality.js @@ -10,12 +10,14 @@ class PhotoGallery { this.darkModeToggle = this.darkModeToggle.bind(this); this.debounce = this.debounce.bind(this); this.detectDarkMode = this.detectDarkMode.bind(this); + + this.detectDarkMode(); + this.filter = this.filter.bind(this); this.finalize = this.finalize.bind(this); this.insertPath = this.insertPath.bind(this); this.lightMode = this.lightMode.bind(this); this.onLoad = this.onLoad.bind(this); - this.onPageShow = this.onPageShow.bind(this); this.openSwipe = this.openSwipe.bind(this); this.parseHierarchicalTags = this.parseHierarchicalTags.bind(this); this.prefetch = this.prefetch.bind(this); @@ -208,10 +210,6 @@ class PhotoGallery { window.addEventListener("scroll", this.scrollFunction); } - onPageShow() { - this.detectDarkMode(); - } - openSwipe(imgIndex) { const options = { index: imgIndex }; const gallery = new PhotoSwipe(this.pswpElement, PhotoSwipeUI_Default, this.shown, options); @@ -532,11 +530,6 @@ class PhotoGallery { } init() { - if (window.addEventListener) { - window.addEventListener("pageshow", this.onPageShow, false); - } else if (window.attachEvent) { - window.attachEvent("pageshow", this.onPageShow); - } if (window.addEventListener) { window.addEventListener("load", this.onLoad, false); } else if (window.attachEvent) {