Files
hexo-theme-butterfly/layout/includes/comments/disqus.pug
2020-07-16 19:30:54 +08:00

44 lines
1.1 KiB
Plaintext

script.
function loadDisqus () {
var disqus_config = function () {
this.page.url = '!{ page.permalink }'
this.page.identifier = '!{ page.path }'
this.page.title = '!{ page.title }'
};
if (window.DISQUS) {
DISQUS.reset({
reload: true,
config: disqus_config
})
} else {
(function() {
var d = document, s = d.createElement('script')
s.src = 'https://!{theme.disqus.shortname}.disqus.com/embed.js'
s.setAttribute('data-timestamp', +new Date())
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
}
}
if ('!{defaultComment}' === 'Disqus' || !{theme.comments.load_begin}) {
loadDisqus()
}
else {
function loadOtherComment () {
loadDisqus()
}
}
if is_post() && theme.comments.count && defaultComment === 'Disqus'
script.
function getDisqusCount() {
var d = document, s = d.createElement('script');
s.src = 'https://!{theme.disqus.shortname}.disqus.com/count.js';
s.id = 'dsq-count-scr';
(d.head || d.body).appendChild(s);
}
getDisqusCount()