diff options
| author | stonedDiscord <10584181+stonedDiscord@users.noreply.github.com> | 2020-11-09 17:05:39 +0100 |
|---|---|---|
| committer | stonedDiscord <10584181+stonedDiscord@users.noreply.github.com> | 2020-11-09 17:05:39 +0100 |
| commit | 1b55c65fab6cc30ce7a050e2dc01dc14c1c4260b (patch) | |
| tree | ff2fe0d17a41596634d6b4c7192d8ad5a2676b2a /webAO | |
| parent | f0386116c3f473dbf84e662631ccd21fea7b0f61 (diff) | |
seperate area creation from music
Diffstat (limited to 'webAO')
| -rw-r--r-- | webAO/client.js | 51 |
1 files 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: <br>" + - "Status: <br>" + - "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` + |
