This commit is contained in:
Jerry committed 2023-12-29 23:01:58 +08:00
1 parent 63fb690d02
commit 6a99a80758
10 files changed
+45 -27

No files matched your search

+2 -1
View File
@@ -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}
+15 -11
View 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()
+7
View File
@@ -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 () => {
Loaded 3 of 10 files, more files were not shown because too many files have changed in this diff. Show more