function toggleChat() {
var e = document.getElementById("chat-box");
if (e.classList.contains("open")) {
e.classList.remove("open");
e.classList.add("closed");
}
else {
e.classList.remove("closed");
e.classList.add("open");
iFr = document.getElementById("ssb_iframe");
iFrDoc = iFr.contentDocument || iFr.contentWindow.document;
iFrDoc.body.focus();
iFrDoc.getElementById("userQuery").focus();
}
}
function initializeChatWidget(config) {
let chatContainer = document.createElement("div");
chatContainer.id = "chat-container";
let chatBubble = document.createElement("div");
chatBubble.id = "chat-bubble";
chatBubble.onclick = toggleChat;
chatBubble.innerHTML = '';
let chatBox = document.createElement("div");
chatBox.id = "chat-box";
chatBox.classList.add("closed");
console.log("initializeChatWidget: botId: ", config.botId);
let chatScreen = "https://ml.api.mmhmm.app/ssb/chat.html?botId=" + config.botId;
chatBox.innerHTML = '';
chatContainer.appendChild(chatBubble);
chatContainer.appendChild(chatBox);
document.body.appendChild(chatContainer);
}
function loadCSS(config) {
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = "https://ml.api.mmhmm.app/ssb/css/chat.css?botId=" + config.botId;
document.head.appendChild(link);
}
let botId = "hcb"; // new URLSearchParams(window.location.search).get('botId');
let botLang = document.documentElement.lang;
let botName = "SSB.1.5.05"
let config = {botId: botId, lang: botLang, title: botName}
loadCSS(config);
initializeChatWidget(config);