From cd181c26946136a3118582b0176fd83c88726e33 Mon Sep 17 00:00:00 2001 From: Mia <49593536+mia-pi-git@users.noreply.github.com> Date: Wed, 10 Jan 2024 18:23:17 -0600 Subject: [PATCH] Battle-log: Allow customizing Youtube player size --- play.pokemonshowdown.com/src/battle-log.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/play.pokemonshowdown.com/src/battle-log.ts b/play.pokemonshowdown.com/src/battle-log.ts index cb2ac17b8f..722f4089ac 100644 --- a/play.pokemonshowdown.com/src/battle-log.ts +++ b/play.pokemonshowdown.com/src/battle-log.ts @@ -916,11 +916,13 @@ export class BattleLog { const src = getAttrib('src') || ''; // Google's ToS requires a minimum of 200x200 - let width = '320'; - let height = '200'; - if (window.innerWidth >= 400) { - width = '400'; - height = '225'; + let width = getAttrib('width') || '0'; + let height = getAttrib('height') || '0'; + if (Number(width) < 200) { + width = window.innerWidth >= 400 ? '400' : '320'; + } + if (Number(height) < 200) { + height = window.innerWidth >= 400 ? '225' : '200'; } const videoId = /(?:\?v=|\/embed\/)([A-Za-z0-9_\-]+)/.exec(src)?.[1]; if (!videoId) return {tagName: 'img', attribs: ['alt', `invalid src for `]}; @@ -929,7 +931,6 @@ export class BattleLog { this.players.push(null); const idx = this.players.length; this.initYoutubePlayer(idx); - console.log(src, time); return { tagName: 'iframe', attribs: [