Fix CSP
This commit is contained in:
parent
51dcf3441d
commit
de978b43a4
5 changed files with 89 additions and 99 deletions
8
themes/red/assets/js/site.js
Normal file
8
themes/red/assets/js/site.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
imagesLoaded(document.querySelector('.grid'), function(instance) {
|
||||||
|
new Masonry('.grid', {
|
||||||
|
itemSelector: '.grid-item',
|
||||||
|
columnWidth: 300,
|
||||||
|
fitWidth: true,
|
||||||
|
gutter: 10
|
||||||
|
});
|
||||||
|
});
|
|
@ -108,15 +108,9 @@
|
||||||
<a href="{{ .URL }}">Next</a>
|
<a href="{{ .URL }}">Next</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<script>
|
{{ $site := resources.Get "js/site.js" }}
|
||||||
imagesLoaded(document.querySelector('.grid'), function(instance) {
|
{{ if hugo.IsProduction }}
|
||||||
new Masonry('.grid', {
|
{{ $site = $site | minify | fingerprint | resources.PostProcess }}
|
||||||
itemSelector: '.grid-item',
|
{{ end }}
|
||||||
columnWidth: 300,
|
<script src="{{ $site.RelPermalink }}" integrity="{{ $site.Data.Integrity }}"></script>
|
||||||
fitWidth: true,
|
|
||||||
gutter: 10
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -40,16 +40,9 @@
|
||||||
</div>
|
</div>
|
||||||
{{ template "_internal/pagination.html" . }}
|
{{ template "_internal/pagination.html" . }}
|
||||||
|
|
||||||
<script>
|
{{ $site := resources.Get "js/site.js" }}
|
||||||
imagesLoaded( document.querySelector('.grid'), function( instance ) {
|
{{ if hugo.IsProduction }}
|
||||||
console.log('all images are loaded');
|
{{ $site = $site | minify | fingerprint | resources.PostProcess }}
|
||||||
var msnry = new Masonry( '.grid', {
|
{{ end }}
|
||||||
itemSelector: '.grid-item',
|
<script src="{{ $site.RelPermalink }}" integrity="{{ $site.Data.Integrity }}"></script>
|
||||||
columnWidth: 200,
|
|
||||||
fitWidth: true,
|
|
||||||
gutter: 10
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -3,93 +3,89 @@
|
||||||
|
|
||||||
{{ .Content }}
|
{{ .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 }}
|
<details>
|
||||||
{{ $selected_year := $.Param "selectedyear" }}
|
<summary>Table of Contents</summary>
|
||||||
{{ $art := (index site.Data ($.Param "json")) }}
|
<ul>
|
||||||
{{ $pixiv_icon := resources.Get "pixiv.webp" }}
|
{{ range $art.categories }}
|
||||||
{{ $newgrounds_icon := resources.Get "newgrounds.webp" }}
|
{{ $without_space := replaceRE "(\\s)" "" .name }}
|
||||||
|
<li><a href="#{{ $without_space }}">{{ .name }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
|
||||||
<details>
|
{{ range $art.categories }}
|
||||||
<summary>Table of Contents</summary>
|
{{ $should_include := false }}
|
||||||
<ul>
|
|
||||||
{{ range $art.categories }}
|
{{ range sort .years "year" "desc" }}
|
||||||
{{ $without_space := replaceRE "(\\s)" "" .name }}
|
{{ if eq (int .year) (int $selected_year) }}
|
||||||
<li><a href="#{{ $without_space }}">{{ .name }}</a></li>
|
{{ $should_include = true }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
{{ range $art.categories }}
|
|
||||||
{{ $should_include := false }}
|
|
||||||
|
|
||||||
|
{{ if $should_include }}
|
||||||
|
{{ $without_space := replaceRE "(\\s)" "" .name }}
|
||||||
|
<h3 id="{{ $without_space }}">{{ .name }}</h3>
|
||||||
{{ range sort .years "year" "desc" }}
|
{{ range sort .years "year" "desc" }}
|
||||||
{{ if eq (int .year) (int $selected_year) }}
|
{{ if eq (int .year) (int $selected_year) }}
|
||||||
{{ $should_include = true }}
|
{{ $year := .year }}
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if $should_include }}
|
<div class="gallery-con">
|
||||||
{{ $without_space := replaceRE "(\\s)" "" .name }}
|
{{ range .pieces }}
|
||||||
<h3 id="{{ $without_space }}">{{ .name }}</h3>
|
<figure class="gallery-fig">
|
||||||
{{ range sort .years "year" "desc" }}
|
{{ $full := resources.Get (printf "%s/%s" ($.Param "json") .filename) }}
|
||||||
{{ if eq (int .year) (int $selected_year) }}
|
{{ if $full }}
|
||||||
{{ $year := .year }}
|
|
||||||
|
|
||||||
<div class="gallery-con">
|
{{ $filename_without_ext := strings.TrimSuffix (path.Ext .filename) .filename }}
|
||||||
{{ range .pieces }}
|
|
||||||
<figure class="gallery-fig">
|
|
||||||
{{ $full := resources.Get (printf "%s/%s" ($.Param "json") .filename) }}
|
|
||||||
{{ if $full }}
|
|
||||||
|
|
||||||
{{ $filename_without_ext := strings.TrimSuffix (path.Ext .filename) .filename }}
|
{{ $month := 1 }}
|
||||||
|
|
||||||
{{ $month := 1 }}
|
{{ if .date }}
|
||||||
|
{{ $split := split .date "-" }}
|
||||||
{{ if .date }}
|
{{ $month = index $split 0 }}
|
||||||
{{ $split := split .date "-" }}
|
|
||||||
{{ $month = index $split 0 }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ $path := printf "/art/%d/%.2d/%s" (int $year) (int $month) $filename_without_ext}}
|
|
||||||
|
|
||||||
<a href="{{ $path }}" aria-label="Click to view details">
|
|
||||||
{{ if $.Params.thumbnails }}
|
|
||||||
{{ $title := .title }}
|
|
||||||
{{ with resources.Get (printf "%s-thumbs/%s" ($.Param "json") .filename) }}
|
|
||||||
<img class="gallery-img" alt="{{ $title }}" width="128" height="128" src="{{ .Permalink }}"/>
|
|
||||||
{{ else }}
|
|
||||||
<p>Thumbnail not found!</p>
|
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
<img alt="{{ .title }}" src="{{ $full.Permalink }}"/>
|
|
||||||
{{ end }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<figcaption>
|
|
||||||
|
|
||||||
{{ with .title }}
|
|
||||||
"{{ . }}"
|
|
||||||
{{ end }}
|
|
||||||
{{ if .newgrounds_url }}
|
|
||||||
<a href="{{ .newgrounds_url }}" style="vertical-align: bottom"><img alt="Newgrounds Icon" style="vertical-align: bottom" width="19" height="19" src="{{ $newgrounds_icon.Permalink }}"></a>
|
|
||||||
{{ end }}
|
|
||||||
{{ if .pixiv_url }}
|
|
||||||
<a href="{{ .pixiv_url }}" style="vertical-align: bottom"><img alt="Pixiv Icon" style="vertical-align: bottom" width="19" height="19" src="{{ $pixiv_icon.Permalink }}"></a>
|
|
||||||
{{ end }}
|
|
||||||
</figcaption>
|
|
||||||
|
|
||||||
{{ else }}
|
|
||||||
|
|
||||||
<em>CANNOT FIND {{.filename }}</em>
|
|
||||||
|
|
||||||
{{ end }}
|
|
||||||
</figure>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
</div>
|
{{ $path := printf "/art/%d/%.2d/%s" (int $year) (int $month) $filename_without_ext}}
|
||||||
{{ end }}
|
|
||||||
|
<a href="{{ $path }}" aria-label="Click to view details">
|
||||||
|
{{ if $.Params.thumbnails }}
|
||||||
|
{{ $title := .title }}
|
||||||
|
{{ with resources.Get (printf "%s-thumbs/%s" ($.Param "json") .filename) }}
|
||||||
|
<img class="gallery-img" alt="{{ $title }}" width="128" height="128" src="{{ .Permalink }}"/>
|
||||||
|
{{ else }}
|
||||||
|
<p>Thumbnail not found!</p>
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
<img alt="{{ .title }}" src="{{ $full.Permalink }}"/>
|
||||||
|
{{ end }}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<figcaption>
|
||||||
|
|
||||||
|
{{ with .title }}
|
||||||
|
"{{ . }}"
|
||||||
|
{{ end }}
|
||||||
|
{{ if .newgrounds_url }}
|
||||||
|
<a href="{{ .newgrounds_url }}" style="vertical-align: bottom"><img alt="Newgrounds Icon" style="vertical-align: bottom" width="19" height="19" src="{{ $newgrounds_icon.Permalink }}"></a>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .pixiv_url }}
|
||||||
|
<a href="{{ .pixiv_url }}" style="vertical-align: bottom"><img alt="Pixiv Icon" style="vertical-align: bottom" width="19" height="19" src="{{ $pixiv_icon.Permalink }}"></a>
|
||||||
|
{{ end }}
|
||||||
|
</figcaption>
|
||||||
|
|
||||||
|
{{ else }}
|
||||||
|
|
||||||
|
<em>CANNOT FIND {{.filename }}</em>
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
</figure>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -6,5 +6,4 @@
|
||||||
<li><a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}">{{ $name }}</a></li>
|
<li><a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}">{{ $name }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue