diff --git a/xExtension-YouTube/extension.php b/xExtension-YouTube/extension.php
index c8bec521..400b0918 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 @@ public function loadConfigValues(): void
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 @@ public function loadConfigValues(): void
}
}
+ /**
+ * 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 @@ public function getHtml(FreshRSS_Entry $entry, string $url): string
{
$content = '';
- $iframe = '