Files
hexo-theme-butterfly/layout/includes/third-party/comments/waline.pug
Jerry d5d5681981 feat: twikoo 增加 option 配置
feat: aside widget 增加排序(只對page頁和sticky內的有效)
feat: aside 增加自定義 widget
improvement: readmode 優化
improvement: html結構優化
2020-12-24 01:29:09 +08:00

35 lines
943 B
Plaintext

- let option = theme.waline.option ? JSON.stringify(theme.waline.option) : false
script.
function loadWaline () {
function initWaline () {
let initData = {
el: '#waline-wrap',
serverURL: '!{theme.waline.serverURL}',
avatar: '#{theme.waline.avatar}',
path: location.pathname,
}
if (!{Boolean(option)}) {
const otherData = !{option}
initData = Object.assign(initData, otherData)
}
const waline = new Waline(initData)
}
if (typeof Waline === 'function') initWaline()
else getScript('!{url_for(theme.CDN.waline)}').then(initWaline)
}
if ('!{theme.comments.use[0]}' === 'Waline' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
else setTimeout(loadWaline, 0)
} else {
function loadOtherComment () {
loadWaline()
}
}