✨ 添加第三方chat服務 crisp

This commit is contained in:
Jerry committed 2020-07-22 13:56:54 +08:00
1 parent 5ee7976c4a
commit 1a2568d645
12 files changed
+166 -130

No files matched your search

+1 -2
View File
@@ -60,8 +60,6 @@ div
if theme.preloader
!=partial('includes/loading/loading-js', {}, {cache:theme.fragment_cache})
!=partial('includes/chat/index', {}, {cache:theme.fragment_cache})
.js-pjax
if is_home() && theme.subtitle.enable
include ./third-party/subtitle.pug
@@ -90,6 +88,7 @@ div
include ./head/aplayer.pug
!=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
!=partial('includes/chat/index', {}, {cache:theme.fragment_cache})
if theme.pjax
!=partial('includes/third-party/pjax', {}, {cache:theme.fragment_cache})
-2
View File
@@ -11,8 +11,6 @@ script.
if (d.head) d.head.appendChild(s);
})(document, window, 'Chatra');
if (!{theme.chat_btn}) {
var chatBtnFn = () => {
var chatBtn = document.getElementById("chat_btn")
+36
View File
@@ -0,0 +1,36 @@
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"])
}
}
}
Loaded 3 of 12 files, more files were not shown because too many files have changed in this diff. Show more