fixed human readable view post counts

This commit is contained in:
Baris Usakli
2013-11-29 14:12:19 -05:00
parent bcfb4ca0e4
commit f6d57a241d
2 changed files with 10 additions and 8 deletions

View File

@@ -299,8 +299,7 @@ var socket,
app.makeNumbersHumanReadable = function(selector) {
$(selector).each(function() {
var num = parseInt($(this).html(), 10);
$(this).html(utils.makeNumberHumanReadable(num));
$(this).html(utils.makeNumberHumanReadable($(this).attr('title')));
});
}

View File

@@ -207,15 +207,18 @@
},
makeNumberHumanReadable: function(num) {
num = parseInt(num, 10);
if (num > 999999) {
return (num / 1000000).toFixed(1) + 'm';
}
else if(num > 999) {
return (num / 1000).toFixed(1) + 'k';
}
var n = parseInt(num, 10);
if(!n) {
return num;
}
if (n > 999999) {
return (n / 1000000).toFixed(1) + 'm';
}
else if(n > 999) {
return (n / 1000).toFixed(1) + 'k';
}
return n;
}
};