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-03-14 17:39:23 +01:00
|
|
|
{{- with $CDN.iconfontCSS -}}
|
|
|
|
{{- slice . | $scratch.Add "linkCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "lib/iconfont/iconfont.css" | $scratch.Add "linkLocal" -}}
|
|
|
|
{{- end -}}
|
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-03-08 14:02:21 +01:00
|
|
|
{{- with $CDN.lazysizesJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "lib/lazysizes/lazysizes.min.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* lightgallery.js */ -}}
|
2020-03-09 13:25:55 +01:00
|
|
|
{{- if ne .Site.Params.page.lightgallery false | and (ne .Params.lightgallery false) -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
{{- 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,
|
2020-03-17 17:52:36 +01:00
|
|
|
actualSize: false,
|
2020-02-24 10:00:39 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
</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-03-08 14:02:21 +01:00
|
|
|
],
|
|
|
|
strict: false,
|
2020-02-14 14:09:21 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 10:53:08 +01:00
|
|
|
{{- /* mermaid */ -}}
|
2020-03-21 09:59:23 +01:00
|
|
|
{{- if $scratch.Get "mermaid" -}}
|
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 13:34:00 +01:00
|
|
|
{{- slice "lib/mermaid/mermaid.scss" | $scratch.Add "linkLocal" -}}
|
2020-02-27 13:14:40 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* ECharts */ -}}
|
2020-03-21 09:59:23 +01:00
|
|
|
{{- if $scratch.Get "echarts" -}}
|
2020-02-27 13:14:40 +01:00
|
|
|
{{- with $CDN.echartsJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "lib/echarts/echarts.min.js" | $scratch.Add "scriptLocal" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.echartsMacaronsJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "lib/echarts/macarons.js" | $scratch.Add "scriptLocal" -}}
|
|
|
|
{{- end -}}
|
2020-03-21 09:59:23 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- /* Mapbox GL */ -}}
|
|
|
|
{{- if $scratch.Get "mapbox" -}}
|
|
|
|
{{- with $CDN.mapboxGLCSS -}}
|
|
|
|
{{- slice . | $scratch.Add "linkCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "lib/mapbox-gl/mapbox-gl.min.css" | $scratch.Add "linkLocal" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $CDN.mapboxGLJS -}}
|
|
|
|
{{- slice . | $scratch.Add "scriptCDN" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- slice "lib/mapbox-gl/mapbox-gl.min.js" | $scratch.Add "scriptLocal" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- slice "lib/mapbox-gl/mapbox-gl-language.js" | $scratch.Add "scriptLocal" -}}
|
2020-02-27 13:14:40 +01:00
|
|
|
<script>
|
2020-03-21 09:59:23 +01:00
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
mapboxgl.accessToken = '{{ .Params.mapbox.accessToken | default .Site.Params.mapbox.accessToken }}';
|
|
|
|
mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');
|
|
|
|
});
|
2020-02-14 14:09:21 +01:00
|
|
|
</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 -}}
|
|
|
|
|
2020-02-27 13:14:40 +01:00
|
|
|
{{- /* Dev feature */ -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- if .Params.dev -}}
|
2020-02-27 13:14:40 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- with $scratch.Get "contentMap" -}}
|
|
|
|
<script>
|
|
|
|
window.contentMap = {{ jsonify . | safeJS }};
|
|
|
|
</script>
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-24 13:34:00 +01:00
|
|
|
{{- /* Theme script */ -}}
|
|
|
|
{{- slice "js/theme.min.js" | $scratch.Add "scriptLocal" -}}
|
|
|
|
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
|
|
|
|
|
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 -}}
|
2020-03-09 20:33:28 +01:00
|
|
|
{{- $stylesheet := dict "resource" $res "fingerprint" ($scratch.Get "fingerprint") -}}
|
2020-03-09 13:25:55 +01:00
|
|
|
{{- partial "plugin/stylesheet.html" $stylesheet -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- 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 -}}
|
2020-03-09 20:33:28 +01:00
|
|
|
{{- $script := dict "resource" $res "fingerprint" ($scratch.Get "fingerprint") -}}
|
2020-03-09 13:25:55 +01:00
|
|
|
{{- partial "plugin/script.html" $script -}}
|
2020-02-14 14:09:21 +01:00
|
|
|
{{- end -}}
|
2020-02-16 17:41:08 +01:00
|
|
|
|
2020-02-17 14:02:27 +01:00
|
|
|
{{- /* Google analytics async */ -}}
|
2020-03-16 14:35:16 +01:00
|
|
|
{{- if eq hugo.Environment "production" | and .Site.GoogleAnalytics -}}
|
2020-02-17 14:02:27 +01:00
|
|
|
{{- template "_internal/google_analytics_async.html" . -}}
|
|
|
|
{{- end -}}
|