summaryrefslogtreecommitdiffci
path: root/internal/lightgallery/html_renderer.go
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2025-08-31 13:16:45 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2025-08-31 13:16:45 +0700
commit5eb7b64b3da54e769cc6e52fd6918e4b465b8c0a (patch)
treedd5fdb059baf9c6597eaf7cefb9a428d9c0ec766 /internal/lightgallery/html_renderer.go
parent3cda48aadae9033f6041e19bbaca4f02ff777d56 (diff)
downloadweb-5eb7b64b3da54e769cc6e52fd6918e4b465b8c0a.tar.gz
web-5eb7b64b3da54e769cc6e52fd6918e4b465b8c0a.zip
feat: integrate partials in page generating
Diffstat (limited to 'internal/lightgallery/html_renderer.go')
-rw-r--r--internal/lightgallery/html_renderer.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/lightgallery/html_renderer.go b/internal/lightgallery/html_renderer.go
index 17a6f2b..21bd049 100644
--- a/internal/lightgallery/html_renderer.go
+++ b/internal/lightgallery/html_renderer.go
@@ -119,7 +119,14 @@ function createLightGallery%s() {
galleryMap.set(inlineGallery, createLightGallery%s);
}
-document.addEventListener('DOMContentLoaded', 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();
+ }
+});
</script>`, galleryID, galleryID, strings.Join(dynamicElements, ","), galleryID, galleryID))
}