This commit is contained in:
Jerry
2024-02-22 17:04:11 +08:00
parent 6ebe51e971
commit d9829167aa
11 changed files with 63 additions and 96 deletions

13
.github/FUNDING.yml vendored
View File

@@ -1,13 +0,0 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: ['https://buy.stripe.com/3cs6rP6YA91sbbG5kk','https://jsd.012700.xyz/gh/jerryc127/CDN/Photo/wechat.jpg'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -140,5 +140,5 @@
when 'Artalk' when 'Artalk'
+countBlock +countBlock
a(href=url_for(page.path) + '#post-comment') a(href=url_for(page.path) + '#post-comment')
span.artalk-count span#ArtalkCount
i.fa-solid.fa-spinner.fa-spin i.fa-solid.fa-spinner.fa-spin

View File

@@ -45,16 +45,16 @@ mixin postUI(posts)
if (theme.post_meta.page.categories && article.categories.data.length > 0) if (theme.post_meta.page.categories && article.categories.data.length > 0)
span.article-meta span.article-meta
span.article-meta-separator | span.article-meta-separator |
i.fas.fa-inbox
each item, index in article.categories.data each item, index in article.categories.data
i.fas.fa-inbox
a(href=url_for(item.path)).article-meta__categories #[=item.name] a(href=url_for(item.path)).article-meta__categories #[=item.name]
if (index < article.categories.data.length - 1) if (index < article.categories.data.length - 1)
i.fas.fa-angle-right.article-meta-link i.fas.fa-angle-right.article-meta-link
if (theme.post_meta.page.tags && article.tags.data.length > 0) if (theme.post_meta.page.tags && article.tags.data.length > 0)
span.article-meta.tags span.article-meta.tags
span.article-meta-separator | span.article-meta-separator |
i.fas.fa-tag
each item, index in article.tags.data each item, index in article.tags.data
i.fas.fa-tag
a(href=url_for(item.path)).article-meta__tags #[=item.name] a(href=url_for(item.path)).article-meta__tags #[=item.name]
if (index < article.tags.data.length - 1) if (index < article.tags.data.length - 1)
span.article-meta-link #[='•'] span.article-meta-link #[='•']

View File

@@ -8,19 +8,15 @@ script.
const keyArray = Array.from(eleGroup).map(i => i.getAttribute('data-page-key')) const keyArray = Array.from(eleGroup).map(i => i.getAttribute('data-page-key'))
const headerList = { const headerList = {
method: 'POST', method: 'GET',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': window.location.origin
},
body: new URLSearchParams({
'site_name': '!{site}',
'type':'page_comment',
'page_keys': keyArray
})
} }
const res = await fetch('!{server}/api/stat', headerList) const searchParams = new URLSearchParams({
'site_name': '!{site}',
'page_keys': keyArray
})
const res = await fetch(`!{server}/api/v2/stats/page_comment?${searchParams}`, headerList)
const result = await res.json() const result = await res.json()
keyArray.forEach((key, index) => { keyArray.forEach((key, index) => {

View File

@@ -11,7 +11,6 @@ script.
site: '!{site}', site: '!{site}',
pageKey: location.pathname, pageKey: location.pathname,
darkMode: document.documentElement.getAttribute('data-theme') === 'dark', darkMode: document.documentElement.getAttribute('data-theme') === 'dark',
countEl: '.artalk-count'
},!{JSON.stringify(option)})) },!{JSON.stringify(option)}))
if (GLOBAL_CONFIG.lightbox === 'null') return if (GLOBAL_CONFIG.lightbox === 'null') return

View File

@@ -3,22 +3,6 @@
script. script.
(() => { (() => {
const init = () => {
twikoo.init(Object.assign({
el: '#twikoo-wrap',
envId: '!{envId}',
region: '!{region}',
onCommentLoaded: () => {
btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
}
}, !{JSON.stringify(option)}))
}
const loadTwikoo = () => {
if (typeof twikoo === 'object') setTimeout(init,0)
else getScript('!{url_for(theme.asset.twikoo)}').then(init)
}
const getCount = () => { const getCount = () => {
const countELement = document.getElementById('twikoo-count') const countELement = document.getElementById('twikoo-count')
if(!countELement) return if(!countELement) return
@@ -34,12 +18,27 @@ script.
}) })
} }
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) { const init = () => {
if (!{lazyload}) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo) twikoo.init(Object.assign({
else { el: '#twikoo-wrap',
loadTwikoo() envId: '!{envId}',
region: '!{region}',
onCommentLoaded: () => {
btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
}
}, !{JSON.stringify(option)}))
!{count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : ''} !{count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : ''}
} }
const loadTwikoo = () => {
if (typeof twikoo === 'object') setTimeout(init,0)
else getScript('!{url_for(theme.asset.twikoo)}').then(init)
}
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) {
if (!{lazyload}) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
else loadTwikoo()
} else { } else {
window.loadOtherComment = loadTwikoo window.loadOtherComment = loadTwikoo
} }

