improvements: 代碼名全大寫

improvements: 補全card-categories和card-archives的 '查看更多‘鏈接 close #337
fix: 修復comments沒設置時,報Unexpected token ')'的bugs close #344
improvements: 優化js和html
fix: 修復toc 滾動百分比不準的Bugs
This commit is contained in:
Jerry
2020-08-31 01:31:59 +08:00
parent 593eb4734e
commit 51c4726c54
33 changed files with 877 additions and 886 deletions

View File

@@ -25,7 +25,7 @@ script.
}
if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('disqus_thread'), loadDisqus)
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqus)
else loadDisqus()
} else {
function loadOtherComment () {

View File

@@ -34,7 +34,7 @@ script.
}
if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('disqus_thread'), loadDisqusjs)
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqusjs)
else loadDisqusjs()
}
else {

View File

@@ -16,7 +16,7 @@ script.
}
if ('!{theme.comments.use[0]}' === 'Facebook Comments' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment)
if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment)
else loadFBComment()
} else {
function loadOtherComment () {

View File

@@ -40,7 +40,7 @@ script.
}
if ('!{theme.comments.use[0]}' === 'Gitalk' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('gitalk-container'), loadGitalk)
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk)
else loadGitalk()
} else {
function loadOtherComment () {

View File

@@ -16,7 +16,7 @@ script.
}
if ('!{theme.comments.use[0]}' === 'Livere' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('lv-container'), loadLivere)
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('lv-container'), loadLivere)
else loadLivere()
}
else {

View File

@@ -25,7 +25,7 @@ script.
}
if ('!{theme.comments.use[0]}' === 'Utterances' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('utterances-wrap'), loadUtterances)
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('utterances-wrap'), loadUtterances)
else loadUtterances()
} else {
function loadOtherComment () {

View File

@@ -29,7 +29,7 @@ script.
}
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.querySelector('#vcomment'),loadValine)
if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#vcomment'),loadValine)
else setTimeout(() => loadValine(), 0)
} else {
function loadOtherComment () {

View File

@@ -43,7 +43,7 @@ script.
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick}</span><time> / ${diffDate(array[i].date, true)}</time></div>
<div class='name'><span>${array[i].nick}</span><time> / ${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}

View File

@@ -42,7 +42,7 @@ script.
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick}</span><time> / ${diffDate(array[i].date, true)}</time></div>
<div class='name'><span>${array[i].nick}</span><time> / ${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}

View File

@@ -16,8 +16,8 @@ script.
const getIcon = (icon, mail) => {
if (icon) return icon
let defaultIcon = '!{theme.newest_comments.leancloud.default_avatar}' || '404'
let iconUrl = `https://gravatar.loli.net/avatar/${md5(mail.toLowerCase())}?d=${defaultIcon}`
let defaultIcon = '!{ theme.newest_comments.leancloud.default_avatar ? `?d=${theme.newest_comments.leancloud.default_avatar}` : ''}'
let iconUrl = `https://gravatar.loli.net/avatar/${md5(mail.toLowerCase()) + defaultIcon}`
return iconUrl
}
@@ -33,7 +33,7 @@ script.
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick}</span><time> / ${diffDate(array[i].date, true)}</time></div>
<div class='name'><span>${array[i].nick}</span><time> / ${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}

View File

@@ -15,7 +15,7 @@ script.
'.js-pjax'
]
if (!{theme.Open_Graph_meta && theme.comments.use && theme.comments.use.includes('Livere')}) {
if (!{Boolean(theme.Open_Graph_meta && theme.comments.use && theme.comments.use.includes('Livere'))}) {
pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}
@@ -28,13 +28,13 @@ script.
})
document.addEventListener('pjax:complete', function () {
refreshFn()
window.refreshFn()
$('script[data-pjax]').each(function () {
$(this).parent().append($(this).remove())
})
GLOBAL_CONFIG.islazyload && lazyLoadInstance.update()
GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()
typeof chatBtnFn === 'function' && chatBtnFn()
typeof panguInit === 'function' && panguInit()