mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
fixed human readable view post counts
This commit is contained in:
@@ -299,8 +299,7 @@ var socket,
|
|||||||
|
|
||||||
app.makeNumbersHumanReadable = function(selector) {
|
app.makeNumbersHumanReadable = function(selector) {
|
||||||
$(selector).each(function() {
|
$(selector).each(function() {
|
||||||
var num = parseInt($(this).html(), 10);
|
$(this).html(utils.makeNumberHumanReadable($(this).attr('title')));
|
||||||
$(this).html(utils.makeNumberHumanReadable(num));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,15 +207,18 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
makeNumberHumanReadable: function(num) {
|
makeNumberHumanReadable: function(num) {
|
||||||
num = parseInt(num, 10);
|
var n = parseInt(num, 10);
|
||||||
if (num > 999999) {
|
if(!n) {
|
||||||
return (num / 1000000).toFixed(1) + 'm';
|
|
||||||
}
|
|
||||||
else if(num > 999) {
|
|
||||||
return (num / 1000).toFixed(1) + 'k';
|
|
||||||
}
|
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
if (n > 999999) {
|
||||||
|
return (n / 1000000).toFixed(1) + 'm';
|
||||||
|
}
|
||||||
|
else if(n > 999) {
|
||||||
|
return (n / 1000).toFixed(1) + 'k';
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user