mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-15 03:16:30 +01:00
199 lines
7.3 KiB
HTML
199 lines
7.3 KiB
HTML
{{- $CDN := .Scratch.Get "CDN" -}}
|
|
|
|
{{- /* Fork Awesome https://forkaweso.me/ */ -}}
|
|
{{- if .Scratch.Get "forkawesome" -}}
|
|
{{- slice "css/lib/forkawesome/fork-awesome.scss" | .Scratch.Add "linkLocal" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* iconfont https://www.iconfont.cn/ */ -}}
|
|
{{- if .Scratch.Get "iconfont" -}}
|
|
{{- slice "css/lib/iconfont/iconfont.css" | .Scratch.Add "linkLocal" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Smooth Scroll https://github.com/cferdinandi/smooth-scroll */ -}}
|
|
{{- with $CDN.smoothScrollJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/smooth-scroll/smooth-scroll.polyfills.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Sharer.js https://github.com/ellisonleao/sharer.js */ -}}
|
|
{{- if .Scratch.Get "share" -}}
|
|
{{- with $CDN.sharerJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/sharer/sharer.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- /* lazysizes https://github.com/aFarkas/lazysizes */ -}}
|
|
{{- with $CDN.lazysizesJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/lazysizes/lazysizes.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* TypeIt https://github.com/alexmacarthur/typeit */ -}}
|
|
{{- with .Scratch.Get "typeitMap" -}}
|
|
{{- with $CDN.typeitJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/typeit/typeit.min.js" | $.Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
{{- range $key, $val := . -}}
|
|
{{- slice $val | $.Scratch.Add "typeitArr" -}}
|
|
{{- end -}}
|
|
<script>
|
|
window.typeitArr = {{ $.Scratch.Get "typeitArr" | jsonify | safeJS }};
|
|
</script>
|
|
{{- end -}}
|
|
|
|
{{- /* KaTeX https://github.com/KaTeX/KaTeX */ -}}
|
|
{{- if .Site.Params.math.enable | and (ne .Params.math false) -}}
|
|
{{- with $CDN.katexCSS -}}
|
|
{{- slice . | $.Scratch.Add "linkCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "css/lib/katex/katex.min.css" | .Scratch.Add "linkLocal" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.katexJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/katex/katex.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.katexAutoRenderJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/katex/auto-render.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
{{- $math := .Site.Params.math -}}
|
|
{{- if $math.copyTex -}}
|
|
{{- with $CDN.katexCopyTexCSS -}}
|
|
{{- slice . | $.Scratch.Add "linkCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "css/lib/katex/copy-tex.min.css" | .Scratch.Add "linkLocal" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.katexCopyTexJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/katex/copy-tex.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- if $math.mhchem -}}
|
|
{{- with $CDN.katexMhchemJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/katex/mhchem.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
renderMathInElement(document.body, {
|
|
delimiters: [
|
|
{ left: "$$", right: "$$", display: true },
|
|
{ left: "\\(", right: "\\)", display: false },
|
|
{ left: "\\[", right: "\\]", display: true },
|
|
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
|
|
{ left: "{{ $math.blockLeftDelimiter }}", right: "{{ $math.blockRightDelimiter }}", display: true },
|
|
{{- end -}}
|
|
{{- if and $math.inlineLeftDelimiter $math.inlineRightDelimiter -}}
|
|
{ left: "{{ $math.inlineLeftDelimiter }}", right: "{{ $math.inlineRightDelimiter }}", display: false },
|
|
{{- end -}}
|
|
]
|
|
});
|
|
});
|
|
</script>
|
|
{{- end -}}
|
|
|
|
{{- /* mermaid https://github.com/knsv/mermaid */ -}}
|
|
{{- with .Scratch.Get "mermaidMap" -}}
|
|
{{- with $CDN.mermaidJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/mermaid/mermaid.min.js" | $.Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
{{- slice "css/mermaid.scss" | $.Scratch.Add "linkLocal" -}}
|
|
<script>
|
|
window.mermaidMap = {{ jsonify . | safeJS }};
|
|
</script>
|
|
{{- end -}}
|
|
|
|
{{- /* Music */ -}}
|
|
{{- if .Scratch.Get "music" -}}
|
|
{{- /* APlayer https://github.com/MoePlayer/APlayer */ -}}
|
|
{{- with $CDN.aplayerCSS -}}
|
|
{{- slice . | $.Scratch.Add "linkCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "css/lib/aplayer/APlayer.min.css" | .Scratch.Add "linkLocal" -}}
|
|
{{- end -}}
|
|
{{- slice "css/lib/aplayer/dark.scss" | .Scratch.Add "linkLocal" -}}
|
|
{{- with $CDN.aplayerJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/aplayer/APlayer.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* MetingJS https://github.com/metowolf/MetingJS */ -}}
|
|
{{- with $CDN.metingJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/meting/Meting.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- /* dev feature */ -}}
|
|
{{- if .Params.dev -}}
|
|
{{- /* ECharts https://github.com/apache/incubator-echarts */ -}}
|
|
{{- with .Scratch.Get "echartsMap" -}}
|
|
{{- with $CDN.echartsJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/echarts/echarts.min.js" | $.Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.echartsMacaronsJS -}}
|
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
{{- else -}}
|
|
{{- slice "js/lib/echarts/macarons.js" | $.Scratch.Add "scriptLocal" -}}
|
|
{{- end -}}
|
|
<script>
|
|
window.echartsMap = {
|
|
{{- range $key, $var := . -}}
|
|
{{- $key }}: {{ $var | safeJS -}},
|
|
{{- end -}}
|
|
};
|
|
window.echartsArr = [];
|
|
</script>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- range .Scratch.Get "linkCDN" -}}
|
|
{{- safeHTML . -}}
|
|
{{- end -}}
|
|
{{- range .Scratch.Get "linkLocal" -}}
|
|
{{- $res := resources.Get . -}}
|
|
{{- if strings.HasSuffix . ".scss" -}}
|
|
{{- $options := dict "outputStyle" "compressed" "enableSourceMap" true -}}
|
|
{{- $res = toCSS $options $res -}}
|
|
{{- else if not (strings.HasSuffix . ".min.css") -}}
|
|
{{- $res = minify $res -}}
|
|
{{- end -}}
|
|
<link rel="stylesheet" href="{{ $res.RelPermalink }}">
|
|
{{- end -}}
|
|
|
|
{{- range .Scratch.Get "scriptCDN" -}}
|
|
{{- safeHTML . -}}
|
|
{{- end -}}
|
|
{{- range .Scratch.Get "scriptLocal" -}}
|
|
{{- $res := resources.Get . -}}
|
|
{{- if not (strings.HasSuffix . ".min.js") -}}
|
|
{{- $res = minify $res -}}
|
|
{{- end -}}
|
|
<script src="{{ $res.RelPermalink }}"></script>
|
|
{{- end -}}
|
|
|
|
{{- /* Theme script */ -}}
|
|
<script src=/js/theme.min.js></script>
|
|
|
|
{{- /* Google analytics async */ -}}
|
|
{{- if .Scratch.Get "production" | and .Site.GoogleAnalytics -}}
|
|
{{- template "_internal/google_analytics_async.html" . -}}
|
|
{{- end -}}
|