diff --git a/src/App.vue b/src/App.vue index b5393be..ffc3543 100644 --- a/src/App.vue +++ b/src/App.vue @@ -267,6 +267,7 @@ export default { // "history": [], // "updated": timestamp, // "unread": 4, + // "urgent": false, // true if at-mentioned // }, // "@username": { // "history": [], @@ -395,6 +396,7 @@ export default { let channel = this.channel; if (this.channels[channel].unread > 0) { this.channels[channel].unread = 0; + this.channels[channel].urgent = false; } }); window.addEventListener("blur", () => { @@ -704,6 +706,34 @@ export default { // Return the count of other peoples videos we have open. return Object.keys(this.WebRTC.streams).length; }, + activeChannels() { + // List of current channels, unread indicators etc. + let result = []; + for (let channel of this.config.channels) { + // VIP room we can't see? + if (channel.VIP && !this.isVIP) continue; + + let data = { + ID: channel.ID, + Name: channel.Name, + }; + if (this.channels[channel.ID] != undefined) { + data.Unread = this.channels[channel.ID].unread; + data.Urgent = this.channels[channel.ID].urgent; + data.Updated = this.channels[channel.ID].updated; + } + result.push(data); + } + + // Is the debug channel enabled? + if (this.prefs.debug) { + result.push({ + ID: DebugChannelID, + Name: "Debug Log", + }); + } + return result; + }, atMentionItems() { // Available users in chat for the at-mentions support. let result = [ @@ -1859,6 +1889,7 @@ export default { this.scrollHistory(this.channel, true); if (this.channels[this.channel]) { this.channels[this.channel].unread = 0; + this.channels[this.channel].urgent = false; } // Responsive CSS: switch back to chat panel upon selecting a channel. @@ -1870,12 +1901,6 @@ export default { // Focus the message entry box. this.messageBox.focus(); }, - hasUnread(channel) { - if (this.channels[channel] == undefined) { - return 0; - } - return this.channels[channel].unread; - }, hasAnyUnread() { // Returns total unread count (for mobile responsive view to show in the left drawer button) let count = 0; @@ -2036,34 +2061,6 @@ export default { return false; }, - activeChannels() { - // List of current channels, unread indicators etc. - let result = []; - for (let channel of this.config.channels) { - // VIP room we can't see? - if (channel.VIP && !this.isVIP) continue; - - let data = { - ID: channel.ID, - Name: channel.Name, - }; - if (this.channels[channel] != undefined) { - data.Unread = this.channels[channel].unread; - data.Updated = this.channels[channel].updated; - } - result.push(data); - } - - // Is the debug channel enabled? - if (this.prefs.debug) { - result.push({ - ID: DebugChannelID, - Name: "Debug Log", - }); - } - return result; - }, - // Start broadcasting my webcam. // - force=true to skip the NSFW modal prompt (this param is passed by the button in that modal) // - changeCamera=true to re-negotiate WebRTC connections with a new camera device (invoked by the Settings modal) @@ -2936,6 +2933,7 @@ export default { history: [], updated: Date.now(), unread: 0, + urgent: false, }; } }, @@ -2993,6 +2991,12 @@ export default { if (message.indexOf("@" + this.username) > -1) { let re = new RegExp("@" + this.username + "\\b", "ig"); message = message.replace(re, `@${this.username}`); + + // Play the sound effect if this is a public channel that isn't currently focused. + if (channel.indexOf("@") !== 0 && (this.channel !== channel || !this.windowFocused)) { + this.playSound("Mentioned"); + this.channels[channel].urgent = true; + } } // And same for @here or @all @@ -3902,6 +3906,29 @@ export default { + +
+
+ +
+
+
+ +
+
+ + +
+   +
+
+   +
+
@@ -4399,12 +4426,12 @@ export default {