mirror of
https://github.com/Smaug123/static-site-pipeline
synced 2025-10-05 08:18:39 +00:00
Upgrade fancybox
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
<div class="gallery">
|
||||
{{ $base := .Get "src" }}
|
||||
{{ $path := print "static/" (.Get "src") }}
|
||||
{{ $galleryName := default "gallery" (.Get "galleryName") }}
|
||||
|
||||
{{ range (readDir $path) }}
|
||||
{{- $thumbext := "-thumb" }}
|
||||
@@ -13,10 +14,13 @@
|
||||
{{- $thumb := .Name | replaceRE "(\\.[^.]+)" ($thumbext | printf "%s.jpg") }}
|
||||
{{- $alttextfile := .Name | replaceRE "(\\..+)" ".md" }}
|
||||
{{- $alttext := printf "%s/%s" $path $alttextfile | os.ReadFile }}
|
||||
<a data-fancybox="gallery" href="/{{ $base }}/{{ .Name }}">
|
||||
<a data-fancybox="{{ $galleryName }}" data-caption="{{ $alttext }}" href="/{{ $base }}/{{ .Name }}">
|
||||
<img src="/{{ $base }}/{{ $thumb }}" width=100 height=100 alt={{ $.Page.RenderString $alttext }}> <br/>
|
||||
</a>
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
<script>document.addEventListener('DOMContentLoaded', function() {
|
||||
Fancybox.bind('[data-fancybox="{{ $galleryName }}"]', {});
|
||||
});</script>
|
||||
</div>
|
||||
</details>
|
@@ -1,15 +1,12 @@
|
||||
{{- if (isset .Params "gallery") -}}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
|
||||
integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT"
|
||||
crossorigin="anonymous"></script>
|
||||
{{- $url := "https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.4.0/jquery.fancybox.min.js" -}}
|
||||
{{- $hash := "sha384-fPPwDm9Mfp/tF9MgxjA4B33PPUlNmlXdP3oKSJgdAywm+cfAEYllAIRl/D3SBlpc" -}}
|
||||
{{- $url := "https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.35/fancybox/fancybox.umd.js" -}}
|
||||
{{- $hash := "sha512-Jbl+VuuqPnKsz0QxpW0eFun5z3ftzXwFOGxA75I5+o7zlY5uFu+FmGp9mY3BEso+f3Ej4YtFtnUGeKwHU/YVvA==" -}}
|
||||
<script defer
|
||||
src="{{- $url -}}"
|
||||
integrity="{{- $hash -}}"
|
||||
crossorigin="anonymous"></script>
|
||||
{{- $url := "https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.4.0/jquery.fancybox.min.css" -}}
|
||||
{{- $hash := "sha384-Ewh0nI9dXkThksh2nOTHmr8wAk5UlhiE2FiGSuZSnYkQ/G1W5wPuXGBnXodqD8GC" -}}
|
||||
{{- $url := "https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.35/fancybox/fancybox.min.css" -}}
|
||||
{{- $hash := "sha512-iYdUaD/DKwJeYpOBlNLwBcGtJj/GSrFDzbPAqye/+IB/Fz6vwRekM2Wqi53sIgxCfaKp3uXpdT666ehkGP1qhw==" -}}
|
||||
<link rel="stylesheet"
|
||||
href="{{- $url -}}"
|
||||
integrity="{{- $hash -}}"
|
||||
|
Reference in New Issue
Block a user