ChatServer/pages/js/utils.js
Norbi Peti 23134e74f0 Many fixes and other things
- Fixed handling the case of no messages in conversation
- Changed sending new messages to HTML instead of JSON - So the message
format is at one place
- Fixed new messages showing the conversation ID to the user at the top
- Fixed unsent messages
- Fixed unread indicator on own message
- Fixed error hider timer
- Fixed message receiving when not logged in
2016-08-16 23:12:20 +02:00

28 lines
747 B
JavaScript

/**
* Created by Norbi on 2016-07-27.
*/
function getFormData($form) {
var unindexed_array = $form.serializeArray();
var indexed_array = {};
$.map(unindexed_array, function (n, i) {
indexed_array[n['name']] = n['value'];
});
return indexed_array;
}
var errorcleartimer = null;
function showError(message) {
if (errorcleartimer != null)
clearInterval(errorcleartimer);
var errormsg = document.getElementById("errormsg");
errormsg.innerHTML = message;
errormsg.style = "display: block";
errorcleartimer = setTimeout(function () { errormsg.style.display = "none"; }, 2000);
}
function isLoggedIn() {
return document.getElementById("usercontent") != null;
}