commit
5a13f01649
@ -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)
|
||||
})()
|
@ -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
|
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Music Score
|
||||
* {% score %}
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
function score(args, content) {
|
||||
function escapeHtmlTags(s) {
|
||||
let lookup = {
|
||||
'&': "&",
|
||||
'"': """,
|
||||
'\'': "'",
|
||||
'<': "<",
|
||||
'>': ">"
|
||||
};
|
||||
return s.replace(/[&"'<>]/g, c => lookup[c]);
|
||||
}
|
||||
return `<div class="abc-music-sheet">${escapeHtmlTags(content)}</div>`;
|
||||
}
|
||||
|
||||
hexo.extend.tag.register('score', score, {ends: true});
|
Loading…
Reference in New Issue