From de978b43a44367b9841ed35e75b6b38e4c8edbc3 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Tue, 27 Dec 2022 21:59:30 -0500 Subject: [PATCH] Fix CSP --- themes/red/assets/js/site.js | 8 ++ themes/red/layouts/_default/art.html | 16 +-- themes/red/layouts/_default/arttag.html | 17 +-- themes/red/layouts/_default/gallery.html | 146 +++++++++++------------ themes/red/layouts/_default/listart.html | 1 - 5 files changed, 89 insertions(+), 99 deletions(-) create mode 100644 themes/red/assets/js/site.js diff --git a/themes/red/assets/js/site.js b/themes/red/assets/js/site.js new file mode 100644 index 0000000..99996ad --- /dev/null +++ b/themes/red/assets/js/site.js @@ -0,0 +1,8 @@ +imagesLoaded(document.querySelector('.grid'), function(instance) { + new Masonry('.grid', { + itemSelector: '.grid-item', + columnWidth: 300, + fitWidth: true, + gutter: 10 + }); +}); diff --git a/themes/red/layouts/_default/art.html b/themes/red/layouts/_default/art.html index 857f603..f26c336 100644 --- a/themes/red/layouts/_default/art.html +++ b/themes/red/layouts/_default/art.html @@ -108,15 +108,9 @@ Next {{ end }} - - + {{ $site := resources.Get "js/site.js" }} + {{ if hugo.IsProduction }} + {{ $site = $site | minify | fingerprint | resources.PostProcess }} + {{ end }} + {{ end }} diff --git a/themes/red/layouts/_default/arttag.html b/themes/red/layouts/_default/arttag.html index 2e24ef1..e75059f 100644 --- a/themes/red/layouts/_default/arttag.html +++ b/themes/red/layouts/_default/arttag.html @@ -40,16 +40,9 @@ {{ template "_internal/pagination.html" . }} - - + {{ $site := resources.Get "js/site.js" }} + {{ if hugo.IsProduction }} + {{ $site = $site | minify | fingerprint | resources.PostProcess }} + {{ end }} + {{ end }} diff --git a/themes/red/layouts/_default/gallery.html b/themes/red/layouts/_default/gallery.html index 2e06abe..35a263b 100644 --- a/themes/red/layouts/_default/gallery.html +++ b/themes/red/layouts/_default/gallery.html @@ -3,93 +3,89 @@ {{ .Content }} - {{ if in .File.Dir "art" }} + {{ $selected_year := $.Param "selectedyear" }} + {{ $art := (index site.Data ($.Param "json")) }} + {{ $pixiv_icon := resources.Get "pixiv.webp" }} + {{ $newgrounds_icon := resources.Get "newgrounds.webp" }} - {{ else }} - {{ $selected_year := $.Param "selectedyear" }} - {{ $art := (index site.Data ($.Param "json")) }} - {{ $pixiv_icon := resources.Get "pixiv.webp" }} - {{ $newgrounds_icon := resources.Get "newgrounds.webp" }} +
+ Table of Contents + +
-
- Table of Contents - -
- - {{ range $art.categories }} - {{ $should_include := false }} + {{ if $should_include }} + {{ $without_space := replaceRE "(\\s)" "" .name }} +

{{ .name }}

{{ range sort .years "year" "desc" }} {{ if eq (int .year) (int $selected_year) }} - {{ $should_include = true }} - {{ end }} - {{ end }} + {{ $year := .year }} - {{ if $should_include }} - {{ $without_space := replaceRE "(\\s)" "" .name }} -

{{ .name }}

- {{ range sort .years "year" "desc" }} - {{ if eq (int .year) (int $selected_year) }} - {{ $year := .year }} + {{ end }} {{ end }} {{ end }} diff --git a/themes/red/layouts/_default/listart.html b/themes/red/layouts/_default/listart.html index 3229f46..1bfdf4d 100644 --- a/themes/red/layouts/_default/listart.html +++ b/themes/red/layouts/_default/listart.html @@ -6,5 +6,4 @@
  • {{ $name }}
  • {{ end }} - {{ end }}