improvement

This commit is contained in:
myw
2026-07-14 14:41:41 +08:00 Unverified
parent f4a6f79142
commit 37233ab28b
18 changed files with 1718 additions and 1660 deletions
+13 -7
View File
@@ -6,10 +6,14 @@ script.
(window.Chatra.q = window.Chatra.q || []).push(arguments)
}
btf.getScript('https://call.chatra.io/chatra.js').then(() => {
const isChatBtn = !{theme.chat.rightside_button}
const isChatHideShow = !{theme.chat.button_hide_show}
const isChatBtn = !{theme.chat.rightside_button}
const isChatHideShow = !{theme.chat.button_hide_show}
if (isChatBtn) {
window.ChatraSetup = { startHidden: true }
}
btf.getScript('https://call.chatra.io/chatra.js').then(() => {
if (isChatBtn) {
const close = () => {
Chatra('minimizeWidget')
@@ -21,11 +25,13 @@ script.
Chatra('show')
}
window.ChatraSetup = { startHidden: true }
window.chatBtnFn = () => document.getElementById('chatra').classList.contains('chatra--expanded') ? close() : open()
window.chatBtnFn = () => {
const el = document.getElementById('chatra')
return el && el.classList.contains('chatra--expanded') ? close() : open()
}
document.getElementById('chat-btn').style.display = 'block'
const chatBtn = document.getElementById('chat-btn')
if (chatBtn) chatBtn.style.display = 'block'
} else if (isChatHideShow) {
window.chatBtn = {
hide: () => Chatra('hide'),
+2 -1
View File
@@ -21,7 +21,8 @@ script.
window.chatBtnFn = () => $crisp.is("chat:visible") ? close() : open()
document.getElementById('chat-btn').style.display = 'block'
const chatBtn = document.getElementById('chat-btn')
if (chatBtn) chatBtn.style.display = 'block'
} else if (isChatHideShow) {
window.chatBtn = {
hide: () => $crisp.push(["do", "chat:hide"]),
+3 -3
View File
@@ -10,7 +10,7 @@ script.
window.tidioChatApi.hide()
isShow = false
}
const open = () => {
window.tidioChatApi.open()
window.tidioChatApi.show()
@@ -32,8 +32,8 @@ script.
isShow ? close() : open()
}
document.getElementById('chat-btn').style.display = 'block'
const chatBtn = document.getElementById('chat-btn')
if (chatBtn) chatBtn.style.display = 'block'
} else if (isChatHideShow) {
window.chatBtn = {
hide: () => window.tidioChatApi && window.tidioChatApi.hide(),