From 1b55c65fab6cc30ce7a050e2dc01dc14c1c4260b Mon Sep 17 00:00:00 2001
From: stonedDiscord <10584181+stonedDiscord@users.noreply.github.com>
Date: Mon, 9 Nov 2020 17:05:39 +0100
Subject: seperate area creation from music
---
webAO/client.js | 51 ++++++++++++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 23 deletions(-)
diff --git a/webAO/client.js b/webAO/client.js
index d00be46..038301a 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -949,30 +949,35 @@ class Client extends EventEmitter {
document.getElementById("client_musiclist").options.add(newentry);
this.musics.push(trackname);
} else {
- const thisarea = {
- name: trackname,
- players: 0,
- status: "IDLE",
- cm: "",
- locked: "FREE"
- };
+ this.createArea(trackindex,trackname);
+ }
+ }
- this.areas.push(thisarea);
-
- // Create area button
- let newarea = document.createElement("SPAN");
- newarea.classList = "area-button area-default";
- newarea.id = "area" + trackindex;
- newarea.innerText = thisarea.name;
- newarea.title = "Players:
" +
- "Status:
" +
- "CM: ";
- newarea.onclick = function () {
- area_click(this);
- };
+ createArea(id,name) {
+ const thisarea = {
+ name: name,
+ players: 0,
+ status: "IDLE",
+ cm: "",
+ locked: "FREE"
+ };
- document.getElementById("areas").appendChild(newarea);
- }
+ this.areas.push(thisarea);
+
+ // Create area button
+ let newarea = document.createElement("SPAN");
+ newarea.classList = "area-button area-default";
+ newarea.id = "area" + id;
+ newarea.innerText = thisarea.name;
+ newarea.title = `Players: ${thisarea.players}\n` +
+ `Status: ${thisarea.status}\n` +
+ `CM: ${thisarea.cm}\n` +
+ `Area lock: ${thisarea.locked}`;
+ newarea.onclick = function () {
+ area_click(this);
+ };
+
+ document.getElementById("areas").appendChild(newarea);
}
/**
@@ -1234,7 +1239,7 @@ class Client extends EventEmitter {
}
thisarea.classList = "area-button area-" + this.areas[i].status.toLowerCase();
-
+
thisarea.innerText = `${this.areas[i].name} (${this.areas[i].players}) [${this.areas[i].status}]`;
thisarea.title = `Players: ${this.areas[i].players}\n` +
--
cgit