This commit is contained in:
myw committed 2026-07-16 16:53:38 +08:00
1 parent 6b44647d4e
commit d8942c236a
20 files changed
+146 -123

No files matched your search

+5 -2
View File
@@ -2,8 +2,11 @@ script.
(() => { (() => {
const abcjsInit = () => { const abcjsInit = () => {
const abcjsFn = () => { const abcjsFn = () => {
const $article = document.getElementById("article-container")
if (!$article || $article.querySelector(".hbe-container")) return
setTimeout(() => { setTimeout(() => {
const sheets = document.querySelectorAll(".abc-music-sheet") const sheets = $article.querySelectorAll(".abc-music-sheet")
for (let i = 0; i < sheets.length; i++) { for (let i = 0; i < sheets.length; i++) {
const ele = sheets[i] const ele = sheets[i]
if (ele.children.length > 0) continue if (ele.children.length > 0) continue
@@ -29,7 +32,7 @@ script.
}, 100) }, 100)
} }
if (typeof ABCJS === "object") { if (typeof ABCJS === "object" && ABCJS !== null) {
abcjsFn() abcjsFn()
} else { } else {
btf.getScript("!{url_for(theme.asset.abcjs_basic_js)}").then(abcjsFn) btf.getScript("!{url_for(theme.asset.abcjs_basic_js)}").then(abcjsFn)
+10 -12
View File
@@ -1,14 +1,15 @@
//- Knocket live chat — https://trtc.io/solutions/knocket //- Knocket live chat — https://trtc.io/solutions/knocket
script. script.
(() => { (() => {
const id = '#{theme.knocket.identifier}' const identifier = !{JSON.stringify(theme.knocket.identifier || '').replace(/</g, '\\u003c')}
if (!id) return if (!identifier) return
btf.getScript(`https://trtc.io/knocket-sdk/sdk.js?identifier=${id}`).then(() => { btf.getScript(`https://trtc.io/knocket-sdk/sdk.js?identifier=${encodeURIComponent(identifier)}`).then(() => {
const isChatBtn = !{theme.chat.rightside_button} const isChatBtn = !{theme.chat.rightside_button}
const isChatHideShow = !{theme.chat.button_hide_show} const isChatHideShow = !{theme.chat.button_hide_show}
const getWidget = () => document.getElementById('contact-widget-auto') let widget = null
const getWidget = () => widget || (widget = document.getElementById('contact-widget-auto'))
if (isChatBtn) { if (isChatBtn) {
const hide = () => { const w = getWidget(); if (w) w.style.display = 'none' } const hide = () => { const w = getWidget(); if (w) w.style.display = 'none' }
@@ -24,21 +25,18 @@ script.
window.chatBtnFn = () => { window.chatBtnFn = () => {
const w = getWidget() const w = getWidget()
if (!w) return if (!w) return
if (w.style.display === 'none') show() w.style.display = w.style.display === 'none' ? '' : 'none'
else hide()
} }
document.getElementById('chat-btn').style.display = 'block' const chatBtn = document.getElementById('chat-btn')
if (chatBtn) chatBtn.style.display = 'block'
} else if (isChatHideShow) { } else if (isChatHideShow) {
const observer = new MutationObserver(() => {
if (getWidget()) observer.disconnect()
})
observer.observe(document.body, { childList: true, subtree: true })
window.chatBtn = { window.chatBtn = {
hide: () => { const w = getWidget(); if (w) w.style.display = 'none' }, hide: () => { const w = getWidget(); if (w) w.style.display = 'none' },
show: () => { const w = getWidget(); if (w) w.style.display = '' } show: () => { const w = getWidget(); if (w) w.style.display = '' }
} }
} }
}).catch(error => {
console.warn('[Knocket] Failed to load the chat SDK.', error)
}) })
})() })()
+1 -1
View File
@@ -15,7 +15,7 @@ script.
const loadMathjax = () => { const loadMathjax = () => {
const article = document.getElementById('article-container') const article = document.getElementById('article-container')
if (!article) return if (!article || article.querySelector('.hbe-container')) return
changeScriptToMath(article) changeScriptToMath(article)
if (!window.MathJax) { if (!window.MathJax) {
Loaded 3 of 20 files, more files were not shown because too many files have changed in this diff. Show more