From d0cb8c614fc70139d2310b54faaa1bad55d0da5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Thu, 20 Feb 2020 23:20:53 +0100 Subject: =?UTF-8?q?pod=C4=8Drtica=20ni=20minus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/messaging.js | 4 +- js/messaging.js.save | 396 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 398 insertions(+), 2 deletions(-) create mode 100644 js/messaging.js.save diff --git a/js/messaging.js b/js/messaging.js index fb764a8..4ea8502 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -228,7 +228,7 @@ async function deleteMsg(id) { M.toast({ html: "Unable to delete the message, Request failed!" }); setLoading(false); } else { - document.getElementById("msg-box-" + id).remove(); + document.getElementById("msg_box-" + id).remove(); setLoading(false); } }, @@ -243,7 +243,7 @@ async function deleteMsg(id) { } function displayMessage(id, data) { - document.getElementById("msg-body-" + id).innerHTML = filterXSS(data["telo"]); + document.getElementById("msg_body-" + id).innerHTML = filterXSS(data["telo"]); } // Function for displaying data diff --git a/js/messaging.js.save b/js/messaging.js.save new file mode 100644 index 0000000..fb764a8 --- /dev/null +++ b/js/messaging.js.save @@ -0,0 +1,396 @@ +const API_ENDPOINT = "https://gimb.tk/test.php"; +const DIRECTORY_URL = "/directory.json"; +// const API_ENDPOINT = "http://localhost:5000/test.php"; + +// "Global" object for name directory +var directory = null; + +async function checkLogin() { + localforage.getItem("logged_in").then(function (value) { + // This code runs once the value has been loaded + // from the offline store. + if (value !== true) { + window.location.replace("/index.html"); + } + }).catch(function (err) { + // This code runs if there were any errors + console.log(err); + }); +} + +// -----------HTML HELPERS----------- +function htmlEncode(value) { + // Create a in-memory element, set its inner text (which is automatically encoded) + // Then grab the encoded contents back out. The element never exists on the DOM. + return $("