mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-10-03 22:22:00 +08:00
update
This commit is contained in:
1 parent
6b44647d4e
commit
d8942c236a
20 files changed
+168
-145
No files matched your search
+5
-2
@@ -2,8 +2,11 @@ script.
|
||||
(() => {
|
||||
const abcjsInit = () => {
|
||||
const abcjsFn = () => {
|
||||
const $article = document.getElementById("article-container")
|
||||
if (!$article || $article.querySelector(".hbe-container")) return
|
||||
|
||||
setTimeout(() => {
|
||||
const sheets = document.querySelectorAll(".abc-music-sheet")
|
||||
const sheets = $article.querySelectorAll(".abc-music-sheet")
|
||||
for (let i = 0; i < sheets.length; i++) {
|
||||
const ele = sheets[i]
|
||||
if (ele.children.length > 0) continue
|
||||
@@ -29,7 +32,7 @@ script.
|
||||
}, 100)
|
||||
}
|
||||
|
||||
if (typeof ABCJS === "object") {
|
||||
if (typeof ABCJS === "object" && ABCJS !== null) {
|
||||
abcjsFn()
|
||||
} else {
|
||||
btf.getScript("!{url_for(theme.asset.abcjs_basic_js)}").then(abcjsFn)
|
||||
|
||||
+10
-12
@@ -1,14 +1,15 @@
|
||||
//- Knocket live chat — https://trtc.io/solutions/knocket
|
||||
script.
|
||||
(() => {
|
||||
const id = '#{theme.knocket.identifier}'
|
||||
if (!id) return
|
||||
const identifier = !{JSON.stringify(theme.knocket.identifier || '').replace(/</g, '\\u003c')}
|
||||
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 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) {
|
||||
const hide = () => { const w = getWidget(); if (w) w.style.display = 'none' }
|
||||
@@ -24,21 +25,18 @@ script.
|
||||
window.chatBtnFn = () => {
|
||||
const w = getWidget()
|
||||
if (!w) return
|
||||
if (w.style.display === 'none') show()
|
||||
else hide()
|
||||
w.style.display = w.style.display === 'none' ? '' : 'none'
|
||||
}
|
||||
|
||||
document.getElementById('chat-btn').style.display = 'block'
|
||||
const chatBtn = document.getElementById('chat-btn')
|
||||
if (chatBtn) chatBtn.style.display = 'block'
|
||||
} else if (isChatHideShow) {
|
||||
const observer = new MutationObserver(() => {
|
||||
if (getWidget()) observer.disconnect()
|
||||
})
|
||||
observer.observe(document.body, { childList: true, subtree: true })
|
||||
|
||||
window.chatBtn = {
|
||||
hide: () => { const w = getWidget(); if (w) w.style.display = 'none' },
|
||||
show: () => { const w = getWidget(); if (w) w.style.display = '' }
|
||||
}
|
||||
}
|
||||
}).catch(error => {
|
||||
console.warn('[Knocket] Failed to load the chat SDK.', error)
|
||||
})
|
||||
})()
|
||||
+1
-1
@@ -15,7 +15,7 @@ script.
|
||||
|
||||
const loadMathjax = () => {
|
||||
const article = document.getElementById('article-container')
|
||||
if (!article) return
|
||||
if (!article || article.querySelector('.hbe-container')) return
|
||||
changeScriptToMath(article)
|
||||
|
||||
if (!window.MathJax) {
|
||||
|
||||
Loaded 3 of 20 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user