mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-25 16:26:36 +01:00
276 lines
14 KiB
HTML
276 lines
14 KiB
HTML
{{- $scratch := .Scratch.Get "scratch" -}}
|
|
{{- $CDN := $scratch.Get "CDN" -}}
|
|
{{- $fingerprint := $scratch.Get "fingerprint" -}}
|
|
{{- $config := dict "desktopHeaderMode" .Site.Params.header.desktopMode "mobileHeaderMode" .Site.Params.header.mobileMode -}}
|
|
{{- with $scratch.Get "contentData" -}}
|
|
{{- $config = dict "content" . | merge $config -}}
|
|
{{- end -}}
|
|
{{- with $scratch.Get "comment" -}}
|
|
{{- $config = dict "comment" . | merge $config -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Fork Awesome */ -}}
|
|
{{- if $scratch.Get "forkawesome" -}}
|
|
{{- $options := dict "targetPath" "lib/forkawesome/fork-awesome.min.css" -}}
|
|
{{- dict "source" "lib/forkawesome/fork-awesome.scss" "toCSS" $options "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* iconfont */ -}}
|
|
{{- if $scratch.Get "iconfont" -}}
|
|
{{- with $CDN.iconfontCSS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/iconfont/iconfont.css" "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Smooth Scroll */ -}}
|
|
{{- with $CDN.smoothScrollJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/smooth-scroll/smooth-scroll.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Search */ -}}
|
|
{{- if .Site.Params.search.enable -}}
|
|
{{- with $CDN.autocompleteJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/autocomplete/autocomplete.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- $searchConfig := dict "noResultsFound" (T "noResultsFound") -}}
|
|
{{- if eq .Site.Params.search.type "lunr" -}}
|
|
{{- with .Site.Home.OutputFormats.Get "json" -}}
|
|
{{- $searchConfig = dict "type" "lunr" "lunrIndexURL" .RelPermalink | merge $searchConfig -}}
|
|
{{- end -}}
|
|
{{- with $CDN.lunrJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/lunr/lunr.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- if ne .Language.Lang "en" -}}
|
|
{{- $searchConfig = T "lunrLanguageCode" | dict "lunrLanguageCode" | merge $searchConfig -}}
|
|
{{- if eq .Language.Lang "zh-cn" -}}
|
|
{{- $searchConfig = dict "lunrSegmentitURL" (resources.Get "lib/lunr/lunr.segmentit.js").RelPermalink | merge $searchConfig -}}
|
|
{{- end -}}
|
|
{{- dict "source" "lib/lunr/lunr.stemmer.support.js" "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- dict "source" (T "lunrLanguageLib") "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- else if eq .Site.Params.search.type "algolia" -}}
|
|
{{- with $CDN.algoliasearchJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/algoliasearch/algoliasearch-lite.umd.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- $searchConfig = dict "type" "algolia" "algoliaIndex" .Site.Params.search.algolia.index "algoliaAppID" .Site.Params.search.algolia.appID "algoliaSearchKey" .Site.Params.search.algolia.searchKey | merge $searchConfig -}}
|
|
{{- end -}}
|
|
{{- $config = dict "search" $searchConfig | merge $config -}}
|
|
{{- end -}}
|
|
|
|
{{- /* lazysizes */ -}}
|
|
{{- with $CDN.lazysizesJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/lazysizes/lazysizes.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* lightgallery.js */ -}}
|
|
{{- if ne .Site.Params.page.lightgallery false | and (ne .Params.lightgallery false) -}}
|
|
{{- with $CDN.lightgalleryCSS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/lightgallery/lightgallery.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.lightgalleryJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/lightgallery/lightgallery.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.lightgalleryThumbnailJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/lightgallery/lg-thumbnail.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.lightgalleryZoomJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/lightgallery/lg-zoom.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- $lightGalleryConfig := dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false -}}
|
|
{{- $config = dict "lightGallery" $lightGalleryConfig | merge $config -}}
|
|
{{- end -}}
|
|
|
|
{{- /* clipboard.js */ -}}
|
|
{{- with $CDN.clipboardJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/clipboard/clipboard.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- $config = T "copyToClipboard" | dict "title" | dict "clipboard" | merge $config -}}
|
|
|
|
{{- /* Sharer.js */ -}}
|
|
{{- if $scratch.Get "share" -}}
|
|
{{- with $CDN.sharerJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/sharer/sharer.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- /* TypeIt */ -}}
|
|
{{- with $scratch.Get "typeitMap" -}}
|
|
{{- with $CDN.typeitJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/typeit/typeit.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- $typeitConfig := slice -}}
|
|
{{- range $key, $val := . -}}
|
|
{{- $typeitConfig = $typeitConfig | append (slice $val) -}}
|
|
{{- end -}}
|
|
{{- $config = dict "typeit" $typeitConfig | merge $config -}}
|
|
{{- end -}}
|
|
|
|
{{- /* KaTeX */ -}}
|
|
{{- if ne .Site.Params.math.enable false | and .Params.math -}}
|
|
{{- with $CDN.katexCSS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/katex/katex.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.katexJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/katex/katex.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.katexAutoRenderJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/katex/auto-render.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- $math := .Site.Params.math -}}
|
|
{{- if $math.copyTex -}}
|
|
{{- with $CDN.katexCopyTexCSS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/katex/copy-tex.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.katexCopyTexJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/katex/copy-tex.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- if $math.mhchem -}}
|
|
{{- with $CDN.katexMhchemJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/katex/mhchem.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- $mathConfig := dict "strict" false -}}
|
|
{{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}}
|
|
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
|
|
{{- $delimiters = $delimiters | append (dict "left" $math.blockLeftDelimiter "right" $math.blockRightDelimiter "display" true) -}}
|
|
{{- end -}}
|
|
{{- $delimiters = $delimiters | append (dict "left" "$" "right" "$" "display" false) (dict "left" "\\(" "right" "\\)" "display" false) -}}
|
|
{{- if and $math.inlineLeftDelimiter $math.inlineRightDelimiter -}}
|
|
{{- $delimiters = $delimiters | append (dict "left" $math.inlineRightDelimiter "right" $math.inlineRightDelimiter "display" false) -}}
|
|
{{- end -}}
|
|
{{- $mathConfig = dict "delimiters" $delimiters | merge $mathConfig -}}
|
|
{{- $config = dict "math" $mathConfig | merge $config -}}
|
|
{{- end -}}
|
|
|
|
{{- /* mermaid */ -}}
|
|
{{- if $scratch.Get "mermaid" -}}
|
|
{{- with $CDN.mermaidJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/mermaid/mermaid.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- $options := dict "targetPath" "lib/mermaid/mermaid.min.css" -}}
|
|
{{- dict "source" "lib/mermaid/mermaid.scss" "toCSS" $options "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* ECharts */ -}}
|
|
{{- if $scratch.Get "echarts" -}}
|
|
{{- with $CDN.echartsJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/echarts/echarts.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.echartsMacaronsJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/echarts/macarons.js" "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Mapbox GL */ -}}
|
|
{{- if $scratch.Get "mapbox" -}}
|
|
{{- with $CDN.mapboxGLCSS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/mapbox-gl/mapbox-gl.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
|
{{- end -}}
|
|
{{- with $CDN.mapboxGLJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/mapbox-gl/mapbox-gl.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- dict "source" "lib/mapbox-gl/mapbox-gl-language.js" "minify" true "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- $mapbox := dict "accessToken" (.Params.mapbox.accessToken | default .Site.Params.mapbox.accessToken) "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" -}}
|
|
{{- $config = dict "mapbox" $mapbox | merge $config -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Music */ -}}
|
|
{{- if $scratch.Get "music" -}}
|
|
{{- /* APlayer */ -}}
|
|
{{- with $CDN.aplayerCSS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "stylesheet" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/aplayer/APlayer.min.css" "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
|
{{- end -}}
|
|
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" -}}
|
|
{{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | slice | $scratch.Add "stylesheet" -}}
|
|
{{- with $CDN.aplayerJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/aplayer/APlayer.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
|
|
{{- /* MetingJS */ -}}
|
|
{{- with $CDN.metingJS -}}
|
|
{{- dict "source" . "crossorigin" true | slice | $scratch.Add "script" -}}
|
|
{{- else -}}
|
|
{{- dict "source" "lib/meting/Meting.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Dev feature */ -}}
|
|
{{- if .Params.dev -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Theme script */ -}}
|
|
{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | slice | $scratch.Add "script" -}}
|
|
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
|
|
|
|
{{- range $scratch.Get "stylesheet" -}}
|
|
{{- partial "plugin/stylesheet.html" . -}}
|
|
{{- end -}}
|
|
|
|
<script type="text/javascript">
|
|
window.config = {{ jsonify $config | safeJS }};
|
|
</script>
|
|
|
|
{{- /* Polyfill.io */ -}}
|
|
{{- partial "plugin/script.html" (dict "source" "https://polyfill.io/v3/polyfill.min.js?features=Element.prototype.closest%2CrequestAnimationFrame%2CCustomEvent%2CPromise%2CObject.entries%2CObject.assign%2CObject.values%2Cfetch%2CElement.prototype.after") -}}
|
|
|
|
{{- range $scratch.Get "script" -}}
|
|
{{- partial "plugin/script.html" . -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Google analytics async */ -}}
|
|
{{- if eq hugo.Environment "production" | and .Site.GoogleAnalytics -}}
|
|
{{- template "_internal/google_analytics_async.html" . -}}
|
|
{{- end -}}
|