mirror of https://github.com/jkjoy/sunpeiwen.git
35 lines
971 B
Plaintext
35 lines
971 B
Plaintext
|
- 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()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|