From 9f0b255f32dfa81bffe75f89335a78a659b4ce6a Mon Sep 17 00:00:00 2001 From: TrueKuehli Date: Tue, 27 Nov 2018 12:16:33 +0100 Subject: Reworked the code, but currently unable to test, so bugs are bound to be in there Will test it sometime later. There also might still be stuff, that has yet to be reworked. --- .../NodeJSServer/src/modules/ui/server-listing.js | 67 ---------------------- 1 file changed, 67 deletions(-) delete mode 100644 WebInterface/NodeJSServer/src/modules/ui/server-listing.js (limited to 'WebInterface/NodeJSServer/src/modules/ui/server-listing.js') diff --git a/WebInterface/NodeJSServer/src/modules/ui/server-listing.js b/WebInterface/NodeJSServer/src/modules/ui/server-listing.js deleted file mode 100644 index 78ca323..0000000 --- a/WebInterface/NodeJSServer/src/modules/ui/server-listing.js +++ /dev/null @@ -1,67 +0,0 @@ -import LoginModal from './login-modal.js'; - -/** - * Class for handling the server list - */ -export default class ServerListing { - /** - * Creates reference to container - * @param {string} serverListId ID of the server list div - * @param {BannerController} notifications Notification Manager - */ - constructor(serverListId, notifications) { - this.serverListing = document.getElementById(serverListId); - this.notifications = notifications; - } - - /** - * Removes all elements currently in the server listing - */ - flushElements() { - this.serverListing.innerHTML = ''; - } - - /** - * Populates servers from a given array of games - * @param {array} array Array of available games - * @param {ServerClient} serverClient Server Client to handle login - * @param {array} ui UI Elements to reload after login - */ - addElements(array, serverClient, ui) { - for (let server of array) { - const name = server['name']; - const playerAmount = server['userCount']; - - let serverDiv = document.createElement('div'); - let nameSpan = document.createElement('span'); - let rightAlignDiv = document.createElement('div'); - let onlineDot = document.createElement('div'); - let playerCountSpan = document.createElement('span'); - let playerCountStaticSpan = document.createElement('span'); - let joinButton = document.createElement('button'); - serverDiv.className = 'server'; - nameSpan.className = 'server-name'; - rightAlignDiv.className = 'right-aligned-items'; - onlineDot.className = 'player-count-dot'; - playerCountSpan.className = 'player-count'; - playerCountStaticSpan.className = 'player-count-static'; - joinButton.className = 'btn join-btn'; - joinButton.id = 'join'; - nameSpan.textContent = name; - playerCountSpan.textContent = playerAmount; - playerCountStaticSpan.textContent = 'Spieler online'; - joinButton.textContent = 'Beitreten'; - joinButton.addEventListener('click', () => { - new LoginModal(name, serverClient, this.notifications, ui); - }); - - rightAlignDiv.appendChild(onlineDot); - rightAlignDiv.appendChild(playerCountSpan); - rightAlignDiv.appendChild(playerCountStaticSpan); - rightAlignDiv.appendChild(joinButton); - serverDiv.appendChild(nameSpan); - serverDiv.appendChild(rightAlignDiv); - this.serverListing.appendChild(serverDiv); - } - } -} -- cgit v1.2.3-54-g00ecf