fix: 【应用】- 嵌入第三方的窗口,点击 X 关闭窗口后,在点击入口无法打开小窗口,只能刷新页面。

This commit is contained in:
shaohuzhang1 2024-03-06 14:25:39 +08:00
parent de920a6a44
commit 0e3f68db7f

View File

@ -68,30 +68,13 @@ function embedChatbot() {
cursor: pointer; cursor: pointer;
` `
close_button.onclick = () => { close_button.onclick = () => {
document.body.removeChild(chat_container) chat_container.style['display']='none'
chat_button.style['display']='block'
} }
chat_container.append(close_button) chat_container.append(close_button)
document.body.append(chat_container) document.body.append(chat_container)
let is_404=false
chat_button.onclick = ($event) => { chat_button.onclick = ($event) => {
if( chat_container.style['display']=='block'){ chat_container.style['display']=chat_container.style['display']=='block'?'none':'block'
chat_container.style['display']='none'
} else {
if(auth(t.token,t.protocol, t.host)){
if(is_404){
document.body.removeChild(chat_container)
document.body.append(chat_container)
is_404=false
}
chat_container.style['display']='block'
}else{
is_404=true
}
}
} }
sty = document.createElement('style') sty = document.createElement('style')
sty.innerText = ` #chat_container { sty.innerText = ` #chat_container {