1
Fork 0

Sort users lexicographically.

This commit is contained in:
Juliusz Chroboczek 2020-09-12 15:23:38 +02:00
parent c9b61ab532
commit 6a554831a1
1 changed files with 12 additions and 0 deletions

View File

@ -767,6 +767,18 @@ function addUser(id, name) {
user.id = 'user-' + id;
user.classList.add("user-p");
user.textContent = name ? name : '(anon)';
if(name) {
let us = div.children;
for(let i = 0; i < us.length; i++) {
let child = us[i];
let childname = users[child.id.slice('user-'.length)];
if(!childname || childname > name) {
div.insertBefore(user, child);
return;
}
}
}
div.appendChild(user);
}