- 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 } })()