window.addEventListener('message', function(event) { // console.log("Message received from the child: " + event.data); // Message received from child // console.log("width: " + $(window).width() + "/" + breakPoint); if(event.data=='Open') { if (width >= breakPoint) $("#chatWidget").css("height", "800px"); else $("#chatWidget").css("height", "100%"); } else if(event.data=='Close') { $("#chatWidget").css("height", "120px"); } }); function getCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for(let i = 0; i = breakPoint) { // Larger Displays // console.log('setPostion Dekstop: ' + argOption); $("#chatWidget").css({'position': 'fixed', 'right': '10px', 'bottom': '15px', 'z-index': '999999', 'height': '120px', 'max-height': '80vh', 'width': '415px'}); if(argOption=='resize') $("#chatWidget").css("height", "800px"); } else { // Mobiles // console.log('setPostion Mobile: ' + argOption); $("#chatWidget").css({'position': 'fixed', 'right': 'unset', 'bottom': '0', 'z-index': '999999', 'height': '100%', 'max-height': 'unset', 'width': '100%'}); } } console.log("Host: https://widget.ahq04.konvo.chat"); let ck = getCookie("kcID"); if (ck != "") { console.log("Welcome back " + ck); } else { console.log("Saving Cookie"); var cookieText = "kcID=k17142738134995; expires=Sun, 05 May 2024 03:10:13 GMT UTC; path=/"; ck = "k17142738134995"; console.log(cookieText); document.cookie = cookieText; } var breakPoint = 440; // The overall screen width below which the widget will be displayed full screen for mobile displays var width = $(window).width(); // console.log("main width: " + width); if (width >= breakPoint) var screenArg = "D"; else var screenArg = "M"; var endPoint = 'https://widget.ahq04.konvo.chat'; var urlArgs = "/?url=" + window.location.href + "&screen=" + screenArg + "&kcID=" + ck; // + "&page=start"; var url = endPoint + urlArgs; console.log(url); $('