diff --git a/src/battle-log.ts b/src/battle-log.ts index 764bd3145..9ed694d3c 100644 --- a/src/battle-log.ts +++ b/src/battle-log.ts @@ -104,6 +104,10 @@ class BattleLog { divHTML = BattleLog.sanitizeHTML(args[1]); break; + case 'uhtml': case 'uhtmlchange': + this.changeUhtml(args[1], args[2], args[0] === 'uhtml'); + return ['', '']; + case 'error': case 'inactive': case 'inactiveoff': divClass = 'chat message-error'; divHTML = BattleLog.escapeHTML(args[1]); @@ -237,9 +241,11 @@ class BattleLog { elements.push(node); } } - for (const node of this.preemptElem.childNodes as any) { - if (node.className && (' ' + node.className + ' ').includes(classContains)) { - elements.push(node); + if (this.preemptElem) { + for (const node of this.preemptElem.childNodes as any) { + if (node.className && (' ' + node.className + ' ').includes(classContains)) { + elements.push(node); + } } } if (html && elements.length && !forceAdd) { diff --git a/src/battle.ts b/src/battle.ts index b241a496a..ef70ceff0 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -3162,7 +3162,7 @@ class Battle { case 'fieldhtml': case 'controlshtml': case 'bigerror': case 'debug': case 'tier': return {args: [cmd, str.slice(index + 1)], kwArgs: {}}; - case 'c': case 'chat': + case 'c': case 'chat': case 'uhtml': case 'uhtmlchange': // three parts const index2a = str.indexOf('|', index + 1); return {args: [cmd, str.slice(index + 1, index2a), str.slice(index2a + 1)], kwArgs: {}};