hexo/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/waline.pug

35 lines
971 B
Plaintext
Raw Normal View History

2023-09-25 15:58:56 +08:00
- const { serverURL, option, pageview } = theme.waline
- const { lazyload, count, use } = theme.comments
script.
function loadWaline () {
function initWaline () {
const waline = Waline.init(Object.assign({
el: '#waline-wrap',
serverURL: '!{serverURL}',
pageview: !{lazyload ? false : pageview},
dark: 'html[data-theme="dark"]',
path: window.location.pathname,
comment: !{lazyload ? false : count},
}, !{JSON.stringify(option)}))
}
if (typeof Waline === 'object') initWaline()
else {
getCSS('!{url_for(theme.asset.waline_css)}').then(() => {
getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
})
}
}
if ('!{use[0]}' === 'Waline' || !!{lazyload}) {
if (!{lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
else setTimeout(loadWaline, 0)
} else {
function loadOtherComment () {
loadWaline()
}
}