fix theme...
This commit is contained in:
32
themes/anzhiyu/layout/includes/third-party/comments/waline.pug
vendored
Normal file
32
themes/anzhiyu/layout/includes/third-party/comments/waline.pug
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
- 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
|
||||
}
|
||||
})()
|
||||
Reference in New Issue
Block a user