diff --git a/xExtension-YouTube/configure.phtml b/xExtension-YouTube/configure.phtml
index 8828fe7d..8895abc7 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 c8bec521..732cce73 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_player_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.
@@ -180,11 +200,14 @@ public function getHtmlPeerTubeContentForLink(FreshRSS_Entry $entry, string $lin
public function getHtml(FreshRSS_Entry $entry, string $url): string
{
$content = '';
+
+ if ($this->autoSize) {
+ $iframe_attribute = 'class="yt_player_autosize"';
+ } else {
+ $iframe_attribute = 'width="' . $this->width . '" height="' . $this->height . '"';
+ }
- $iframe = '';
@@ -252,6 +275,7 @@ public function handleConfigureAction(): void
$this->registerTranslates();
if (Minz_Request::isPost()) {
+ FreshRSS_Context::userConf()->_attribute('yt_player_autosize', Minz_Request::paramBoolean('yt_autosize'));
FreshRSS_Context::userConf()->_attribute('yt_player_height', Minz_Request::paramInt('yt_height'));
FreshRSS_Context::userConf()->_attribute('yt_player_width', Minz_Request::paramInt('yt_width'));
FreshRSS_Context::userConf()->_attribute('yt_show_content', Minz_Request::paramBoolean('yt_show_content'));
diff --git a/xExtension-YouTube/i18n/de/ext.php b/xExtension-YouTube/i18n/de/ext.php
index e6926707..35ca4caa 100644
--- a/xExtension-YouTube/i18n/de/ext.php
+++ b/xExtension-YouTube/i18n/de/ext.php
@@ -2,6 +2,7 @@
return array(
'yt_videos' => array(
+ 'autosize' => 'Autogröße des Players',
'height' => 'Höhe des Players',
'width' => 'Breite des Players',
'updates' => 'Die neueste Version des Plugins findest Du bei',
diff --git a/xExtension-YouTube/i18n/en/ext.php b/xExtension-YouTube/i18n/en/ext.php
index 6f37c024..234fc36a 100644
--- a/xExtension-YouTube/i18n/en/ext.php
+++ b/xExtension-YouTube/i18n/en/ext.php
@@ -2,6 +2,7 @@
return array(
'yt_videos' => array(
+ 'autosize' => 'Player autosize',
'height' => 'Player height',
'width' => 'Player width',
'updates' => 'You can find the latest extension version at',
diff --git a/xExtension-YouTube/i18n/fr/ext.php b/xExtension-YouTube/i18n/fr/ext.php
index 3beee1b8..50e8f57a 100644
--- a/xExtension-YouTube/i18n/fr/ext.php
+++ b/xExtension-YouTube/i18n/fr/ext.php
@@ -2,6 +2,7 @@
return array(
'yt_videos' => array(
+ 'autosize' => 'Taille automatique du lecteur',
'height' => 'Hauteur du lecteur',
'width' => 'Largeur du lecteur',
'updates' => 'Vous pouvez trouver la dernière mise à jour de l’extension sur ',
diff --git a/xExtension-YouTube/i18n/tr/ext.php b/xExtension-YouTube/i18n/tr/ext.php
index a206d2fc..4681ec81 100644
--- a/xExtension-YouTube/i18n/tr/ext.php
+++ b/xExtension-YouTube/i18n/tr/ext.php
@@ -2,6 +2,7 @@
return array(
'yt_videos' => array(
+ 'autosize' => 'Oynatıcı otomatik boyutlandırma',
'height' => 'Oynatıcı yükseklik',
'width' => 'Oynatıcı genişlik',
'updates' => 'En son uzantı sürümünü şu adreste bulabilirsiniz:',
diff --git a/xExtension-YouTube/static/style.css b/xExtension-YouTube/static/style.css
new file mode 100644
index 00000000..aaf1420a
--- /dev/null
+++ b/xExtension-YouTube/static/style.css
@@ -0,0 +1,4 @@
+.yt_player_autosize {
+ width: 100%;
+ aspect-ratio: 16 / 9;
+}
\ No newline at end of file