diff options
| author | 2025-10-17 05:09:02 +0700 | |
|---|---|---|
| committer | 2025-10-17 05:09:02 +0700 | |
| commit | 7526d3c1dbb5564fb4156da4510a92038a6fdac8 (patch) | |
| tree | 4da4bc1e36fb5035a71476241547214a3f6d7837 /internal/glightbox | |
| parent | c9a2858279d3d3bf48d752d5ad250303368f9ebd (diff) | |
| download | web-7526d3c1dbb5564fb4156da4510a92038a6fdac8.tar.gz web-7526d3c1dbb5564fb4156da4510a92038a6fdac8.zip | |
feat: add tooltip for images in a gallery
feat: add image index inside a gallery
fix: return gap inside a gallery
Diffstat (limited to 'internal/glightbox')
| -rw-r--r-- | internal/glightbox/html_renderer.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/glightbox/html_renderer.go b/internal/glightbox/html_renderer.go index 3da98eb..5514b6d 100644 --- a/internal/glightbox/html_renderer.go +++ b/internal/glightbox/html_renderer.go @@ -86,8 +86,12 @@ func (r *GLightboxHTMLRenderer) renderGLightbox(w util.BufWriter, source []byte, } } + if len(img.Caption) > 0 { + tagClassList = append(tagClassList, "grid-tooltip") + } + elements = append(elements, fmt.Sprintf(` - <a href="https://f003.backblazeb2.com/file/sayana-photos/full/%s" class="glightbox-%s grid-item %s grid-item-%s" + <a href="https://f003.backblazeb2.com/file/sayana-photos/full/%s" class="glightbox-%s grid-item %s grid-item-%s p-1" data-gallery="gallery-%s" data-title="%s" %s> <picture> <source media="(width < 640px)" srcset="https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp" /> @@ -97,7 +101,9 @@ func (r *GLightboxHTMLRenderer) renderGLightbox(w util.BufWriter, source []byte, <source media="(width >= 2400px)" srcset="https://f003.backblazeb2.com/file/sayana-photos/webp-1600p/%s.webp" /> <img src="https://f003.backblazeb2.com/file/sayana-photos/webp-800p/%s.webp" /> </picture> - </a>`, img.URL, galleryID, strings.Join(tagClassList, " "), galleryID, galleryID, dayDate.Format("2006-01-02 15:04:05 -07:00"), dataDescriptionAttribute, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt)) + <span class="grid-tooltip-text">%s</span> + <span class="grid-item-index">%d</span> + </a>`, img.URL, galleryID, strings.Join(tagClassList, " "), galleryID, galleryID, dayDate.Format("2006-01-02 15:04:05 -07:00"), dataDescriptionAttribute, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, captionHTML, i+1)) if glightboxDescId != "" { elements = append(elements, fmt.Sprintf(` |