Feat: refactor parameter params.footer.siteTime

This commit is contained in:
Cell
2022-12-18 16:27:19 +08:00
parent fc30159f47
commit aca8809ea5
10 changed files with 45 additions and 23 deletions
+1
View File
@@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
- :sparkles: Feat: add TagCloud config support for tags page, see parameter `params.tagcloud` ([#235](https://github.com/hugo-fixit/FixIt/issues/235))
- :sparkles: Feat: add custom templates and parameter `params.customFilePath` support
- :sparkles: Feat: add feature end of post flag support ([#236](https://github.com/hugo-fixit/FixIt/issues/236))
- :sparkles: Feat: refactor parameter `params.footer.siteTime`
- :sparkles: Feat: add params to close wordcount and readingTime in post ([#209](https://github.com/hugo-fixit/FixIt/issues/209))
- :sparkles: Feat: add parameter `params.home.profile.avatarMenu`
- :truck: Feat: migrate parameter `params.autoBookmark` to `params.page.autoBookmark` ([#55](https://github.com/hugo-fixit/FixIt/issues/55))
+8 -4
View File
@@ -28,16 +28,20 @@
display: block;
}
.ms-1 {
.ms-1,
.mx-1 {
margin-left: 0.25rem !important;
}
.me-1 {
.me-1,
.mx-1 {
margin-right: 0.25rem !important;
}
.ps-1 {
.ps-1,
.px-1 {
padding-left: 0.25rem !important;
}
.pe-1 {
.pe-1,
.px-1 {
padding-right: 0.25rem !important;
}
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6 -2
View File
@@ -168,8 +168,6 @@
author = true
# Site creation year
since = 2021
# FixIt 0.2.14 | NEW Site creation time
siteTime = "" # e.g. "2021-12-18T16:15:22+08:00"
# FixIt 0.2.14 | NEW whether to show total word count of site content
wordCount = true
# FixIt 0.2.12 | NEW Public network security only in China (HTML format is supported)
@@ -178,6 +176,12 @@
icp = ""
# license info (HTML format is supported)
license = '<a rel="license external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# FixIt 0.2.17 | CHANGED Site creation time
[params.footer.siteTime]
animate = true
icon = "fa-solid fa-heartbeat"
pre = ""
value = "" # e.g. "2021-12-18T16:15:22+08:00"
# FixIt 0.2.0 | NEW Section (all posts) page config
[params.section]
+1 -1
Submodule docs updated: c42ef5fd74...fae8f21fc4
+2 -2
View File
@@ -232,8 +232,8 @@
{{- end -}}
{{- /* Site creation time */ -}}
{{- if .Site.Params.footer.siteTime -}}
{{- $config = dict "siteTime" .Site.Params.footer.siteTime | merge $config -}}
{{- with .Site.Params.footer.siteTime.value -}}
{{- $config = dict "siteTime" . | merge $config -}}
{{- end -}}
{{- /* PWA */ -}}
+6 -4
View File
@@ -50,12 +50,14 @@
</div>
{{- end -}}
{{- if .Site.Params.footer.siteTime | or .Site.Params.footer.wordCount -}}
{{- if .Site.Params.footer.siteTime.value | or .Site.Params.footer.wordCount -}}
<div class="footer-line statistics">
{{- if .Site.Params.footer.siteTime -}}
{{- with .Site.Params.footer.siteTime -}}
<span class="site-time" title='{{ T "siteRunning" }}'>
{{- dict "Class" "fa-solid fa-heartbeat fa-fw animate-icon" | partial "plugin/icon.html" -}}&nbsp;
{{- printf `<span class="run-times">%v</span>` (T "siteRunning") | safeHTML -}}
{{- $siteTimeIcon := printf (cond .Animate "%v fa-fw animate-icon" "%v fa-fw") .Icon -}}
{{- dict "Class" $siteTimeIcon | partial "plugin/icon.html" -}}
{{- with .Pre -}}<span class="ms-1 d-none">{{ . }}</span>{{- end -}}
{{- printf `<span class="run-times ms-1">%v</span>` (T "siteRunning") | safeHTML -}}
</span>
{{- end -}}
</div>
@@ -1,19 +1,29 @@
{{- /* Deprecated parameter detection */ -}}
{{- $warns := slice -}}
{{- $errors := slice -}}
{{- $warnErrors := slice -}}
{{- with .Site.Params.home.profile.gravatarSite -}}
{{- $warnErrors = $warnErrors | append "The parameter `home.profile.gravatarSite` is deprecated since v0.2.14, use `gravatar.host` instead." -}}
{{- $warns = $warns | append "The parameter `home.profile.gravatarSite` is deprecated since v0.2.14, use `gravatar.host` instead." -}}
{{- end -}}
{{- with .Site.Params.ibruce.siteTime -}}
{{- $warnErrors = $warnErrors | append "The parameter `ibruce.siteTime` is deprecated since v0.2.14, use `footer.siteTime` instead." -}}
{{- $warns = $warns | append "The parameter `ibruce.siteTime` is deprecated since v0.2.14, use `footer.siteTime` instead." -}}
{{- end -}}
{{- with .Site.Params.autoBookmark -}}
{{- $warnErrors = $warnErrors | append "The parameter `autoBookmark` is deprecated since v0.2.17, use `page.autoBookmark` instead." -}}
{{- $warns = $warns | append "The parameter `autoBookmark` is deprecated since v0.2.17, use `page.autoBookmark` instead." -}}
{{- end -}}
{{- with .Site.Params.footer.custom -}}
{{- $warnErrors = $warnErrors | append "The parameter `footer.custom` is deprecated since v0.2.17, use parameter `params.customFilePath.footer` instead." -}}
{{- $warns = $warns | append "The parameter `footer.custom` is deprecated since v0.2.17, use parameter `params.customFilePath.footer` instead." -}}
{{- end -}}
{{- with .Site.Params.footer.siteTime -}}
{{- if gt (len .) 4 -}}
{{- $errors = $errors | append "The parameter `footer.siteTime` has changed to an array since v0.2.17. Please correct the format!" -}}
{{- end -}}
{{- end -}}
{{- if len $warnErrors -}}
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $warnErrors "\n - ") -}}
{{- if len $warns -}}
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $warns "\n - ") -}}
{{- end -}}
{{- if len $errors -}}
{{- errorf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $errors "\n - ") -}}
{{- end -}}
+2 -1
View File
@@ -988,7 +988,8 @@ class FixIt {
minutes = Math.floor(runTime / 60 - 24 * 60 * days - 60 * hours),
seconds = Math.floor((now - run) / 1000 - 24 * 60 * 60 * days - 60 * 60 * hours - 60 * minutes);
$runTimes.innerHTML = `${days}, ${String(hours).padStart(2, 0)}:${String(minutes).padStart(2, 0)}:${String(seconds).padStart(2, 0)}`;
}
document.querySelector('.site-time .d-none')?.classList.remove('d-none');
};
initSiteTime() {
if (this.config.siteTime) {