Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryc127 committed Oct 20, 2024
2 parents f0e147c + c72f8c4 commit 3704dae
Show file tree
Hide file tree
Showing 38 changed files with 459 additions and 254 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ npm i hexo-theme-butterfly
- [x] Share (Sharejs/Addtoany)
- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk)
- [x] Multiple Comment System Support
- [x] Online Chats (Chatra/Tidio/Daovoice/Crisp)
- [x] Online Chats (Chatra/Tidio/Crisp)
- [x] Web analytics
- [x] Google AdSense
- [x] Webmaster Verification
Expand All @@ -98,6 +98,7 @@ npm i hexo-theme-butterfly
- [x] Busuanzi visitor counter
- [x] Medium Zoom/Fancybox
- [x] Mermaid
- [x] Chart.js
- [x] Justified Gallery
- [x] Lazyload images
- [x] Instantpage/Pangu/Snackbar notification toast/PWA......
Expand Down
3 changes: 2 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ theme: butterfly
- [x] 多種分享系統(Sharejs/Addtoany)
- [X] 多種評論系統(Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk)
- [x] 支持雙評論部署
- [x] 多種在線聊天(Chatra/Tidio/Daovoice/Crisp)
- [x] 多種在線聊天(Chatra/Tidio/Crisp)
- [x] 多種分析系統
- [x] 谷歌廣告/手動廣告位置
- [x] 各種站長驗證
Expand All @@ -98,6 +98,7 @@ theme: butterfly
- [x] 不蒜子訪問統計
- [x] 兩種大圖模式(Medium Zoom/Fancybox)
- [x] Mermaid 圖表顯示
- [x] Chart.js 圖表顯示
- [x] 照片牆
- [x] 圖片懶加載
- [x] Instantpage/Pangu/Snackbar彈窗/PWA......
Expand Down
28 changes: 22 additions & 6 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ facebook_comments:
pageSize: 10
# Choose: social / time / reverse_time
order_by: social
lang: zh_TW
lang: en_US

# Twikoo
# https://github.com/imaegoo/twikoo
Expand Down Expand Up @@ -645,7 +645,7 @@ artalk:
# --------------------------------------

chat:
# Choose: chatra/tidio/daovoice/crisp
# Choose: chatra/tidio/crisp
# Leave it empty if you don't need chat
use:
# Chat Button [recommend]
Expand All @@ -662,10 +662,6 @@ chatra:
tidio:
public_key:

# http://dashboard.daovoice.io/app
daovoice:
app_id:

# https://crisp.chat/en/
crisp:
website_id:
Expand Down Expand Up @@ -924,6 +920,25 @@ mermaid:
light: default
dark: dark

# chartjs
# see https://www.chartjs.org/docs/latest/
chartjs:
enable: false
# Do not modify unless you understand how they work.
# The default settings are only used when the MD syntax is not specified.
# General font color for the chart
fontColor:
light: "rgba(0, 0, 0, 0.8)"
dark: "rgba(255, 255, 255, 0.8)"
# General border color for the chart
borderColor:
light: "rgba(0, 0, 0, 0.1)"
dark: "rgba(255, 255, 255, 0.2)"
# Background color for scale labels on radar and polar area charts
scale_ticks_backdropColor:
light: "transparent"
dark: "transparent"

# Note - Bootstrap Callout
note:
# Note tag style values:
Expand Down Expand Up @@ -1050,6 +1065,7 @@ CDN:
# canvas_fluttering_ribbon:
# canvas_nest:
# canvas_ribbon:
# chartjs:
# click_heart:
# clickShowText:
# disqusjs:
Expand Down
57 changes: 24 additions & 33 deletions layout/includes/header/post-info.pug
Original file line number Diff line number Diff line change
Expand Up @@ -60,39 +60,7 @@
if block
block

