diff options
-rw-r--r-- | js/messaging.js | 13 | ||||
-rw-r--r-- | pages/messaging.html | 19 |
2 files changed, 31 insertions, 1 deletions
diff --git a/js/messaging.js b/js/messaging.js index ed53880..f5d2e13 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -272,6 +272,9 @@ function displayData() { filterXSS(element["cas"]["ura"]) + ":" + filterXSS(element["cas"]["minuta"]) + '</div></div></div>'; }); + document.getElementById("storage-bar").hidden = false; + document.getElementById("storage-progressbar").style.width = Number(Number(messages.length/120)*100).toFixed(2)+"%"; + document.getElementById("storage-desc").innerHTML = messages.length+"/120 messages "+document.getElementById("storage-progressbar").style.width; } async function sendMessage(recipient_number, subject, body) { @@ -345,6 +348,14 @@ function setupEventListeners() { // here we tell the reader what to do when it's done reading... reader.onload = readerEvent => { additionalstufftoaddtomessage += '<br><img src="' + readerEvent.target.result + '" />'; // this is the content! + if(document.getElementById("msg-added-image").innerHTML.length > 1) { + document.getElementById("msg-added-image").innerHTML += '<img style=width:20mm src="' + readerEvent.target.result + '" />'; // this is the content! + } else { + document.getElementById("msg-added-image").innerHTML = "<input type=button value='Remove images' class='btn waves-effect waves-light' " + +"onclick=additionalstufftoaddtomessage='';document.getElementById('msg-added-image').innerHTML='' /><br>Note: GimB servers don't like large messages, " + +"so only very small images may be attached or your message will not be delivered.<br>Attached images:<br><img style=width:20mm " + +"src='"+readerEvent.target.result+"' />"; // ravno obratni narekovaji + } M.toast({ html: "Image added as an attachment." }); } } @@ -362,7 +373,9 @@ function setupEventListeners() { document.getElementById("msg-body").value = ""; document.getElementById("full-name").value = ""; document.getElementById("msg-subject").value = ""; + document.getElementById("msg-send").disabled = true; additionalstufftoaddtomessage = ""; + document.getElementById("msg-added-image").innerHTML = ""; }).catch(function (err) { M.toast({ html: "Unable to read directory of people. Message could not be sent." }); console.log(err); diff --git a/pages/messaging.html b/pages/messaging.html index 70f61a9..eaeb962 100644 --- a/pages/messaging.html +++ b/pages/messaging.html @@ -124,10 +124,27 @@ <i class="material-icons right">system_update</i> </button> <div id="msg-list"></div> + <p> + <div class="row" id="storage-bar"> + <div class="col s4"> + Message storage used in this folder: + </div> + <div class="col s3" id="storage-desc"> + 0/120 messages 10% + </div> + <div class="progress col s5"> + <div class="determinate" id="storage-progressbar" style="width: 0%"></div> + </div> + <p> + You can only have 120 messages per message folder, older messages will not be shown. Remember to delete read and sent + messages regulary to avoid any issues. + </p> + </div> + </p> </div> </body> -</html>
\ No newline at end of file +</html> |