mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
feat: 點擊文字特效增加隨機配置 feat: 可配置是否添加css前綴 fix: 修復子目錄下,配置justifiedGallery CDN(相對鏈接)後,連接會無法訪問的bugs fix: 修復 pangu 配置post 後,仍在全站生效的bugs improvement: 夜間模式下,廣告降低亮度 improvement: 手機端toc邊距微調 improvement: html格式優化 improvement: 搜索優化 improvement: 刪除不必要的語言文件
59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
- let disqusjsApi = theme.disqusjs.api || 'https://disqus.skk.moe/disqus/'
|
|
script.
|
|
function loadDisqusjs () {
|
|
function addDisqusjsCSS () {
|
|
const ele = document.createElement('link')
|
|
ele.rel = 'stylesheet'
|
|
ele.href= '!{url_for(theme.CDN.disqusjs_css)}'
|
|
document.getElementsByTagName('head')[0].appendChild(ele)
|
|
}
|
|
|
|
function initDisqusjs () {
|
|
window.DISQUS = null
|
|
new DisqusJS({
|
|
shortname: '!{theme.disqusjs.shortname}',
|
|
siteName: '!{theme.disqusjs.siteName}',
|
|
identifier: '!{ page.path }',
|
|
url: '!{ page.permalink }',
|
|
title: '!{ page.title }',
|
|
api: '!{disqusjsApi}',
|
|
apikey: '!{theme.disqusjs.apikey}',
|
|
nocomment: '!{theme.disqusjs.nocomment}',
|
|
admin: '!{theme.disqusjs.admin}',
|
|
adminLabel: '!{theme.disqusjs.adminLabel}'
|
|
});
|
|
}
|
|
|
|
window.disqusReset = initDisqusjs
|
|
|
|
if (window.disqusJsLoad) initDisqusjs()
|
|
else {
|
|
addDisqusjsCSS()
|
|
getScript('!{url_for(theme.CDN.disqusjs)}').then(initDisqusjs)
|
|
window.disqusJsLoad = true
|
|
}
|
|
}
|
|
|
|
if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) {
|
|
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqusjs)
|
|
else loadDisqusjs()
|
|
}
|
|
else {
|
|
function loadOtherComment () {
|
|
loadDisqusjs()
|
|
}
|
|
}
|
|
|
|
|
|
if is_post() && !theme.comments.lazyload && theme.comments.count && theme.comments.use[0] === 'Disqusjs'
|
|
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});
|
|
}
|
|
|