2022-11-22 14:03:23 +08:00

40 lines
1.3 KiB
Plaintext

//- https://guide.daocloud.io/daovoice/javascript-api-5869833.html
script.
(function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/!{theme.daovoice.app_id}.js","daovoice")
script.
var isChatBtn = !{theme.chat_btn}
daovoice('init', {
app_id: '!{theme.daovoice.app_id}',},{
launcher: {
disableLauncherIcon: isChatBtn // 悬浮 ICON 是否显示
},
});
daovoice('update');
if (isChatBtn) {
var chatBtnFn = () => {
var chatBtn = document.getElementById("chat_btn")
chatBtn.addEventListener("click", function(){
daovoice('show')
});
}
chatBtnFn()
} else {
if (!{theme.chat_hide_show}) {
function chatBtnHide () {
daovoice('update', {},{
launcher: {
disableLauncherIcon: true // 悬浮 ICON 是否显示
},
});
}
function chatBtnShow () {
daovoice('update', {},{
launcher: {
disableLauncherIcon: false // 悬浮 ICON 是否显示
},
});
}
}
}