From d7db0952d3fe7689f4c6196ff0cb1f56a2a57371 Mon Sep 17 00:00:00 2001 From: giuliof Date: Sun, 20 Sep 2020 22:38:21 +0200 Subject: [PATCH] [F.END] Patch: forgot to push child. Reoreded childs --- frontend/frontend.js | 70 +++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/frontend/frontend.js b/frontend/frontend.js index 90f318c..2e95df2 100644 --- a/frontend/frontend.js +++ b/frontend/frontend.js @@ -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; }