if (eaeroApi == undefined) { var eaeroApi = {}; 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 = '//app.eaero.de/app.php/api/multiHours/' + template + '/' + idArr + '/' + date + '/ae01e024448df7bf732d33a11b614b21'; 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); }; 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 = '//app.eaero.de/app.php/api/hours/' + template + '/' + id + '/ae01e024448df7bf732d33a11b614b21'; } 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); }; 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 = '//app.eaero.de/app.php/api/tableOfHours/' + scriptId + '/1,2,3,4,5,6,7//ae01e024448df7bf732d33a11b614b21'; } 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); }; if (typeof eAeroApiLoaded == 'function') { eAeroApiLoaded(); } }