diff options
author | WayJam So <imsuwj@gmail.com> | 2020-07-22 18:35:26 +0300 |
---|---|---|
committer | WayJam So <imsuwj@gmail.com> | 2020-07-22 18:35:26 +0300 |
commit | e18d66917332ea00f920cf17e798ecd1215c4140 (patch) | |
tree | fb6702c89ba7d9ea878256fb63cec5850667efc2 | |
parent | 02f80e96db0e30b6d62702b1ab41ea257d89e871 (diff) |
format code
-rw-r--r-- | .editorconfig | 16 | ||||
-rw-r--r-- | assets/js/main.js | 8 | ||||
-rw-r--r-- | layouts/404.html | 21 | ||||
-rw-r--r-- | layouts/_default/archives.html | 36 | ||||
-rw-r--r-- | layouts/_default/single.html | 22 | ||||
-rw-r--r-- | layouts/index.html | 6 | ||||
-rw-r--r-- | layouts/partials/comments.html | 18 | ||||
-rw-r--r-- | static/manifest.json | 24 |
8 files changed, 83 insertions, 68 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7b67d0c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +trim_trailing_whitespace = true + +[*.js] +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false
\ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js index 2b467a7..5300c36 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,11 +1,11 @@ -(function() { +(function () { const backToTopBtn = document.getElementById("back_to_top"); - window.onscroll = function() { + window.onscroll = function () { scrollFunction(backToTopBtn); }; - backToTopBtn.addEventListener("click", backToTop) + backToTopBtn.addEventListener("click", backToTop); })(); function scrollFunction(btn) { @@ -16,7 +16,7 @@ function scrollFunction(btn) { // When the user clicks on the button, scroll to the top of the document function backToTop(e) { - e.preventDefault() + e.preventDefault(); document.body.scrollTop = 0; // For Safari document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera } diff --git a/layouts/404.html b/layouts/404.html index f1e05e8..2a0253b 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -2,16 +2,15 @@ {{ define "main" }} <section id="main" class="notfound"> - <div class="container"> - <div class="content"> - <h1 class="not-found-title">404</h1> - <div class="block"> - <h3>Sorry, we couldn't find the page you're looking for.</h3> - <div class="line"></div> - <p class="back"><a href="{{ "/" | relLangURL }}">Go back home</a></p> - </div> - </div> - </div> + <div class="container"> + <div class="content"> + <h1 class="not-found-title">404</h1> + <div class="block"> + <h3>Sorry, we couldn't find the page you're looking for.</h3> + <div class="line"></div> + <p class="back"><a href="{{ "/" | relLangURL }}">Go back home</a></p> + </div> + </div> + </div> </section> {{ end }} - diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html index cdfa54e..421e8ea 100644 --- a/layouts/_default/archives.html +++ b/layouts/_default/archives.html @@ -5,26 +5,26 @@ <section id="archives" class="post_list content"> <div class="listing"> {{ $paginator := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) (.Site.Params.listPaginate | default 20) }} - {{ if $paginator }} - {{- range $index, $element := $paginator.Pages -}} - {{- $thisYear := $element.Date.Format "2006" }} - {{- $lastElement := $index | add -1 | index $paginator.Pages }} - {{- if or (eq $index 0) ( ne ($lastElement.Date.Format "2006") $thisYear ) }} - <div class="collection-title"> - <h3 class="archive-year">{{ $thisYear }}</h3> - </div> - {{- end }} - <div class="archive-post line_item item"> - <a href="{{ .RelPermalink }}" title="{{ .Title }}"> - <span>{{ .Title }}</span> - <span class="date">{{ $element.Date.Format "01-02" }}</span> - </a> - </div> - {{- end }} - {{ end }} + {{ if $paginator }} + {{- range $index, $element := $paginator.Pages -}} + {{- $thisYear := $element.Date.Format "2006" }} + {{- $lastElement := $index | add -1 | index $paginator.Pages }} + {{- if or (eq $index 0) ( ne ($lastElement.Date.Format "2006") $thisYear ) }} + <div class="collection-title"> + <h3 class="archive-year">{{ $thisYear }}</h3> + </div> + {{- end }} + <div class="archive-post line_item item"> + <a href="{{ .RelPermalink }}" title="{{ .Title }}"> + <span>{{ .Title }}</span> + <span class="date">{{ $element.Date.Format "01-02" }}</span> + </a> + </div> + {{- end }} + {{ end }} </div> </section> - {{ partial "pagination.html" . }} + {{ partial "pagination.html" . }} </div> </section> {{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 628e43f..5ec9366 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -22,16 +22,16 @@ </div> <div class="clearfix"></div> </article> - {{ if not (eq .Type "section") }} - <div class="other_posts"> - {{ if .PrevInSection }} - <a href="{{.PrevInSection.Permalink}}" class="prev">{{ .PrevInSection.LinkTitle }}</a> - {{ end }} - {{ if .NextInSection }} - <a href="{{.NextInSection.Permalink}}" class="next">{{ .NextInSection.LinkTitle }}</a> - {{ end }} - </div> - {{ partial "comments.html" . }} - {{ end }} + {{ if not (eq .Type "section") }} + <div class="other_posts"> + {{ if .PrevInSection }} + <a href="{{.PrevInSection.Permalink}}" class="prev">{{ .PrevInSection.LinkTitle }}</a> + {{ end }} + {{ if .NextInSection }} + <a href="{{.NextInSection.Permalink}}" class="next">{{ .NextInSection.LinkTitle }}</a> + {{ end }} + </div> + {{ partial "comments.html" . }} + {{ end }} </section> {{ end }} diff --git a/layouts/index.html b/layouts/index.html index 742c6bc..e9ad34d 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -10,9 +10,9 @@ </h3> <div class="post_content summary"> {{ .Summary }} - {{ if .Truncated }} - <span class="hellip">…</span> - {{ end }} + {{ if .Truncated }} + <span class="hellip">…</span> + {{ end }} </div> </article> {{ end }} diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 363d4f2..2f3e087 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -4,9 +4,9 @@ {{- else if eq $comment.type "valine"}} {{- if $comment.valine.visitor -}} <span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}"> - <span class="post-meta-item-text">文章阅读量</span> - <span class="leancloud-visitors-count">0</span> - </span> + <span class="post-meta-item-text">文章阅读量</span> + <span class="leancloud-visitors-count">0</span> + </span> {{- end }} <div id="vcomments"></div> <script src="//unpkg.com/valine@latest/dist/Valine.min.js"></script> @@ -14,9 +14,9 @@ const meta = '{{- $comment.valine.meta }}'.split(',').filter(function (item) { return ['nick','mail','link'].indexOf(item) > -1; }); - const requiredFields = '{{- $comment.valine.requiredFields }}'.split(',').filter(function(item) { - return ['nick', 'mail'].indexOf(item) > -1; - }) + const requiredFields = '{{- $comment.valine.requiredFields }}'.split(',').filter(function(item) { + return ['nick', 'mail'].indexOf(item) > -1; + }) new Valine({ el: '#vcomments', appId: '{{- $comment.valine.appid }}', @@ -25,9 +25,9 @@ avatar: '{{- $comment.valine.avatar }}', pageSize: '{{- $comment.valine.pageSize }}' || 10, visitor: {{- $comment.valine.visitor }}, - highlight: {{- $comment.valine.highlight }}, - recordIP: {{- $comment.valine.recordIP }}, - requiredFields: requiredFields || undefined, + highlight: {{- $comment.valine.highlight }}, + recordIP: {{- $comment.valine.recordIP }}, + requiredFields: requiredFields || undefined, meta: meta || undefined, }); </script> diff --git a/static/manifest.json b/static/manifest.json index 7cd4850..891d5b8 100644 --- a/static/manifest.json +++ b/static/manifest.json @@ -1,14 +1,14 @@ { - "name": "Hugo", - "short_name": "", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" + "name": "Hugo", + "short_name": "", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" } |