This commit is contained in:
Jerry
2020-07-16 19:30:54 +08:00
Unverified
parent 5b6e008b84
commit 898cc31c58
93 changed files with 2128 additions and 2151 deletions

View File

@@ -1,21 +1,20 @@
#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)
function addGitalkSource () {
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 () {
function initGitalk () {
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)),
id: '!{md5(page.path)}',
language: '!{theme.gitalk.language}',
perPage: !{theme.gitalk.perPage},
distractionFreeMode: !{theme.gitalk.distractionFreeMode},
@@ -24,7 +23,13 @@ script.
updateCountCallback: commentCount
})
gitalk.render('gitalk-container')
})
}
if (typeof Gitalk === 'function') initGitalk()
else {
addGitalkSource()
$.getScript('!{url_for(theme.CDN.gitalk)}', initGitalk)
}
function commentCount(n){
try {
@@ -36,7 +41,7 @@ script.
}
if ('!{defaultComment}' === 'Gitalk' || !{theme.comments.load_begin}) {
window.addEventListener('load', loadGitalk)
loadGitalk()
}
else {
function loadOtherComment () {
@@ -45,3 +50,4 @@ script.
}