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

View File

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