diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..222861c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 2, + "useTabs": false +} diff --git a/config.js b/config.js index bb8baed..c987d87 100644 --- a/config.js +++ b/config.js @@ -1,11 +1,11 @@ const CONFIG = { - apiKey: "9811add4-5ee3-436d-ae9d-d98ff53a1f12", - remoteAppPort: 5899, - style: { - fontBackground: "rgba(19, 20, 33, 0.5)", - fontColor: "#ffffff", - fontSize: "70pt", - fontStrokeSize: "3px", - fontStrokeColor: "#000000", - }, + apiKey: "9811add4-5ee3-436d-ae9d-d98ff53a1f12", + remoteAppPort: 5899, + style: { + fontBackground: "rgba(19, 20, 33, 0.5)", + fontColor: "#ffffff", + fontSize: "70pt", + fontStrokeSize: "3px", + fontStrokeColor: "#000000", + }, }; diff --git a/css/style.css b/css/style.css index 82d200d..0cb65c2 100644 --- a/css/style.css +++ b/css/style.css @@ -1,27 +1,27 @@ * { - font-family: Arial, Helvetica, sans-serif; - font-weight: bold; - padding: 0; - margin: 0; + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + padding: 0; + margin: 0; } #content div { - margin-top: 5px; + margin-top: 5px; } .content-img { - float: left; - width: 100px; + float: left; + width: 100px; } .content-img img { - display: block; + display: block; } .content-text { - margin-left: 130px; + margin-left: 130px; } .content-text p { - display: inline; - padding-left: 20px; - padding-right: 20px; + display: inline; + padding-left: 20px; + padding-right: 20px; } diff --git a/js/app.js b/js/app.js index 787fad9..acf6cc0 100644 --- a/js/app.js +++ b/js/app.js @@ -1,70 +1,70 @@ function main() { - const ws = new WebSocket(`ws://localhost:${CONFIG.remoteAppPort}`); - const paylaod = { - type: "auth", - payload: { - identifier: "de.tealfire.obs", - version: "0.0.1", - name: "TS5 OBS Overlay", - description: "A simple OBS overlay for TS5 by DerTyp876", - content: { - apiKey: CONFIG.apiKey, - }, - }, - }; + const ws = new WebSocket(`ws://localhost:${CONFIG.remoteAppPort}`); + const paylaod = { + type: "auth", + payload: { + identifier: "de.tealfire.obs", + version: "0.0.1", + name: "TS5 OBS Overlay", + description: "A simple OBS overlay for TS5 by DerTyp876", + content: { + apiKey: CONFIG.apiKey, + }, + }, + }; - clientList.clear(); - channelList.clear(); + clientList.clear(); + channelList.clear(); - ws.onopen = (event) => { - // Send payload to TS5 client - ws.send(JSON.stringify(paylaod)); - }; + ws.onopen = (event) => { + // Send payload to TS5 client + ws.send(JSON.stringify(paylaod)); + }; - ws.onmessage = (event) => { - let data = JSON.parse(event.data); - // console.log(data); - switch (data.type) { - case "auth": - handleAuthMessage(data); - console.log( - "%c --> API-KEY: %s ", - "color:red;font-weight:bold;", - ` ${data.payload.apiKey}` - ); - break; - case "clientMoved": - handleClientMoved(data); - break; - case "clientPropertiesUpdated": - handleClientPropertiesUpdate(data); - break; - case "talkStatusChanged": - handleTalkStatusChanged(data); - break; - case "serverPropertiesUpdated": - ws.close(); - default: - console.log(`No handler for event type: ${data.type}`); - break; - } + ws.onmessage = (event) => { + let data = JSON.parse(event.data); + // console.log(data); + switch (data.type) { + case "auth": + handleAuthMessage(data); + console.log( + "%c --> API-KEY: %s ", + "color:red;font-weight:bold;", + ` ${data.payload.apiKey}` + ); + break; + case "clientMoved": + handleClientMoved(data); + break; + case "clientPropertiesUpdated": + handleClientPropertiesUpdate(data); + break; + case "talkStatusChanged": + handleTalkStatusChanged(data); + break; + case "serverPropertiesUpdated": + ws.close(); + default: + console.log(`No handler for event type: ${data.type}`); + break; + } - // Draw clientList in HTML object - drawClients(); - }; + // Draw clientList in HTML object + drawClients(); + }; - ws.onerror = (err) => { - console.error(err); - ws.close(); - return; - }; + ws.onerror = (err) => { + console.error(err); + ws.close(); + return; + }; - ws.onclose = (event) => { - console.log("Disconnected: " + event.reason); - clientList.clear(); - channelList.clear(); - drawClients(); - main(); // Reconnected - }; + ws.onclose = (event) => { + console.log("Disconnected: " + event.reason); + clientList.clear(); + channelList.clear(); + drawClients(); + main(); // Reconnected + }; } main(); diff --git a/js/display_content.js b/js/display_content.js index 4fdbf6d..c42dcc3 100644 --- a/js/display_content.js +++ b/js/display_content.js @@ -1,23 +1,23 @@ function drawClients() { - let elem = document.getElementById("content"); + let elem = document.getElementById("content"); - result = ""; - getClientsInChannel(thisClient.channel).forEach((c) => { - result += `
${c.name}