ChatServer/pages/js/conversations.js
NorbiPeti 1938a9f1db Added a lot of things
- Added "Add user to conversation"
-- Added a window to search for users to add
-- And made it all working
- Fixed the unread indicator
- Removed older TODOs
2016-08-18 22:35:23 +02:00

36 lines
1.3 KiB
JavaScript

function addConversation() {
var json = JSON.stringify({ "action": "add" });
$.ajax({
url: "/conversations", data: json, method: "POST", success: function (result) {
document.getElementById("conversations").innerHTML += result;
showAddUserToConv();
}, error: function (result) {
showError(result.responseText);
}
});
return false;
}
function showAddUserToConv() {
var json = JSON.stringify({ "action": "adduserdialog" });
$.ajax({
url: "/conversations", data: json, method: "POST", success: function (result) {
document.getElementById("hoverdialog").innerHTML = result;
document.getElementById("hoverdialogcont").style.display = "table";
}, error: function (result) {
showError(result.responseText);
}
});
}
function addUserToConv() {
var liste = document.getElementById("searchuserlist");
var json = JSON.stringify({ "action": "adduser", "userid": liste.options[liste.selectedIndex].value });
$.ajax({
url: "/conversations", data: json, method: "POST", success: function (result) {
document.getElementById("hoverdialogcont").style.display = "none";
}, error: function (result) {
showError(result.responseText);
}
});
}