// Timeout dla automatycznej minimizacji po odpowiedzi z 🤖 let autoMinimizeTimeout = null; // Wyślij wiadomość po naciśnięciu Enter w polu #msg document.getElementById('msg').addEventListener('keydown', function (e) { if (e.key === 'Enter') { e.preventDefault(); send(); } }); // Start zminimalizowany i auto-rozszerzenie po 15 sekundach document.addEventListener('DOMContentLoaded', function () { const body = document.getElementById('chatbotBody'); const toggle = document.getElementById('chatbotToggle'); // Ustaw startowo na zminimalizowany body.classList.add('minimized'); toggle.textContent = '+'; toggle.setAttribute('aria-label', 'Otwórz czat'); // Zaplanuj automatyczne rozszerzenie po 15s let autoExpandTimeout = setTimeout(function () { if (body.classList.contains('minimized')) { body.classList.remove('minimized'); toggle.textContent = '−'; toggle.setAttribute('aria-label', 'Minimalizuj czat'); } }, 15000); // Obsługa kliknięcia — jeśli użytkownik otworzy ręcznie, anuluj automatyczne rozszerzenie toggle.addEventListener('click', function () { const isMin = body.classList.toggle('minimized'); this.textContent = isMin ? '+' : '−'; this.setAttribute('aria-label', isMin ? 'Otwórz czat' : 'Minimalizuj czat'); if (!isMin) { clearTimeout(autoExpandTimeout); } }); }); const mailEl = document.querySelector('#company-email'); var baseEmail = mailEl.innerText baseEmail = baseEmail.replace('oo', 'o@o'); mailEl.href=`mailto:${baseEmail}` mailEl.innerText = baseEmail const phone = document.querySelector('#company-phone'); const number = phone.innerText var newNumber = number.replace('123', '501'); newNumber = newNumber.replace('456', '953'); newNumber = newNumber.replace('789', '051'); phone.innerText = newNumber; phone.href= `tel:${newNumber}`