Kid City USA Enterprises offers unparalleled preschool, daycare, and before & after school programs on Page Street in Las Vegas, Nevada.
(function() {
var iframe = document.createElement('iframe');
iframe.src = 'https://chatbot-for-kidscityusa-lasvegas3.glitch.me/'
iframe.style.border = 'none';
iframe.style.position = 'fixed';
iframe.style.bottom = '0';
iframe.style.right = '0';
iframe.style.width = '100%';
iframe.style.height = '100%';
iframe.style.maxWidth = '500px';
iframe.style.maxHeight = '600px';
iframe.style.zIndex = '2147483647';
document.body.appendChild(iframe);
var toggleBtn = document.createElement('button');
toggleBtn.id = 'chatbot-toggle';
toggleBtn.style.position = 'fixed';
toggleBtn.style.bottom = '10px';
toggleBtn.style.right = '480px';
toggleBtn.style.backgroundColor = 'white';
toggleBtn.style.color = 'white';
toggleBtn.style.border = 'none';
toggleBtn.style.borderRadius = '50%';
toggleBtn.style.width = '70px';
toggleBtn.style.height = '70px';
toggleBtn.style.display = 'flex';
toggleBtn.style.justifyContent = 'center';
toggleBtn.style.alignItems = 'center';
toggleBtn.style.cursor = 'pointer';
toggleBtn.style.zIndex = '2147483646';
var img = document.createElement('img');
img.src = 'https://cdn.glitch.global/b3ab09eb-1116-4be8-a7e0-1c7e203a9b89/24-242263_chat-speech-bubble-with-text-lines-comments-speech-removebg-preview.png?v=1691191893430';
img.style.width = '50px';
img.style.height = '50px';
toggleBtn.appendChild(img);
document.body.appendChild(toggleBtn);
var closeButton = document.createElement('button');
closeButton.id = 'chatbot-close';
closeButton.style.position = 'fixed';
closeButton.style.bottom = '420px';
closeButton.style.right = '35px';
closeButton.style.fontSize = '15px';
closeButton.style.width = '24px';
closeButton.style.height = '24px';
closeButton.style.backgroundColor = 'black';
closeButton.style.border = 'none';
closeButton.style.borderRadius = '50%';
closeButton.style.cursor = 'pointer';
closeButton.style.justifyContent = 'center';
closeButton.style.alignItems = 'center';
closeButton.style.zIndex = '2147483647';
closeButton.style.color = 'white';
closeButton.textContent = 'X';
closeButton.style.display = 'none';
document.body.appendChild(closeButton);
var chatbotIsOpen = localStorage.getItem('chatbotIsOpen');
if (chatbotIsOpen === null) {
chatbotIsOpen = true;
} else {
chatbotIsOpen = chatbotIsOpen === 'true';
}
function updateChatbotVisibility() {
if (chatbotIsOpen) {
iframe.style.display = 'flex';
closeButton.style.display = 'flex';
} else {
iframe.style.display = 'none';
closeButton.style.display = 'none';
}
localStorage.setItem('chatbotIsOpen', chatbotIsOpen);
}
function updateToggleBtnPosition() {
if (window.innerWidth <= 768) { // Mobile view threshold
toggleBtn.style.right = '20px';
} else {
toggleBtn.style.right = '480px';
}
}
toggleBtn.addEventListener('click', function() {
chatbotIsOpen = !chatbotIsOpen;
updateChatbotVisibility();
});
closeButton.addEventListener('click', function() {
chatbotIsOpen = false;
updateChatbotVisibility();
});
// Listen for custom events from the parent window
window.addEventListener('message', function(event) {
if (event.data && event.data.action) {
console.log('Received message:', event.data.action); // Log received messages
if (event.data.action === 'openCalendly') {
closeButton.style.display = 'none';
} else if (event.data.action === 'closeCalendly') {
closeButton.style.display = 'flex';
} else if (event.data.action === 'closeChatbot') {
chatbotIsOpen = false;
updateChatbotVisibility();
}
}
});
// Listen for window resize to update the toggle button position
window.addEventListener('resize', updateToggleBtnPosition);
// Initial check for toggle button position
updateToggleBtnPosition();
updateChatbotVisibility();
})();