mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
footer stats will display human readable stuff
This commit is contained in:
@@ -7,13 +7,16 @@
|
|||||||
|
|
||||||
socket.emit('user.count', {});
|
socket.emit('user.count', {});
|
||||||
socket.on('user.count', function(data) {
|
socket.on('user.count', function(data) {
|
||||||
stats_users.innerHTML = data.count;
|
stats_users.innerHTML = utils.makeNumberHumanReadable(data.count);
|
||||||
|
stats_users.title = data.count;
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.emit('post.stats');
|
socket.emit('post.stats');
|
||||||
socket.on('post.stats', function(data) {
|
socket.on('post.stats', function(data) {
|
||||||
stats_topics.innerHTML = data.topics;
|
stats_topics.innerHTML = utils.makeNumberHumanReadable(data.topics);
|
||||||
stats_posts.innerHTML = data.posts;
|
stats_topics.title = data.topics;
|
||||||
|
stats_posts.innerHTML = utils.makeNumberHumanReadable(data.posts);
|
||||||
|
stats_posts.title = data.posts;
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.emit('api:user.active.get');
|
socket.emit('api:user.active.get');
|
||||||
|
|||||||
@@ -162,6 +162,15 @@
|
|||||||
isRelativeUrl: function(url) {
|
isRelativeUrl: function(url) {
|
||||||
var firstChar = url.slice(0, 1);
|
var firstChar = url.slice(0, 1);
|
||||||
return (firstChar === '.' || firstChar === '/');
|
return (firstChar === '.' || firstChar === '/');
|
||||||
|
},
|
||||||
|
|
||||||
|
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';
|
||||||
|
return num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user