diff options
author | rstular <rok@stular.eu> | 2020-05-14 12:51:47 +0200 |
---|---|---|
committer | rstular <rok@stular.eu> | 2020-05-14 12:51:47 +0200 |
commit | ac80e6613180c3b492d0f2c58f71d22bb05fbaab (patch) | |
tree | 6b311ef54c53582dc9490d6043a459cac82ba0b6 /js | |
parent | Fix subject not showing (diff) | |
download | beziapp-ac80e6613180c3b492d0f2c58f71d22bb05fbaab.tar beziapp-ac80e6613180c3b492d0f2c58f71d22bb05fbaab.tar.gz beziapp-ac80e6613180c3b492d0f2c58f71d22bb05fbaab.tar.bz2 beziapp-ac80e6613180c3b492d0f2c58f71d22bb05fbaab.tar.lz beziapp-ac80e6613180c3b492d0f2c58f71d22bb05fbaab.tar.xz beziapp-ac80e6613180c3b492d0f2c58f71d22bb05fbaab.tar.zst beziapp-ac80e6613180c3b492d0f2c58f71d22bb05fbaab.zip |
Diffstat (limited to '')
-rw-r--r-- | js/gsec.js | 31 | ||||
-rw-r--r-- | js/messaging.js | 3 |
2 files changed, 24 insertions, 10 deletions
@@ -510,7 +510,7 @@ class gsec { let parser = new DOMParser(); let parsed = parser.parseFromString(response.data, "text/html"); let currentPage; - if(parsed.getElementsByClassName("pager").length == 0) { // pager is not shown, there is only page one. + if (parsed.getElementsByClassName("pager").length == 0) { // pager is not shown, there is only page one. currentPage = 1; } else { currentPage = Number(parsed.getElementsByClassName("pager")[0].getElementsByTagName("span")[0].innerHTML); @@ -531,21 +531,22 @@ class gsec { "__EVENTTARGET": "ctl00$ContentPlaceHolder1$gvwSporocila" }; this.postback(requestURi, dataToBeSent, null, true).then((response) => { - if(outputResponse == true) { + if (outputResponse == true) { response.url = requestURi; resolve(response); } + let parser = new DOMParser(); let parsed = parser.parseFromString(response.data, "text/html"); let messageElements = parsed.getElementById("ctl00_ContentPlaceHolder1_gvwSporocila").getElementsByTagName("tbody")[0].getElementsByTagName("td"); - for(const messageElement of messageElements) { + for (const messageElement of messageElements) { let msgId = messageElement.getElementsByTagName("input")[0].value; var date = messageElement.getElementsByClassName("msgSubDate")[0].innerHTML.split(" ")[0].split("."); var today = new Date(); - if(date[2] == undefined || date[2].length < 1) { + if (date[2] == undefined || date[2].length < 1) { date[2] = today.getFullYear(); } - if(date[1] == undefined || date[1].length < 1) { + if (date[1] == undefined || date[1].length < 1) { date[1] = today.getMonth()+1; date[0] = today.getDate(); } @@ -553,11 +554,16 @@ class gsec { if (tume == undefined || tume == null) { // js nism kriv za to pizdraijo; gimsis je. tume = messageElement.getElementsByClassName("msgSubDate")[0].innerHTML; } - var dateStringToParse = date[2]+"-"+date[1]+"-"+date[0]+" "+tume; + var dateStringToParse = `${date[2]}-${date[1]}-${date[0]} ${tume}`; var dateObj = new Date(Date.parse(dateStringToParse)); // "tume"! var person = messageElement.getElementsByClassName("msgDir")[0].innerHTML; var subject = messageElement.getElementsByClassName("msgSubject")[0].innerHTML; - messages.push({"date": dateObj, "sender": person, "subject": subject, "msgId": msgId}); + messages.push({ + "date": dateObj, + "sender": person, + "subject": subject, + "msgId": msgId + }); } resolve(messages); }); @@ -586,9 +592,16 @@ class gsec { let recipient = parsed.querySelectorAll("[id$=Label8]")[0].innerHTML; var date = parsed.querySelectorAll("[id$=Label7]")[0].innerHTML.split(" (").pop().split(" ")[0].split("."); var tume = parsed.querySelectorAll("[id$=Label7]")[0].innerHTML.split(" (").pop().split(")")[0].split(" ").pop(); // "tume"! - var dateObj = new Date(Date.parse(date[2]+"-"+date[1]+"-"+date[0]+" "+tume)); // "tume"! + var dateObj = new Date(Date.parse(`${date[2]}-${date[1]}-${date[0]} ${tume}`)); // "tume"! var msgId = parsed.getElementById("ctl00_ContentPlaceHolder1_hfIdSporocilo").getAttribute("value"); - message = {"subject": subject, "body": body, "sender": sender, "recipient": recipient, "date": dateObj, "msgId": msgId}; + message = { + "subject": subject, + "body": body, + "sender": sender, + "recipient": recipient, + "date": dateObj, + "msgId": msgId + }; resolve(message); }); diff --git a/js/messaging.js b/js/messaging.js index 77002d0..145711d 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -165,6 +165,7 @@ async function loadMessages(force_refresh = true, katera = 0) { } async function loadMsg(id) { + setLoading(true); // Load required data let promises_to_run = [ @@ -254,7 +255,7 @@ async function deleteMsg(id) { function displayMessage(id, data) { let regex_results = ENCRYPTED_MESSAGE_REGEX.exec(data["telo"]); if (regex_results != null) { - var datatodecrypt = regex_results[2]; // length-6 da zbrišemo zadnji </div> + var datatodecrypt = regex_results[2]; var randomencdivid = Math.floor(Math.random() * 9999).toString().padStart(4, "0"); var msgcontent = ` |