From ff075e2e7e3ff12c95fbe6b2072a5296c0cdc7ce Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 5 Feb 2017 20:07:28 +1300 Subject: [PATCH] client: fix clearing ALL unread flags when clearing a single one --- client/dcwebui.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/dcwebui.js b/client/dcwebui.js index 1e723c6..d0317c3 100644 --- a/client/dcwebui.js +++ b/client/dcwebui.js @@ -450,7 +450,13 @@ var tab_set = function(tab) { var tabitems = $(".tabitem"); for (var i in tabitems) { try { - tabitems[i].className = "tabitem" + (tabitems[i].getAttribute('data-tab') === tab ? ' selected' : ''); + // Update UNREAD/SELECTED flags for the target + var was_unread = (tabitems[i].className.indexOf("unread") !== -1); + var is_target = (tabitems[i].getAttribute('data-tab') === tab); + + var is_still_unread = (was_unread && !is_target); + + tabitems[i].className = "tabitem" + (is_target ? ' selected' : '') + (is_still_unread ? ' unread' : ''); } catch (e) {}; }