[F.END] Patch: forgot to push child. Reoreded childs

This commit is contained in:
giuliof 2020-09-20 22:38:21 +02:00
parent ad715d301a
commit d7db0952d3
1 changed files with 36 additions and 34 deletions

View File

@ -26,41 +26,8 @@ function zerocalcareDisplay() {
titleElement.appendChild(document.createTextNode(decodeURI(json_obj[i]['NAME'])));
titleElement.style.fontStyle = 'italic';
titleElement.classList.add('widget-title');
var dateElement = document.createElement('div');
var dateText = document.createElement('span');
dateText.appendChild(document.createTextNode(m.format('dddd D MMMM YYYY')));
dateElement.appendChild(document.createTextNode('📅 '));
dateElement.appendChild(dateText);
var timeElement = document.createElement('div');
var timeText = document.createElement('span');
var timeString = (json_obj[i]['ALLDAY'] == true) ? 'Tutto il giorno' : ('ore ' + m.format('HH:mm'));
timeText.appendChild(document.createTextNode(timeString));
timeElement.appendChild(document.createTextNode('⏰ '));
timeElement.appendChild(timeText);
// add if location is not empty -- default location should be selected by backend
var locationElement = document.createElement('div');
var locationText = document.createElement('span');
if (typeof json_obj[i]['LOCATION'] !== undefined && json_obj[i]['LOCATION'] != '') {
locationText.appendChild(document.createTextNode(json_obj[i]['LOCATION']));
}
else {
locationText.appendChild(document.createTextNode('Officina Informatica'));
}
locationElement.appendChild(document.createTextNode('📍 '));
locationElement.appendChild(locationText);
if (json_obj[i]['DESCRIPTION'] !== undefined && json_obj[i]['DESCRIPTION'] != '') {
var descriptionElement = document.createElement('div');
var descriptionText = document.createElement('span');
descriptionText.appendChild(document.createTextNode(json_obj[i]['DESCRIPTION']));
descriptionElement.appendChild(document.createTextNode('📝 '));
descriptionElement.appendChild(descriptionText);
}
eventElement.appendChild(titleElement);
// Check if event is not confirmed
if (typeof json_obj[i]['STATUS'] === 'string') {
if (json_obj[i]['STATUS'] == 'TENTATIVE') {
@ -89,9 +56,44 @@ function zerocalcareDisplay() {
eventElement.appendChild(unconfirmedElement);
}
}
var dateElement = document.createElement('div');
var dateText = document.createElement('span');
dateText.appendChild(document.createTextNode(m.format('dddd D MMMM YYYY')));
dateElement.appendChild(document.createTextNode('📅 '));
dateElement.appendChild(dateText);
eventElement.appendChild(dateElement);
var timeElement = document.createElement('div');
var timeText = document.createElement('span');
var timeString = (json_obj[i]['ALLDAY'] == true) ? 'Tutto il giorno' : ('ore ' + m.format('HH:mm'));
timeText.appendChild(document.createTextNode(timeString));
timeElement.appendChild(document.createTextNode('⏰ '));
timeElement.appendChild(timeText);
eventElement.appendChild(timeElement);
// add if location is not empty -- default location should be selected by backend
var locationElement = document.createElement('div');
var locationText = document.createElement('span');
if (typeof json_obj[i]['LOCATION'] !== undefined && json_obj[i]['LOCATION'] != '') {
locationText.appendChild(document.createTextNode(json_obj[i]['LOCATION']));
}
else {
locationText.appendChild(document.createTextNode('Officina Informatica'));
}
locationElement.appendChild(document.createTextNode('📍 '));
locationElement.appendChild(locationText);
eventElement.appendChild(locationElement);
if (json_obj[i]['DESCRIPTION'] !== undefined && json_obj[i]['DESCRIPTION'] != '') {
var descriptionElement = document.createElement('div');
var descriptionText = document.createElement('span');
descriptionText.appendChild(document.createTextNode(json_obj[i]['DESCRIPTION']));
descriptionElement.appendChild(document.createTextNode('📝 '));
descriptionElement.appendChild(descriptionText);
eventElement.appendChild(descriptionElement);
}
zerocalcareOutput.appendChild(eventElement);
atLeastOne = true;
}