var html = '
BürgerBadePark
Öffnungszeitentatsächliche ÖffnungszeitenJahr:2025KW:2012.05.2025-18.05.2025
Montag
Mo
12.05.2025
geschlossen
geschlossen
Dienstag
Di
13.05.2025
geschlossen
geschlossen
Mittwoch
Mi
14.05.2025
geschlossen
geschlossen
Donnerstag
Do
15.05.2025
geschlossen
geschlossen
Freitag
Fr
16.05.2025
geschlossen
geschlossen
Samstag
Sa
17.05.2025
geschlossen
geschlossen
Sonntag
So
18.05.2025
geschlossen
geschlossen
'; var me = document.getElementById('div_tableOfHours138'); if (!me) { me = document.getElementById('tableOfHours138'); } if (me) { var textnode = document.createElement('div'); textnode.id = 'div_tableOfHours138'; textnode.scriptSrc = '////app.eaero.de/api/tableOfHours/138/1,2,3,4,5,6,7//edf3182d097d714f58928808b82106b4?scriptId=tableOfHours138'; textnode.innerHTML = html; me.parentNode.replaceChild(textnode, me); } else { // typ und id suchen var scripts = document.getElementsByTagName("script"); var src = '////app.eaero.de/api/tableOfHours/138/1,2,3,4,5,6,7//edf3182d097d714f58928808b82106b4?scriptId=tableOfHours138'; console.log(src); var type = ''; var id = ''; var pos1TableOfHours = src.indexOf('/api/tableOfHours/'); var pos1CalendarOfHours = src.indexOf('/api/calendarOfHours/'); var pos1hours = src.indexOf('/api/hours/'); var offset = 0; var idInNext = false; var template = '/'; var pos1 = -1; if(pos1TableOfHours > -1) { pos1 = pos1TableOfHours; offset = 18; type = 'tableOfHours'; } else if(pos1CalendarOfHours > -1) { type = 'calendarOfHours'; template = 'document.write'; } else if(pos1hours > -1) { pos1 = pos1hours; offset = 11; idInNext = true; type = 'hours'; } if(pos1 > -1) { var pos2 = src.indexOf('/', pos1 + offset); if(!idInNext) { id = src.substring(pos1 + offset, pos2); } else { var pos2Back = pos2 + 1; template = '/' + src.substring(pos1 + offset, pos2) + '/'; pos2 = src.indexOf('/', pos2 + 1); id = src.substring(pos2Back, pos2); } console.log(type); console.log(id); console.log(template); } // /typ und id suchen var scriptNodeReplaced = false; if(type != '' && id != '') { for(i=0;i -1) { //console.log(scripts[i]); var newNode = document.createElement('div'); newNode.innerHTML = html; newNode.setAttribute('id', 'div_tableOfHours138'); newNode.setAttribute('scriptSrc', '////app.eaero.de/api/tableOfHours/138/1,2,3,4,5,6,7//edf3182d097d714f58928808b82106b4?scriptId=tableOfHours138'); scripts[i].parentNode.replaceChild(newNode, scripts[i]); scriptNodeReplaced = true; console.log('gefunden'); } } } if(!scriptNodeReplaced && template != '/') { console.log('document.write'); document.write('
' + html + '
'); } } if ('withEQCSS' == 'withEQCSS') { var bodyElement = document.getElementsByTagName('body')[0]; var bodyEQCSS = bodyElement.getAttribute('eqcss'); if (bodyEQCSS == null) { //console.log('body eqcss: ' + bodyElement.getAttribute('eqcss')); bodyElement.setAttribute('eqcss', 'eqcss'); //!!console.log(typeof(EQCSS)); if (typeof(EQCSS) === 'undefined') { //!!console.log('EQCSS laden'); eaApiLoadScript('//app.eaero.de/app.php/js/EQCSS.min.js', function () { if (typeof(EQCSS) !== 'undefined') { //console.log('EQCSS apply'); EQCSS.apply(); } }); } else { if (typeof(EQCSS) !== 'undefined') { //console.log('EQCSS apply'); EQCSS.apply(); } } } else { if (typeof(EQCSS) !== 'undefined') { //console.log('EQCSS apply'); EQCSS.apply(); } } } if('withEQCSS' == 'withEQCSS' && '' != 'withoutMouseUpListener') { if(window.eAeroMouseupInstalled === undefined) { window.eAeroMouseupInstalled = true; document.addEventListener("mouseup", function(e) { console.log('mouseup'); setTimeout(function() { console.log('EQCSS apply'); EQCSS.apply(); }, 1); }); } } if ('not-withCalendarControl' == 'withCalendarControl') { /* var bodyElement = document.getElementsByTagName('body')[0]; var bodyJQUERY = bodyElement.getAttribute('jquery'); var bodyJQUERYUI = bodyElement.getAttribute('jqueryui'); */ var isPreloadJs = typeof createjs !== 'undefined'; function doWithCalendar() { return; var bodyElement = document.getElementsByTagName('body')[0]; var preloadjs = bodyElement.getAttribute('preloadjs'); if (preloadjs) { console.log('#div_tableOfHours138 #datepicker'); $('#div_tableOfHours138 #datepicker').datepicker({ language: 'de', xmultidate: true }).next().on('click', function () { }); } } if (!isPreloadJs && false) { eaApiLoadScript('//app.eaero.de/app.php/js/vendor/preloadjs-0.6.1.min.js', function () { console.log('loaded preloadjs tableOfHours138'); if(typeof eaQueue == 'undefined') { console.log('new eqQueue'); eaQueue = []; } eaQueue['tableOfHours138'] = new createjs.LoadQueue(); // Callback, wenn Queue abgearbeitet eaQueue['tableOfHours138'].on("complete", function () { var bodyElement = document.getElementsByTagName('body')[0]; bodyElement.setAttribute('preloadjs', 'preloadjs'); console.log('complete tableOfHours138'); //console.log($.fn.datepicker.dates['de']); doWithCalendar(); }, this); var manifest = []; var mi = 0; if (!window.jQuery) { // nur, wenn kein jQuery da //eaQueue['tableOfHours138'].loadFile('//app.eaero.de/app.php/js/vendor/jquery-1.11.3.min.js'); manifest[mi++] = '//app.eaero.de/app.php/js/vendor/jquery-1.11.3.min.js'; } //eaQueue['tableOfHours138'].loadFile('//app.eaero.de/app.php/assets/js/date-time/bootstrap-datepicker.min.js'); manifest[mi++] = '//app.eaero.de/app.php/assets/js/date-time/bootstrap-datepicker.min.js'; //if(!window.jQuery || typeof ($.fn.datepicker.dates['de']) == 'undefined') { // nur, wenn kein jquery oder locale da //eaQueue['tableOfHours138'].loadFile('//app.eaero.de/app.php/assets/js/date-time/locales/bootstrap-datepicker.de.js'); manifest[mi++] = '//app.eaero.de/app.php/assets/js/date-time/locales/bootstrap-datepicker.de.js'; //} //eaQueue['tableOfHours138'].loadFile('//app.eaero.de/app.php/assets/css/bootstrap.min.css'); manifest[mi++] = '//app.eaero.de/app.php/assets/css/bootstrap.min.css'; //eaQueue['tableOfHours138'].loadFile('//app.eaero.de/app.php/assets/css/bootstrap-datepicker.css'); manifest[mi++] = '//app.eaero.de/app.php/assets/css/bootstrap-datepicker.css'; //eaQueue['tableOfHours138'].loadFile('//app.eaero.de/app.php/assets/css/datepicker.css'); manifest[mi++] = '//app.eaero.de/app.php/assets/css/datepicker.css'; //eaQueue['tableOfHours138'].loadFile('//app.eaero.de/app.php/assets/css/custom.css'); manifest[mi++] = '//app.eaero.de/app.php/assets/css/custom.css'; //queue.loadFile('//app.eaero.de/app.php/assets/css/ace.min.css'); eaQueue['tableOfHours138'].loadManifest(manifest, true); console.log('load tableOfHours138'); //eaQueue['tableOfHours138'].load(); setTimeout(function() { //console.log('load tableOfHours138'); //eaQueue['tableOfHours138'].load(); }, 1000); }); /* if(bodyJQUERY == null) { bodyElement.setAttribute('jquery', 'jquery'); eaApiLoadScript('//app.eaero.de/app.php/js/vendor/jquery-1.11.3.min.js', function() { bodyJQUERY = true; bodyElement.setAttribute('jqueryui', 'jqueryui'); //eaApiLoadScript('//app.eaero.de/app.php/assets/js/jquery-ui-1.10.3.full.min.js', function() { eaApiLoadScript('//app.eaero.de/app.php/assets/js/date-time/bootstrap-datepicker.min.js', function() { bodyJQUERYUI = true; doWithCalendar(); }); }); } else { doWithCalendar(); } */ } else { doWithCalendar(); } } function eaApiLoadScript(url, callback) { // script-Tag anlegen var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; // Callback-Funktion binden //script.onreadystatechange = callback; // Probleme mit IE < 11, daher auskommentiert script.onload = callback; // Script-Tag im Header anlegen, damit Ladevorgang beginnt head.appendChild(script); } if (eaeroApi == undefined) { var eaeroApi = {}; // Lädt und aktualisiert Öffnungszeiten für mehrere IDs über ein API-Script. eaeroApi.updateMultipleHours = function (idArr, template, date, clear, withDayAfterTomorrow, withFootnotes, withLegend) { // todo: prüfen, ob dies ev. auch im head-Element funktioniert var bodyElement = document.getElementsByTagName('body')[0]; if(!bodyElement && bodyElement == undefined) { console.log('Fehler in der Implementierung der eaero-API. Kein Body-Element gefunden. Script wird eventuell zu früh geladen.'); return } if (!withDayAfterTomorrow || withDayAfterTomorrow == undefined) { withDayAfterTomorrow = 0; } if (!withFootnotes || withFootnotes == undefined) { withFootnotes = 0; } if (!withLegend || withLegend == undefined) { withLegend = 0; } var src = '{url}/api/multiHours/' + template + '/' + idArr + '/' + date + '/{secret}'; var params = ''; if(withDayAfterTomorrow != 0) { if(params == '') params += '?'; else params += '&'; params += 'withDayAfterTomorrow=1'; } if(withFootnotes != 0) { if(params == '') params += '?'; else params += '&'; params += 'withFootnotes=1'; } if(withLegend != 0) { if(params == '') params += '?'; else params += '&'; params += 'withLegend=1'; } src += params; var s = document.createElement("script"); s.type = "text/javascript"; s.src = src; if (clear) { for (var i = 0; i < idArr.length; i++) { var divId = 'div_hours' + idArr[i]; var div = document.getElementById(divId); if (div && div != undefined) { div.innerHTML = ''; } } } bodyElement.appendChild(s); }; // Lädt und aktualisiert Öffnungszeiten für eine einzelne ID über ein API-Script. eaeroApi.updateHours = function (scriptId, id, template, date, clear, withDayAfterTomorrow, withFootnotes, withLegend) { var divElement = document.getElementById('div_' + scriptId); if (!divElement || divElement == undefined) { return; } if (!withDayAfterTomorrow || withDayAfterTomorrow == undefined) { withDayAfterTomorrow = 0; } if (!withFootnotes || withFootnotes == undefined) { withFootnotes = 0; } if (!withLegend || withLegend == undefined) { withLegend = 0; } var scriptSrc = ''; if (divElement.scriptSrc != undefined) { scriptSrc = divElement.scriptSrc; } else { scriptSrc = '{url}/api/hours/' + template + '/' + id + '/{secret}'; } var scriptSrcArr = scriptSrc.split('/'); for (i = 0; i < scriptSrcArr.length; i++) { if (scriptSrcArr[i] == 'hours') { scriptSrcArr[i + 3] = date; } } src = scriptSrcArr.join('/'); var params = ''; if(withDayAfterTomorrow != 0) { if(params != '') params += '?'; else params += '&'; params += 'withDayAfterTomorrow=1'; } if(withFootnotes != 0) { if(params != '') params += '?'; else params += '&'; params += 'withFootnotes=1'; } if(withLegend != 0) { if(params != '') params += '?'; else params += '&'; params += 'withLegend=1'; } src += params; var s = document.createElement("script"); s.type = "text/javascript"; s.src = src; s.id = 'div_' + scriptId; if (clear) { divElement.innerHTML = ''; } divElement.appendChild(s); }; // Lädt und aktualisiert eine Tabelle mit Öffnungszeiten. eaeroApi.updateTableOfHours = function(scriptId, date, clear) { var divElement = document.getElementById('div_' + scriptId); var prevButton = document.getElementById('toh_prev_button_' + scriptId); var nextButton = document.getElementById('toh_next_button_' + scriptId); var loadIndicator = document.getElementById('toh_load_indicator_' + scriptId); if (!divElement || divElement == undefined) { return; } if(prevButton) { prevButton.setAttribute('disabled', 'disabled'); } if(nextButton) { nextButton.setAttribute('disabled', 'disabled'); } if(loadIndicator) { loadIndicator.setAttribute('style', ''); } var scriptSrc = ''; if (divElement.scriptSrc != undefined) { scriptSrc = divElement.scriptSrc; } else if(divElement.getAttribute('scriptSrc') != undefined) { scriptSrc = divElement.getAttribute('scriptSrc'); } else { scriptSrc = '{url}/api/tableOfHours/' + scriptId + '/1,2,3,4,5,6,7//{secret}'; } var scriptSrcArr = scriptSrc.split('/'); for (i = 0; i < scriptSrcArr.length; i++) { if (scriptSrcArr[i] == 'tableOfHours') { scriptSrcArr[i + 3] = date; } } src = scriptSrcArr.join('/'); var s = document.createElement("script"); s.type = "text/javascript"; s.src = src; s.id = 'div_' + scriptId; if (clear) { divElement.innerHTML = ''; } divElement.appendChild(s); }; // Schließt den Chatbot. eaeroApi.closeChatBot = function(scriptId) { eaeroApi.closeOrStartChatBot(scriptId, true); }; // Startet den Chatbot. eaeroApi.startChatBot = function(scriptId) { eaeroApi.closeOrStartChatBot(scriptId, false); }; // Öffnet oder schließt den Chatbot basierend auf dem Status. eaeroApi.closeOrStartChatBot = function(scriptId, close) { var divElement = document.getElementById('div_' + scriptId); if (!divElement || divElement == undefined) { return; } var sendButton = document.getElementById('ea-send-message-' + scriptId); var closeButton = document.getElementById('ea-close-bot-' + scriptId); if(sendButton) { sendButton.setAttribute('disabled', 'true'); } if(closeButton) { closeButton.setAttribute('disabled', 'true'); } if(!close) { sessionStorage.removeItem('eaero-hdTicketToken'); } console.log('updateChatBot-close'); eaeroApi.updateChatBot('chatbot{chatBotId}', sessionStorage.getItem('eaero-hdTicketToken'), null, close); if(!close) { eaeroApi.updateChatBot('chatbot{chatBotId}', sessionStorage.getItem('eaero-hdTicketToken'), null); } } // Minimiert oder öffnet den Chatbot und aktualisiert bei Bedarf. eaeroApi.toggleChat = function(withUpdate) { if(withUpdate === undefined) { withUpdate = true; } console.log('toggleChat'); var container = document.getElementById('ea-chat-bot-container'); var overlay = document.getElementById('ea-modal-overlay'); container.classList.toggle('minimized'); container.classList.remove('maximized'); container.classList.remove('snapped'); if (container.classList.contains('maximized')) { overlay.style.display = 'block'; } else { overlay.style.display = 'none'; } sessionStorage.setItem('eaero-mini', container.classList.contains('minimized')); sessionStorage.setItem('eaero-maxi', false); sessionStorage.setItem('eaero-snap', false); var panel = document.getElementById('ea-chat'); if(panel !== null) panel.scrollTop = panel.scrollHeight; if(!container.classList.contains('maximized')) { eaeroApi.snapInChat(withUpdate); } if(!container.classList.contains('minimized')) { console.log('updateChatBot-toggleChat'); if(withUpdate) eaeroApi.updateChatBot('chatbot{chatBotId}', sessionStorage.getItem('eaero-hdTicketToken'), null); } document.getElementById("ea-message").focus(); }; // Maximiert oder verkleinert den Chatbot-Fensterbereich. eaeroApi.toggleMaximizeChat = function(chatBotId) { //console.log('toggleMaximizeChat', chatBotId); var container = document.getElementById('ea-chat-bot-container'); var overlay = document.getElementById('ea-modal-overlay'); container.classList.toggle('maximized'); container.classList.remove('minimized'); container.classList.remove('snapped'); if (container.classList.contains('maximized')) { overlay.style.display = 'block'; } else { overlay.style.display = 'none'; } sessionStorage.setItem('eaero-mini', false); sessionStorage.setItem('eaero-maxi', container.classList.contains('maximized')); sessionStorage.setItem('eaero-snap', false); if(container.classList.contains('maximized')) { // prüfen, ob im snap-in-container, dann ans wieder zurück zum Script const chatDivElement = document.getElementById('div_chatbot' + chatBotId); const chatbotElement = document.querySelector('.ea-chatbot'); if (chatDivElement && chatbotElement) { // Den Chatbot in das snap-in-Element verschieben //console.log('appendChild from .ea-chatbot to div_chatbot8'); chatDivElement.appendChild(chatbotElement); } } var panel = document.getElementById('ea-chat'); if(panel !== null) panel.scrollTop = panel.scrollHeight; if(!container.classList.contains('maximized')) { eaeroApi.snapInChat(); } document.getElementById("ea-message").focus(); }; // Verschiebt den Chatbot in die Snap-In-Ansicht, wenn er nicht maximiert ist. eaeroApi.snapInChatIfNotMaximized = function() { //console.log('snapInChatIfNotMaximized'); if(sessionStorage.getItem('eaero-maxi') != 'true') { eaeroApi.snapInChat(); } }; // Verschiebt den Chatbot in die Snap-In-Ansicht. eaeroApi.snapInChat = function(withUpdate) { if(withUpdate === undefined) { withUpdate = true; } console.log('snapInChat'); const snapInElement = document.getElementById('ea-chat-bot-snap-in-container'); const chatbotElement = document.querySelector('.ea-chatbot'); if (snapInElement && chatbotElement) { // Den Chatbot in das snap-in-Element verschieben //console.log('appendChild from .ea-chatbot to ea-chat-bot-snap-in-container'); snapInElement.innerHTML = ''; // Inhalt leeren snapInElement.appendChild(chatbotElement); var container = document.getElementById('ea-chat-bot-container'); var overlay = document.getElementById('ea-modal-overlay'); container.classList.remove('maximized'); container.classList.remove('minimized'); container.classList.add('snapped'); overlay.style.display = 'none'; sessionStorage.setItem('eaero-mini', false); sessionStorage.setItem('eaero-maxi', false); sessionStorage.setItem('eaero-snap', true); console.log('updateChatBot-snapInChat'); if(withUpdate) eaeroApi.updateChatBot('chatbot{chatBotId}', sessionStorage.getItem('eaero-hdTicketToken'), null); } }; eaeroApi.isUpdatingChat = false; // Aktualisiert den Chatverlauf durch einen API-Request. eaeroApi.updateChatBot = function(scriptId, hdTicketToken, message, close) { console.log('updateChatBot'); if(eaeroApi.isUpdatingChat) { return; } if(close === undefined) { close = false; } //console.log('message', message); //console.log('scriptId', scriptId); var divElement = document.getElementById('div_' + scriptId); if (!divElement || divElement == undefined) { return; } if(!close) { eaeroApi.isUpdatingChat = true; } var sendButton = document.getElementById('ea-send-message-' + scriptId); var closeButton = document.getElementById('ea-close-bot-' + scriptId); var messageBox = document.getElementById('ea-message'); //console.log('...'); if(sendButton) { sendButton.setAttribute('disabled', 'true'); } if(closeButton) { closeButton.setAttribute('disabled', 'true'); } if(messageBox) { messageBox.setAttribute('disabled', 'true'); } src = '//{host_and_base}/api/chatbot/do/chat/{chatBotId}/{secret}'; src = src.replace(/\/app\.php\//g, '/'); //console.log('src', src); document.getElementById('ea-message').value = ''; const chatDiv = document.getElementById('ea-chat'); if(message) { const messageDiv = document.createElement("div"); messageDiv.classList.add("ea-chat-item"); messageDiv.classList.add("ea-chat-role-user"); messageDiv.textContent = message; chatDiv.appendChild(messageDiv); } eaeroApi.typing(); fetch(src, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ scriptId: scriptId, hdTicketToken: hdTicketToken, message: message, close: close }) }) .then(response => response.json()) .then(data => { //console.log("Antwort vom Server:", data); eaeroApi.isUpdatingChat = false; handleChatData(data); if(close && data.history.length === 0) { // todo: wenn snappedIn, dann Chat mit neuem Request neu starten var container = document.getElementById('ea-chat-bot-container'); if(container.classList.contains('snapped')) { console.log('CHAT NEU STARTEN'); eaeroApi.updateChatBot('chatbot{chatBotId}', sessionStorage.getItem('eaero-hdTicketToken'), null); return } eaeroApi.toggleChat(false); } if(sendButton) { sendButton.removeAttribute('disabled'); } if(closeButton) { closeButton.removeAttribute('disabled'); } if(messageBox) { messageBox.removeAttribute('disabled'); messageBox.focus(); } }) .catch(error => { eaeroApi.isUpdatingChat = false; console.error("Fehler:", error) }); }; // Sendet ein Formular aus dem Chatbot per API an den Server. eaeroApi.postChatBotForm = function(scriptId, hdTicketToken, formData) { console.log('postChatBotForm'); if(close === undefined) { close = false; } //console.log('message', message); //console.log('scriptId', scriptId); var divElement = document.getElementById('div_' + scriptId); if (!divElement || divElement == undefined) { return; } var sendButton = document.getElementById('ea-send-message-' + scriptId); var closeButton = document.getElementById('ea-close-bot-' + scriptId); var messageBox = document.getElementById('ea-message'); //console.log('...'); if(sendButton) { sendButton.setAttribute('disabled', 'true'); } if(closeButton) { closeButton.setAttribute('disabled', 'true'); } if(messageBox) { messageBox.setAttribute('disabled', 'true'); } //return; var src = '//{host_and_base}/api/chatbot/do/postForm/{chatBotId}/{secret}'; src = src.replace(/\/app\.php\//g, '/'); document.getElementById('ea-message').value = ''; document.querySelectorAll('.ea-chat-form button, .ea-chat-form input').forEach(function(element) { element.disabled = true; }); document.querySelectorAll('.ea-chat-form-before button, .ea-chat-form-before input').forEach(function(element) { element.disabled = true; }); eaeroApi.typing(); fetch(src, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ scriptId: scriptId, hdTicketToken: hdTicketToken, formData: formData, close: close }) }) .then(response => response.json()) .then(data => { //console.log("Antwort vom Server:", data); handleChatData(data); if(sendButton) { sendButton.removeAttribute('disabled'); } if(closeButton) { closeButton.removeAttribute('disabled'); } if(messageBox) { messageBox.removeAttribute('disabled'); messageBox.focus(); } }) .catch(error => console.error("Fehler:", error)); }; // Zeigt eine Tipp-Animation im Chatbot an. eaeroApi.typing = function() { const chatDiv = document.getElementById('ea-chat'); const typingDiv = document.createElement('div'); typingDiv.className = 'ea-chat-typing-indicator'; typingDiv.innerHTML = ` `; document.querySelectorAll('.ea-chat-typing-indicator').forEach(el => el.remove()); chatDiv.appendChild(typingDiv); chatDiv.scrollTop = chatDiv.scrollHeight; }; if (typeof eAeroApiLoaded == 'function') { eAeroApiLoaded(); } eaeroApi.chatbotCheckForUpdateTimeStamp = null; function handleChatData(data) { console.log('handleChatData', data); sessionStorage.setItem('eaero-hdTicketToken', data['hdTicketToken']); // Element in den Container einfügen const chatContainer = document.getElementById("ea-chat"); // Ziel-Container im HTML const chatBotContainer = document.getElementById("ea-chat-bot-container"); // Ziel-Container im HTML if(!data['isArchived']) { chatBotContainer.classList.remove('ea-chat-not-in-conversation'); } else if(data['isArchived']) { chatBotContainer.classList.add('ea-chat-not-in-conversation'); } if(data['isInConversation'] !== null && data['isArchived'] !== null && !data['isInConversation'] && !data['isArchived']) { eaeroApi.chatbotCheckForUpdateTimeStamp = data['timestamp']; } else { eaeroApi.chatbotCheckForUpdateTimeStamp = null; } chatContainer.innerHTML = ''; data.history.forEach(chatItem => { const chatDiv = document.createElement("div"); const innerDiv = document.createElement("div"); // Klasse je nach "in"-Wert setzen chatDiv.classList.add("ea-chat-item", chatItem.in ? "ea-chat-role-user" : "ea-chat-role-assistant"); innerDiv.classList.add("ea-chat-time"); innerDiv.setAttribute("date", chatItem.timestamp.date); // Textinhalt setzen chatDiv.textContent = chatItem.text; chatDiv.appendChild(innerDiv); chatContainer.appendChild(chatDiv); if(!chatItem.in) { const faceDiv = document.createElement("div"); const faceImg = document.createElement("img"); faceDiv.classList.add("ea-chat-face", chatItem.in ? "ea-chat-face-role-user" : "ea-chat-face-role-assistant"); faceImg.setAttribute("src", "//app.eaero.de/eaero-chat-bot/images/face.png"); faceDiv.appendChild(faceImg); chatContainer.appendChild(faceDiv); } }); renderChatBot(); initChatForm(); chatBotFormatRelativeTime(); var panel = document.getElementById('ea-chat'); if(panel !== null) panel.scrollTop = panel.scrollHeight; document.getElementById("ea-message").focus(); } function chatBotFormatRelativeTime() { //console.log('chatBotFormatRelativeTime'); const elements = document.querySelectorAll('.ea-chat-time'); elements.forEach(el => { const timeAttr = el.getAttribute('date'); if (!timeAttr) return; const dateStr = timeAttr.replace(" ", "T"); // "2025-03-21T14:20:08.000000" const eventDate = new Date(dateStr); const now = new Date(); // Zeitdifferenz in Millisekunden const diffMs = now - eventDate; const diffSeconds = Math.floor(diffMs / 1000); const diffMinutes = Math.floor(diffMs / 1000 / 60); // Format-Helfer const pad = (num) => String(num).padStart(2, "0"); // Datumsteile const eventDay = eventDate.getDate(); const eventMonth = eventDate.getMonth(); const eventYear = eventDate.getFullYear(); const nowDay = now.getDate(); const nowMonth = now.getMonth(); const nowYear = now.getFullYear(); let text = ""; if (diffSeconds < 10) { text = "gerade eben"; } else if (diffSeconds < 60) { text = `vor ${diffSeconds} Sekunde${diffSeconds === 1 ? "" : "n"}`; } else if (diffMinutes < 30) { text = `vor ${diffMinutes} Minute${diffMinutes === 1 ? "" : "n"}`; } else if ( eventYear === nowYear && eventMonth === nowMonth && eventDay === nowDay ) { // gleiches Datum wie heute text = `um ${pad(eventDate.getHours())}:${pad(eventDate.getMinutes())}`; } else { text = `${pad(eventDate.getDate())}.${pad(eventDate.getMonth() + 1)}.${eventDate.getFullYear()} ${pad(eventDate.getHours())}:${pad(eventDate.getMinutes())}`; } el.textContent = text; }); } function chatBotCheckForUpdates() { return; // derzeit deaktiviert. Es gbit ein Problem mit dieser Aktualisierung und der Interaktion mit dem Schließen-Button des Chat-Bots if(eaeroApi.chatbotCheckForUpdateTimeStamp === null) { return; } console.log('chatBotCheckForUpdates', eaeroApi.chatbotCheckForUpdateTimeStamp, eaeroApi.chatBotScriptId); eaeroApi.updateChatBot(eaeroApi.chatBotScriptId, sessionStorage.getItem('eaero-hdTicketToken'), null); } setInterval(chatBotFormatRelativeTime, 1 * 1000); setInterval(chatBotCheckForUpdates, 10 * 1000); }