portails/layouts/partials/footer/script-footer.html

114 lines
4.8 KiB
HTML
Raw Normal View History

2020-11-04 08:26:58 +01:00
{{ $indexTemplate := resources.Get "js/index.js" -}}
{{ $index := $indexTemplate | resources.ExecuteAsTemplate "index.js" . -}}
2021-03-04 17:53:25 +01:00
{{ $bs := resources.Get "js/bootstrap.js" -}}
{{ $bs := $bs | js.Build -}}
2021-03-15 18:55:49 +01:00
{{ $highlight := resources.Get "js/highlight.js" -}}
{{ $highlight := $highlight | js.Build -}}
2021-03-16 15:14:45 +01:00
{{ $katex := resources.Get "js/vendor/katex/dist/katex.js" -}}
{{ $katexAutoRender := resources.Get "js/vendor/katex/dist/contrib/auto-render.js" -}}
2021-07-01 08:48:56 +02:00
{{ $mermaid := resources.Get "js/mermaid.js" | js.Build -}}
2021-06-30 15:16:45 +02:00
{{ $app := resources.Get "js/app.js" -}}
{{ $slice := slice $app -}}
{{ if .Site.Params.options.lazySizes -}}
{{ $lazySizes := resources.Get "js/lazysizes.js" -}}
{{ $lazySizes := $lazySizes | js.Build -}}
{{ $slice = $slice | append $lazySizes -}}
{{ end -}}
{{ if .Site.Params.options.clipBoard -}}
{{ $clipBoard := resources.Get "js/clipboard.js" -}}
{{ $clipBoard := $clipBoard | js.Build -}}
{{ $slice = $slice | append $clipBoard -}}
{{ end -}}
{{ if .Site.Params.options.instantPage -}}
{{ $instantPage := resources.Get "js/instant.page.js" -}}
{{ $instantPage := $instantPage | js.Build -}}
{{ $slice = $slice | append $instantPage -}}
{{ end -}}
2022-06-25 04:20:57 +02:00
{{ $showFlexSearch := .Site.Params.options.flexSearch }}
{{ if $showFlexSearch -}}
2021-06-25 13:29:22 +02:00
{{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.bundle.js" -}}
{{ $slice = $slice | append $flexSearch -}}
2022-06-25 05:36:32 +02:00
{{ if and (isset .Site.Params.options "searchsectionsshow") (not (eq .Site.Params.options.searchSectionsShow "ALL")) -}}
{{ $showFlexSearch = or (eq (len .Site.Params.options.searchSectionsShow) 0) (in .Site.Params.options.searchSectionsShow .Section) (and .IsHome (in .Site.Params.options.searchSectionsShow "HomePage")) -}}
2022-06-25 04:20:57 +02:00
{{ end -}}
{{ end -}}
{{ if .Site.Params.options.darkMode -}}
{{ $darkMode := resources.Get "js/darkmode.js" -}}
{{ $darkMode := $darkMode | js.Build -}}
{{ $slice = $slice | append $darkMode -}}
{{ end -}}
{{ if and (.Site.Params.alert) (.Site.Params.alertDismissable) -}}
2021-09-07 12:08:46 +02:00
{{ $alert := resources.Get "js/alert.js" -}}
{{ $alert := $alert | js.Build -}}
{{ $slice = $slice | append $alert -}}
{{ end -}}
2021-03-16 15:14:45 +01:00
{{ if .Site.Params.options.kaTex -}}
{{ $katexConfig := resources.Get "js/katex.js" -}}
{{ $katexConfig := $katexConfig | js.Build -}}
{{ $slice = $slice | append $katexConfig -}}
{{ end -}}
2022-03-30 15:05:00 +02:00
{{ $scrollLock := resources.Get "js/scroll-lock.js" | js.Build -}}
{{ $slice = $slice | append $scrollLock -}}
{{ $js := $slice | resources.Concat "main.js" -}}
2020-04-15 15:48:16 +02:00
{{ if eq (hugo.Environment) "development" -}}
2021-03-04 17:53:25 +01:00
{{ if .Site.Params.options.bootStrapJs -}}
2021-04-02 19:45:05 +02:00
<script src="{{ $bs.RelPermalink }}" defer></script>
2021-03-04 17:53:25 +01:00
{{ end -}}
2021-03-15 18:55:49 +01:00
{{ if .Site.Params.options.highLight -}}
2021-04-02 19:45:05 +02:00
<script src="{{ $highlight.RelPermalink }}" defer></script>
2021-03-15 18:55:49 +01:00
{{ end -}}
2021-03-16 15:14:45 +01:00
{{ if .Site.Params.options.kaTex -}}
2021-04-02 19:45:05 +02:00
<script src="{{ $katex.RelPermalink }}" defer></script>
<script src="{{ $katexAutoRender.RelPermalink }}" onload="renderMathInElement(document.body);" defer></script>
2021-03-16 15:14:45 +01:00
{{ end -}}
2021-07-01 08:48:56 +02:00
<script src="{{ $js.RelPermalink }}" defer></script>
2021-07-02 11:08:31 +02:00
{{ with .Params.mermaid -}}
2021-06-30 15:16:45 +02:00
<script src="{{ $mermaid.RelPermalink }}" defer></script>
{{ end -}}
2022-06-25 04:20:57 +02:00
{{ if $showFlexSearch -}}
2021-04-02 19:45:05 +02:00
<script src="{{ $index.RelPermalink }}" defer></script>
{{ end -}}
2020-04-15 15:48:16 +02:00
{{ else -}}
{{ $js := $js | minify | fingerprint "sha512" -}}
{{ $index := $index | minify | fingerprint "sha512" -}}
2021-03-04 17:53:25 +01:00
{{ $bs := $bs | minify | fingerprint "sha512" -}}
2021-03-15 18:55:49 +01:00
{{ $highlight := $highlight | minify | fingerprint "sha512" -}}
2021-03-16 15:14:45 +01:00
{{ $katex := $katex | minify | fingerprint "sha512" -}}
{{ $katexAutoRender := $katexAutoRender | minify | fingerprint "sha512" -}}
2021-06-30 15:16:45 +02:00
{{ $mermaid := $mermaid | minify | fingerprint "sha512" -}}
2021-03-04 17:53:25 +01:00
{{ if .Site.Params.options.bootStrapJs -}}
2021-04-02 19:45:05 +02:00
<script src="{{ $bs.RelPermalink }}" integrity="{{ $bs.Data.Integrity }}" crossorigin="anonymous" defer></script>
2021-03-04 17:53:25 +01:00
{{ end -}}
2021-03-15 18:55:49 +01:00
{{ if .Site.Params.options.highLight -}}
2021-04-02 19:45:05 +02:00
<script src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}" crossorigin="anonymous" defer></script>
2021-03-16 15:14:45 +01:00
{{ end -}}
{{ if .Site.Params.options.kaTex -}}
2021-04-02 19:45:05 +02:00
<script src="{{ $katex.RelPermalink }}" integrity="{{ $katex.Data.Integrity }}" crossorigin="anonymous" defer></script>
<script src="{{ $katexAutoRender.RelPermalink }}" integrity="{{ $katexAutoRender.Data.Integrity }}" crossorigin="anonymous" defer></script>
2021-03-15 18:55:49 +01:00
{{ end -}}
2021-07-01 08:48:56 +02:00
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous" defer></script>
2021-07-02 11:08:31 +02:00
{{ with .Params.mermaid -}}
2021-06-30 15:16:45 +02:00
<script src="{{ $mermaid.RelPermalink }}" integrity="{{ $mermaid.Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ end -}}
2022-06-25 04:20:57 +02:00
{{ if $showFlexSearch -}}
2021-09-28 16:26:15 +02:00
<script src="{{ $index.Permalink }}" integrity="{{ $index.Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ end -}}
{{ end -}}