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,13 +1,15 @@
#disqus_thread
script.
function loadDisqusjs () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.CDN.disqusjs_css)}'
document.getElementsByTagName('head')[0].appendChild(ele)
function addDisqusjsCSS () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.CDN.disqusjs_css)}'
document.getElementsByTagName('head')[0].appendChild(ele)
}
loadScript('!{url_for(theme.CDN.disqusjs)}', function() {
var dsqjs = new DisqusJS({
function initDiqusjs () {
window.DISQUS = null
new DisqusJS({
shortname: '!{theme.disqusjs.shortname}',
siteName: '!{theme.disqusjs.siteName}',
identifier: '!{ page.path }',
@@ -19,11 +21,18 @@ script.
admin: '!{theme.disqusjs.admin}',
adminLabel: '!{theme.disqusjs.adminLabel}'
});
})
}
if (window.disqusjsload) initDiqusjs()
else {
addDisqusjsCSS()
$.getScript('!{url_for(theme.CDN.disqusjs)}', initDiqusjs)
window.disqusjsload = true
}
}
if ('!{defaultComment}' === 'Disqusjs' || !{theme.comments.load_begin}) {
window.addEventListener('load', loadDisqusjs)
loadDisqusjs()
}
else {
function loadOtherComment () {
@@ -40,4 +49,4 @@ if is_post() && theme.comments.count && defaultComment === 'Disqusjs'
s.id = 'dsq-count-scr';
(d.head || d.body).appendChild(s);
}
window.addEventListener('load', getDisqusCount, false);
getDisqusCount()