mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
🐛 : Shortcodes gallery (non-unique id, multiple loading <script> tag)
This commit is contained in:
@@ -48,8 +48,12 @@
|
||||
|
||||
{{/* Packery */}}
|
||||
{{ if .Page.HasShortcode "gallery" }}
|
||||
{{ $packeryLib := resources.Get "lib/packery/packery.pkgd.min.js" }}
|
||||
<script defer src="{{ $packeryLib.RelPermalink }}" integrity="{{ $packeryLib.Data.Integrity }}"></script>
|
||||
{{ $packeryLib := resources.Get "lib/packery/packery.pkgd.min.js" }}
|
||||
<script defer src="{{ $packeryLib.RelPermalink }}" integrity="{{ $packeryLib.Data.Integrity }}"></script>
|
||||
|
||||
{{ $jsShortcodeGallery := resources.Get "js/shortcodes/gallery.js" }}
|
||||
{{ $jsShortcodeGallery = $jsShortcodeGallery | resources.Minify | resources.Fingerprint "sha512" }}
|
||||
<script type="text/javascript" src="{{ $jsShortcodeGallery.RelPermalink }}" integrity="{{ $jsShortcodeGallery.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{/* tw-elements */}}
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
{{ $id := delimit (slice "gallery" .Ordinal now.UnixNano) "-" }}
|
||||
{{ $random := delimit (shuffle (seq 1 9)) "" }}
|
||||
{{ $id := delimit (slice "gallery" $random now.UnixNano) "-" }}
|
||||
|
||||
<div id="{{ $id }}">
|
||||
<div id="{{ $id }}" class="gallery">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(window).on("load", function () {
|
||||
$('#{{ $id }}').packery({
|
||||
percentPosition: true,
|
||||
gutter: 5,
|
||||
resize: true
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
Reference in New Issue
Block a user