You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
9 months ago
|
- const { use, lazyload } = theme.comments
|
||
|
- const { appId, appKey, avatar, serverURLs, visitor, option } = theme.valine
|
||
|
|
||
|
- let emojiMaps = '""'
|
||
|
if site.data.valine
|
||
|
- emojiMaps = JSON.stringify(site.data.valine)
|
||
|
|
||
|
script.
|
||
|
(() => {
|
||
|
const initValine = () => {
|
||
|
const valine = new Valine(Object.assign({
|
||
|
el: '#vcomment',
|
||
|
appId: '#{appId}',
|
||
|
appKey: '#{appKey}',
|
||
|
avatar: '#{avatar}',
|
||
|
serverURLs: '#{serverURLs}',
|
||
|
emojiMaps: !{emojiMaps},
|
||
|
path: window.location.pathname,
|
||
|
visitor: #{visitor}
|
||
|
}, !{JSON.stringify(option)}))
|
||
|
}
|
||
|
|
||
|
const loadValine = async () => {
|
||
|
if (typeof Valine === 'function') initValine()
|
||
|
else {
|
||
|
await getScript('!{url_for(theme.asset.valine)}')
|
||
|
initValine()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if ('!{use[0]}' === 'Valine' || !!{lazyload}) {
|
||
|
if (!{lazyload}) btf.loadComment(document.getElementById('vcomment'),loadValine)
|
||
|
else setTimeout(loadValine, 0)
|
||
|
} else {
|
||
|
window.loadOtherComment = loadValine
|
||
|
}
|
||
|
})()
|
||
|
|