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>
|
||||
{{ end }}
|
||||
|
||||
<script>
|
||||
imagesLoaded(document.querySelector('.grid'), function(instance) {
|
||||
new Masonry('.grid', {
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: 300,
|
||||
fitWidth: true,
|
||||
gutter: 10
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{{ $site := resources.Get "js/site.js" }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $site = $site | minify | fingerprint | resources.PostProcess }}
|
||||
{{ end }}
|
||||
<script src="{{ $site.RelPermalink }}" integrity="{{ $site.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
|
|
|
@ -40,16 +40,9 @@
|
|||
</div>
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
|
||||
<script>
|
||||
imagesLoaded( document.querySelector('.grid'), function( instance ) {
|
||||
console.log('all images are loaded');
|
||||
var msnry = new Masonry( '.grid', {
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: 200,
|
||||
fitWidth: true,
|
||||
gutter: 10
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{{ $site := resources.Get "js/site.js" }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $site = $site | minify | fingerprint | resources.PostProcess }}
|
||||
{{ end }}
|
||||
<script src="{{ $site.RelPermalink }}" integrity="{{ $site.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
|
|
|
@ -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" }}
|
||||
<details>
|
||||
<summary>Table of Contents</summary>
|
||||
<ul>
|
||||
{{ range $art.categories }}
|
||||
{{ $without_space := replaceRE "(\\s)" "" .name }}
|
||||
<li><a href="#{{ $without_space }}">{{ .name }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Table of Contents</summary>
|
||||
<ul>
|
||||
{{ range $art.categories }}
|
||||
{{ $without_space := replaceRE "(\\s)" "" .name }}
|
||||
<li><a href="#{{ $without_space }}">{{ .name }}</a></li>
|
||||
{{ range $art.categories }}
|
||||
{{ $should_include := false }}
|
||||
|
||||
{{ range sort .years "year" "desc" }}
|
||||
{{ if eq (int .year) (int $selected_year) }}
|
||||
{{ $should_include = true }}
|
||||
{{ 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" }}
|
||||
{{ if eq (int .year) (int $selected_year) }}
|
||||
{{ $should_include = true }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $year := .year }}
|
||||
|
||||
{{ if $should_include }}
|
||||
{{ $without_space := replaceRE "(\\s)" "" .name }}
|
||||
<h3 id="{{ $without_space }}">{{ .name }}</h3>
|
||||
{{ range sort .years "year" "desc" }}
|
||||
{{ if eq (int .year) (int $selected_year) }}
|
||||
{{ $year := .year }}
|
||||
<div class="gallery-con">
|
||||
{{ range .pieces }}
|
||||
<figure class="gallery-fig">
|
||||
{{ $full := resources.Get (printf "%s/%s" ($.Param "json") .filename) }}
|
||||
{{ if $full }}
|
||||
|
||||
<div class="gallery-con">
|
||||
{{ 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 }}
|
||||
|
||||
{{ $filename_without_ext := strings.TrimSuffix (path.Ext .filename) .filename }}
|
||||
{{ $month := 1 }}
|
||||
|
||||
{{ $month := 1 }}
|
||||
|
||||
{{ if .date }}
|
||||
{{ $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>
|
||||
{{ if .date }}
|
||||
{{ $split := split .date "-" }}
|
||||
{{ $month = index $split 0 }}
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
{{ 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 }}
|
||||
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -6,5 +6,4 @@
|
|||
<li><a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}">{{ $name }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Reference in a new issue