Staff usernames are now colored in chat messages

This commit is contained in:
elijahr2411 2023-01-27 09:18:18 -05:00
parent 1a721298b7
commit c4722060b8

View file

@ -479,12 +479,28 @@ function reloadVMList() {
vmlist.children[0].innerHTML = "";
vms.forEach((v) => vmlist.children[0].appendChild(v.element));
}
function chatMessage(username, msg) {
function chatMessage(user, msg) {
var tr = document.createElement("tr");
var td = document.createElement("td");
if (username == "" || username === undefined)
if (user == "" || user === undefined)
td.innerHTML = msg;
else td.innerHTML = `<b>${username}&gt;</b> ${msg}`;
else {
var u = users.find(u => u.username === user);
var userclass = "";
switch (u.rank) {
case 2:
userclass = "text-danger";
break;
case 3:
userclass = "text-success";
break;
case 0:
default:
userclass = "text-light";
break;
}
td.innerHTML = `<b class="${userclass}">${user}&gt;</b> ${msg}`;
}
tr.appendChild(td);
chatList.appendChild(tr);
}