Merge pull request #22 from DenverCoder1/new-wallpaper

This commit is contained in:
Jonah Lawrence 2022-01-18 17:10:09 -07:00 committed by GitHub
commit 9339f2c927
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 13 deletions

View File

@ -190,13 +190,6 @@ if (isset($_GET['random'])) {
// initialize glightbox
const lightbox = GLightbox();
// if imgproxy version fails to load, fallback to full-size image
document.querySelectorAll(".gallery img").forEach(function(img) {
img.addEventListener("error", function() {
this.src = this.parentElement.href;
});
});
// add hash to url when image is opened
lightbox.on("slide_changed", function(slide) {
window.location.hash = slide.current.slideConfig.alt;
@ -211,6 +204,7 @@ if (isset($_GET['random'])) {
if (window.location.hash) {
openImageFromHash();
}
});
// if hash is changed and lightbox is closed, open image
window.addEventListener("hashchange", function() {
@ -218,6 +212,10 @@ if (isset($_GET['random'])) {
openImageFromHash();
}
});
// if imgproxy version fails to load, fallback to full-size image
document.querySelectorAll(".gallery img").forEach(function(img) {
this.src = this.parentElement.href;
});
</script>
</body>