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-17 14:02:27 +01:00
|
|
|
{{- /* Fork Awesome https://forkaweso.me/ */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "forkawesome" -}}
|
|
|
|
{{- slice "css/lib/forkawesome/fork-awesome.scss" | $scratch.Add "linkLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-17 14:31:53 +01:00
|
|
|
{{- /* iconfont https://www.iconfont.cn/ */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "iconfont" -}}
|
|
|
|
{{- slice "css/lib/iconfont/iconfont.css" | $scratch.Add "linkLocal" -}}
|
2020-02-17 14:31:53 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-17 19:53:07 +01:00
|
|
|
{{- /* Smooth Scroll https://github.com/cferdinandi/smooth-scroll */ -}}
|
|
|
|
{{- 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:00:39 +01:00
|
|
|
{{- slice "js/lib/smooth-scroll/smooth-scroll.polyfills.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-17 19:53:07 +01:00
|
|
|
{{- /* Sharer.js https://github.com/ellisonleao/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:00:39 +01:00
|
|
|
{{- slice "js/lib/sharer/sharer.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-17 19:53:07 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* lazysizes https://github.com/aFarkas/lazysizes */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- if $scratch.Get "lazysizes" -}}
|
|
|
|
{{- with $CDN.lazysizesJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "js/lib/lazysizes/lazysizes.min.js" | $scratch.Add "scriptLocal" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.lazysizesNativeLoadingJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "js/lib/lazysizes/ls.native-loading.min.js" | $scratch.Add "scriptLocal" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* lightgallery.js https://github.com/sachinchoolur/lightgallery.js */ -}}
|
|
|
|
{{- if $scratch.Get "lightgallery" -}}
|
|
|
|
{{- with $CDN.lightgalleryCSS -}}
|
|
|
|
{{- slice . | $scratch.Add "linkCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "css/lib/lightgallery/lightgallery.min.css" | $scratch.Add "linkLocal" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.lightgalleryJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "js/lib/lightgallery/lightgallery.min.js" | $scratch.Add "scriptLocal" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.lightgalleryThumbnailJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "js/lib/lightgallery/lg-thumbnail.min.js" | $scratch.Add "scriptLocal" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.lightgalleryZoomJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "js/lib/lightgallery/lg-zoom.min.js" | $scratch.Add "scriptLocal" -}}
|
|
|
|
{{- 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 -}}
|
|
|
|
|
|
|
|
{{- /* TypeIt https://github.com/alexmacarthur/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:00:39 +01:00
|
|
|
{{- slice "js/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 -}}
|
|
|
|
|
|
|
|
{{- /* KaTeX https://github.com/KaTeX/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:00:39 +01:00
|
|
|
{{- slice "css/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:00:39 +01:00
|
|
|
{{- slice "js/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:00:39 +01:00
|
|
|
{{- slice "js/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:00:39 +01:00
|
|
|
{{- slice "css/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:00:39 +01:00
|
|
|
{{- slice "js/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:00:39 +01:00
|
|
|
{{- slice "js/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 -}}
|
|
|
|
|
|
|
|
{{- /* mermaid https://github.com/knsv/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:00:39 +01:00
|
|
|
{{- slice "js/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-14 14:09:21 +01:00
|
|
|
{{- /* APlayer https://github.com/MoePlayer/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:00:39 +01:00
|
|
|
{{- slice "css/lib/aplayer/APlayer.min.css" | $scratch.Add "linkLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- slice "css/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:00:39 +01:00
|
|
|
{{- slice "js/lib/aplayer/APlayer.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* MetingJS https://github.com/metowolf/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:00:39 +01:00
|
|
|
{{- slice "js/lib/meting/Meting.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* dev feature */ -}}
|
|
|
|
{{- if .Params.dev -}}
|
|
|
|
{{- /* ECharts https://github.com/apache/incubator-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:00:39 +01:00
|
|
|
{{- slice "js/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:00:39 +01:00
|
|
|
{{- slice "js/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 -}}
|