From cfedc91453b67e79202730e7cf4197df24631379 Mon Sep 17 00:00:00 2001 From: sijanec Date: Wed, 20 May 2020 13:33:51 +0200 Subject: fixed install script --- dist/js/chats.js | 504 ------------------------------------------------------- 1 file changed, 504 deletions(-) delete mode 100644 dist/js/chats.js (limited to 'dist/js/chats.js') diff --git a/dist/js/chats.js b/dist/js/chats.js deleted file mode 100644 index daf10ab..0000000 --- a/dist/js/chats.js +++ /dev/null @@ -1,504 +0,0 @@ -// 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 $("