diff options
Diffstat (limited to 'assets/js/gsec.js')
-rw-r--r-- | assets/js/gsec.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/assets/js/gsec.js b/assets/js/gsec.js index 19e190f..96ea624 100644 --- a/assets/js/gsec.js +++ b/assets/js/gsec.js @@ -273,8 +273,15 @@ class gsec { } rowSpan.remove(); // magic - var subject = SUBJECT_REGEX.exec(subFields[1].innerHTML)[1].trim(); - var desc = DESC_REGEX.exec(subFields[1].innerHTML)[1]; + + var subject = SUBJECT_REGEX.exec(subFields[1].innerHTML); + if (subject == null) { + continue; + } + subject = subject[1].trim(); + + var desc = DESC_REGEX.exec(subFields[1].innerHTML); + desc = desc == null ? "" : desc[1]; gradings.push({ "date": dateObj, @@ -529,7 +536,7 @@ class gsec { "__EVENTARGUMENT": "Select$" + selectId }; - this.postback(GSE_URL+"Page_Gim/Uporabnik/Sporocila.aspx", dataToBeSent, null, true).then((response) => { + this.postback(GSE_URL + "Page_Gim/Uporabnik/Sporocila.aspx", dataToBeSent, null, true).then((response) => { let parser = new DOMParser(); let parsed = parser.parseFromString(response.data, "text/html"); let subject = parsed.getElementsByClassName("msgSubjectS")[0].innerHTML.trim(); @@ -612,9 +619,9 @@ class gsec { } var tume = messageElement.getElementsByClassName("msgSubDate")[0].innerHTML.split(" ")[1]; - if(tume == null || tume.length < 1) { + if (tume == null || tume.length === 0) { tume = messageElement.getElementsByClassName("msgSubDate")[0].innerHTML; - } + } var dateStringToParse = `${date[2]}-${date[1]}-${date[0]} ${tume}`; var dateObj = new Date(Date.parse(dateStringToParse)); // "tume"! var person = messageElement.getElementsByClassName("msgDir")[0].innerHTML; |