Diffstat (limited to 'internal/lightgallery/html_renderer.go')
| -rw-r--r-- | internal/lightgallery/html_renderer.go | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/internal/lightgallery/html_renderer.go b/internal/lightgallery/html_renderer.go index 8e184e0..17a6f2b 100644 --- a/internal/lightgallery/html_renderer.go +++ b/internal/lightgallery/html_renderer.go @@ -60,8 +60,7 @@ func (r *LightGalleryHTMLRenderer) renderLightGallery(w util.BufWriter, source [ for _, img := range gallery.Images { imageUrlSegments := strings.Split(img.URL, ".") imageUrlWithoutExt := strings.Join(imageUrlSegments[:len(imageUrlSegments)-1], ".") - imageUrlParts := strings.Split(imageUrlWithoutExt, "/") - imageNameParts := strings.Split(imageUrlParts[len(imageUrlParts)-1], "-") + imageNameParts := strings.Split(imageUrlWithoutExt, "-") var captionBuf bytes.Buffer captionHTML := img.Caption @@ -120,14 +119,7 @@ function createLightGallery%s() { galleryMap.set(inlineGallery, createLightGallery%s); } -document.addEventListener('htmx:afterRequest', (e) => { - if (e.detail.xhr.status == 404 || e.detail.successful != true) { - return console.error(e); - } - if (e.detail.target.id == 'general-page-body') { - createLightGallery%s(); - } -}, {once: true}); +document.addEventListener('DOMContentLoaded', createLightGallery%s); </script>`, galleryID, galleryID, strings.Join(dynamicElements, ","), galleryID, galleryID)) } |