Added clickable chat links, made the title change with the chat clicked.
This commit is contained in:
parent
2a4f48cec7
commit
b7274a9097
|
@ -102,6 +102,10 @@ function port_display(i)
|
||||||
return port_display;
|
return port_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function title(id) {
|
||||||
|
return profiles[id].username+"@"+profiles[id].hostname+port_display(id);
|
||||||
|
}
|
||||||
|
|
||||||
function profile_switch_to(id)
|
function profile_switch_to(id)
|
||||||
{
|
{
|
||||||
// Set the active profile
|
// Set the active profile
|
||||||
|
@ -111,11 +115,11 @@ function profile_switch_to(id)
|
||||||
var chats_menu = "";
|
var chats_menu = "";
|
||||||
|
|
||||||
// Loop over the chats
|
// Loop over the chats
|
||||||
var chats_array = Object.keys(connections[id].chats);
|
for(var i=0;i<connections[id].chats.length;i++)
|
||||||
for(var i=0;i<chats_array.length;i++)
|
|
||||||
{
|
{
|
||||||
// Add to the chats menu
|
// Add to the chats menu
|
||||||
chats_menu += "<li><a href='#'>"+connections[id].chats[chats_array[i]].name+"</a></li>";
|
chats_menu += "<li><a href='#' onclick=chat_switch_to("+i+")>"
|
||||||
|
+connections[id].chats[i].name+"</a></li>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a users menu
|
// Create a users menu
|
||||||
|
@ -145,7 +149,21 @@ function profile_switch_to(id)
|
||||||
";
|
";
|
||||||
|
|
||||||
// Set the title
|
// Set the title
|
||||||
document.title = profiles[id].username+"@"+profiles[id].hostname+port_display(id);
|
document.title = title(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function chat_switch_to(id)
|
||||||
|
{
|
||||||
|
// Set the HTML
|
||||||
|
document.getElementById("chat-area").innerHTML = "\
|
||||||
|
<div class='chat-content'></div>\
|
||||||
|
<textbox id='chat-content-send-textbox'></textbox>\
|
||||||
|
<button id='chat-content-send-button'>Send</button>\
|
||||||
|
";
|
||||||
|
|
||||||
|
// Set the title
|
||||||
|
document.title = title(active_profile)+" - "
|
||||||
|
+connections[active_profile].chats[id].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_chat_menu()
|
function add_chat_menu()
|
||||||
|
@ -195,7 +213,7 @@ function profiles_reload()
|
||||||
|
|
||||||
// Set the html for the list item
|
// Set the html for the list item
|
||||||
profile.innerHTML = "<a href='javascript:void(0)' onclick='profile_switch_to("+
|
profile.innerHTML = "<a href='javascript:void(0)' onclick='profile_switch_to("+
|
||||||
i+")'>"+profiles[i].username+"@"+profiles[i].hostname+port_display(i)+"</a>";
|
i+")'>"+title(i)+"</a>";
|
||||||
|
|
||||||
// Add the profile to the menu
|
// Add the profile to the menu
|
||||||
chat_menu.appendChild(profile);
|
chat_menu.appendChild(profile);
|
||||||
|
|
Loading…
Reference in New Issue