diff --git a/src/webpage/channel.ts b/src/webpage/channel.ts index e69e012..3efee6d 100644 --- a/src/webpage/channel.ts +++ b/src/webpage/channel.ts @@ -1368,7 +1368,18 @@ class Channel extends SnowFlake { }; live.classList.add("callVoiceIcon"); - buttonRow.append(mute, video, live, call); + const chat = document.createElement("div"); + const chatspan = document.createElement("span"); + chatspan.classList.add("svg-frmessage"); + chat.append(chatspan); + updateLiveIcon(); + chat.onclick = async () => { + this.voiceMode = this.voiceMode === "VoiceOnly" ? "ChatAndVoice" : "VoiceOnly"; + this.getHTML(true); + }; + chat.classList.add("callVoiceIcon"); + + buttonRow.append(mute, video, live, call, chat); const users = document.createElement("div"); const mut = new MutationObserver(() => { @@ -1466,7 +1477,11 @@ class Channel extends SnowFlake { if (getMessages) { chatArea.style.removeProperty("display"); } else { - chatArea.style.setProperty("display", "none"); + if (this.voiceMode === "VoiceOnly") { + chatArea.style.setProperty("display", "none"); + } else { + chatArea.style.removeProperty("display"); + } this.setUpVoiceArea(); } @@ -2372,6 +2387,7 @@ class Channel extends SnowFlake { }); notification.addEventListener("click", (_) => { window.focus(); + this.getHTML(true, true); }); } else if (Notification.permission !== "denied") { @@ -2383,6 +2399,7 @@ class Channel extends SnowFlake { }); } } + voiceMode: "VoiceOnly" | "ChatAndVoice" = "VoiceOnly"; async addRoleToPerms(role: Role) { await fetch(this.info.api + "/channels/" + this.id + "/permissions/" + role.id, { method: "PUT", diff --git a/src/webpage/message.ts b/src/webpage/message.ts index 2c65259..c987f8b 100644 --- a/src/webpage/message.ts +++ b/src/webpage/message.ts @@ -182,7 +182,20 @@ class Message extends SnowFlake { color: "red", }, ); + + Message.contextmenu.addSeperator(); + Message.contextmenu.addButton( + () => I18n.usedFermi(), + () => {}, + { + visable: function () { + return this.nonce.length <= 9; + }, + enabled: () => false, + }, + ); } + nonce: string = ""; setEdit() { const prev = this.channel.editing; this.channel.editing = this; diff --git a/src/webpage/style.css b/src/webpage/style.css index 201094e..b6292a9 100644 --- a/src/webpage/style.css +++ b/src/webpage/style.css @@ -229,6 +229,7 @@ body { #voiceArea { background: var(--black); position: relative; + min-width: 60%; } .voiceUsers { padding: 20px; diff --git a/translations/en.json b/translations/en.json index b8f7420..8c10078 100644 --- a/translations/en.json +++ b/translations/en.json @@ -225,6 +225,7 @@ "left":"Left voice chat" } }, + "usedFermi":"Used Fermi", "delete": "Delete", "webhooks": { "createdAt": "Created at $1",