diff --git a/xExtension-YouTube/configure.phtml b/xExtension-YouTube/configure.phtml index 8828fe7..8895abc 100644 --- a/xExtension-YouTube/configure.phtml +++ b/xExtension-YouTube/configure.phtml @@ -6,6 +6,13 @@ declare(strict_types=1);
+
+ +
+
diff --git a/xExtension-YouTube/extension.php b/xExtension-YouTube/extension.php index c8bec52..400b091 100644 --- a/xExtension-YouTube/extension.php +++ b/xExtension-YouTube/extension.php @@ -9,6 +9,10 @@ */ final class YouTubeExtension extends Minz_Extension { + /** + * Whether we set the Youtube iframe to autosize + */ + private bool $autoSize = false; /** * Video player width */ @@ -32,6 +36,8 @@ final class YouTubeExtension extends Minz_Extension #[\Override] public function init(): void { + Minz_View::appendStyle($this->getFileUrl('style.css', 'css')); + $this->registerHook('entry_before_display', [$this, 'embedYouTubeVideo']); $this->registerHook('check_url_before_add', [self::class, 'convertYoutubeFeedUrl']); $this->registerTranslates(); @@ -63,6 +69,11 @@ final class YouTubeExtension extends Minz_Extension return; } + $autoSize = FreshRSS_Context::userConf()->attributeBool('yt_autosize'); + if ($autoSize !== null) { + $this->autoSize = $autoSize; + } + $width = FreshRSS_Context::userConf()->attributeInt('yt_player_width'); if ($width !== null) { $this->width = $width; @@ -84,6 +95,15 @@ final class YouTubeExtension extends Minz_Extension } } + /** + * Returns whether this extension enables autosize for the YouTube player iframe. + * You have to call loadConfigValues() before this one, otherwise you get default values. + */ + public function isAutoSize(): bool + { + return $this->autoSize; + } + /** * Returns the width in pixel for the YouTube player iframe. * You have to call loadConfigValues() before this one, otherwise you get default values. @@ -181,7 +201,13 @@ final class YouTubeExtension extends Minz_Extension { $content = ''; - $iframe = '