Improve sidebar message counter

This commit is contained in:
Mattias Erming 2014-09-12 16:27:27 -07:00
parent 0f68823298
commit cabf766fba
2 changed files with 5 additions and 3 deletions

View File

@ -327,6 +327,7 @@ $(function() {
self.addClass("active")
.find(".badge")
.removeClass("highlight")
.data("count", "")
.empty();
if (sidebar.find(".highlight").length == 0) {
@ -432,8 +433,9 @@ $(function() {
var badge = btn.find(".badge");
if (badge.length !== 0) {
var i = (parseInt(badge.html()) || 0) + 1;
badge.html(i);
var i = (badge.data("count") || 0) + 1;
badge.data("count", i);
badge.html(i > 999 ? (i / 1000).toFixed(1) + "k" : i);
if (highlight || query) {
badge.addClass("highlight");
}

View File

@ -1,7 +1,7 @@
{
"name": "shout",
"description": "A web IRC client",
"version": "0.25.2",
"version": "0.25.3",
"author": "Mattias Erming",
"preferGlobal": true,
"bin": {