LoveIt/layouts/partials/js.html
2019-08-17 03:40:34 +08:00

66 lines
3.3 KiB
HTML

{{ $scripts := resources.Get "/js/main.js" | slice }}
{{ $dynamicToTop := resources.Get "/js/dynamicToTop.js" }}
<!-- jQuery https://github.com/jquery/jquery -->
{{ $jquery := `
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
` }}
{{ $lazysizes := `
<script src="https://cdn.jsdelivr.net/npm/lazysizes@5.1.1/lazysizes.min.js" integrity="sha256-6zKmNZVeImc0d1Y55vm4So/0W5mbwWiPS4zJt3F4t2A=" crossorigin="anonymous"></script>
` }}
<!-- KaTeX https://github.com/KaTeX/KaTeX -->
{{ $katex := `
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.js" integrity="sha384-9Nhn55MVVN0/4OFx7EE5kpFBPsEMZxKTCnA+4fqDmg12eCTqGi6+BB2LjY8brQxJ" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
` }}
<!-- TypeIt https://github.com/alexmacarthur/typeit -->
{{ $typeit := `
<script src="https://cdn.jsdelivr.net/npm/typeit@6.0.3/dist/typeit.min.js" integrity="sha256-jl1b2Wp4cXCUyX8FxPZ8Z0PPIPV3QYNb/jPSLGDej2c=" crossorigin="anonymous"></script>
` }}
<!-- jQuery.countdown https://github.com/hilios/jQuery.countdown -->
{{ $countdown := `
<script src="https://cdn.jsdelivr.net/npm/jquery-countdown@2.2.0/dist/jquery.countdown.min.js" integrity="sha256-Ikk5myJowmDQaYVCUD0Wr+vIDkN8hGI58SGWdE671A8=" crossorigin="anonymous"></script>
` }}
<!-- MetingJS https://github.com/metowolf/MetingJS -->
{{ $metingjs := `
<!-- require APlayer -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<!-- require MetingJS -->
<script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>
` }}
{{ $jquery | safeHTML }}
{{ if .IsPage }}
{{ $lazysizes | safeHTML }}
{{ if .Scratch.Get "music" }}
{{ $metingjs | safeHTML }}
{{ end }}
{{ if or .Params.math .Site.Params.math }}
{{ $katex | safeHTML }}
{{ end }}
{{ $scripts = $scripts | append $dynamicToTop }}
{{ $scripts = $scripts | resources.Concat "/js/vendor_post.js" | resources.Minify }}
{{ else }}
{{ $scripts = $scripts | resources.Concat "/js/vendor_main.js" | resources.Minify}}
{{ end }}
{{ $typeitMap := .Scratch.Get "typeitMap" }}
{{ if $typeitMap }}
{{ $typeit | safeHTML }}
{{ $typeitArr := slice }}
{{ range $key, $val := $typeitMap }}
{{ $typeitArr = $typeitArr | append (slice $val) }}
{{ end }}
<script>var typeitArr = {{ $typeitArr | jsonify | safeJS }};</script>
{{ end }}
{{ with .Scratch.Get "countdownMap" }}
{{ $countdown | safeHTML }}
<script>var countdownMap = {{ . | jsonify | safeJS }};</script>
{{ end }}
<script src="{{ $scripts.RelPermalink }}" async=""></script>
{{ template "_internal/google_analytics_async.html" . }}