diff --git a/web/static/css/chat.css b/web/static/css/chat.css index 548a35a..0911cec 100644 --- a/web/static/css/chat.css +++ b/web/static/css/chat.css @@ -23,6 +23,11 @@ body { background-color: #ffefff; } +/* Truncate long text, e.g. usernames in the who list */ +.truncate-text-line { + text-overflow: ellipsis; +} + /************************ * Main CSS Grid Layout * ************************/ diff --git a/web/static/js/BareRTC.js b/web/static/js/BareRTC.js index 7b9ec36..c412a93 100644 --- a/web/static/js/BareRTC.js +++ b/web/static/js/BareRTC.js @@ -105,6 +105,7 @@ const app = Vue.createApp({ // Who List for the room. whoList: [], whoTab: 'online', + whoSort: 'a-z', whoMap: {}, // map username to wholist entry muted: {}, // muted usernames for client side state @@ -404,6 +405,40 @@ const app = Vue.createApp({ if (this.webcam.mutualOpen) status |= this.VideoFlag.MutualOpen; return status; }, + sortedWhoList() { + let result = [...this.whoList]; + + switch (this.whoSort) { + case "broadcasting": + result.sort((a, b) => { + return (b.video & this.VideoFlag.Active) - (a.video & this.VideoFlag.Active); + }); + break; + case "nsfw": + result.sort((a, b) => { + let left = (a.video & (this.VideoFlag.Active | this.VideoFlag.NSFW)), + right = (b.video & (this.VideoFlag.Active | this.VideoFlag.NSFW)); + return right - left; + }); + break; + case "status": + result.sort((a, b) => { + if (a.status === b.status) return 0; + return b.status < a.status ? -1 : 1; + }); + break; + case "op": + result.sort((a, b) => { + return b.op - a.op; + }); + break; + case "z-a": + result = result.reverse(); + } + + // Default ordering from ChatServer = a-z + return result; + }, }, methods: { // Load user prefs from localStorage, called on startup diff --git a/web/templates/chat.html b/web/templates/chat.html index baa7dcc..cc2f4f2 100644 --- a/web/templates/chat.html +++ b/web/templates/chat.html @@ -963,7 +963,7 @@