client: display unread message count in the title

This commit is contained in:
mappu 2017-02-05 22:43:21 +13:00
parent d937491545
commit aa8d89d14b

View File

@ -467,11 +467,16 @@ var tab_set = function(tab) {
}
}
if (tab == "tab-main" && pagevis_currently_visible) {
mainchat_unread_count = 0;
}
updateTitle();
write(tab).scroll();
$("#chatbox").focus();
last_tab = tab;
};
var tab_new = function(id, name) {
@ -768,7 +773,7 @@ var updateTitle = function() {
var prefix = "";
var unrTabs = $(".unread");
if (unrTabs.length === 1 && unrTabs[0].getAttribute('data-tab') == "tab-main") {
prefix = "[NEW] "
prefix = "[" + mainchat_unread_count + " NEW] "
} else if (unrTabs.length > 0) {
prefix = "[NEW PM] "
}
@ -803,6 +808,8 @@ var timestamp_formats = [ "H:i", "H:i:s", "Y-m-d H:i:s" ];
var timestamp_names = [ "Minutes", "Seconds", "Full" ];
var timestamp_format_index = 0;
var mainchat_unread_count = 0;
var timestamp_display = function() {
return "Timestamp format: " + timestamp_names[timestamp_format_index];
};
@ -1054,6 +1061,8 @@ window.onload = function() {
if (! tab_is_visible("tab-main")) {
tab_mark_unread("tab-main");
mainchat_unread_count += 1;
updateTitle();
}
});
sock.on('priv', function(data) {