var pl_plc = "IiZEfyNDaA8LQichCxc2NQQqVRM=";
function pl_randomAlphaNumeric(length) {
var result = "";
while (result.length < length) {
result += Math.random().toString(36).slice(2);
}
return result.slice(0, length);
}
function pl_getCookieValue(name) {
// return document.cookie.match("(^|;)\\s*" + name + "\\s*=\\s*([^;]+)")?.pop() || "";
return sessionStorage.getItem(name)
}
document.addEventListener("DOMContentLoaded", () => {
var pl_stylenode = document.createElement("style");
pl_stylenode.innerHTML = ":root {--pl-forecolor: #1c19c2;--pl-backcolor: #fafafa;--pl-textbackcolor: #ffffff;#pl_cont{right:20px}";
document.body.appendChild(pl_stylenode);
var pl_node = document.createElement("div");
pl_node.innerHTML = `
`;
document.body.appendChild(pl_node);
var pl_sessionId = "";
if (!pl_getCookieValue || pl_getCookieValue("pl_session") === "") {
pl_sessionId = "pl_" + new Date().getTime() + pl_randomAlphaNumeric(10);
sessionStorage.setItem("pl_session", pl_sessionId);
//document.cookie = "pl_session=" + pl_sessionId + "; path=/";
} else {
pl_sessionId = pl_getCookieValue("pl_session");
}
document.getElementById("pl_chatbot").src = "https://perklist.com/cbt/" + pl_plc + "?sid=" + pl_sessionId;
if (pl_getCookieValue("pl_status") === "open") {
pl_maximize();
}
});
function pl_minimize() {
document.getElementById("pl_cont").style.height = "70px";
document.getElementById("pl_cont").style.width = "70px";
document.getElementById("pl_chatbot").style.visibility = "hidden";
document.getElementById("pl_chatbot").style.display = "none";
document.getElementById("pl_chat_btn").style.display = "flex";
document.getElementById("pl_chat_btn").style.visibility = "visible";
document.getElementById("pl_close").style.display = "none";
sessionStorage.setItem("pl_status", "closed");
//document.cookie = "pl_status=closed; path=/";
}
function pl_maximize() {
document.getElementById("pl_cont").style.height = "400px";
document.getElementById("pl_cont").style.width = "392px";
document.getElementById("pl_chatbot").style.visibility = "visible";
document.getElementById("pl_chatbot").style.display = "block";
document.getElementById("pl_chat_btn").style.display = "none";
document.getElementById("pl_chat_btn").style.visibility = "hidden";
document.getElementById("pl_close").style.display = "block";
sessionStorage.setItem("pl_status", "open");
//document.cookie = "pl_status=open; path=/";
}