Added a way to add chats, added titles
This commit is contained in:
parent
a10e14f9d1
commit
79f73d3dbc
|
@ -2,7 +2,7 @@
|
|||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Connect</title>
|
||||
<title>Chat Client</title>
|
||||
<script src="scripts/include.js"></script>
|
||||
<script src="scripts/profiles.js"></script>
|
||||
<script src="scripts/communications.js"></script>
|
||||
|
|
|
@ -272,6 +272,7 @@ function connect(profile, connection_id)
|
|||
|
||||
// Create a client
|
||||
var client = new net.Socket();
|
||||
g.client = client;
|
||||
|
||||
function rsa_task_send(data)
|
||||
{
|
||||
|
|
|
@ -87,6 +87,21 @@ function profile_connect(id)
|
|||
}
|
||||
}
|
||||
|
||||
function port_display(i)
|
||||
{
|
||||
// Should the port be displayed
|
||||
var port_display = "";
|
||||
|
||||
// Is the port not the default port
|
||||
if(profiles[i].port != PORT_DEFAULT)
|
||||
{
|
||||
// Set the port display varible
|
||||
port_display = ":"+profiles[i].port.toString();
|
||||
}
|
||||
|
||||
return port_display;
|
||||
}
|
||||
|
||||
function profile_switch_to(id)
|
||||
{
|
||||
// Set the active profile
|
||||
|
@ -117,7 +132,10 @@ function profile_switch_to(id)
|
|||
// Set the html data
|
||||
document.getElementById("chat-main").innerHTML = "\
|
||||
<div id='chats-menu' class='menu-vertical'>\
|
||||
<ul>"+chats_menu+"</ul>\
|
||||
<ul>\
|
||||
<li><a class='add-chat' href='#' onclick='add_chat_menu()'><b>Add</b></a></li>\
|
||||
"+chats_menu+"\
|
||||
</ul>\
|
||||
</div>\
|
||||
<div id='chat-area'>\
|
||||
</div>\
|
||||
|
@ -125,6 +143,35 @@ function profile_switch_to(id)
|
|||
<ul>"+users_menu+"</ul>\
|
||||
</div>\
|
||||
";
|
||||
|
||||
// Set the title
|
||||
document.title = profiles[id].username+"@"+profiles[id].hostname+port_display(id);
|
||||
}
|
||||
|
||||
function add_chat_menu()
|
||||
{
|
||||
// Set the html data
|
||||
document.getElementById("chat-area").innerHTML = "\
|
||||
<p>\
|
||||
<table>\
|
||||
<tr><td>Name</td><td><input type='text' id='add-chat-name'></td></tr>\
|
||||
</table>\
|
||||
<button onclick='add_chat()'>Add</button>\
|
||||
</p>\
|
||||
";
|
||||
}
|
||||
|
||||
function add_chat()
|
||||
{
|
||||
// Send the data to the server
|
||||
socket_write(
|
||||
connections[active_profile].client,
|
||||
connections[active_profile].encryption,
|
||||
{
|
||||
mode: "new_chat",
|
||||
name: document.getElementById('add-chat-name').value
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function profiles_reload()
|
||||
|
@ -144,19 +191,11 @@ function profiles_reload()
|
|||
// Create a list item
|
||||
var profile = document.createElement("li");
|
||||
|
||||
// Should the port be displayed
|
||||
var port_display = "";
|
||||
|
||||
// Is the port not the default port
|
||||
if(profiles[i].port != PORT_DEFAULT)
|
||||
{
|
||||
// Set the port display varible
|
||||
port_display = ":"+profiles[i].port.toString();
|
||||
}
|
||||
|
||||
// Set the html for the list item
|
||||
profile.innerHTML = "<a href='javascript:void(0)' onclick='profile_switch_to("+
|
||||
i+")'>"+profiles[i].username+"@"+profiles[i].hostname+port_display+"</a>";
|
||||
i+")'>"+profiles[i].username+"@"+profiles[i].hostname+port_display(i)+"</a>";
|
||||
|
||||
// Add the profile to the menu
|
||||
chat_menu.appendChild(profile);
|
||||
|
@ -167,6 +206,7 @@ function profiles_reload()
|
|||
function switch_new_profile()
|
||||
{
|
||||
// Set the html
|
||||
document.title = "New Profile";
|
||||
document.getElementById("chat-main").innerHTML = "\
|
||||
<p>New Profile:</p>\
|
||||
<p>\
|
||||
|
|
Loading…
Reference in New Issue