mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
feat: gitalk 增加 option 配置
improvement: pug代碼優化
This commit is contained in:
12
layout/includes/third-party/comments/waline.pug
vendored
12
layout/includes/third-party/comments/waline.pug
vendored
@@ -1,4 +1,3 @@
|
||||
- let option = theme.waline.option ? JSON.stringify(theme.waline.option) : false
|
||||
- let emojiMaps = '""'
|
||||
if site.data.waline
|
||||
- emojiMaps = JSON.stringify(site.data.waline)
|
||||
@@ -6,7 +5,7 @@ if site.data.waline
|
||||
script.
|
||||
function loadWaline () {
|
||||
function initWaline () {
|
||||
let initData = {
|
||||
const waline = new Waline(Object.assign({
|
||||
el: '#waline-wrap',
|
||||
serverURL: '!{theme.waline.serverURL}',
|
||||
avatar: '#{theme.waline.avatar}',
|
||||
@@ -14,14 +13,7 @@ script.
|
||||
emojiCDN: '#{theme.waline.emojiCDN}',
|
||||
emojiMaps: !{emojiMaps},
|
||||
visitor: #{theme.waline.visitor}
|
||||
}
|
||||
|
||||
if (!{Boolean(option)}) {
|
||||
const otherData = !{option}
|
||||
initData = Object.assign(initData, otherData)
|
||||
}
|
||||
|
||||
const waline = new Waline(initData)
|
||||
}, !{JSON.stringify(theme.waline.option)}))
|
||||
}
|
||||
|
||||
if (typeof Waline === 'function') initWaline()
|
||||
|
||||
Reference in New Issue
Block a user