diff --git a/config.js b/config.js index b4d4c1e..6cfccae 100644 --- a/config.js +++ b/config.js @@ -10,5 +10,5 @@ const CONFIG = { fontStrokeColor: "#000000", }, hideSelf: false, // Hide yourself in the overlay - hideSilent: true, // Only show talking people + hideSilent: false, // Only show talking people }; diff --git a/js/display_content.js b/js/display_content.js index 3306490..b26d52f 100644 --- a/js/display_content.js +++ b/js/display_content.js @@ -1,14 +1,18 @@ +// Draw clients in the overlay +// Gets called everytime an event has been received (app.js -> ws.onmessage) function drawClients() { - let elem = document.getElementById("content"); + const overlayContent = document.getElementById("content"); - result = ""; + let result = ""; if (selfClient) { + // Loop through all clients which are currently in your channel getClientsInChannel(selfClient.channel).forEach((c) => { - isHidden = CONFIG.hideSilent && (c.talkStatus == 0 || c.isMuted()); - - result += `
`; + + // Add image result += '
'; if (c.outputMuted) { result += ' '; @@ -19,12 +23,16 @@ function drawClients() { } else { result += ' '; } + + // Close client div result += "
"; + + // Add client text (name of the client) result += `

${c.name}

`; }); } - elem.innerHTML = result; + overlayContent.innerHTML = result; } diff --git a/js/objects.js b/js/objects.js index 8755d62..91f5283 100644 --- a/js/objects.js +++ b/js/objects.js @@ -6,14 +6,7 @@ class Channel { } class Client { - constructor( - id, - channel, - name, - inputMuted = false, - outputMuted = false, - talkStatus = 0 - ) { + constructor(id, channel, name, inputMuted = false, outputMuted = false, talkStatus = 0) { this.id = id; this.channel = channel; this.name = name; @@ -26,6 +19,12 @@ class Client { isMuted() { return this.inputMuted == true || this.outputMuted == true; } + + isHidden() { + return ( + (CONFIG.hideSilent && (this.talkStatus == 0 || this.isMuted())) || (CONFIG.hideSelf && this.id == selfClient.id) + ); + } } class List { diff --git a/js/utils.js b/js/utils.js index 05bec5c..b4dd7e9 100644 --- a/js/utils.js +++ b/js/utils.js @@ -3,7 +3,7 @@ function getClientsInChannel(channel) { clientList.items.forEach((e) => { if (e.channel) { - if (e.channel.id == channel.id && !(CONFIG.hideSelf && selfClient && e.id == selfClient.id)) { + if (e.channel.id == channel.id) { result.push(e); } }