Skip to content

Commit

Permalink
♻️ Refactor: deprecate params.ibruce in favor of params.busuanzi powe…
Browse files Browse the repository at this point in the history
…red by Vercount

Resolve #472
Close EvanNotFound/vercount#10
  • Loading branch information
Lruihao committed Jul 28, 2024
1 parent 6c752c1 commit 7c67b90
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 35 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ Thanks to all the [contributors](https://github.com/hugo-fixit/FixIt/graphs/cont
- [cookieconsent](https://github.com/osano/cookieconsent)
- [cell-watermark](https://github.com/Lruihao/watermark)
- [不蒜子](http://busuanzi.ibruce.info/)
- [Vercount](https://github.com/EvanNotFound/vercount)
- [pangu.js](https://github.com/vinta/pangu.js)
- [Artalk](https://artalk.js.org/)
- [Waline](https://waline.js.org/)
Expand Down
1 change: 1 addition & 0 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ FixIt 支持下列语言:
- [cookieconsent](https://github.com/osano/cookieconsent)
- [cell-watermark](https://github.com/Lruihao/watermark)
- [不蒜子](http://busuanzi.ibruce.info/)
- [Vercount](https://github.com/EvanNotFound/vercount)
- [pangu.js](https://github.com/vinta/pangu.js)
- [Artalk](https://artalk.js.org/)
- [Waline](https://waline.js.org/)
Expand Down
13 changes: 9 additions & 4 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -693,11 +693,16 @@ enableEmoji = true
# FixIt 0.2.13 | NEW watermark's fontFamily
fontFamily = "inherit"

# FixIt 0.2.12 | NEW Busuanzi count
[params.ibruce]
# FixIt 0.3.10 | NEW Busuanzi count
[params.busuanzi]
# whether to enable busuanzi count
enable = false
# Enable in post meta
enablePost = false
# busuanzi count core ["vercount", "busuanzi"], default: "vercount"
core = "vercount"
# whether to show the site views
siteViews = true
# whether to show the page views
pageViews = true

# Site verification code config for Google/Bing/Yandex/Pinterest/Baidu/360/Sogou
[params.verification]
Expand Down
12 changes: 9 additions & 3 deletions layouts/partials/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,15 @@
{{- end -}}

{{- /* 不蒜子 */ -}}
{{- if eq .Site.Params.ibruce.enable true -}}
{{- $source := "//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- if eq .Site.Params.busuanzi.enable true -}}
{{- $source := "https://vercount.one/js" -}}
{{- if eq .Lang "zh-cn" -}}
{{- $source = "https://cn.vercount.one/js" -}}
{{- end -}}
{{- if eq .Site.Params.busuanzi.core "busuanzi" -}}
{{- $source = "//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" -}}
{{- end -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}

{{- /* Site creation time */ -}}
Expand Down
13 changes: 9 additions & 4 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,20 @@
{{- end -}}

{{- /* 不蒜子 */ -}}
{{- if eq .Site.Params.ibruce.enable true -}}
{{- $busuanzi := .Site.Params.busuanzi -}}
{{- if eq $busuanzi.enable true -}}
{{- $loading := dict "Class" "fa-solid fa-spinner fa-spin fa-fw" | partial "plugin/icon.html" -}}
<div class="footer-line visitor{{ with $footerConfig.order.visitor }} order-{{ . }}{{ end }}">
{{- $iconUV := dict "Class" "fa-regular fa-user fa-fw me-1" | partial "plugin/icon.html" -}}
{{- $iconPV := dict "Class" "fa-regular fa-eye fa-fw me-1" | partial "plugin/icon.html" -}}
<div class="footer-line visitor{{ with $footerConfig.order.visitor }} order-{{ . }}{{ end }}{{ if not $busuanzi.siteViews }} d-none{{ end }}">
<span id="busuanzi_container_site_uv" title='{{ T "footer.siteUV" }}'>
{{- dict "Class" "fa-regular fa-user fa-fw" | partial "plugin/icon.html" -}}&nbsp;<span id="busuanzi_value_site_uv">{{ $loading }}</span>{{- /* NO_SPACING */ -}}
{{- $iconUV }}<span id="busuanzi_value_site_uv">{{ $loading }}</span>
{{- /* NO_SPACING */ -}}
</span>
{{- /* NO_SPACING */ -}}
<span id="busuanzi_container_site_pv" class="footer-divider" title='{{ T "footer.sitePV" }}'>
{{- dict "Class" "fa-regular fa-eye fa-fw" | partial "plugin/icon.html" -}}&nbsp;<span id="busuanzi_value_site_pv">{{ $loading }}</span>{{- /* NO_SPACING */ -}}
{{- $iconPV }}<span id="busuanzi_value_site_pv">{{ $loading }}</span>
{{- /* NO_SPACING */ -}}
</span>
</div>
{{- end -}}
Expand Down
4 changes: 4 additions & 0 deletions layouts/partials/init/detection-deprecated.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
{{- $warns = $warns | append "The parameter `params.footer.custom` is deprecated since v0.3.7, use `layouts/partials/custom.html` instead." -}}
{{- end -}}

{{- with .Site.Params.ibruce -}}
{{- $warns = $warns | append "The parameter `params.ibruce` is deprecated since v0.3.9, use `params.busuanzi` instead." -}}
{{- end -}}

{{- if len $warns -}}
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $warns "\n - ") -}}
{{- end -}}
Expand Down
45 changes: 21 additions & 24 deletions layouts/posts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,31 +87,25 @@ <h1 class="single-title animate__animated animate__flipInX">
{{- $visitorIcon := dict "Class" "fa-regular fa-eye fa-fw me-1" | partial "plugin/icon.html" -}}
{{- $commentIcon := dict "Class" "fa-regular fa-comments fa-fw me-1" | partial "plugin/icon.html" -}}
{{- /* Visitor Count */ -}}
{{- if $comment.enable -}}
{{- if $comment.artalk.enable -}}
<span class="comment-visitors" data-flag-title="{{ $title }}">
{{ $visitorIcon }}<span class="artalk-visitor-count" data-page-key="{{ .RelPermalink }}">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if ($comment.valine.enable | and $comment.valine.visitor) -}}
<span id="{{ .RelPermalink }}" class="leancloud_visitors comment-visitors" data-flag-title="{{ $title }}">
{{ $visitorIcon }}<span class="leancloud-visitors-count">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if $comment.waline.enable | and $comment.waline.pageview -}}
<span class="comment-visitors" data-flag-title="{{ $title }}">
{{ $visitorIcon }}<span data-path="{{ .RelPermalink }}" class="waline-pageview-count">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if $comment.twikoo.enable | and $comment.twikoo.visitor -}}
<span id="{{ .RelPermalink }}" class="comment-visitors" data-flag-title="{{ $title }}">
{{ $visitorIcon }}<span id="twikoo_visitors">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if .Site.Params.ibruce.enable | and .Site.Params.ibruce.enablePost -}}
<span id="busuanzi_container_page_pv" class="busuanzi_visitors comment-visitors" data-flag-title="{{ $title }}">
{{ $visitorIcon }}<span id="busuanzi_value_page_pv">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- end -}}
{{- else if .Site.Params.ibruce.enable | and .Site.Params.ibruce.enablePost -}}
{{- if $comment.enable | and $comment.artalk.enable -}}
<span class="comment-visitors" data-flag-title="{{ $title }}">
{{- $visitorIcon }}<span class="artalk-visitor-count" data-page-key="{{ .RelPermalink }}">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if $comment.enable | and $comment.valine.enable | and $comment.valine.visitor -}}
<span id="{{ .RelPermalink }}" class="leancloud_visitors comment-visitors" data-flag-title="{{ $title }}">
{{- $visitorIcon }}<span class="leancloud-visitors-count">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if $comment.enable | and $comment.waline.enable | and $comment.waline.pageview -}}
<span class="comment-visitors" data-flag-title="{{ $title }}">
{{- $visitorIcon }}<span data-path="{{ .RelPermalink }}" class="waline-pageview-count">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if $comment.enable | and $comment.twikoo.enable | and $comment.twikoo.visitor -}}
<span id="{{ .RelPermalink }}" class="comment-visitors" data-flag-title="{{ $title }}">
{{- $visitorIcon }}<span id="twikoo_visitors">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if .Site.Params.busuanzi.enable | and .Site.Params.busuanzi.pageViews -}}
<span id="busuanzi_container_page_pv" class="busuanzi_visitors comment-visitors" data-flag-title="{{ $title }}">
{{ $visitorIcon }}<span id="busuanzi_value_page_pv">-</span>&nbsp;{{ T "single.views" }}
{{- $visitorIcon }}<span id="busuanzi_value_page_pv">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- end -}}
{{- /* Comment Count */ -}}
Expand Down Expand Up @@ -208,6 +202,9 @@ <h1 class="single-title animate__animated animate__flipInX">
{{- partial "single/reward.html" . -}}
{{- end -}}

{{- /* Custom post footer */ -}}
{{- block "custom-post__footer" . }}{{ end -}}

{{- /* Comment */ -}}
{{- partial "single/comment.html" . -}}
</article>
Expand Down

0 comments on commit 7c67b90

Please sign in to comment.