Sort usernames in connection log

This commit is contained in:
calzoneman 2013-05-01 17:24:07 -05:00
parent d8894f0280
commit 5b7eed3541
1 changed files with 12 additions and 0 deletions

View File

@ -622,6 +622,18 @@ function updateSeenLogins(entries) {
if(tbl.children().length > 1) { if(tbl.children().length > 1) {
$(tbl.children()[1]).remove(); $(tbl.children()[1]).remove();
} }
entries.sort(function(a, b) {
var x = a.name.toLowerCase();
var y = b.name.toLowerCase();
// Force blanknames to the bottom
if(x == "") {
return 1;
}
if(y == "") {
return -1;
}
return x == y ? 0 : (x < y ? -1 : 1);
});
for(var i = 0; i < entries.length; i++) { for(var i = 0; i < entries.length; i++) {
var tr = $("<tr/>").appendTo(tbl); var tr = $("<tr/>").appendTo(tbl);
var bantd = $("<td/>").appendTo(tr); var bantd = $("<td/>").appendTo(tr);