// Setup some varibles var profiles; var connections = []; var active_profile; // Load the profiles fs.readFile("profiles.json", "utf-8", function(err, data) { try { // Throw an error if there is one if(err) throw err; // Try to load it from the data profiles = JSON.parse(data); } catch(e) { // Set the profiles varible to its default value profiles = []; } // Reload the profiles profiles_reload(); // Connect to all the profiles for(var i=0;i"; } // Create a users menu var users_menu = ""; // Loop over the users var users_array = Object.keys(connections[id].users); for(var i=0;i"; } // Set the html data document.getElementById("chat-main").innerHTML = "\ \
\
\ \ "; } function profiles_reload() { // Get the chat menu id var chat_menu = document.getElementById("server-menu-profiles"); // Reset it chat_menu.innerHTML = ""; // Loop over the profiles for(var i=0;i"+profiles[i].username+"@"+profiles[i].hostname+port_display+""; // Add the profile to the menu chat_menu.appendChild(profile); } } } function switch_new_profile() { // Set the html document.getElementById("chat-main").innerHTML = "\

New Profile:

\

\ \ \ \ \ \
Hostname
Port
Username
Password
\ \

\ "; }