diff options
Diffstat (limited to 'layouts/partials')
-rw-r--r-- | layouts/partials/comments.html | 122 | ||||
-rw-r--r-- | layouts/partials/footer.html | 12 | ||||
-rw-r--r-- | layouts/partials/head.html | 22 | ||||
-rw-r--r-- | layouts/partials/post/reward.html | 6 | ||||
-rw-r--r-- | layouts/partials/post/toc.html | 4 | ||||
-rw-r--r-- | layouts/partials/scripts.html | 78 |
6 files changed, 122 insertions, 122 deletions
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 440240a..cac3546 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -1,4 +1,4 @@ -{{ if and .IsPage (ne .Params.comment false) }} +{{ if and .IsPage (ne .Params.comment false) -}} <!-- Disqus --> {{- if .Site.DisqusShortname -}} <div id="disqus_thread"></div> @@ -34,76 +34,76 @@ <!-- LiveRe --> {{- if .Site.Params.livereUID -}} - <div id="lv-container" data-id="city" data-uid="{{ .Site.Params.livereUID }}"> - <script type="text/javascript"> - (function(d, s) { - var j, e = d.getElementsByTagName(s)[0]; + <div id="lv-container" data-id="city" data-uid="{{ .Site.Params.livereUID }}"> + <script type="text/javascript"> + (function(d, s) { + var j, e = d.getElementsByTagName(s)[0]; - if (typeof LivereTower === 'function') { return; } + if (typeof LivereTower === 'function') { return; } - j = d.createElement(s); - j.src = 'https://cdn-city.livere.com/js/embed.dist.js'; - j.async = true; + j = d.createElement(s); + j.src = 'https://cdn-city.livere.com/js/embed.dist.js'; + j.async = true; - e.parentNode.insertBefore(j, e); - })(document, 'script'); - </script> - <noscript>Please enable JavaScript to view the comments powered by <a href="https://livere.com/">LiveRe.</a></noscript> - </div> + e.parentNode.insertBefore(j, e); + })(document, 'script'); + </script> + <noscript>Please enable JavaScript to view the comments powered by <a href="https://livere.com/">LiveRe.</a></noscript> + </div> {{- end -}} <!-- gitment --> {{- if .Site.Params.gitment.owner -}} - <div id="comments-gitment"></div> - {{ if .Site.Params.publicCDN.enable -}} - {{ .Site.Params.publicCDN.gitmentCSS | safeHTML }} - {{ .Site.Params.publicCDN.gitmentJS | safeHTML }} - {{- else -}} - <link rel="stylesheet" href="{{ "lib/gitment/gitment-0.0.3.min.css" | relURL }}"> - <script src="{{ "lib/gitment/gitment-0.0.3.min.js" | relURL }}"></script> - {{- end }} - <script type="text/javascript"> - const gitment = new Gitment({ - id: '{{ .Date }}', - title: '{{ .Title }}', - link: decodeURI(location.href), - desc: '{{ .Summary }}', - owner: '{{ .Site.Params.gitment.owner }}', - repo: '{{ .Site.Params.gitment.repo }}', - oauth: { - client_id: '{{ .Site.Params.gitment.clientId }}', - client_secret: '{{ .Site.Params.gitment.clientSecret }}' - } - }) - gitment.render('comments-gitment') - </script> - <noscript>Please enable JavaScript to view the <a href="https://github.com/imsun/gitment">comments powered by gitment.</a></noscript> - {{- end }} + <div id="comments-gitment"></div> + {{ if .Site.Params.publicCDN.enable -}} + {{ .Site.Params.publicCDN.gitmentCSS | safeHTML }} + {{ .Site.Params.publicCDN.gitmentJS | safeHTML }} + {{- else -}} + <link rel="stylesheet" href="{{ "lib/gitment/gitment-0.0.3.min.css" | relURL }}"> + <script src="{{ "lib/gitment/gitment-0.0.3.min.js" | relURL }}"></script> + {{- end }} + <script type="text/javascript"> + var gitment = new Gitment({ + id: '{{ .Date }}', + title: '{{ .Title }}', + link: decodeURI(location.href), + desc: '{{ .Summary }}', + owner: '{{ .Site.Params.gitment.owner }}', + repo: '{{ .Site.Params.gitment.repo }}', + oauth: { + client_id: '{{ .Site.Params.gitment.clientId }}', + client_secret: '{{ .Site.Params.gitment.clientSecret }}' + } + }); + gitment.render('comments-gitment'); + </script> + <noscript>Please enable JavaScript to view the <a href="https://github.com/imsun/gitment">comments powered by gitment.</a></noscript> + {{- end -}} <!-- gitalk --> {{- if .Site.Params.gitalk.owner -}} - <div id="gitalk-container"></div> - {{ if .Site.Params.publicCDN.enable -}} - {{ .Site.Params.publicCDN.gitalkCSS | safeHTML }} - {{ .Site.Params.publicCDN.gitalkJS | safeHTML }} - {{- else -}} - <link rel="stylesheet" href="{{ "lib/gitalk/gitalk-1.2.2.min.css" | relURL }}"> - <script src="{{ "lib/gitalk/gitalk-1.2.2.min.js" | relURL }}"></script> - {{- end }} - <script type="text/javascript"> - var gitalk = new Gitalk({ - id: '{{ .Date }}', - title: '{{ .Title }}', - clientID: '{{ .Site.Params.gitalk.clientId }}', - clientSecret: '{{ .Site.Params.gitalk.clientSecret }}', - repo: '{{ .Site.Params.gitalk.repo }}', - owner: '{{ .Site.Params.gitalk.owner }}', - admin: ['{{ .Site.Params.gitalk.owner }}'], - body: decodeURI(location.href) - }); - gitalk.render('gitalk-container'); - </script> - <noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by gitalk.</a></noscript> + <div id="gitalk-container"></div> + {{ if .Site.Params.publicCDN.enable -}} + {{ .Site.Params.publicCDN.gitalkCSS | safeHTML }} + {{ .Site.Params.publicCDN.gitalkJS | safeHTML }} + {{- else -}} + <link rel="stylesheet" href="{{ "lib/gitalk/gitalk-1.2.2.min.css" | relURL }}"> + <script src="{{ "lib/gitalk/gitalk-1.2.2.min.js" | relURL }}"></script> + {{- end }} + <script type="text/javascript"> + var gitalk = new Gitalk({ + id: '{{ .Date }}', + title: '{{ .Title }}', + clientID: '{{ .Site.Params.gitalk.clientId }}', + clientSecret: '{{ .Site.Params.gitalk.clientSecret }}', + repo: '{{ .Site.Params.gitalk.repo }}', + owner: '{{ .Site.Params.gitalk.owner }}', + admin: ['{{ .Site.Params.gitalk.owner }}'], + body: decodeURI(location.href) + }); + gitalk.render('gitalk-container'); + </script> + <noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by gitalk.</a></noscript> {{- end }} {{- end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index b6a1fa5..5cb72f4 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -26,13 +26,13 @@ <div class="busuanzi-footer"> {{ $spinner := "img/spinner.svg" | relURL -}} {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.sitePV -}} - {{ $valueSpan := printf `<span id="busuanzi_value_site_pv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}} - <span id="busuanzi_container_site_pv"> {{ printf (T "sitePV") $valueSpan | safeHTML }} </span> - {{ if .Site.Params.busuanzi.siteUV }}<span class="division">|</span>{{ end }} + {{ $valueSpan := printf `<span id="busuanzi_value_site_pv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}} + <span id="busuanzi_container_site_pv"> {{ printf (T "sitePV") $valueSpan | safeHTML }} </span> + {{ if .Site.Params.busuanzi.siteUV }}<span class="division">|</span>{{ end }} {{- end }} {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.siteUV -}} - {{ $valueSpan := printf `<span id="busuanzi_value_site_uv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}} - <span id="busuanzi_container_site_uv"> {{ printf (T "siteUV") $valueSpan | safeHTML }} </span> + {{ $valueSpan := printf `<span id="busuanzi_value_site_uv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}} + <span id="busuanzi_container_site_uv"> {{ printf (T "siteUV") $valueSpan | safeHTML }} </span> {{- end }} </div> {{- end }} @@ -40,7 +40,7 @@ <span class="copyright-year"> {{- $current := now.Format "2006" }} © - {{ if ne .Site.Params.since $current }} + {{ if ne .Site.Params.since $current -}} {{ .Site.Params.since }} - {{ end }} {{- $current }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 9b5c840..b38f160 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -14,16 +14,16 @@ {{- if .Description -}} <meta name="description" content="{{ .Description | safeHTML }}" /> -{{ else if .IsPage }} +{{- else if .IsPage -}} <meta name="description" content="{{ .Summary | plainify }}" /> -{{ else if .Site.Params.description }} +{{- else if .Site.Params.description -}} <meta name="description" content="{{ .Site.Params.description | safeHTML }}" /> {{- end -}} {{- if .Keywords -}} {{ $length := len .Keywords | add -1 -}} <meta name="keywords" content="{{ range $index, $element := .Keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> -{{ else if .Site.Params.keywords }} +{{- else if .Site.Params.keywords -}} {{ $length := len .Site.Params.keywords | add -1 -}} <meta name="keywords" content="{{ range $index, $element := .Site.Params.keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> {{- end }} @@ -37,10 +37,10 @@ <!-- Permalink & RSSlink --> <link rel="canonical" href="{{ .Permalink }}" /> -{{ if .RSSLink -}} +{{- if .RSSLink }} <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" /> <link href="{{ .RSSLink }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}" /> -{{ end -}} +{{- end -}} <!-- Favicon and Touch icons --> <link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}"> @@ -50,15 +50,15 @@ <link rel="mask-icon" href="{{ "safari-pinned-tab.svg" | relURL }}" color="#5bbad5"> <!-- debug --> -{{- if .Site.Params.debug }} +{{- if .Site.Params.debug -}} <script src="https://cdn.jsdelivr.net/npm/eruda@1.2.6/eruda.min.js" integrity="sha256-Jmz4bc3kp+rRrXX2tGadNBKFLwtzMapr8kHABxSAAP8=" crossorigin="anonymous"></script> <script>eruda.init();</script> -{{- end }} +{{- end -}} <!-- busuanzi --> -{{ if .Site.Params.busuanzi.enable -}} +{{- if .Site.Params.busuanzi.enable -}} <script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script> -{{- end }} +{{- end -}} <!-- Styles --> <link href="{{ print "dist/" .Site.Data.even.assets.even.css | relURL }}" rel="stylesheet"> @@ -66,10 +66,10 @@ {{ if .Site.Params.fancybox }}{{ .Site.Params.publicCDN.fancyboxCSS | safeHTML }}{{ end }} {{- else -}} {{ if .Site.Params.fancybox }}<link href="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.css" | relURL }}" rel="stylesheet">{{ end }} -{{- end }} +{{- end -}} <!-- custom css --> -{{ range .Site.Params.customCSS }} +{{ range .Site.Params.customCSS -}} <link rel="stylesheet" href="{{ "/css/" | relURL }}{{ . }}"> {{ end }} diff --git a/layouts/partials/post/reward.html b/layouts/partials/post/reward.html index 3242854..baceac7 100644 --- a/layouts/partials/post/reward.html +++ b/layouts/partials/post/reward.html @@ -1,16 +1,16 @@ -{{ if or .Params.reward (and .Site.Params.reward.enable (ne .Params.reward false)) }} +{{ if or .Params.reward (and .Site.Params.reward.enable (ne .Params.reward false)) -}} <div class="post-reward"> <input type="checkbox" name="reward" id="reward" hidden /> <label class="reward-button" for="reward">{{ T "reward" }}</label> <div class="qr-code"> {{ $qrCode := .Site.Params.reward }} - {{ with $qrCode.wechat }} + {{ with $qrCode.wechat -}} <label class="qr-code-image" for="reward"> <img class="image" src="{{ . }}"> <span>{{ T "rewardWechat" }}</span> </label> {{- end }} - {{ with $qrCode.alipay }} + {{ with $qrCode.alipay -}} <label class="qr-code-image" for="reward"> <img class="image" src="{{ . }}"> <span>{{ T "rewardAlipay" }}</span> diff --git a/layouts/partials/post/toc.html b/layouts/partials/post/toc.html index 4fed1c7..759ad43 100644 --- a/layouts/partials/post/toc.html +++ b/layouts/partials/post/toc.html @@ -1,7 +1,7 @@ -{{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }} +{{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}} <div class="post-toc" id="post-toc"> <h2 class="post-toc-title">{{ T "toc" }}</h2> - {{ $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default false }} + {{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default false }} <div class="post-toc-content{{ if not (or .Params.autoCollapseToc (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false))) }} always-active{{ end }}"> {{.TableOfContents}} </div> diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index a89ad89..2dfea1a 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -17,55 +17,55 @@ <!-- timeago.JS --> {{- if and (or .Params.enableOutdatedInfoWarning (and .Site.Params.outdatedInfoWarning.enable (ne .Params.enableOutdatedInfoWarning false))) (or .IsPage .IsHome) }} {{- if .Site.Params.publicCDN.enable }} - {{ .Site.Params.publicCDN.timeagoJS | safeHTML }} - {{ .Site.Params.publicCDN.timeagoLocalesJS | safeHTML }} + {{ .Site.Params.publicCDN.timeagoJS | safeHTML }} + {{ .Site.Params.publicCDN.timeagoLocalesJS | safeHTML }} {{- else }} - <script type="text/javascript" src="{{ "lib/timeago/timeago-3.0.2.min.js" | relURL }}"></script> - <script type="text/javascript" src="{{ "lib/timeago/timeago.locales-3.0.2.min.js" | relURL }}"></script> + <script type="text/javascript" src="{{ "lib/timeago/timeago-3.0.2.min.js" | relURL }}"></script> + <script type="text/javascript" src="{{ "lib/timeago/timeago.locales-3.0.2.min.js" | relURL }}"></script> {{- end }} -<script> // NOTE: timeago.js uses the language code format like "zh_CN" (underscore and case sensitive) - var languageCode = {{ .Site.LanguageCode }}.replace(/-/g, '_').replace(/_(.*)/, function ($0, $1) {return $0.replace($1, $1.toUpperCase());}); - timeago().render(document.querySelectorAll('.timeago'), languageCode); - timeago.cancel(); // stop update -</script> -{{- end }} + <script><!-- NOTE: timeago.js uses the language code format like "zh_CN" (underscore and case sensitive) --> + var languageCode = {{ .Site.LanguageCode }}.replace(/-/g, '_').replace(/_(.*)/, function ($0, $1) {return $0.replace($1, $1.toUpperCase());}); + timeago().render(document.querySelectorAll('.timeago'), languageCode); + timeago.cancel(); // stop update + </script> +{{- end -}} <!-- flowchart --> {{- if and (or .Params.flowchartDiagrams.enable (and .Site.Params.flowchartDiagrams.enable (ne .Params.flowchartDiagrams.enable false))) (or .IsPage .IsHome) -}} -<script> - {{- if .Params.flowchartDiagrams.options -}} - window.flowchartDiagramsOptions = {{ .Params.flowchartDiagrams.options | safeJS }}; - {{- else if .Site.Params.flowchartDiagrams.options -}} - window.flowchartDiagramsOptions = {{ .Site.Params.flowchartDiagrams.options | safeJS }}; + <script> + {{- if .Params.flowchartDiagrams.options -}} + window.flowchartDiagramsOptions = {{ .Params.flowchartDiagrams.options | safeJS }}; + {{- else if .Site.Params.flowchartDiagrams.options -}} + window.flowchartDiagramsOptions = {{ .Site.Params.flowchartDiagrams.options | safeJS }}; + {{- end -}} + </script> + {{- if .Site.Params.publicCDN.enable -}} + {{ .Site.Params.publicCDN.flowchartDiagramsJS | safeHTML }} + {{- else -}} + <script src="{{ "lib/flowchartDiagrams/raphael-2.2.7.min.js" | relURL }}" integrity="sha256-67By+NpOtm9ka1R6xpUefeGOY8kWWHHRAKlvaTJ7ONI=" crossorigin="anonymous"></script> + <script src="{{ "lib/flowchartDiagrams/flowchart-1.8.0.min.js" | relURL }}" integrity="sha256-zNGWjubXoY6rb5MnmpBNefO0RgoVYfle9p0tvOQM+6k=" crossorigin="anonymous"></script> {{- end -}} -</script> -{{- if .Site.Params.publicCDN.enable -}} - {{ .Site.Params.publicCDN.flowchartDiagramsJS | safeHTML }} -{{- else -}} -<script src="{{ "lib/flowchartDiagrams/raphael-2.2.7.min.js" | relURL }}" integrity="sha256-67By+NpOtm9ka1R6xpUefeGOY8kWWHHRAKlvaTJ7ONI=" crossorigin="anonymous"></script> -<script src="{{ "lib/flowchartDiagrams/flowchart-1.8.0.min.js" | relURL }}" integrity="sha256-zNGWjubXoY6rb5MnmpBNefO0RgoVYfle9p0tvOQM+6k=" crossorigin="anonymous"></script> -{{- end -}} {{- end -}} <!-- js-sequence-diagrams --> {{- if and (or .Params.sequenceDiagrams.enable (and .Site.Params.sequenceDiagrams.enable (ne .Params.sequenceDiagrams.enable false))) (or .IsPage .IsHome) -}} -<script> - {{- if .Params.sequenceDiagrams.options -}} - window.sequenceDiagramsOptions = {{ .Params.sequenceDiagrams.options | safeJS }}; - {{- else if .Site.Params.sequenceDiagrams.options -}} - window.sequenceDiagramsOptions = {{ .Site.Params.sequenceDiagrams.options | safeJS }}; + <script> + {{- if .Params.sequenceDiagrams.options -}} + window.sequenceDiagramsOptions = {{ .Params.sequenceDiagrams.options | safeJS }}; + {{- else if .Site.Params.sequenceDiagrams.options -}} + window.sequenceDiagramsOptions = {{ .Site.Params.sequenceDiagrams.options | safeJS }}; + {{- end -}} + </script> + {{- if .Site.Params.publicCDN.enable -}} + {{ .Site.Params.publicCDN.sequenceDiagramsJS | safeHTML }} + {{ .Site.Params.publicCDN.sequenceDiagramsCSS | safeHTML }} + {{- else -}} + <script src="{{ "lib/js-sequence-diagrams/webfontloader-1.6.28.js" | relURL }}" integrity="sha256-4O4pS1SH31ZqrSO2A/2QJTVjTPqVe+jnYgOWUVr7EEc=" crossorigin="anonymous"></script> + <script src="{{ "lib/js-sequence-diagrams/snap.svg-0.5.1.min.js" | relURL }}" integrity="sha256-oI+elz+sIm+jpn8F/qEspKoKveTc5uKeFHNNVexe6d8=" crossorigin="anonymous"></script> + <script src="{{ "lib/js-sequence-diagrams/underscore-1.8.3.min.js" | relURL }}" integrity="sha256-obZACiHd7gkOk9iIL/pimWMTJ4W/pBsKu+oZnSeBIek=" crossorigin="anonymous"></script> + <script src="{{ "lib/js-sequence-diagrams/sequence-diagram-2.0.1.min.js" | relURL }}" integrity="sha384-8748Vn52gHJYJI0XEuPB2QlPVNUkJlJn9tHqKec6J3q2r9l8fvRxrgn/E5ZHV0sP" crossorigin="anonymous"></script> + <link rel="stylesheet" href="{{ "lib/js-sequence-diagrams/sequence-diagram-2.0.1.min.css" | relURL }}" integrity="sha384-6QbLKJMz5dS3adWSeINZe74uSydBGFbnzaAYmp+tKyq60S7H2p6V7g1TysM5lAaF" crossorigin="anonymous"> {{- end -}} -</script> -{{- if .Site.Params.publicCDN.enable -}} - {{ .Site.Params.publicCDN.sequenceDiagramsJS | safeHTML }} - {{ .Site.Params.publicCDN.sequenceDiagramsCSS | safeHTML }} -{{- else -}} -<script src="{{ "lib/js-sequence-diagrams/webfontloader-1.6.28.js" | relURL }}" integrity="sha256-4O4pS1SH31ZqrSO2A/2QJTVjTPqVe+jnYgOWUVr7EEc=" crossorigin="anonymous"></script> -<script src="{{ "lib/js-sequence-diagrams/snap.svg-0.5.1.min.js" | relURL }}" integrity="sha256-oI+elz+sIm+jpn8F/qEspKoKveTc5uKeFHNNVexe6d8=" crossorigin="anonymous"></script> -<script src="{{ "lib/js-sequence-diagrams/underscore-1.8.3.min.js" | relURL }}" integrity="sha256-obZACiHd7gkOk9iIL/pimWMTJ4W/pBsKu+oZnSeBIek=" crossorigin="anonymous"></script> -<script src="{{ "lib/js-sequence-diagrams/sequence-diagram-2.0.1.min.js" | relURL }}" integrity="sha384-8748Vn52gHJYJI0XEuPB2QlPVNUkJlJn9tHqKec6J3q2r9l8fvRxrgn/E5ZHV0sP" crossorigin="anonymous"></script> -<link rel="stylesheet" href="{{ "lib/js-sequence-diagrams/sequence-diagram-2.0.1.min.css" | relURL }}" integrity="sha384-6QbLKJMz5dS3adWSeINZe74uSydBGFbnzaAYmp+tKyq60S7H2p6V7g1TysM5lAaF" crossorigin="anonymous"> -{{- end -}} {{- end }} <script type="text/javascript" src="{{ print "dist/" .Site.Data.even.assets.even.js | relURL }}"></script> @@ -128,5 +128,5 @@ <!-- custom js --> {{ range .Site.Params.customJS -}} -<script src="{{ "/js/" | relURL }}{{ . }}"></script> + <script src="{{ "/js/" | relURL }}{{ . }}"></script> {{ end }} |