2019-08-07 13:15:44 +02:00
|
|
|
<!-- jQuery https://github.com/jquery/jquery -->
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ $jquery := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_js }}
|
|
|
|
{{ $jquery = .Site.Params.cdn.jquery_js }}
|
|
|
|
{{ else }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $res := resources.Get "js/lib/jquery/jquery.slim.min.js" | resources.Minify }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $jquery = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
|
|
|
<!-- lazysizes https://github.com/aFarkas/lazysizes -->
|
|
|
|
{{ $lazysizes := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.lazysizes_js }}
|
|
|
|
{{ $lazysizes = .Site.Params.cdn.lazysizes_js }}
|
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "js/lib/lazysizes/lazysizes.min.js" | resources.Minify }}
|
|
|
|
{{ $lazysizes = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
2019-08-25 20:25:56 +02:00
|
|
|
<!-- Smooth Scroll https://github.com/cferdinandi/smooth-scroll -->
|
|
|
|
{{ $smooth_scroll := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.smooth_scroll_js }}
|
|
|
|
{{ $smooth_scroll = .Site.Params.cdn.smooth_scroll_js }}
|
|
|
|
{{ else }}
|
|
|
|
{{ $res := resources.Get "js/lib/smooth-scroll/smooth-scroll.polyfills.min.js" | resources.Minify }}
|
|
|
|
{{ $smooth_scroll = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
|
|
|
{{ end }}
|
|
|
|
{{ $smooth_scroll = delimit (slice $smooth_scroll "<script>window.scroll = new SmoothScroll('[data-scroll]', {speed: 300, speedAsDuration: true});</script>") "" }}
|
2019-08-07 13:15:44 +02:00
|
|
|
<!-- KaTeX https://github.com/KaTeX/KaTeX -->
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ $katex_css := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_css }}
|
|
|
|
{{ $katex_css = .Site.Params.cdn.katex_css }}
|
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "css/lib/katex/katex.min.css" | resources.Minify }}
|
|
|
|
{{ $katex_css = printf "<link rel=\"stylesheet\" href=\"%s\">" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ $katex_js := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_js }}
|
|
|
|
{{ $katex_js = .Site.Params.cdn.katex_js }}
|
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "js/lib/katex/katex.min.js" | resources.Minify }}
|
|
|
|
{{ $katex_js = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ $katex_auto_render_js := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_auto_render_js }}
|
|
|
|
{{ $katex_auto_render_js = .Site.Params.cdn.katex_auto_render_js }}
|
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "js/lib/katex/auto-render.min.js" | resources.Minify }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $katex_auto_render_js = printf "<script defer src=\"%s\" onload=\"renderMathInElement(document.body);\"></script>" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ $katex := delimit (slice $katex_css $katex_js $katex_auto_render_js) "" }}
|
2019-08-17 17:16:09 +02:00
|
|
|
<!-- mermaid https://github.com/knsv/mermaid -->
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $mermaid := "" }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.mermaid_js }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $mermaid = .Site.Params.cdn.mermaid_js }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "js/lib/mermaid/mermaid.min.js" | resources.Minify }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $mermaid = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
2019-11-23 18:10:17 +01:00
|
|
|
{{ $mermaidInit := "<script>mermaid.initialize({startOnLoad: false, theme: null});</script>" }}
|
|
|
|
{{ $mermaid = delimit (slice $mermaid $mermaidInit) "" }}
|
2019-08-17 17:16:09 +02:00
|
|
|
<!-- ECharts https://github.com/apache/incubator-echarts -->
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $echarts_js := "" }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_js }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $echarts_js = .Site.Params.cdn.echarts_js }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "js/lib/echarts/echarts.min.js" | resources.Minify }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $echarts_js = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $echarts_macarons_js := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_macarons_js }}
|
|
|
|
{{ $echarts_macarons_js = .Site.Params.cdn.echarts_macarons_js }}
|
|
|
|
{{ else }}
|
|
|
|
{{ $res := resources.Get "js/lib/echarts/macarons.js" | resources.Minify }}
|
|
|
|
{{ $echarts_macarons_js = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
|
|
|
{{ end }}
|
|
|
|
{{ $echarts := delimit (slice $echarts_js $echarts_macarons_js) "" }}
|
2019-08-07 23:01:18 +02:00
|
|
|
<!-- TypeIt https://github.com/alexmacarthur/typeit -->
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ $typeit := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.typeit_js }}
|
|
|
|
{{ $typeit = .Site.Params.cdn.typeit_js }}
|
|
|
|
{{ else }}
|
2020-01-29 15:16:50 +01:00
|
|
|
{{ $res := resources.Get "js/lib/typeit/typeit.min.js" | resources.Minify }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $typeit = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
2019-08-11 19:36:19 +02:00
|
|
|
<!-- jQuery.countdown https://github.com/hilios/jQuery.countdown -->
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ $countdown := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_countdown_js }}
|
|
|
|
{{ $countdown = .Site.Params.cdn.jquery_countdown_js }}
|
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "js/lib/jquery-countdown/jquery.countdown.min.js" | resources.Minify }}
|
|
|
|
{{ $countdown = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
2019-08-24 13:32:41 +02:00
|
|
|
<!-- APlayer https://github.com/MoePlayer/APlayer -->
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ $aplayer_css := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.aplayer_css }}
|
|
|
|
{{ $aplayer_css = .Site.Params.cdn.aplayer_css }}
|
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "css/lib/aplayer/APlayer.min.css" | resources.Minify }}
|
|
|
|
{{ $aplayer_css = printf "<link rel=\"stylesheet\" href=\"%s\">" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ $aplayer_js := "" }}
|
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.aplayer_js }}
|
|
|
|
{{ $aplayer_js = .Site.Params.cdn.aplayer_js }}
|
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "js/lib/aplayer/APlayer.min.js" | resources.Minify }}
|
|
|
|
{{ $aplayer_js = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ end }}
|
2020-01-29 17:20:09 +01:00
|
|
|
{{ $aplayer := delimit (slice $aplayer_css $aplayer_js) "" }}
|
2019-08-24 13:32:41 +02:00
|
|
|
<!-- MetingJS https://github.com/metowolf/MetingJS -->
|
|
|
|
{{ $meting := "" }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.meting_js }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $meting = .Site.Params.cdn.meting_js }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{ else }}
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "js/lib/meting/Meting.min.js" | resources.Minify }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $meting = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
|
|
|
|
{{ end }}
|
2019-08-08 00:05:51 +02:00
|
|
|
|
2019-08-07 06:31:14 +02:00
|
|
|
{{ $jquery | safeHTML }}
|
2019-08-18 19:36:52 +02:00
|
|
|
{{ $lazysizes | safeHTML }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $smooth_scroll | safeHTML }}
|
2019-08-07 06:31:14 +02:00
|
|
|
|
2019-08-05 15:15:01 +02:00
|
|
|
{{ if .IsPage }}
|
2019-11-23 18:10:17 +01:00
|
|
|
{{/* dev feature */}}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ if .Params.dev }}
|
|
|
|
{{ with .Scratch.Get "echartsMap" }}
|
|
|
|
{{ $echarts | safeHTML }}
|
|
|
|
<script>window.echartsMap = {
|
2019-11-23 18:10:17 +01:00
|
|
|
{{ range $key, $var := . }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $key }}: {{ $var | safeJS }},
|
|
|
|
{{ end }}
|
|
|
|
};window.echartsArr=[];</script>
|
|
|
|
{{ end }}
|
2019-08-17 17:16:09 +02:00
|
|
|
{{ end }}
|
2019-11-23 18:10:17 +01:00
|
|
|
{{/* dev feature */}}
|
2019-08-17 17:16:09 +02:00
|
|
|
|
2019-11-23 18:10:17 +01:00
|
|
|
{{ with .Scratch.Get "mermaidMap" }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $mermaid | safeHTML }}
|
2019-11-23 18:10:17 +01:00
|
|
|
<script>window.mermaidMap = {{ . | jsonify | safeJS }};</script>
|
2019-08-08 19:54:09 +02:00
|
|
|
{{ end }}
|
2019-08-17 17:16:09 +02:00
|
|
|
|
2019-08-16 21:40:34 +02:00
|
|
|
{{ if or .Params.math .Site.Params.math }}
|
2019-08-07 06:31:14 +02:00
|
|
|
{{ $katex | safeHTML }}
|
2019-08-06 18:16:32 +02:00
|
|
|
{{ end }}
|
2019-08-17 17:16:09 +02:00
|
|
|
|
|
|
|
{{ if .Scratch.Get "music" }}
|
2019-08-24 13:32:41 +02:00
|
|
|
{{ $aplayer | safeHTML }}
|
|
|
|
{{ $meting | safeHTML }}
|
2019-08-17 17:16:09 +02:00
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ with .Scratch.Get "countdownMap" }}
|
|
|
|
{{ $countdown | safeHTML }}
|
2019-08-24 13:32:41 +02:00
|
|
|
<script>window.countdownMap = {{ . | jsonify | safeJS }};</script>
|
2019-08-17 17:16:09 +02:00
|
|
|
{{ end }}
|
2019-03-13 23:35:27 +01:00
|
|
|
{{ end }}
|
2019-03-13 23:38:18 +01:00
|
|
|
|
2019-08-16 21:40:34 +02:00
|
|
|
{{ $typeitMap := .Scratch.Get "typeitMap" }}
|
|
|
|
{{ if $typeitMap }}
|
|
|
|
{{ $typeit | safeHTML }}
|
|
|
|
{{ $typeitArr := slice }}
|
|
|
|
{{ range $key, $val := $typeitMap }}
|
|
|
|
{{ $typeitArr = $typeitArr | append (slice $val) }}
|
|
|
|
{{ end }}
|
2019-08-24 13:32:41 +02:00
|
|
|
<script>window.typeitArr = {{ $typeitArr | jsonify | safeJS }};</script>
|
2019-08-16 21:40:34 +02:00
|
|
|
{{ end }}
|
|
|
|
|
2019-08-22 20:54:26 +02:00
|
|
|
{{ $res := resources.Get "/js/blog.js" | resources.Minify }}
|
|
|
|
<script src="{{ $res.RelPermalink }}"></script>
|
2019-08-11 19:36:19 +02:00
|
|
|
|
2019-08-24 14:25:05 +02:00
|
|
|
{{ if not .Site.IsServer }}
|
|
|
|
{{ template "_internal/google_analytics_async.html" . }}
|
|
|
|
{{ end }}
|