Hexo个人博客
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

- const { serverURL, option, pageview } = theme.waline
- const { lazyload, count, use } = theme.comments
script.
(() => {
const 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)}))
const destroyWaline = () => {
waline.destroy()
}
btf.addGlobalFn('pjax', destroyWaline, 'destroyWaline')
}
const loadWaline = async () => {
if (typeof Waline === 'object') initWaline()
else {
await getCSS('!{url_for(theme.asset.waline_css)}')
await getScript('!{url_for(theme.asset.waline_js)}')
initWaline()
}
}
if ('!{use[0]}' === 'Waline' || !!{lazyload}) {
if (!{lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
else setTimeout(loadWaline, 0)
} else {
window.loadOtherComment = loadWaline
}
})()