View File

@@ -3,8 +3,10 @@
script. script.
(() => { (() => {
const initWaline = () => { let initFn = window.walineFn || null
const waline = Waline.init(Object.assign({
const initWaline = (Fn) => {
const waline = Fn(Object.assign({
el: '#waline-wrap', el: '#waline-wrap',
serverURL: '!{serverURL}', serverURL: '!{serverURL}',
pageview: !{lazyload ? false : pageview}, pageview: !{lazyload ? false : pageview},
@@ -18,15 +20,16 @@ script.
} }
btf.addGlobalFn('pjax', destroyWaline, 'destroyWaline') btf.addGlobalFn('pjax', destroyWaline, 'destroyWaline')
} }
const loadWaline = async () => { const loadWaline = async () => {
if (typeof Waline === 'object') initWaline() if (initFn) initWaline(initFn)
else { else {
await getCSS('!{url_for(theme.asset.waline_css)}') await getCSS('!{url_for(theme.asset.waline_css)}')
await getScript('!{url_for(theme.asset.waline_js)}') const { init } = await import('!{url_for(theme.asset.waline_js)}')
initWaline() initFn = init || Waline.init
initWaline(initFn)
window.walineFn = initFn
} }
} }

View File

@@ -47,7 +47,7 @@ script.
const getSetting = async () => { const getSetting = async () => {
try { try {
const res = await fetch('!{server}/api/conf', { method: 'GET' }) const res = await fetch('!{server}/api/v2/conf', { method: 'GET' })
return await res.json() return await res.json()
} catch (e) { } catch (e) {
console.log(e) console.log(e)
@@ -55,24 +55,20 @@ script.
} }
const headerList = { const headerList = {
method: 'POST', method: 'GET',
headers: { }
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': window.location.origin const searchParams = new URLSearchParams({
},
body: new URLSearchParams({
'site_name': '!{site}', 'site_name': '!{site}',
'limit': '!{theme.newest_comments.limit}', 'limit': '!{theme.newest_comments.limit}',
'type':'latest_comments'
}) })
}
const getComment = async () => { const getComment = async () => {
try { try {
const res = await fetch('!{server}/api/stat', headerList) const res = await fetch(`!{server}/api/v2/stats/latest_comments?${searchParams}`, headerList)
const result = await res.json() const result = await res.json()
const avatarStr = await getSetting() const avatarStr = await getSetting()
const { mirror, params, default:defaults } = avatarStr.data.frontend_conf.gravatar const { mirror, params, default:defaults } = avatarStr.frontend_conf.gravatar
const avatarCdn = !{avatarCdn} || mirror const avatarCdn = !{avatarCdn} || mirror
let avatarDefault = !{avatarDefault} || params || defaults let avatarDefault = !{avatarDefault} || params || defaults
avatarDefault = avatarDefault.startsWith('d=') ? avatarDefault : `d=${avatarDefault}` avatarDefault = avatarDefault.startsWith('d=') ? avatarDefault : `d=${avatarDefault}`

View File

@@ -1,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "4.12.0", "version": "4.13.0",
"description": "A Simple and Card UI Design theme for Hexo", "description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json", "main": "package.json",
"scripts": { "scripts": {
@@ -23,7 +23,7 @@
"email": "my@crazywong.com" "email": "my@crazywong.com"
}, },
"dependencies": { "dependencies": {
"hexo-renderer-stylus": "^3.0.0", "hexo-renderer-stylus": "^3.0.1",
"hexo-renderer-pug": "^3.0.0" "hexo-renderer-pug": "^3.0.0"
}, },
"homepage": "https://butterfly.js.org/", "homepage": "https://butterfly.js.org/",

View File

@@ -1,11 +1,11 @@
algolia_search: algolia_search:
name: algoliasearch name: algoliasearch
file: dist/algoliasearch-lite.umd.js file: dist/algoliasearch-lite.umd.js
version: 4.22.0 version: 4.22.1
instantsearch: instantsearch:
name: instantsearch.js name: instantsearch.js
file: dist/instantsearch.production.min.js file: dist/instantsearch.production.min.js
version: 4.63.0 version: 4.65.0
pjax: pjax:
name: pjax name: pjax
file: pjax.min.js file: pjax.min.js
@@ -37,17 +37,17 @@ disqusjs_css:
twikoo: twikoo:
name: twikoo name: twikoo
file: dist/twikoo.all.min.js file: dist/twikoo.all.min.js
version: 1.6.29 version: 1.6.31
waline_js: waline_js:
name: '@waline/client' name: '@waline/client'
file: dist/waline.js file: dist/waline.js
other_name: waline other_name: waline
version: 2.15.8 version: 3.1.2
waline_css: waline_css:
name: '@waline/client' name: '@waline/client'
file: dist/waline.css file: dist/waline.css
other_name: waline other_name: waline
version: 2.15.8 version: 3.1.2
sharejs: sharejs:
name: butterfly-extsrc name: butterfly-extsrc
file: sharejs/dist/js/social-share.min.js file: sharejs/dist/js/social-share.min.js
@@ -73,7 +73,7 @@ katex_copytex:
mermaid: mermaid:
name: mermaid name: mermaid
file: dist/mermaid.min.js file: dist/mermaid.min.js
version: 10.6.1 version: 10.8.0
canvas_ribbon: canvas_ribbon:
name: butterfly-extsrc name: butterfly-extsrc
file: dist/canvas-ribbon.min.js file: dist/canvas-ribbon.min.js
@@ -105,7 +105,7 @@ clickShowText:
lazyload: lazyload:
name: vanilla-lazyload name: vanilla-lazyload
file: dist/lazyload.iife.min.js file: dist/lazyload.iife.min.js
version: 17.8.5 version: 17.8.8
instantpage: instantpage:
name: instant.page name: instant.page
file: instantpage.js file: instantpage.js
@@ -121,12 +121,12 @@ pangu:
fancybox_css: fancybox_css:
name: '@fancyapps/ui' name: '@fancyapps/ui'
file: dist/fancybox/fancybox.css file: dist/fancybox/fancybox.css
version: 5.0.32 version: 5.0.33
other_name: fancyapps-ui other_name: fancyapps-ui
fancybox: fancybox:
name: '@fancyapps/ui' name: '@fancyapps/ui'
file: dist/fancybox/fancybox.umd.js file: dist/fancybox/fancybox.umd.js
version: 5.0.32 version: 5.0.33
other_name: fancyapps-ui other_name: fancyapps-ui
medium_zoom: medium_zoom:
name: medium-zoom name: medium-zoom
@@ -145,19 +145,11 @@ fontawesome:
file: css/all.min.css file: css/all.min.css
other_name: font-awesome other_name: font-awesome
version: 6.5.1 version: 6.5.1
flickr_justified_gallery_js:
name: flickr-justified-gallery
file: dist/fjGallery.min.js
version: 2.1.2
flickr_justified_gallery_css:
name: flickr-justified-gallery
file: dist/fjGallery.css
version: 2.1.2
egjs_infinitegrid: egjs_infinitegrid:
name: '@egjs/infinitegrid' name: '@egjs/infinitegrid'
other_name: egjs-infinitegrid other_name: egjs-infinitegrid
file: dist/infinitegrid.min.js file: dist/infinitegrid.min.js
version: 4.11.0 version: 4.11.1
aplayer_css: aplayer_css:
name: aplayer name: aplayer
file: dist/APlayer.min.css file: dist/APlayer.min.css
@@ -188,11 +180,11 @@ prismjs_autoloader:
artalk_js: artalk_js:
name: artalk name: artalk
file: dist/Artalk.js file: dist/Artalk.js
version: 2.7.3 version: 2.8.2
artalk_css: artalk_css:
name: artalk name: artalk
file: dist/Artalk.css file: dist/Artalk.css
version: 2.7.3 version: 2.8.2
pace_js: pace_js:
name: pace-js name: pace-js
other_name: pace other_name: pace
@@ -216,4 +208,4 @@ docsearch_css:
abcjs_basic_js: abcjs_basic_js:
name: abcjs name: abcjs
file: dist/abcjs-basic-min.js file: dist/abcjs-basic-min.js
version: 6.2.3 version: 6.3.0

View File

@@ -99,14 +99,9 @@
#post-info #post-info
position: absolute position: absolute
bottom: 100px bottom: 30px
padding: 0 8% padding: 0 8%
width: 100% width: 100%
text-align: center
+maxWidth900()
bottom: 30px
text-align: left
+maxWidth768() +maxWidth768()
bottom: 22px bottom: 22px