From 0162aaf3fe0d04e5ef2f724bfd39f129e14fc2ad Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Thu, 21 May 2026 15:38:13 +0000 Subject: [PATCH] Support /subtlenotify In oldclient, it'll be treated like `/nonotify`. In newclient, it'll do a subtle notification, which according to #2641 is desirable in some cases. --- play.pokemonshowdown.com/js/client-mainmenu.js | 1 + play.pokemonshowdown.com/src/battle-log.ts | 6 ++++-- play.pokemonshowdown.com/src/panel-chat.tsx | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/play.pokemonshowdown.com/js/client-mainmenu.js b/play.pokemonshowdown.com/js/client-mainmenu.js index db4e93fde..e3e73c6a9 100644 --- a/play.pokemonshowdown.com/js/client-mainmenu.js +++ b/play.pokemonshowdown.com/js/client-mainmenu.js @@ -1254,6 +1254,7 @@ case 'raw': return { message: '
' + BattleLog.sanitizeHTML(target) + '
', noNotify: isNotPM }; case 'nonotify': + case 'subtlenotify': return { message: '
' + timestamp + BattleLog.sanitizeHTML(target) + '
', noNotify: true }; case 'challenge': return { challenge: target }; diff --git a/play.pokemonshowdown.com/src/battle-log.ts b/play.pokemonshowdown.com/src/battle-log.ts index b00ecc9c9..faa1b503c 100644 --- a/play.pokemonshowdown.com/src/battle-log.ts +++ b/play.pokemonshowdown.com/src/battle-log.ts @@ -142,7 +142,7 @@ export class BattleLog { } let divClass = 'chat'; let divHTML = ''; - let noNotify: boolean | undefined; + let noNotify: boolean | 'subtle' | undefined; if (!['name', 'n'].includes(args[0])) this.lastRename = null; switch (args[0]) { case 'chat': case 'c': case 'c:': @@ -1232,7 +1232,7 @@ export class BattleLog { parseChatMessage( message: string, name: string, timestamp: string, isHighlighted?: boolean - ): [divClass: string, divHTML: string, noNotify?: boolean] { + ): [divClass: string, divHTML: string, noNotify?: boolean | 'subtle'] { let showMe = !BattleLog.prefs('chatformatting')?.hideme; let group = ' '; if (!/[A-Za-z0-9]/.test(name.charAt(0))) { @@ -1320,6 +1320,8 @@ export class BattleLog { return ['chat', BattleLog.sanitizeHTML(target), true]; case 'nonotify': return ['chat', BattleLog.sanitizeHTML(target), true]; + case 'subtlenotify': + return ['chat', BattleLog.sanitizeHTML(target), 'subtle']; default: // Not a command or unsupported. Parsed as a normal chat message. if (!name) { diff --git a/play.pokemonshowdown.com/src/panel-chat.tsx b/play.pokemonshowdown.com/src/panel-chat.tsx index 87d829946..e0268ecff 100644 --- a/play.pokemonshowdown.com/src/panel-chat.tsx +++ b/play.pokemonshowdown.com/src/panel-chat.tsx @@ -158,6 +158,8 @@ export class ChatRoom extends PSRoom { title: `${this.title}`, body: textContent, }); + } else if (noNotify === 'subtle') { + this.subtleNotify(); } } else { this.subtleNotify();