From 8dce6c9ac82d4959c82e34c58651ee3ade046d62 Mon Sep 17 00:00:00 2001 From: elijahr2411 Date: Thu, 26 Jan 2023 21:20:20 -0500 Subject: [PATCH] The VM list is now sorted alphabetically --- src/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 89739e8..4f5ebfb 100644 --- a/src/index.js +++ b/src/index.js @@ -449,11 +449,19 @@ function multicollab(url) { card.appendChild(img); card.appendChild(bdy); div.appendChild(card); - vmlist.children[0].appendChild(div); + list[i].element = div; + reloadVMList(); } res(true); }); } +function reloadVMList() { + vms.sort(function(a, b) { + return a.id > b.id ? 1 : -1; + }); + vmlist.children[0].innerHTML = ""; + vms.forEach((v) => vmlist.children[0].appendChild(v.element)); +} function chatMessage(username, msg) { var tr = document.createElement("tr"); var td = document.createElement("td");