mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-17 04:40:53 +08:00
49 lines
1.2 KiB
Plaintext
49 lines
1.2 KiB
Plaintext
script.
|
|
function loadDisqus () {
|
|
var disqus_config = function () {
|
|
this.page.url = '!{ page.permalink }'
|
|
this.page.identifier = '!{ page.path }'
|
|
this.page.title = '!{ page.title }'
|
|
};
|
|
|
|
window.disqusReset = () => {
|
|
DISQUS.reset({
|
|
reload: true,
|
|
config: disqus_config
|
|
})
|
|
}
|
|
|
|
if (window.DISQUS) {
|
|
disqusReset()
|
|
} 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.
|
|
if (window.DISQUSWIDGETS === undefined) {
|
|
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);
|
|
} else {
|
|
DISQUSWIDGETS.getCount({reset: true});
|
|
}
|