Skip to content

Commit 3704dae

Browse files
committed
Merge branch 'dev'
2 parents f0e147c + c72f8c4 commit 3704dae

38 files changed

+459
-254
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ npm i hexo-theme-butterfly
8686
- [x] Share (Sharejs/Addtoany)
8787
- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk)
8888
- [x] Multiple Comment System Support
89-
- [x] Online Chats (Chatra/Tidio/Daovoice/Crisp)
89+
- [x] Online Chats (Chatra/Tidio/Crisp)
9090
- [x] Web analytics
9191
- [x] Google AdSense
9292
- [x] Webmaster Verification
@@ -98,6 +98,7 @@ npm i hexo-theme-butterfly
9898
- [x] Busuanzi visitor counter
9999
- [x] Medium Zoom/Fancybox
100100
- [x] Mermaid
101+
- [x] Chart.js
101102
- [x] Justified Gallery
102103
- [x] Lazyload images
103104
- [x] Instantpage/Pangu/Snackbar notification toast/PWA......

README_CN.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ theme: butterfly
8686
- [x] 多種分享系統(Sharejs/Addtoany)
8787
- [X] 多種評論系統(Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk)
8888
- [x] 支持雙評論部署
89-
- [x] 多種在線聊天(Chatra/Tidio/Daovoice/Crisp)
89+
- [x] 多種在線聊天(Chatra/Tidio/Crisp)
9090
- [x] 多種分析系統
9191
- [x] 谷歌廣告/手動廣告位置
9292
- [x] 各種站長驗證
@@ -98,6 +98,7 @@ theme: butterfly
9898
- [x] 不蒜子訪問統計
9999
- [x] 兩種大圖模式(Medium Zoom/Fancybox)
100100
- [x] Mermaid 圖表顯示
101+
- [x] Chart.js 圖表顯示
101102
- [x] 照片牆
102103
- [x] 圖片懶加載
103104
- [x] Instantpage/Pangu/Snackbar彈窗/PWA......

_config.yml

+22-6
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ facebook_comments:
602602
pageSize: 10
603603
# Choose: social / time / reverse_time
604604
order_by: social
605-
lang: zh_TW
605+
lang: en_US
606606

607607
# Twikoo
608608
# https://github.com/imaegoo/twikoo
@@ -645,7 +645,7 @@ artalk:
645645
# --------------------------------------
646646

647647
chat:
648-
# Choose: chatra/tidio/daovoice/crisp
648+
# Choose: chatra/tidio/crisp
649649
# Leave it empty if you don't need chat
650650
use:
651651
# Chat Button [recommend]
@@ -662,10 +662,6 @@ chatra:
662662
tidio:
663663
public_key:
664664

665-
# http://dashboard.daovoice.io/app
666-
daovoice:
667-
app_id:
668-
669665
# https://crisp.chat/en/
670666
crisp:
671667
website_id:
@@ -924,6 +920,25 @@ mermaid:
924920
light: default
925921
dark: dark
926922

923+
# chartjs
924+
# see https://www.chartjs.org/docs/latest/
925+
chartjs:
926+
enable: false
927+
# Do not modify unless you understand how they work.
928+
# The default settings are only used when the MD syntax is not specified.
929+
# General font color for the chart
930+
fontColor:
931+
light: "rgba(0, 0, 0, 0.8)"
932+
dark: "rgba(255, 255, 255, 0.8)"
933+
# General border color for the chart
934+
borderColor:
935+
light: "rgba(0, 0, 0, 0.1)"
936+
dark: "rgba(255, 255, 255, 0.2)"
937+
# Background color for scale labels on radar and polar area charts
938+
scale_ticks_backdropColor:
939+
light: "transparent"
940+
dark: "transparent"
941+
927942
# Note - Bootstrap Callout
928943
note:
929944
# Note tag style values:
@@ -1050,6 +1065,7 @@ CDN:
10501065
# canvas_fluttering_ribbon:
10511066
# canvas_nest:
10521067
# canvas_ribbon:
1068+
# chartjs:
10531069
# click_heart:
10541070
# clickShowText:
10551071
# disqusjs:

layout/includes/header/post-info.pug

+24-33
Original file line numberDiff line numberDiff line change
@@ -60,39 +60,7 @@
6060
if block
6161
block
6262

