QuickReference/themes/anzhiyu/layout/includes/third-party/comments/waline.pug

32 lines
997 B
Plaintext

- 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 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}) anzhiyu.loadComment(document.getElementById('waline-wrap'),loadWaline)
else setTimeout(loadWaline, 0)
} else {
window.loadOtherComment = loadWaline
}
})()