mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
feat: 支持abcjs乐谱渲染
- 添加相关可配置选项 - 添加渲染与组件注册相关脚本 - 添加默认cdn配置
This commit is contained in:
18
layout/includes/third-party/abcjs.pug
vendored
Normal file
18
layout/includes/third-party/abcjs.pug
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
script.
|
||||
function abcjsInit() {
|
||||
function abcjsFn() {
|
||||
for (let abcContainer of document.getElementsByClassName("abc-music-sheet")) {
|
||||
ABCJS.renderAbc(abcContainer, abcContainer.innerHTML, {responsive: 'resize'});
|
||||
}
|
||||
}
|
||||
if (typeof ABCJS === 'object') {
|
||||
abcjsFn();
|
||||
} else {
|
||||
getScript('!{url_for(theme.asset.abcjs_basic_js)}')
|
||||
.then(() => {
|
||||
abcjsFn();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', abcjsInit);
|
||||
Reference in New Issue
Block a user