mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-10-03 22:22:00 +08:00
Merge pull request #1239 from LittleNyima/patch-abcjs
feat: 支持abcjs乐谱渲染
This commit is contained in:
7 files changed
+66
-1
No files matched your search
@@ -787,6 +787,13 @@ fancybox: true
|
|||||||
# Tag Plugins settings (標籤外掛)
|
# Tag Plugins settings (標籤外掛)
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
|
|
||||||
|
# abcjs (樂譜渲染)
|
||||||
|
# See https://github.com/paulrosen/abcjs
|
||||||
|
# ---------------
|
||||||
|
abcjs:
|
||||||
|
enable: false
|
||||||
|
per_page: true
|
||||||
|
|
||||||
# mermaid
|
# mermaid
|
||||||
# see https://github.com/mermaid-js/mermaid
|
# see https://github.com/mermaid-js/mermaid
|
||||||
mermaid:
|
mermaid:
|
||||||
@@ -967,3 +974,4 @@ CDN:
|
|||||||
# artalk_js:
|
# artalk_js:
|
||||||
# artalk_css:
|
# artalk_css:
|
||||||
# busuanzi:
|
# busuanzi:
|
||||||
|
# abcjs_basic_js:
|
||||||
@@ -31,6 +31,8 @@ div
|
|||||||
|
|
||||||
include ./third-party/math/index.pug
|
include ./third-party/math/index.pug
|
||||||
|
|
||||||
|
include ./third-party/abcjs/index.pug
|
||||||
|
|
||||||
if commentsJsLoad
|
if commentsJsLoad
|
||||||
include ./third-party/comments/js.pug
|
include ./third-party/comments/js.pug
|
||||||
|
|
||||||
|
|||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
script.
|
||||||
|
(() => {
|
||||||
|
function abcjsInit() {
|
||||||
|
function abcjsFn() {
|
||||||
|
for (let abcContainer of document.getElementsByClassName("abc-music-sheet")) {
|
||||||
|
ABCJS.renderAbc(abcContainer, abcContainer.innerHTML, {responsive: 'resize'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typeof ABCJS === 'object' ? abcjsFn()
|
||||||
|
: getScript('!{url_for(theme.asset.abcjs_basic_js)}').then(abcjsFn)
|
||||||
|
}
|
||||||
|
|
||||||
|
window.pjax ? abcjsInit() : document.addEventListener('DOMContentLoaded', abcjsInit)
|
||||||
|
})()
|
||||||
Loaded 3 of 7 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user