mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
pjax
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user