mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 14:07:06 +08:00
feat: 修改 toc 打開效果
feat: 適配 hexo-blog-encrypt fix: 修復 hexo 新版本下,prismjs 的問題 improvement: 在 pjax 關閉的情況下。減少不必要的全局變量 improvement: 更新依賴版本 improvement: 頁面進入效果優化 improvement: 添加平滑滾動 improvement: 兼容性優化 improvement: 優化 lighthouse 分數 improvement: 優化代碼
This commit is contained in:
@@ -31,8 +31,8 @@ script.
|
||||
const loadArtalk = async () => {
|
||||
if (typeof Artalk === 'object') initArtalk()
|
||||
else {
|
||||
await getCSS('!{theme.asset.artalk_css}')
|
||||
await getScript('!{theme.asset.artalk_js}')
|
||||
await btf.getCSS('!{theme.asset.artalk_css}')
|
||||
await btf.getScript('!{theme.asset.artalk_js}')
|
||||
initArtalk()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ script.
|
||||
const loadDisqusjs = async() => {
|
||||
if (window.disqusJsLoad) initDisqusjs()
|
||||
else {
|
||||
await getCSS('!{url_for(theme.asset.disqusjs_css)}')
|
||||
await getScript('!{url_for(theme.asset.disqusjs)}')
|
||||
await btf.getCSS('!{url_for(theme.asset.disqusjs_css)}')
|
||||
await btf.getScript('!{url_for(theme.asset.disqusjs)}')
|
||||
initDisqusjs()
|
||||
window.disqusJsLoad = true
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ script.
|
||||
const loadGitalk = async() => {
|
||||
if (typeof Gitalk === 'function') initGitalk()
|
||||
else {
|
||||
await getCSS('!{url_for(theme.asset.gitalk_css)}')
|
||||
await getScript('!{url_for(theme.asset.gitalk)}')
|
||||
await btf.getCSS('!{url_for(theme.asset.gitalk_css)}')
|
||||
await btf.getScript('!{url_for(theme.asset.gitalk)}')
|
||||
initGitalk()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ script.
|
||||
|
||||
const loadTwikoo = () => {
|
||||
if (typeof twikoo === 'object') setTimeout(init,0)
|
||||
else getScript('!{url_for(theme.asset.twikoo)}').then(init)
|
||||
else btf.getScript('!{url_for(theme.asset.twikoo)}').then(init)
|
||||
}
|
||||
|
||||
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) {
|
||||
|
||||
@@ -23,7 +23,7 @@ script.
|
||||
const loadValine = async () => {
|
||||
if (typeof Valine === 'function') initValine()
|
||||
else {
|
||||
await getScript('!{url_for(theme.asset.valine)}')
|
||||
await btf.getScript('!{url_for(theme.asset.valine)}')
|
||||
initValine()
|
||||
}
|
||||
}
|
||||
|
||||
14
layout/includes/third-party/comments/waline.pug
vendored
14
layout/includes/third-party/comments/waline.pug
vendored
@@ -22,14 +22,16 @@ script.
|
||||
btf.addGlobalFn('pjax', destroyWaline, 'destroyWaline')
|
||||
}
|
||||
|
||||
const loadWaline = async () => {
|
||||
const loadWaline = () => {
|
||||
if (initFn) initWaline(initFn)
|
||||
else {
|
||||
await getCSS('!{url_for(theme.asset.waline_css)}')
|
||||
const { init } = await import('!{url_for(theme.asset.waline_js)}')
|
||||
initFn = init || Waline.init
|
||||
initWaline(initFn)
|
||||
window.walineFn = initFn
|
||||
btf.getCSS('!{url_for(theme.asset.waline_css)}')
|
||||
.then(() => import('!{url_for(theme.asset.waline_js)}'))
|
||||
.then(({ init }) => {
|
||||
initFn = init || Waline.init
|
||||
initWaline(initFn)
|
||||
window.walineFn = initFn
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user