This commit is contained in:
Jerry
2023-04-03 18:51:42 +08:00
parent f4d0687750
commit 4c9395666d
6 changed files with 35 additions and 28 deletions

View File

@@ -31,6 +31,8 @@ div
include ./third-party/math/index.pug
include ./third-party/abcjs/index.pug
if commentsJsLoad
include ./third-party/comments/js.pug
@@ -60,11 +62,4 @@ div
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
script(async data-pjax src= theme.asset.busuanzi || '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js')
!=partial('includes/third-party/search/index', {}, {cache: true})
if theme.abcjs && theme.abcjs.enable
if theme.abcjs.per_page
if is_post() || is_page()
include ./third-party/abcjs.pug
else if page.abcjs
include ./third-party/abcjs.pug
!=partial('includes/third-party/search/index', {}, {cache: true})

View File

@@ -1,18 +0,0 @@
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);

View File

@@ -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)
})()

View File

@@ -0,0 +1,6 @@
if theme.abcjs.enable
if theme.abcjs.per_page
if is_post() || is_page()
include ./abcjs.pug
else if page.abcjs
include ./abcjs.pug