diff --git a/docusaurus.config.js b/docusaurus.config.js index 0c3e419..6406547 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -283,10 +283,6 @@ var _hmt = _hmt || []; src: "/js/clarity.js", async: true, }, - { - src: "https://tcdn.casibase.org/casibase.js", - async: true, - }, { src: "/js/casibase.js", async: true, diff --git a/static/js/casibase.js b/static/js/casibase.js index e0de4ae..bd55edd 100644 --- a/static/js/casibase.js +++ b/static/js/casibase.js @@ -1,5 +1,16 @@ -/* eslint-disable no-undef */ -initCasibaseChat({ - endpoint: "https://ai.casbin.com", - themeColor: "rgb(64,59,121)", -}); +(function(w, d, s, c, i) { + const j = d.createElement(s); + j.async = false; + j.src = "https://tcdn.casibase.org/casibase.js"; + j.onload = function() { + w[c]("init", { + endpoint: "https://ai.casbin.com", + themeColor: "rgb(64,59,121)", + }); + }; + const f = d.getElementsByTagName(s)[0]; + f.parentNode.insertBefore(j, f); + w[c] = w[c] || function() { + (w[c].q = w[c].q || []).push(arguments); + }; +})(window, document, "script", "casibaseChat");