Made buttons be greyed out when they're selected

This commit is contained in:
jsrobson10 2019-05-01 13:16:52 +10:00
parent bc797a9e12
commit 33c3d5f30a
2 changed files with 19 additions and 2 deletions

View File

@ -142,6 +142,10 @@ function title(id) {
function profile_switch_to(id) function profile_switch_to(id)
{ {
// Switch the profile classes
$("#profile_button_"+active_profile).removeClass("selected");
$("#profile_button_"+id).addClass("selected");
// Set the active profile // Set the active profile
active_profile = id; active_profile = id;
@ -152,7 +156,7 @@ function profile_switch_to(id)
for(var i=0;i<connections[id].chats.length;i++) for(var i=0;i<connections[id].chats.length;i++)
{ {
// Add to the chats menu // Add to the chats menu
chats_menu += "<li><a href='#' onclick=chat_switch_to("+i+")>" chats_menu += "<li><a href='#' onclick=chat_switch_to("+i+") id='chat_switch_"+i+"'>"
+connections[id].chats[i].name+"</a></li>"; +connections[id].chats[i].name+"</a></li>";
} }
@ -259,6 +263,10 @@ function chat_switch_to(id)
document.title = title(active_profile)+" - " document.title = title(active_profile)+" - "
+connections[active_profile].chats[id].name; +connections[active_profile].chats[id].name;
// Move the active class
$("#chat_switch_"+active_chat).removeClass("selected");
$("#chat_switch_"+id).addClass("selected");
// Set the active chat // Set the active chat
active_chat = id; active_chat = id;
@ -335,6 +343,9 @@ function chat_send()
function add_chat_menu() function add_chat_menu()
{ {
// Deselect the selected chat
$("#chat_switch_"+active_chat).removeClass("selected");
// Set the html data // Set the html data
document.getElementById("chat-area").innerHTML = "\ document.getElementById("chat-area").innerHTML = "\
<p>\ <p>\
@ -361,6 +372,8 @@ function add_chat()
function profiles_reload() function profiles_reload()
{ {
console.log("Profiles reloaded");
// Get the chat menu id // Get the chat menu id
var chat_menu = document.getElementById("server-menu-profiles"); var chat_menu = document.getElementById("server-menu-profiles");

View File

@ -90,7 +90,7 @@
padding: 8px; padding: 8px;
margin: 4px; margin: 4px;
border-radius: 6px; border-radius: 6px;
background-color: #CCD; background-color: #BBC;
} }
.chat-content-message p.message-header { .chat-content-message p.message-header {
@ -117,3 +117,7 @@
#server-menu-profiles li a.disabled { #server-menu-profiles li a.disabled {
background-color: #BBC; background-color: #BBC;
} }
.selected {
background-color: #AAB;
}