Merge branch 'dev'

This commit is contained in:
Jerry committed 2025-03-02 15:37:03 +08:00
commit b3ba4c9ac4
12 files changed
+165 -85

No files matched your search

+1 -1
View File
@@ -158,7 +158,7 @@ subtitle:
# Choose: false/1/2/3 # Choose: false/1/2/3
# false - disable the function # false - disable the function
# 1 - hitokoto.cn # 1 - hitokoto.cn
# 2 - yijuzhan.com # 2 - https://api.aa1.cn/doc/yiyan.html
# 3 - jinrishici.com # 3 - jinrishici.com
source: false source: false
# If you close the typewriter effect, the subtitle will only show the first line of sub # If you close the typewriter effect, the subtitle will only show the first line of sub
+43 -14
View File
@@ -1,17 +1,46 @@
script. script.
(() => { (function() {
const abcjsInit = () => { const abcjsInit = function() {
const abcjsFn = () => setTimeout(() => { const abcjsFn = function() {
document.querySelectorAll(".abc-music-sheet").forEach(ele => { setTimeout(function() {
if (ele.children.length > 0) return const sheets = document.querySelectorAll(".abc-music-sheet")
ABCJS.renderAbc(ele, ele.innerHTML, {responsive: 'resize'}) for (let i = 0; i < sheets.length; i++) {
}) const ele = sheets[i]
}, 100) if (ele.children.length > 0) continue
typeof ABCJS === 'object' ? abcjsFn() // Parse parameters from data-params attribute
: btf.getScript('!{url_for(theme.asset.abcjs_basic_js)}').then(abcjsFn) let params = {}
const dp = ele.getAttribute("data-params")
if (dp) {
try {
params = JSON.parse(dp)
} catch (e) {
console.error("Failed to parse data-params:", e)
}
}
// Merge parsed parameters with the responsive option
// Ensures params content appears before responsive
const options = { ...params, responsive: "resize" }
// Render the music score using ABCJS.renderAbc
ABCJS.renderAbc(ele, ele.innerHTML, options)
}
}, 100)
}
if (typeof ABCJS === "object") {
abcjsFn()
} else {
btf.getScript("!{url_for(theme.asset.abcjs_basic_js)}").then(abcjsFn)
}
} }
window.pjax ? abcjsInit() : window.addEventListener('load', abcjsInit) if (window.pjax) {
btf.addGlobalFn('encrypt', abcjsInit, 'abcjs') abcjsInit()
})() } else {
window.addEventListener("load", abcjsInit)
}
btf.addGlobalFn("encrypt", abcjsInit, "abcjs")
})()
+5 -2
View File
@@ -59,7 +59,10 @@ script.
document.addEventListener('pjax:error', e => { document.addEventListener('pjax:error', e => {
if (e.request.status === 404) { if (e.request.status === 404) {
window.location.href = e.request.responseURL const usePjax = !{theme.pjax && theme.pjax.enable}
!{theme.error_404 && theme.error_404.enable}
? (usePjax ? pjax.loadUrl('!{url_for("/404.html")}') : window.location.href = '!{url_for("/404.html")}')
: window.location.href = e.request.responseURL
} }
}) })
})() })()
Loaded 3 of 12 files, more files were not shown because too many files have changed in this diff. Show more