mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
improvements: 補全card-categories和card-archives的 '查看更多‘鏈接 close #337 fix: 修復comments沒設置時,報Unexpected token ')'的bugs close #344 improvements: 優化js和html fix: 修復toc 滾動百分比不準的Bugs
46 lines
1.3 KiB
Plaintext
46 lines
1.3 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());
|
|
(d.head || d.body).appendChild(s);
|
|
})();
|
|
}
|
|
}
|
|
|
|
if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) {
|
|
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqus)
|
|
else loadDisqus()
|
|
} else {
|
|
function loadOtherComment () {
|
|
loadDisqus()
|
|
}
|
|
}
|
|
|
|
if is_post() && !theme.comments.lazyload && theme.comments.count && theme.comments.use[0] === '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});
|
|
}
|