diff --git a/config.js b/config.js index 14dda9c..89fdd1d 100644 --- a/config.js +++ b/config.js @@ -7,4 +7,6 @@ const CONFIG = { fontStrokeSize: "3px", fontStrokeColor: "#000000", }, + hideSelf: false, + hideSilent: false, }; diff --git a/js/app.js b/js/app.js index 79759e1..aab60f1 100644 --- a/js/app.js +++ b/js/app.js @@ -15,6 +15,7 @@ function main() { clientList.clear(); channelList.clear(); + selfClient = null; ws.onopen = (event) => { // Send payload to TS5 client diff --git a/js/display_content.js b/js/display_content.js index f82b4ea..c23d8f4 100644 --- a/js/display_content.js +++ b/js/display_content.js @@ -4,7 +4,13 @@ function drawClients() { result = ""; if (thisClient) { getClientsInChannel(thisClient.channel).forEach((c) => { - result += `
`; + isHidden = CONFIG.hideSilent && (c.talkStatus == 0 || c.isMuted()); + + result += `
`; result += '
'; if (c.outputMuted) { result += ' '; diff --git a/js/event_handlers.js b/js/event_handlers.js index b953ef6..57245b8 100644 --- a/js/event_handlers.js +++ b/js/event_handlers.js @@ -6,6 +6,8 @@ function handleAuthMessage(data) { parseClientInfos(data.payload.connections[0].clientInfos) ); thisClient = clientList.getById(data.payload.connections[0].clientId); + + selfClient = data.payload.connections[0].clientInfos.find((client) => client.id == data.payload.connections[0].clientId); } function handleClientMoved(data) { diff --git a/js/objects.js b/js/objects.js index 850267f..8755d62 100644 --- a/js/objects.js +++ b/js/objects.js @@ -22,6 +22,10 @@ class Client { this.talkStatus = talkStatus; console.log(`Client created: ${this.id} - ${this.name}`); } + + isMuted() { + return this.inputMuted == true || this.outputMuted == true; + } } class List { diff --git a/js/utils.js b/js/utils.js index b4dd7e9..05bec5c 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) { + if (e.channel.id == channel.id && !(CONFIG.hideSelf && selfClient && e.id == selfClient.id)) { result.push(e); } }