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

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
}