pull/1429/head
Jerry 10 months ago
parent 63fb690d02
commit 6a99a80758

@ -266,6 +266,7 @@ aside:
sort_order: # Don't modify the setting unless you know how it works sort_order: # Don't modify the setting unless you know how it works
card_post_series: card_post_series:
enable: true enable: true
series_title: false # The title shows the series name
orderBy: 'date' # Order by title or date orderBy: 'date' # Order by title or date
order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending
@ -929,7 +930,7 @@ CDN:
third_party_provider: jsdelivr third_party_provider: jsdelivr
# Add version number to url, true or false # Add version number to url, true or false
version: false version: true
# Custom format # Custom format
# For example: https://cdn.staticfile.org/${cdnjs_name}/${version}/${min_cdnjs_file} # For example: https://cdn.staticfile.org/${cdnjs_name}/${version}/${min_cdnjs_file}

@ -3,8 +3,9 @@
script. script.
(() => { (() => {
let artalkItem = null
const initArtalk = () => { const initArtalk = () => {
window.artalkItem = new Artalk(Object.assign({ artalkItem = Artalk.init(Object.assign({
el: '#artalk-wrap', el: '#artalk-wrap',
server: '!{server}', server: '!{server}',
site: '!{site}', site: '!{site}',
@ -14,18 +15,22 @@ script.
},!{JSON.stringify(option)})) },!{JSON.stringify(option)}))
if (GLOBAL_CONFIG.lightbox === 'null') return if (GLOBAL_CONFIG.lightbox === 'null') return
window.artalkItem.use(ctx => { artalkItem.on('list-loaded', () => {
ctx.on('list-loaded', () => { artalkItem.ctx.get('list').getCommentNodes().forEach(comment => {
ctx.getCommentList().forEach(comment => { const $content = comment.getRender().$content
const $content = comment.getRender().$content btf.loadLightbox($content.querySelectorAll('img:not([atk-emoticon])'))
btf.loadLightbox($content.querySelectorAll('img:not([atk-emoticon])'))
})
}) })
}) })
const destroyArtalk = () => {
artalkItem.destroy()
}
btf.addGlobalFn('pjax', destroyArtalk, 'destroyArtalk')
} }
const loadArtalk = async () => { const loadArtalk = async () => {
if (typeof window.artalkItem === 'object') initArtalk() if (typeof Artalk === 'object') initArtalk()
else { else {
await getCSS('!{theme.asset.artalk_css}') await getCSS('!{theme.asset.artalk_css}')
await getScript('!{theme.asset.artalk_js}') await getScript('!{theme.asset.artalk_js}')
@ -37,12 +42,11 @@ script.
const artalkWrap = document.getElementById('artalk-wrap') const artalkWrap = document.getElementById('artalk-wrap')
if (!(artalkWrap && artalkWrap.children.length)) return if (!(artalkWrap && artalkWrap.children.length)) return
const isDark = theme === 'dark' const isDark = theme === 'dark'
window.artalkItem.setDarkMode(isDark) artalkItem.setDarkMode(isDark)
} }
btf.addGlobalFn('themeChange', artalkChangeMode, 'artalk') btf.addGlobalFn('themeChange', artalkChangeMode, 'artalk')
if ('!{use[0]}' === 'Artalk' || !!{lazyload}) { if ('!{use[0]}' === 'Artalk' || !!{lazyload}) {
if (!{lazyload}) btf.loadComment(document.getElementById('artalk-wrap'), loadArtalk) if (!{lazyload}) btf.loadComment(document.getElementById('artalk-wrap'), loadArtalk)
else loadArtalk() else loadArtalk()

@ -12,6 +12,13 @@ script.
path: window.location.pathname, path: window.location.pathname,
comment: !{lazyload ? false : count}, comment: !{lazyload ? false : count},
}, !{JSON.stringify(option)})) }, !{JSON.stringify(option)}))
const destroyWaline = () => {
waline.destroy()
}
btf.addGlobalFn('pjax', destroyWaline, 'destroyWaline')
} }
const loadWaline = async () => { const loadWaline = async () => {

@ -17,7 +17,10 @@ script.
const findTrueUrl = (array) => { const findTrueUrl = (array) => {
Promise.all(array.map(item => Promise.all(array.map(item =>
fetch(item.url).then(resp => resp.json()).then(data => { 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') { if (data.user.login === 'utterances-bot') {
return urlArray.pop() return urlArray.pop()
} else { } else {
@ -48,7 +51,7 @@ script.
const githubArray = data.map(item => { const githubArray = data.map(item => {
return { return {
'avatar': item.user.avatar_url, 'avatar': item.user.avatar_url,
'content': changeContent(item.body_html), 'content': changeContent(item.body_html || item.body),
'nick': item.user.login, 'nick': item.user.login,
'url': item.issue_url, 'url': item.issue_url,
'date': item.updated_at, 'date': item.updated_at,

@ -3,7 +3,7 @@ if theme.aside.card_post_series.enable
.card-widget.card-post-series .card-widget.card-post-series
.item-headline .item-headline
i.fa-solid.fa-layer-group 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 .aside-list
each item in array[page.series] each item in array[page.series]
- const { path, title = _p('no_title'), cover, cover_type, date:dateA } = item - 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 tocNumber = typeof page.toc_number === 'boolean' ? page.toc_number : theme.toc.number
- let tocExpand = page.toc_expand !== undefined ? page.toc_expand : theme.toc.expand - let tocExpand = typeof page.toc_expand === 'boolean' ? page.toc_expand : theme.toc.expand
- let tocExpandClass = tocExpand ? 'is-expand' : '' - let tocExpandClass = tocExpand ? 'is-expand' : ''
#card-toc.card-widget #card-toc.card-widget

@ -1,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "4.11.0", "version": "4.12.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": {

@ -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.20.0 version: 4.22.0
instantsearch: instantsearch:
name: instantsearch.js name: instantsearch.js
file: dist/instantsearch.production.min.js file: dist/instantsearch.production.min.js
version: 4.60.0 version: 4.63.0
pjax: pjax:
name: pjax name: pjax
file: pjax.min.js file: pjax.min.js
@ -37,7 +37,7 @@ disqusjs_css:
twikoo: twikoo:
name: twikoo name: twikoo
file: dist/twikoo.all.min.js file: dist/twikoo.all.min.js
version: 1.6.25 version: 1.6.29
waline_js: waline_js:
name: '@waline/client' name: '@waline/client'
file: dist/waline.js file: dist/waline.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.28 version: 5.0.32
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.28 version: 5.0.32
other_name: fancyapps-ui other_name: fancyapps-ui
medium_zoom: medium_zoom:
name: medium-zoom name: medium-zoom
@ -144,7 +144,7 @@ fontawesome:
name: '@fortawesome/fontawesome-free' name: '@fortawesome/fontawesome-free'
file: css/all.min.css file: css/all.min.css
other_name: font-awesome other_name: font-awesome
version: 6.4.2 version: 6.5.1
flickr_justified_gallery_js: flickr_justified_gallery_js:
name: flickr-justified-gallery name: flickr-justified-gallery
file: dist/fjGallery.min.js file: dist/fjGallery.min.js
@ -188,11 +188,11 @@ prismjs_autoloader:
artalk_js: artalk_js:
name: artalk name: artalk
file: dist/Artalk.js file: dist/Artalk.js
version: 2.6.4 version: 2.7.3
artalk_css: artalk_css:
name: artalk name: artalk
file: dist/Artalk.css file: dist/Artalk.css
version: 2.6.4 version: 2.7.3
pace_js: pace_js:
name: pace-js name: pace-js
other_name: pace other_name: pace

@ -181,6 +181,7 @@ hexo.extend.filter.register('before_generate', () => {
}, },
card_post_series: { card_post_series: {
enable: true, enable: true,
series_title: false,
orderBy: 'date', orderBy: 'date',
order: -1 order: -1
} }
@ -534,7 +535,7 @@ hexo.extend.filter.register('before_generate', () => {
CDN: { CDN: {
internal_provider: 'local', internal_provider: 'local',
third_party_provider: 'jsdelivr', third_party_provider: 'jsdelivr',
version: false, version: true,
custom_format: null, custom_format: null,
option: null option: null
} }

@ -115,6 +115,8 @@ beautify()
h4, h4,
h5, h5,
h6 h6
width: fit-content
a:not(.headerlink) a:not(.headerlink)
position relative position relative
z-index 10 z-index 10

Loading…
Cancel
Save