mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
feat: 適配 hexo-blog-encrypt fix: 修復 hexo 新版本下,prismjs 的問題 improvement: 在 pjax 關閉的情況下。減少不必要的全局變量 improvement: 更新依賴版本 improvement: 頁面進入效果優化 improvement: 添加平滑滾動 improvement: 兼容性優化 improvement: 優化 lighthouse 分數 improvement: 優化代碼
17 lines
555 B
Plaintext
17 lines
555 B
Plaintext
script.
|
|
(() => {
|
|
const abcjsInit = () => {
|
|
const abcjsFn = () => {
|
|
document.querySelectorAll(".abc-music-sheet").forEach(ele => {
|
|
if (ele.children.length > 0) return
|
|
ABCJS.renderAbc(ele, ele.innerHTML, {responsive: 'resize'})
|
|
})
|
|
}
|
|
|
|
typeof ABCJS === 'object' ? abcjsFn()
|
|
: btf.getScript('!{url_for(theme.asset.abcjs_basic_js)}').then(abcjsFn)
|
|
}
|
|
|
|
window.pjax ? abcjsInit() : window.addEventListener('load', abcjsInit)
|
|
btf.addGlobalFn('encrypt', abcjsInit, 'abcjs')
|
|
})() |