- const commentUse = comments.use && comments.use[0]
if page.comments !== false && commentUse && !comments.lazyload
case commentUse
when 'Valine'
if theme.valine.visitor
+pvBlock(url_for(page.path), 'leancloud_visitors', page.title)
span.leancloud-visitors-count
i.fa-solid.fa-spinner.fa-spin
when 'Waline'
if theme.waline.pageview
+pvBlock('', '', '')
span.waline-pageview-count(data-path=url_for(page.path))
i.fa-solid.fa-spinner.fa-spin
when 'Twikoo'
if theme.twikoo.visitor
+pvBlock('', '', '')
span#twikoo_visitors
i.fa-solid.fa-spinner.fa-spin
when 'Artalk'
if theme.artalk.visitor
+pvBlock('', '', '')
span#ArtalkPV
i.fa-solid.fa-spinner.fa-spin
default
if theme.umami_analytics.enable && theme.umami_analytics.UV_PV.page_pv
+pvBlock('', '', '')
span#umamiPV(data-path=url_for(page.path))
i.fa-solid.fa-spinner.fa-spin
else if theme.busuanzi.page_pv
+pvBlock('', 'post-meta-pv-cv', '')
span#busuanzi_value_page_pv
i.fa-solid.fa-spinner.fa-spin
else
mixin otherPV()
if theme.umami_analytics.enable && theme.umami_analytics.UV_PV.page_pv
+pvBlock('', '', '')
span#umamiPV(data-path=url_for(page.path))
Expand All @@ -102,6 +70,29 @@
span#busuanzi_value_page_pv
i.fa-solid.fa-spinner.fa-spin

- const commentUse = comments.use && comments.use[0]
if page.comments !== false && commentUse && !comments.lazyload
if commentUse === 'Valine' && theme.valine.visitor
+pvBlock(url_for(page.path), 'leancloud_visitors', page.title)
span.leancloud-visitors-count
i.fa-solid.fa-spinner.fa-spin
else if commentUse === 'Waline' && theme.waline.pageview
+pvBlock('', '', '')
span.waline-pageview-count(data-path=url_for(page.path))
i.fa-solid.fa-spinner.fa-spin
else if commentUse === 'Twikoo' && theme.twikoo.visitor
+pvBlock('', '', '')
span#twikoo_visitors
i.fa-solid.fa-spinner.fa-spin
else if commentUse === 'Artalk' && theme.artalk.visitor
+pvBlock('', '', '')
span#ArtalkPV
i.fa-solid.fa-spinner.fa-spin
else
+otherPV()
else
+otherPV()

if comments.count && !comments.lazyload && page.comments !== false && comments.use
- var whichCount = comments.use[0]

Expand Down
12 changes: 3 additions & 9 deletions layout/includes/mixins/indexPostUI.pug
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,9 @@ mixin indexPostUI()
i.fa-solid.fa-spinner.fa-spin

//- Display the article introduction on homepage
case theme.index_post_content.method
when false
- break
when 1
.content!= article.description
when 2
.content!= article.description || truncate(article.content, theme.index_post_content.length)
default
.content!= truncate(article.content, theme.index_post_content.length)
- const content = postDesc(article)
if content
.content!=content

if theme.ad && theme.ad.index
if (index + 1) % 3 === 0
Expand Down
22 changes: 14 additions & 8 deletions layout/includes/page/shuoshuo.pug
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
let start = 0
const container = document.getElementById('article-container')

const showDateAndTine = date => new Date(date).toLocaleString()

