summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/gsec.js31
-rw-r--r--js/messaging.js3
-rw-r--r--pages-src/messaging.bvr52
-rw-r--r--pages/messaging.html52
4 files changed, 76 insertions, 62 deletions
diff --git a/js/gsec.js b/js/gsec.js
index 5b426f0..d06b409 100644
--- a/js/gsec.js
+++ b/js/gsec.js
@@ -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 = `
diff --git a/pages-src/messaging.bvr b/pages-src/messaging.bvr
index ed52e8f..ad1d33a 100644
--- a/pages-src/messaging.bvr
+++ b/pages-src/messaging.bvr
@@ -83,48 +83,48 @@
</button>
</div>
</div>
- <div hidden="hidden" class="row" id="msg-e2ee-pass">
+ <div hidden="hidden" class="row" id="msg-e2ee-pass">
<div class="input-field col s12">
<i class="material-icons prefix">lock</i>
<input id="msg-e2ee-pass-input" type="password" autocomplete="new-password" class="">
<label for="msg-e2ee-pass-input"><x-su>passwordForE2EE</x-su></label>
</div>
- </div>
+ </div>
</div>
<div id="msg-added-image"></div>
</div>
<h4><x-su>messages</x-su></h4>
<button class="btn waves-effect waves-light" id="msg-load-btn" onclick="loadMessages(true, 0);" type="button">
- <x-su>received</x-su>
- <i class="material-icons right">system_update</i>
+ <x-su>received</x-su>
+ <i class="material-icons right">inbox</i>
</button>
<button class="btn waves-effect waves-light" id="msg-load-btn" onclick="loadMessages(true, 1);" type="button">
- <x-su>sent</x-su>
- <i class="material-icons right">system_update</i>
+ <x-su>sent</x-su>
+ <i class="material-icons right">forward</i>
</button>
<button class="btn waves-effect waves-light" id="msg-load-btn" onclick="loadMessages(true, 2);" type="button">
- <x-su>deleted</x-su>
- <i class="material-icons right">system_update</i>
+ <x-su>deleted</x-su>
+ <i class="material-icons right">delete</i>
</button>
<div id="msg-list"></div>
- <p>
- <div class="row" id="storage-bar">
- <div class="col s4">
- <x-su>messageStorageUsed</x-su>:
- </div>
- <div class="col s3" id="storage-desc">
- 0/120 <x-sl>messages</x-sl> 10%
- </div>
- <div class="progress col s5">
- <div class="determinate" id="storage-progressbar" style="width: 0%"></div>
- </div>
- </div>
- <div class="row">
- <p>
- <x-du>maxMessagesNote</x-du>
- </p>
- </div>
- </p>
+ <p>
+ <div class="row" id="storage-bar">
+ <div class="col s4">
+ <x-su>messageStorageUsed</x-su>:
+ </div>
+ <div class="col s3" id="storage-desc">
+ 0/120 <x-sl>messages</x-sl> 10%
+ </div>
+ <div class="progress col s5">
+ <div class="determinate" id="storage-progressbar" style="width: 0%"></div>
+ </div>
+ </div>
+ <div class="row">
+ <p>
+ <x-du>maxMessagesNote</x-du>
+ </p>
+ </div>
+ </p>
</div>
</body>
</html>
diff --git a/pages/messaging.html b/pages/messaging.html
index fb251ec..515770a 100644
--- a/pages/messaging.html
+++ b/pages/messaging.html
@@ -105,48 +105,48 @@
</button>
</div>
</div>
- <div hidden="hidden" class="row" id="msg-e2ee-pass">
+ <div hidden="hidden" class="row" id="msg-e2ee-pass">
<div class="input-field col s12">
<i class="material-icons prefix">lock</i>
<input id="msg-e2ee-pass-input" type="password" autocomplete="new-password" class="">
<label for="msg-e2ee-pass-input"><x-su>passwordForE2EE</x-su></label>
</div>
- </div>
+ </div>
</div>
<div id="msg-added-image"></div>
</div>
<h4><x-su>messages</x-su></h4>
<button class="btn waves-effect waves-light" id="msg-load-btn" onclick="loadMessages(true, 0);" type="button">
- <x-su>received</x-su>
- <i class="material-icons right">system_update</i>
+ <x-su>received</x-su>
+ <i class="material-icons right">inbox</i>
</button>
<button class="btn waves-effect waves-light" id="msg-load-btn" onclick="loadMessages(true, 1);" type="button">
- <x-su>sent</x-su>
- <i class="material-icons right">system_update</i>
+ <x-su>sent</x-su>
+ <i class="material-icons right">forward</i>
</button>
<button class="btn waves-effect waves-light" id="msg-load-btn" onclick="loadMessages(true, 2);" type="button">
- <x-su>deleted</x-su>
- <i class="material-icons right">system_update</i>
+ <x-su>deleted</x-su>
+ <i class="material-icons right">delete</i>
</button>
<div id="msg-list"></div>
- <p>
- <div class="row" id="storage-bar">
- <div class="col s4">
- <x-su>messageStorageUsed</x-su>:
- </div>
- <div class="col s3" id="storage-desc">
- 0/120 <x-sl>messages</x-sl> 10%
- </div>
- <div class="progress col s5">
- <div class="determinate" id="storage-progressbar" style="width: 0%"></div>
- </div>
- </div>
- <div class="row">
- <p>
- <x-du>maxMessagesNote</x-du>
- </p>
- </div>
- </p>
+ <p>
+ <div class="row" id="storage-bar">
+ <div class="col s4">
+ <x-su>messageStorageUsed</x-su>:
+ </div>
+ <div class="col s3" id="storage-desc">
+ 0/120 <x-sl>messages</x-sl> 10%
+ </div>
+ <div class="progress col s5">
+ <div class="determinate" id="storage-progressbar" style="width: 0%"></div>
+ </div>
+ </div>
+ <div class="row">
+ <p>
+ <x-du>maxMessagesNote</x-du>
+ </p>
+ </div>
+ </p>
</div>
</body>
</html>