hexo-theme-butterfly/layout/includes/third-party/chat/crisp.pug
Jerry 507453671a 🐛 適配hexo 5.0.0 修復toc點擊不會跳轉的bugs
🐛 適配hexo 5.0.0 修復toc點擊不會跳轉的bugs
🍻 文件整理
🍻 UI微調
2020-08-01 01:50:01 +08:00

36 lines
943 B
Plaintext

script.
window.$crisp = [];
window.CRISP_WEBSITE_ID = "!{theme.crisp.website_id}";
(function () {
d = document;
s = d.createElement("script");
s.src = "https://client.crisp.chat/l.js";
s.async = 1;
d.getElementsByTagName("head")[0].appendChild(s);
})();
$crisp.push(["safe", true])
if (!{theme.chat_btn}) {
$crisp.push(["do", "chat:hide"])
$crisp.push(["on", "chat:closed", function() {
$crisp.push(["do", "chat:hide"])
}])
var chatBtnFn = () => {
var chatBtn = document.getElementById("chat_btn")
chatBtn.addEventListener("click", function(){
$crisp.push(["do", "chat:show"])
$crisp.push(["do", "chat:open"])
});
}
chatBtnFn()
} else {
if (!{theme.chat_hide_show}) {
function chatBtnHide () {
$crisp.push(["do", "chat:hide"])
}
function chatBtnShow () {
$crisp.push(["do", "chat:show"])
}
}
}