feat: 修改newest_comments的leancloud為valine,並刪除其配置,改為讀取valine配置

feat: 增加waline最新評論模塊
feat: 增加waline評論數顯示
feat: 增加waline評論
fix: 修復jquery在一些界面仍然加載問題
This commit is contained in:
Jerry
2020-12-19 00:44:58 +08:00
Unverified
parent 83299dfd2f
commit 25cf081250
13 changed files with 216 additions and 55 deletions

View File

@@ -31,6 +31,8 @@ hr
#utterances-wrap
when 'Twikoo'
#twikoo-wrap
when 'Waline'
#waline
when 'Facebook Comments'
.fb-comments(data-colorscheme = theme.display_mode === 'dark' ? 'dark' : 'light'
data-numposts= theme.facebook_comments.pageSize || 10

View File

@@ -14,5 +14,7 @@ each name in theme.comments.use
!=partial('includes/third-party/comments/utterances', {}, {cache:theme.fragment_cache})
when 'Twikoo'
!=partial('includes/third-party/comments/twikoo', {}, {cache:theme.fragment_cache})
when 'Waline'
!=partial('includes/third-party/comments/waline', {}, {cache:theme.fragment_cache})
when 'Facebook Comments'
!=partial('includes/third-party/comments/facebook_comments', {}, {cache:theme.fragment_cache})

View File

@@ -0,0 +1,34 @@
- let option = theme.waline.option ? JSON.stringify(theme.waline.option) : false
script.
function loadWaline () {
function initWaline () {
let initData = {
el: '#waline',
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.querySelector('#waline'),loadWaline)
else setTimeout(loadWaline, 0)
} else {
function loadOtherComment () {
loadWaline()
}
}