hexo/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/valine.pug

34 lines
996 B
Plaintext
Raw Normal View History

2023-09-25 15:58:56 +08:00
- let emojiMaps = '""'
if site.data.valine
- emojiMaps = JSON.stringify(site.data.valine)
script.
function loadValine () {
function initValine () {
const valine = new Valine(Object.assign({
el: '#vcomment',
appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}',
avatar: '#{theme.valine.avatar}',
serverURLs: '#{theme.valine.serverURLs}',
emojiMaps: !{emojiMaps},
path: window.location.pathname,
visitor: #{theme.valine.visitor}
}, !{JSON.stringify(theme.valine.option)}))
}
if (typeof Valine === 'function') initValine()
else getScript('!{url_for(theme.asset.valine)}').then(initValine)
}
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('vcomment'),loadValine)
else setTimeout(loadValine, 0)
} else {
function loadOtherComment () {
loadValine()
}
}