63-
- const commentUse = comments.use && comments.use[0]
64-
if page.comments !== false && commentUse && !comments.lazyload
65-
case commentUse
66-
when 'Valine'
67-
if theme.valine.visitor
68-
+pvBlock(url_for(page.path), 'leancloud_visitors', page.title)
69-
span.leancloud-visitors-count
70-
i.fa-solid.fa-spinner.fa-spin
71-
when 'Waline'
72-
if theme.waline.pageview
73-
+pvBlock('', '', '')
74-
span.waline-pageview-count(data-path=url_for(page.path))
75-
i.fa-solid.fa-spinner.fa-spin
76-
when 'Twikoo'
77-
if theme.twikoo.visitor
78-
+pvBlock('', '', '')
79-
span#twikoo_visitors
80-
i.fa-solid.fa-spinner.fa-spin
81-
when 'Artalk'
82-
if theme.artalk.visitor
83-
+pvBlock('', '', '')
84-
span#ArtalkPV
85-
i.fa-solid.fa-spinner.fa-spin
86-
default
87-
if theme.umami_analytics.enable && theme.umami_analytics.UV_PV.page_pv
88-
+pvBlock('', '', '')
89-
span#umamiPV(data-path=url_for(page.path))
90-
i.fa-solid.fa-spinner.fa-spin
91-
else if theme.busuanzi.page_pv
92-
+pvBlock('', 'post-meta-pv-cv', '')
93-
span#busuanzi_value_page_pv
94-
i.fa-solid.fa-spinner.fa-spin
95-
else
63+
mixin otherPV()
9664
if theme.umami_analytics.enable && theme.umami_analytics.UV_PV.page_pv
9765
+pvBlock('', '', '')
9866
span#umamiPV(data-path=url_for(page.path))
@@ -102,6 +70,29 @@
10270
span#busuanzi_value_page_pv
10371
i.fa-solid.fa-spinner.fa-spin
10472

73+
- const commentUse = comments.use && comments.use[0]
74+
if page.comments !== false && commentUse && !comments.lazyload
75+
if commentUse === 'Valine' && theme.valine.visitor
76+
+pvBlock(url_for(page.path), 'leancloud_visitors', page.title)
77+
span.leancloud-visitors-count
78+
i.fa-solid.fa-spinner.fa-spin
79+
else if commentUse === 'Waline' && theme.waline.pageview
80+
+pvBlock('', '', '')
81+
span.waline-pageview-count(data-path=url_for(page.path))
82+
i.fa-solid.fa-spinner.fa-spin
83+
else if commentUse === 'Twikoo' && theme.twikoo.visitor
84+
+pvBlock('', '', '')
85+
span#twikoo_visitors
86+
i.fa-solid.fa-spinner.fa-spin
87+
else if commentUse === 'Artalk' && theme.artalk.visitor
88+
+pvBlock('', '', '')
89+
span#ArtalkPV
90+
i.fa-solid.fa-spinner.fa-spin
91+
else
92+
+otherPV()
93+
else
94+
+otherPV()
95+
10596
if comments.count && !comments.lazyload && page.comments !== false && comments.use
10697
- var whichCount = comments.use[0]
10798

layout/includes/mixins/indexPostUI.pug

+3-9
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,9 @@ mixin indexPostUI()
105105
i.fa-solid.fa-spinner.fa-spin
106106

107107
//- Display the article introduction on homepage
108-
case theme.index_post_content.method
109-
when false
110-
- break
111-
when 1
112-
.content!= article.description
113-
when 2
114-
.content!= article.description || truncate(article.content, theme.index_post_content.length)
115-
default
116-
.content!= truncate(article.content, theme.index_post_content.length)
108+
- const content = postDesc(article)
109+
if content
110+
.content!=content
117111

118112
if theme.ad && theme.ad.index
119113
if (index + 1) % 3 === 0

layout/includes/page/shuoshuo.pug

+14-8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
let start = 0
2222
const container = document.getElementById('article-container')
2323

