From 8cc2b856a47f7b1881171914147e6ddca7a8a02b Mon Sep 17 00:00:00 2001 From: sijanec Date: Wed, 20 May 2020 21:17:06 +0200 Subject: testing minification with jsmin --- dist/js/chats.js | 540 ++++--------------------------------------------------- 1 file changed, 37 insertions(+), 503 deletions(-) (limited to 'dist/js/chats.js') diff --git a/dist/js/chats.js b/dist/js/chats.js index daf10ab..7403d0c 100644 --- a/dist/js/chats.js +++ b/dist/js/chats.js @@ -1,504 +1,38 @@ -// const API_ENDPOINT = "https://gimb.tk/test.php"; -const DIRECTORY_URL = "/directory.json"; -const CHATS_BEGIN_TAG = ""; -const CHATS_END_TAG = ""; -const CHAT_REGEX = /([\S\s]+)/g; -const CHATS_SUBJECT_PREFIX = "ba-ctlmsg-chat-"; -// "Global" object for name directory -let directory = null; -let currentlyChattingWith = null; // msgid -let sogovornik = null; // name -let firstPageOfMessages = null; // so we can test if new messages ever arrive - -/** - * Redirects user to login page if it's not logged int - */ -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); - }); -} - -/** - * Find the matching key for a provided value in an object - * @param {object} object Object to search - * @param {object} value Value to find the matching key for - * @returns {object} Key - */ -function getKeyByValue(object, value) { - return Object.keys(object).find(key => object[key] === value); -} - -// -----------HTML HELPERS----------- -/** - * Encode HTML entities - * @param {string} value Value to encode - * @returns {string} Encoded value - */ -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 $("