mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 19:06:16 +01:00
244 lines
9 KiB
HTML
244 lines
9 KiB
HTML
{{- $scratch := .Scratch.Get "scratch" -}}
|
|
{{- $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 */ -}}
|
|
{{- 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>
|
|
{{- 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 ne .Site.Params.math.enable false | and .Params.math -}}
|
|
{{- 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: true },
|
|
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
|
|
{ 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 },
|
|
{{- 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 -}}
|
|
};
|
|
</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 -}}
|