24+
const showDateAndTine = date => new Date(date).toLocaleString()
25+
2426
const addData = data => {
2527
const cLength = data.length
2628
const end = start + 10 > cLength ? cLength : start + 10
@@ -34,16 +36,19 @@
3436
</div>
3537
<div class="shuoshuo-info">
3638
<div class="shuoshuo-author">${item.author || '!{config.author}'}</div>
37-
<div class="shuoshuo-date">${btf.diffDate(item.date, true)}</div>
39+
<time class="shuoshuo-date" title="${showDateAndTine(item.date)}">${btf.diffDate(item.date, true)}</time>
3840
</div>
3941
</div>
4042
<div class="shuoshuo-content">
4143
${item.content}
4244
</div>
4345
<div class="shuoshuo-footer">
44-
<div class="shuoshuo-tags">
45-
${item.tags.map(tag => `<span class="shuoshuo-tag">${tag}</span>`).join('')}
46-
</div>
46+
${item.tags && item.tags.length ? `
47+
<div class="shuoshuo-footer">
48+
<div class="shuoshuo-tags">
49+
${item.tags.map(tag => `<span class="shuoshuo-tag">${tag}</span>`).join('')}
50+
</div>
51+
</div>` : ''}
4752
</div>
4853
</div>
4954
`
@@ -94,10 +99,11 @@
9499
img.no-lightbox(src=i.avatar || url_for(theme.avatar.img))
95100
.shuoshuo-info
96101
.shuoshuo-author=i.author || config.author
97-
.shuoshuo-date=relative_date(i.date)
102+
time.shuoshuo-date(title=full_date(i.date))=date(i.date)
98103
.shuoshuo-content
99104
!=markdown(i.content)
100105
.shuoshuo-footer
101-
.shuoshuo-tags
102-
each tag in i.tags
103-
span.shuoshuo-tag=tag
106+
if i.tags
107+
.shuoshuo-tags
108+
each tag in i.tags
109+
span.shuoshuo-tag=tag

layout/includes/page/tags.pug

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
.tag-cloud-list.is-center
1+
.tag-cloud-list.text-center
22
!=cloudTags({source: site.tags, orderby: page.orderby || 'random', order: page.order || 1, minfontsize: 1.2, maxfontsize: 1.5, limit: 0, unit: 'em'})

layout/includes/pagination.pug

+20-22
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,28 @@
77
}
88
99
if is_post()
10-
- let prev = theme.post_pagination === 1 ? page.prev : page.next
11-
- let next = theme.post_pagination === 1 ? page.next : page.prev
10+
- let paginationOrder = theme.post_pagination === 1 ? { prev: page.prev, next: page.next } : { prev: page.next, next: page.prev }
11+
1212
nav#pagination.pagination-post
13-
if(prev)
14-
- var hasPageNext = next ? 'pull-left' : 'pull-full'
15-
a.prev-post(class=hasPageNext href=url_for(prev.path) title=prev.title)
16-
if prev.cover_type === 'img'
17-
img.cover(src=url_for(prev.cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post')
18-
else
19-
.cover(style=`background: ${prev.cover || 'var(--default-bg-color)'}`)
20-
.pagination-info
21-
.label=_p('pagination.prev')
22-
.prev_info=prev.title
13+
each direction, key in paginationOrder
14+
if direction
15+
- const getPostDesc = direction.postDesc || postDesc(direction)
16+
- let className = key === 'prev' ? (paginationOrder.next ? '' : 'full-width') : (paginationOrder.prev ? '' : 'full-width')
17+
- className = getPostDesc ? className : className + ' no-desc'
18+
19+
a.pagination-related(class=className href=url_for(direction.path) title=direction.title)
20+
if direction.cover_type === 'img'
21+
img.cover(src=url_for(direction.cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt=`cover of ${key === 'prev' ? 'previous' : 'next'} post`)
22+
else
23+
.cover(style=`background: ${direction.cover || 'var(--default-bg-color)'}`)
2324

24-
if(next)
25-
- var hasPagePrev = prev ? 'pull-right' : 'pull-full'
26-
a.next-post(class=hasPagePrev href=url_for(next.path) title=next.title)
27-
if next.cover_type === 'img'
28-
img.cover(src=url_for(next.cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post')
29-
else
30-
.cover(style=`background: ${next.cover || 'var(--default-bg-color)'}`)
31-
.pagination-info
32-
.label=_p('pagination.next')
33-
.next_info=next.title
25+
.info(class=key === 'prev' ? '' : 'text-right')
26+
.info-1
27+
.info-item-1=_p(`pagination.${key}`)
28+
.info-item-2!=direction.title
29+
if getPostDesc
30+
.info-2
31+
.info-item-1!=getPostDesc
3432
else
3533
nav#pagination
3634
.pagination

layout/includes/sidebar.pug

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ if theme.menu
22
#sidebar
33
#menu-mask
44
#sidebar-menus
5-
.avatar-img.is-center
5+
.avatar-img.text-center
66
img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
7-
.site-data.is-center
7+
.site-data.text-center
88
a(href=url_for(config.archive_dir) + '/')
99
.headline= _p('aside.articles')
1010
.length-num= site.posts.length

layout/includes/third-party/abcjs/abcjs.pug

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
script.
22
(() => {
33
const abcjsInit = () => {
4-
const abcjsFn = () => {
4+
const abcjsFn = () => setTimeout(() => {
55
document.querySelectorAll(".abc-music-sheet").forEach(ele => {
66
if (ele.children.length > 0) return
77
ABCJS.renderAbc(ele, ele.innerHTML, {responsive: 'resize'})
88
})
9-
}
9+
}, 100)
1010

1111
typeof ABCJS === 'object' ? abcjsFn()
1212
: btf.getScript('!{url_for(theme.asset.abcjs_basic_js)}').then(abcjsFn)

layout/includes/third-party/chat/daovoice.pug

-40
This file was deleted.

layout/includes/third-party/chat/index.pug

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@ case theme.chat.use
33
include ./chatra.pug
44
when 'tidio'
55
include ./tidio.pug
6-
when 'daovoice'
7-
include ./daovoice.pug
86
when 'crisp'
97
include ./crisp.pug

0 commit comments

Comments
 (0)