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'
+countBlock
a(href=url_for(page.path) + '#post-comment')
span.artalk-count
span#ArtalkCount
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)
span.article-meta
span.article-meta-separator |
i.fas.fa-inbox
each item, index in article.categories.data
i.fas.fa-inbox
a(href=url_for(item.path)).article-meta__categories #[=item.name]
if (index < article.categories.data.length - 1)
i.fas.fa-angle-right.article-meta-link
if (theme.post_meta.page.tags && article.tags.data.length > 0)
span.article-meta.tags
span.article-meta-separator |
i.fas.fa-tag
each item, index in article.tags.data
i.fas.fa-tag
a(href=url_for(item.path)).article-meta__tags #[=item.name]
if (index < article.tags.data.length - 1)
span.article-meta-link #[='•']

View File

@@ -8,19 +8,15 @@ script.
const keyArray = Array.from(eleGroup).map(i => i.getAttribute('data-page-key'))
const headerList = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': window.location.origin
},
body: new URLSearchParams({
'site_name': '!{site}',
'type':'page_comment',
'page_keys': keyArray
})
method: 'GET',
}
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()
keyArray.forEach((key, index) => {

View File

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

View File

@@ -3,22 +3,6 @@
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 countELement = document.getElementById('twikoo-count')
if(!countELement) return
@@ -34,12 +18,27 @@ 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)}))
!{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()
!{count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : ''}
}
else loadTwikoo()
} else {
window.loadOtherComment = loadTwikoo
}

View File

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

View File

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

View File

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

View File

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

View File

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