mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
✨ 增加mac light 代碼框 ✨ 增加文章過期提醒配置 ✨ 文章copyright 可單獨配置 ✨ card-category 中category名稱和數字限制一行顯示 ✨ 簡繁轉換優化,placeholder文字也會被轉換 🐛 修復配置PWA參數時,如果網站是子目錄時,會出現加載不到文件的bugs 調整當card-category有收縮按鈕時的顯示佈局
48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
#gitalk-container
|
|
script(src=url_for(theme.CDN.blueimp_md5))
|
|
|
|
script.
|
|
function loadGitalk () {
|
|
const ele = document.createElement('link')
|
|
ele.rel = 'stylesheet'
|
|
ele.href= '!{url_for(theme.CDN.gitalk_css)}'
|
|
document.getElementsByTagName('head')[0].appendChild(ele)
|
|
|
|
loadScript('!{url_for(theme.CDN.gitalk)}', function () {
|
|
var gitalk = new Gitalk({
|
|
clientID: '!{theme.gitalk.client_id}',
|
|
clientSecret: '!{theme.gitalk.client_secret}',
|
|
repo: '!{theme.gitalk.repo}',
|
|
owner: '!{theme.gitalk.owner}',
|
|
admin: ['!{theme.gitalk.admin}'],
|
|
id: md5(decodeURI(location.pathname)),
|
|
language: '!{theme.gitalk.language}',
|
|
perPage: !{theme.gitalk.perPage},
|
|
distractionFreeMode: !{theme.gitalk.distractionFreeMode},
|
|
pagerDirection: '!{theme.gitalk.pagerDirection}',
|
|
createIssueManually: !{theme.gitalk.createIssueManually},
|
|
updateCountCallback: commentCount
|
|
})
|
|
gitalk.render('gitalk-container')
|
|
})
|
|
|
|
function commentCount(n){
|
|
try {
|
|
document.getElementsByClassName('gitalk-comment-count')[0].innerHTML= n
|
|
} catch (e) {
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
|
|
if ('!{defaultComment}' === 'Gitalk' || !{theme.comments.load_begin}) {
|
|
window.addEventListener('load', loadGitalk)
|
|
}
|
|
else {
|
|
function loadOtherComment () {
|
|
loadGitalk()
|
|
}
|
|
}
|
|
|
|
|