From 15251e3508ee3096309295ed94aa88755053a615 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 16 Feb 2022 19:41:50 -0500 Subject: [PATCH] The sidebar buttons are now unhighlighted by default. When rendering a room view, iterate through all of them, unhighlight any that are highlighted, and then highlight the correct one. --- webcit-ng/static/index.html | 16 ++++++++-------- webcit-ng/static/js/views.js | 9 +++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/webcit-ng/static/index.html b/webcit-ng/static/index.html index f87f5f7bf..3344f177b 100644 --- a/webcit-ng/static/index.html +++ b/webcit-ng/static/index.html @@ -53,16 +53,16 @@ LOADING
-
+ diff --git a/webcit-ng/static/js/views.js b/webcit-ng/static/js/views.js index cfdca07ba..7fb8b8a4b 100644 --- a/webcit-ng/static/js/views.js +++ b/webcit-ng/static/js/views.js @@ -18,8 +18,17 @@ function render_room_view(gt_msg, lt_msg) { document.getElementById("ctdl-newmsg-button").style.display = "none"; // the view renderer will set this + // Clear the highlighting out of all the sidebar buttons + var items = document.getElementById("ctdl-sidebar").getElementsByTagName("*"); + for (var i = items.length; i--;) { + if (items[i].id.includes("ctdl-sidebar-button-")) { + items[i].classList.remove("w3-blue"); + } + } + switch(current_view) { case views.VIEW_BBS: + document.getElementById("ctdl-sidebar-button-forums").classList.add("w3-blue"); document.getElementById("ctdl-main").innerHTML = "
"; forum_readmessages("ctdl-mrp", gt_msg, lt_msg); break; -- 2.39.2