mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c5d587f64 | ||
|
|
ee6b137e94 | ||
|
|
e5e3998950 | ||
|
|
d9829167aa | ||
|
|
097ea40a4a | ||
|
|
6ebe51e971 | ||
|
|
6a99a80758 | ||
|
|
b409207978 |
13
.github/FUNDING.yml
vendored
Normal file
13
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# 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']
|
||||
@@ -266,6 +266,7 @@ aside:
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_post_series:
|
||||
enable: true
|
||||
series_title: false # The title shows the series name
|
||||
orderBy: 'date' # Order by title or date
|
||||
order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending
|
||||
|
||||
@@ -929,7 +930,7 @@ CDN:
|
||||
third_party_provider: jsdelivr
|
||||
|
||||
# Add version number to url, true or false
|
||||
version: false
|
||||
version: true
|
||||
|
||||
# Custom format
|
||||
# For example: https://cdn.staticfile.org/${cdnjs_name}/${version}/${min_cdnjs_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
|
||||
@@ -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 #[='•']
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
27
layout/includes/third-party/comments/artalk.pug
vendored
27
layout/includes/third-party/comments/artalk.pug
vendored
@@ -3,29 +3,33 @@
|
||||
|
||||
script.
|
||||
(() => {
|
||||
let artalkItem = null
|
||||
const initArtalk = () => {
|
||||
window.artalkItem = new Artalk(Object.assign({
|
||||
artalkItem = Artalk.init(Object.assign({
|
||||
el: '#artalk-wrap',
|
||||
server: '!{server}',
|
||||
site: '!{site}',
|
||||
pageKey: location.pathname,
|
||||
darkMode: document.documentElement.getAttribute('data-theme') === 'dark',
|
||||
countEl: '.artalk-count'
|
||||
},!{JSON.stringify(option)}))
|
||||
|
||||
if (GLOBAL_CONFIG.lightbox === 'null') return
|
||||
window.artalkItem.use(ctx => {
|
||||
ctx.on('list-loaded', () => {
|
||||
ctx.getCommentList().forEach(comment => {
|
||||
const $content = comment.getRender().$content
|
||||
btf.loadLightbox($content.querySelectorAll('img:not([atk-emoticon])'))
|
||||
})
|
||||
artalkItem.on('list-loaded', () => {
|
||||
artalkItem.ctx.get('list').getCommentNodes().forEach(comment => {
|
||||
const $content = comment.getRender().$content
|
||||
btf.loadLightbox($content.querySelectorAll('img:not([atk-emoticon])'))
|
||||
})
|
||||
})
|
||||
|
||||
const destroyArtalk = () => {
|
||||
artalkItem.destroy()
|
||||
}
|
||||
|
||||
btf.addGlobalFn('pjax', destroyArtalk, 'destroyArtalk')
|
||||
}
|
||||
|
||||
const loadArtalk = async () => {
|
||||
if (typeof window.artalkItem === 'object') initArtalk()
|
||||
if (typeof Artalk === 'object') initArtalk()
|
||||
else {
|
||||
await getCSS('!{theme.asset.artalk_css}')
|
||||
await getScript('!{theme.asset.artalk_js}')
|
||||
@@ -37,12 +41,11 @@ script.
|
||||
const artalkWrap = document.getElementById('artalk-wrap')
|
||||
if (!(artalkWrap && artalkWrap.children.length)) return
|
||||
const isDark = theme === 'dark'
|
||||
window.artalkItem.setDarkMode(isDark)
|
||||
artalkItem.setDarkMode(isDark)
|
||||
}
|
||||
|
||||
|
||||
btf.addGlobalFn('themeChange', artalkChangeMode, 'artalk')
|
||||
|
||||
|
||||
if ('!{use[0]}' === 'Artalk' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('artalk-wrap'), loadArtalk)
|
||||
else loadArtalk()
|
||||
|
||||
39
layout/includes/third-party/comments/twikoo.pug
vendored
39
layout/includes/third-party/comments/twikoo.pug
vendored
@@ -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
|
||||
}
|
||||
|
||||
20
layout/includes/third-party/comments/waline.pug
vendored
20
layout/includes/third-party/comments/waline.pug
vendored
@@ -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},
|
||||
@@ -12,14 +14,22 @@ script.
|
||||
path: window.location.pathname,
|
||||
comment: !{lazyload ? false : count},
|
||||
}, !{JSON.stringify(option)}))
|
||||
|
||||
const destroyWaline = () => {
|
||||
waline.destroy()
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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}`
|
||||
|
||||
@@ -17,7 +17,10 @@ script.
|
||||
const findTrueUrl = (array) => {
|
||||
Promise.all(array.map(item =>
|
||||
fetch(item.url).then(resp => resp.json()).then(data => {
|
||||
const urlArray = data.body.match(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig)
|
||||
let urlArray = data.body ? data.body.match(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig) : []
|
||||
if (!Array.isArray(urlArray) || urlArray.length === 0) {
|
||||
urlArray = [`${data.html_url}`]
|
||||
}
|
||||
if (data.user.login === 'utterances-bot') {
|
||||
return urlArray.pop()
|
||||
} else {
|
||||
@@ -48,7 +51,7 @@ script.
|
||||
const githubArray = data.map(item => {
|
||||
return {
|
||||
'avatar': item.user.avatar_url,
|
||||
'content': changeContent(item.body_html),
|
||||
'content': changeContent(item.body_html || item.body),
|
||||
'nick': item.user.login,
|
||||
'url': item.issue_url,
|
||||
'date': item.updated_at,
|
||||
|
||||
@@ -3,7 +3,7 @@ if theme.aside.card_post_series.enable
|
||||
.card-widget.card-post-series
|
||||
.item-headline
|
||||
i.fa-solid.fa-layer-group
|
||||
span= _p('aside.card_post_series')
|
||||
span= theme.aside.card_post_series.series_title ? page.series : _p('aside.card_post_series')
|
||||
.aside-list
|
||||
each item in array[page.series]
|
||||
- const { path, title = _p('no_title'), cover, cover_type, date:dateA } = item
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- let tocNumber = page.toc_number !== undefined ? page.toc_number : theme.toc.number
|
||||
- let tocExpand = page.toc_expand !== undefined ? page.toc_expand : theme.toc.expand
|
||||
- let tocNumber = typeof page.toc_number === 'boolean' ? page.toc_number : theme.toc.number
|
||||
- let tocExpand = typeof page.toc_expand === 'boolean' ? page.toc_expand : theme.toc.expand
|
||||
- let tocExpandClass = tocExpand ? 'is-expand' : ''
|
||||
|
||||
#card-toc.card-widget
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hexo-theme-butterfly",
|
||||
"version": "4.11.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/",
|
||||
|
||||
36
plugins.yml
36
plugins.yml
@@ -1,11 +1,11 @@
|
||||
algolia_search:
|
||||
name: algoliasearch
|
||||
file: dist/algoliasearch-lite.umd.js
|
||||
version: 4.20.0
|
||||
version: 4.22.1
|
||||
instantsearch:
|
||||
name: instantsearch.js
|
||||
file: dist/instantsearch.production.min.js
|
||||
version: 4.60.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.25
|
||||
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.28
|
||||
version: 5.0.33
|
||||
other_name: fancyapps-ui
|
||||
fancybox:
|
||||
name: '@fancyapps/ui'
|
||||
file: dist/fancybox/fancybox.umd.js
|
||||
version: 5.0.28
|
||||
version: 5.0.33
|
||||
other_name: fancyapps-ui
|
||||
medium_zoom:
|
||||
name: medium-zoom
|
||||
@@ -144,20 +144,12 @@ fontawesome:
|
||||
name: '@fortawesome/fontawesome-free'
|
||||
file: css/all.min.css
|
||||
other_name: font-awesome
|
||||
version: 6.4.2
|
||||
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
|
||||
version: 6.5.1
|
||||
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.6.4
|
||||
version: 2.8.2
|
||||
artalk_css:
|
||||
name: artalk
|
||||
file: dist/Artalk.css
|
||||
version: 2.6.4
|
||||
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
|
||||
|
||||
@@ -181,6 +181,7 @@ hexo.extend.filter.register('before_generate', () => {
|
||||
},
|
||||
card_post_series: {
|
||||
enable: true,
|
||||
series_title: false,
|
||||
orderBy: 'date',
|
||||
order: -1
|
||||
}
|
||||
@@ -534,7 +535,7 @@ hexo.extend.filter.register('before_generate', () => {
|
||||
CDN: {
|
||||
internal_provider: 'local',
|
||||
third_party_provider: 'jsdelivr',
|
||||
version: false,
|
||||
version: true,
|
||||
custom_format: null,
|
||||
option: null
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -115,6 +115,8 @@ beautify()
|
||||
h4,
|
||||
h5,
|
||||
h6
|
||||
width: fit-content
|
||||
|
||||
a:not(.headerlink)
|
||||
position relative
|
||||
z-index 10
|
||||
|
||||
Reference in New Issue
Block a user