aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/scripts.html
blob: fc254b58b61515cef99b0e2cfcf18d3ed3b52629 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!-- js -->
<script src="{{ "lib/highlight/highlight.pack.js?v=20171001" | relURL }}"></script>
{{- if .Site.Params.publicCDN.enable }}
  {{ .Site.Params.publicCDN.jquery | safeHTML }}
  {{ .Site.Params.publicCDN.slideout | safeHTML }}
  {{ if .Site.Params.fancybox }}{{ .Site.Params.publicCDN.fancyboxJs | safeHTML }}{{ end }}
{{- else -}}
  <script type="text/javascript" src="{{ "lib/jquery/jquery-3.2.1.min.js" | relURL }}"></script>
  <script type="text/javascript" src="{{ "lib/slideout/slideout-1.0.1.min.js" | relURL }}"></script>
  {{ if .Site.Params.fancybox }}<script type="text/javascript" src="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.js" | relURL }}"></script>{{ end }}
{{- end }}
<script type="text/javascript" src="{{ "dist/even.min.js?v=3.0.1" | relURL }}"></script>

{{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
  <script type="text/javascript">
    window.MathJax = {
      {{ if or .Params.mathjaxEnableSingleDollar (and .Site.Params.mathjaxEnableSingleDollar (ne .Params.mathjaxEnableSingleDollar false)) -}}
        tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
      {{ end -}}
      showProcessingMessages: false,
      messageStyle: 'none'
    };
  </script>
  <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
{{- end }}

<!-- Analytics -->
{{- if .Site.GoogleAnalytics -}}
  {{ template "_internal/google_analytics_async.html" . }}
{{- end -}}

{{- with .Site.Params.baidu_analytics -}}
<script id="baidu_analytics">
  var _hmt = _hmt || [];
  (function() {
    if (window.location.hostname === 'localhost') return;
    var hm = document.createElement("script"); hm.async = true;
    hm.src = "https://hm.baidu.com/hm.js?{{.}}";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
</script>
{{- end }}

<!-- baidu_push -->
{{- if .Site.Params.baidu_push -}}
<script id="baidu_push">
  (function(){
    if (window.location.hostname === 'localhost') return;
    var bp = document.createElement('script'); bp.async = true;
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
      bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
      bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
  })();
</script>
{{- end }}

<!-- custom js -->
{{ range .Site.Params.customJS }}
<script src="{{ "/js/" | relURL }}{{ . }}"></script>
{{ end }}