From b7274a90977da4a2ea9ca2ed9288b23741868992 Mon Sep 17 00:00:00 2001 From: jsrobson10 Date: Sat, 13 Apr 2019 14:29:00 +1000 Subject: [PATCH] Added clickable chat links, made the title change with the chat clicked. --- scripts/profiles.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/scripts/profiles.js b/scripts/profiles.js index b0367e8..f151392 100644 --- a/scripts/profiles.js +++ b/scripts/profiles.js @@ -102,6 +102,10 @@ function port_display(i) return port_display; } +function title(id) { + return profiles[id].username+"@"+profiles[id].hostname+port_display(id); +} + function profile_switch_to(id) { // Set the active profile @@ -111,11 +115,11 @@ function profile_switch_to(id) var chats_menu = ""; // Loop over the chats - var chats_array = Object.keys(connections[id].chats); - for(var i=0;i"; + chats_menu += "
  • " + +connections[id].chats[i].name+"
  • "; } // Create a users menu @@ -145,7 +149,21 @@ function profile_switch_to(id) "; // 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 = "\ +
    \ + \ + \ + "; + + // Set the title + document.title = title(active_profile)+" - " + +connections[active_profile].chats[id].name; } function add_chat_menu() @@ -195,7 +213,7 @@ function profiles_reload() // Set the html for the list item profile.innerHTML = ""+profiles[i].username+"@"+profiles[i].hostname+port_display(i)+""; + i+")'>"+title(i)+""; // Add the profile to the menu chat_menu.appendChild(profile);