2020-02-24 10:00:39 +01:00
|
|
|
{{- $scratch := .Scratch.Get "scratch" -}}
|
|
|
|
{{- $CDN := $scratch.Get "CDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* Fork Awesome */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "forkawesome" -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/forkawesome/fork-awesome.scss" | $scratch.Add "linkLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* iconfont */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "iconfont" -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/iconfont/iconfont.css" | $scratch.Add "linkLocal" -}}
|
2020-02-17 14:31:53 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* Smooth Scroll */ -}}
|
2020-02-17 19:53:07 +01:00
|
|
|
{{- with $CDN.smoothScrollJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/smooth-scroll/smooth-scroll.polyfills.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* Sharer.js */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "share" -}}
|
2020-02-17 19:53:07 +01:00
|
|
|
{{- with $CDN.sharerJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-17 19:53:07 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/sharer/sharer.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-17 19:53:07 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* lazysizes */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "lazysizes" -}}
|
|
|
|
{{- with $CDN.lazysizesJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/lazysizes/lazysizes.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.lazysizesNativeLoadingJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/lazysizes/ls.native-loading.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* lightgallery.js */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "lightgallery" -}}
|
|
|
|
{{- with $CDN.lightgalleryCSS -}}
|
|
|
|
{{- slice . | $scratch.Add "linkCDN" -}}
|
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/lightgallery/lightgallery.min.css" | $scratch.Add "linkLocal" -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.lightgalleryJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/lightgallery/lightgallery.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.lightgalleryThumbnailJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/lightgallery/lg-thumbnail.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.lightgalleryZoomJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/lightgallery/lg-zoom.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- end -}}
|
|
|
|
<script>
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
lightGallery(document.getElementById('content'), {
|
|
|
|
selector: '.lightgallery',
|
|
|
|
speed: 400,
|
|
|
|
hideBarsDelay: 2000,
|
|
|
|
thumbnail: true,
|
|
|
|
exThumbImage: 'data-thumbnail',
|
|
|
|
thumbWidth: 80,
|
|
|
|
thumbContHeight: 80,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* TypeIt */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- with $scratch.Get "typeitMap" -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.typeitJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/typeit/typeit.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- range $key, $val := . -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice $val | $scratch.Add "typeitArr" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
<script>
|
2020-02-24 10:00:39 +01:00
|
|
|
window.typeitArr = {{ $scratch.Get "typeitArr" | jsonify | safeJS }};
|
2020-02-14 14:09:21 +01:00
|
|
|
</script>
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* KaTeX */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if ne .Site.Params.math.enable false | and .Params.math -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.katexCSS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "linkCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/katex/katex.min.css" | $scratch.Add "linkLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.katexJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/katex/katex.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.katexAutoRenderJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/katex/auto-render.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- $math := .Site.Params.math -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- if $math.copyTex -}}
|
|
|
|
{{- with $CDN.katexCopyTexCSS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "linkCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/katex/copy-tex.min.css" | $scratch.Add "linkLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.katexCopyTexJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/katex/copy-tex.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if $math.mhchem -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.katexMhchemJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/katex/mhchem.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
<script>
|
2020-02-24 10:00:39 +01:00
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
2020-02-14 14:09:21 +01:00
|
|
|
renderMathInElement(document.body, {
|
|
|
|
delimiters: [
|
2020-02-24 10:00:39 +01:00
|
|
|
{ left: '$$', right: '$$', display: true },
|
|
|
|
{ left: '\\[', right: '\\]', display: true },
|
2020-02-19 11:48:37 +01:00
|
|
|
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{ left: '{{ $math.blockLeftDelimiter }}', right: '{{ $math.blockRightDelimiter }}', display: true },
|
|
|
|
{{- end -}}
|
|
|
|
{ left: '$', right: '$', display: false },
|
|
|
|
{ left: '\\(', right: '\\)', display: false },
|
|
|
|
{{- if and $math.inlineLeftDelimiter $math.inlineRightDelimiter -}}
|
|
|
|
{ left: '{{ $math.inlineLeftDelimiter }}', right: '{{ $math.inlineRightDelimiter }}', display: false },
|
2020-02-19 11:48:37 +01:00
|
|
|
{{- end -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* mermaid */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- with $scratch.Get "mermaidMap" -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.mermaidJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/mermaid/mermaid.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice "css/mermaid.scss" | $scratch.Add "linkLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
<script>
|
|
|
|
window.mermaidMap = {{ jsonify . | safeJS }};
|
|
|
|
</script>
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* Music */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "music" -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* APlayer */ -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.aplayerCSS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "linkCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/aplayer/APlayer.min.css" | $scratch.Add "linkLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/aplayer/dark.scss" | $scratch.Add "linkLocal" -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.aplayerJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/aplayer/APlayer.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* MetingJS */ -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.metingJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/meting/Meting.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* dev feature */ -}}
|
|
|
|
{{- if .Params.dev -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* ECharts */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- with $scratch.Get "echartsMap" -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.echartsJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/echarts/echarts.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
2020-02-16 19:32:52 +01:00
|
|
|
{{- with $CDN.echartsMacaronsJS -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- else -}}
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- slice "lib/echarts/macarons.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
<script>
|
|
|
|
window.echartsMap = {
|
|
|
|
{{- range $key, $var := . -}}
|
|
|
|
{{- $key }}: {{ $var | safeJS -}},
|
|
|
|
{{- end -}}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- range $scratch.Get "linkCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- safeHTML . -}}
|
|
|
|
{{- end -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- range $scratch.Get "linkLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- $res := resources.Get . -}}
|
2020-02-14 15:07:46 +01:00
|
|
|
{{- if strings.HasSuffix . ".scss" -}}
|
|
|
|
{{- $options := dict "outputStyle" "compressed" "enableSourceMap" true -}}
|
|
|
|
{{- $res = toCSS $options $res -}}
|
|
|
|
{{- else if not (strings.HasSuffix . ".min.css") -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- $res = minify $res -}}
|
|
|
|
{{- end -}}
|
|
|
|
<link rel="stylesheet" href="{{ $res.RelPermalink }}">
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- range $scratch.Get "scriptCDN" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- safeHTML . -}}
|
|
|
|
{{- end -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- range $scratch.Get "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- $res := resources.Get . -}}
|
|
|
|
{{- if not (strings.HasSuffix . ".min.js") -}}
|
|
|
|
{{- $res = minify $res -}}
|
|
|
|
{{- end -}}
|
|
|
|
<script src="{{ $res.RelPermalink }}"></script>
|
|
|
|
{{- end -}}
|
2020-02-16 17:41:08 +01:00
|
|
|
|
|
|
|
{{- /* Theme script */ -}}
|
|
|
|
<script src=/js/theme.min.js></script>
|
2020-02-17 14:02:27 +01:00
|
|
|
|
|
|
|
{{- /* Google analytics async */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "production" | and .Site.GoogleAnalytics -}}
|
2020-02-17 14:02:27 +01:00
|
|
|
{{- template "_internal/google_analytics_async.html" . -}}
|
|
|
|
{{- end -}}
|