[xExtension-YouTube] refine iframe element logic

This commit is contained in:
intriguedlife 2025-02-09 00:12:07 +01:00
parent 8ed35c8f76
commit bb097e52a7
2 changed files with 5 additions and 9 deletions

View file

@ -202,15 +202,12 @@ final class YouTubeExtension extends Minz_Extension
$content = ''; $content = '';
if ($this->autoSize) { if ($this->autoSize) {
$class = "yt_autosize_true"; $iframe_attribute = 'class="yt_player_autosize"';
} else { } else {
$class = "yt_autosize_false"; $iframe_attribute = 'width="' . $this->width . '" height="' . $this->height . '"';
} }
$iframe = '<iframe class="' . $class . '" $iframe = '<iframe ' . $iframe_attribute . '
style="height: ' . $this->height . 'px; width: ' . $this->width . 'px;"
width="' . $this->width . '"
height="' . $this->height . '"
src="' . $url . '" src="' . $url . '"
frameborder="0" frameborder="0"
allowFullScreen></iframe>'; allowFullScreen></iframe>';

View file

@ -1,5 +1,4 @@
.yt_autosize_true { .yt_player_autosize {
height: 100%;
width: 100%; width: 100%;
aspect-ratio: 16 / 9; aspect-ratio: 16 / 9;
} }