const addData = data => {
const cLength = data.length
const end = start + 10 > cLength ? cLength : start + 10
Expand All @@ -34,16 +36,19 @@
</div>
<div class="shuoshuo-info">
<div class="shuoshuo-author">${item.author || '!{config.author}'}</div>
<div class="shuoshuo-date">${btf.diffDate(item.date, true)}</div>
<time class="shuoshuo-date" title="${showDateAndTine(item.date)}">${btf.diffDate(item.date, true)}</time>
</div>
</div>
<div class="shuoshuo-content">
${item.content}
</div>
<div class="shuoshuo-footer">
<div class="shuoshuo-tags">
${item.tags.map(tag => `<span class="shuoshuo-tag">${tag}</span>`).join('')}
</div>
${item.tags && item.tags.length ? `
<div class="shuoshuo-footer">
<div class="shuoshuo-tags">
${item.tags.map(tag => `<span class="shuoshuo-tag">${tag}</span>`).join('')}
</div>
</div>` : ''}
</div>
</div>
`
Expand Down Expand Up @@ -94,10 +99,11 @@
img.no-lightbox(src=i.avatar || url_for(theme.avatar.img))
.shuoshuo-info
.shuoshuo-author=i.author || config.author
.shuoshuo-date=relative_date(i.date)
time.shuoshuo-date(title=full_date(i.date))=date(i.date)
.shuoshuo-content
!=markdown(i.content)
.shuoshuo-footer
.shuoshuo-tags
each tag in i.tags
span.shuoshuo-tag=tag
if i.tags
.shuoshuo-tags
each tag in i.tags
span.shuoshuo-tag=tag
2 changes: 1 addition & 1 deletion layout/includes/page/tags.pug
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.tag-cloud-list.is-center
.tag-cloud-list.text-center
!=cloudTags({source: site.tags, orderby: page.orderby || 'random', order: page.order || 1, minfontsize: 1.2, maxfontsize: 1.5, limit: 0, unit: 'em'})
42 changes: 20 additions & 22 deletions layout/includes/pagination.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,28 @@
}
if is_post()
- let prev = theme.post_pagination === 1 ? page.prev : page.next
- let next = theme.post_pagination === 1 ? page.next : page.prev
- let paginationOrder = theme.post_pagination === 1 ? { prev: page.prev, next: page.next } : { prev: page.next, next: page.prev }

nav#pagination.pagination-post
if(prev)
- var hasPageNext = next ? 'pull-left' : 'pull-full'
a.prev-post(class=hasPageNext href=url_for(prev.path) title=prev.title)
if prev.cover_type === 'img'
img.cover(src=url_for(prev.cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post')
else
.cover(style=`background: ${prev.cover || 'var(--default-bg-color)'}`)
.pagination-info
.label=_p('pagination.prev')
.prev_info=prev.title
each direction, key in paginationOrder
if direction
- const getPostDesc = direction.postDesc || postDesc(direction)
- let className = key === 'prev' ? (paginationOrder.next ? '' : 'full-width') : (paginationOrder.prev ? '' : 'full-width')
- className = getPostDesc ? className : className + ' no-desc'

a.pagination-related(class=className href=url_for(direction.path) title=direction.title)
if direction.cover_type === 'img'
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`)
else
.cover(style=`background: ${direction.cover || 'var(--default-bg-color)'}`)

if(next)
- var hasPagePrev = prev ? 'pull-right' : 'pull-full'
a.next-post(class=hasPagePrev href=url_for(next.path) title=next.title)
if next.cover_type === 'img'
img.cover(src=url_for(next.cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post')
else
.cover(style=`background: ${next.cover || 'var(--default-bg-color)'}`)
.pagination-info
.label=_p('pagination.next')
.next_info=next.title
.info(class=key === 'prev' ? '' : 'text-right')
.info-1
.info-item-1=_p(`pagination.${key}`)
.info-item-2!=direction.title
if getPostDesc
.info-2
.info-item-1!=getPostDesc
else
nav#pagination
.pagination
Expand Down
4 changes: 2 additions & 2 deletions layout/includes/sidebar.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ if theme.menu
#sidebar
#menu-mask
#sidebar-menus
.avatar-img.is-center
.avatar-img.text-center
img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
.site-data.is-center
.site-data.text-center
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
Expand Down
4 changes: 2 additions & 2 deletions layout/includes/third-party/abcjs/abcjs.pug
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
script.
(() => {
const abcjsInit = () => {
const abcjsFn = () => {
const abcjsFn = () => setTimeout(() => {
document.querySelectorAll(".abc-music-sheet").forEach(ele => {
if (ele.children.length > 0) return
ABCJS.renderAbc(ele, ele.innerHTML, {responsive: 'resize'})
})
}
}, 100)

typeof ABCJS === 'object' ? abcjsFn()
: btf.getScript('!{url_for(theme.asset.abcjs_basic_js)}').then(abcjsFn)
Expand Down
40 changes: 0 additions & 40 deletions layout/includes/third-party/chat/daovoice.pug

This file was deleted.

2 changes: 0 additions & 2 deletions layout/includes/third-party/chat/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ case theme.chat.use
include ./chatra.pug
when 'tidio'
include ./tidio.pug
when 'daovoice'
include ./daovoice.pug
when 'crisp'
include ./crisp.pug
Loading

0 comments on commit 3704dae

Please sign in to comment.