From 3b78c37a472a1ea73d287ef24f25725ac2eed53e Mon Sep 17 00:00:00 2001 From: giuliof Date: Fri, 17 Apr 2020 23:58:15 +0200 Subject: [PATCH] [F.END] Strict JS --- frontend/frontend.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/frontend.js b/frontend/frontend.js index db07e9c..0eb0e2e 100644 --- a/frontend/frontend.js +++ b/frontend/frontend.js @@ -1,10 +1,10 @@ +"use strict"; function zerocalcareDisplay() { + const zerocalcareOutput = document.getElementById('zerocalcareOutput'); - zerocalcareOutput = document.getElementById('zerocalcareOutput'); + if (this.readyState == 4 && this.status == 200) { - if (xhr.readyState == 4 && xhr.status == 200) { - - var json_obj = JSON.parse(xhr.responseText); + var json_obj = JSON.parse(this.responseText); if (json_obj.length == 0) { zerocalcareOutput.childNodes[0].textContent = 'Nessun appuntamento in programma'; @@ -116,9 +116,8 @@ function zerocalcareDisplay() { } function zerocalcareTrigger() { - xhr = new XMLHttpRequest(); + const xhr = new XMLHttpRequest(); xhr.onload = zerocalcareDisplay; xhr.open('GET', 'https://golem.linux.it/cgi/zerocalcare/main.py?interval=4weeks', true); xhr.send(null); - }