From e18d66917332ea00f920cf17e798ecd1215c4140 Mon Sep 17 00:00:00 2001 From: WayJam So Date: Wed, 22 Jul 2020 23:35:26 +0800 Subject: format code --- .editorconfig | 16 ++++++++++++++++ assets/js/main.js | 8 ++++---- layouts/404.html | 21 ++++++++++----------- layouts/_default/archives.html | 36 ++++++++++++++++++------------------ layouts/_default/single.html | 22 +++++++++++----------- layouts/index.html | 6 +++--- layouts/partials/comments.html | 18 +++++++++--------- static/manifest.json | 24 ++++++++++++------------ 8 files changed, 83 insertions(+), 68 deletions(-) create mode 100644 .editorconfig 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" }}
-
-
-

404

-
-

Sorry, we couldn't find the page you're looking for.

-
-

Go back home

-
-
-
+
+
+

404

+
+

Sorry, we couldn't find the page you're looking for.

+
+

Go back home

+
+
+
{{ 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 @@
{{ $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 ) }} -
-

{{ $thisYear }}

-
- {{- end }} -
- - {{ .Title }} - {{ $element.Date.Format "01-02" }} - -
- {{- 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 ) }} +
+

{{ $thisYear }}

+
+ {{- end }} +
+ + {{ .Title }} + {{ $element.Date.Format "01-02" }} + +
+ {{- end }} + {{ end }}
- {{ partial "pagination.html" . }} + {{ partial "pagination.html" . }} {{ 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 @@
- {{ if not (eq .Type "section") }} - - {{ partial "comments.html" . }} - {{ end }} + {{ if not (eq .Type "section") }} + + {{ partial "comments.html" . }} + {{ end }} {{ 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 @@
{{ .Summary }} - {{ if .Truncated }} - - {{ end }} + {{ if .Truncated }} + + {{ end }}
{{ 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 -}} - - 0 - + 文章阅读量 + 0 + {{- end }}
@@ -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, }); 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" } -- cgit v1.2.3