Skip to content
Snippets Groups Projects
Commit 04567ffd authored by Fabian Galinski's avatar Fabian Galinski :pouting_cat:
Browse files

[TASK] Improvement of the width calculation

parent 1fe59f32
No related branches found
No related tags found
No related merge requests found
......@@ -26,8 +26,8 @@
<target><![CDATA[Aspect Ratio (nur genutzt, wenn der Thumbnail-Typ dies prüfen soll)]]></target>
</trans-unit>
<trans-unit id="flexform.disableLightbox" approved="yes">
<source><![CDATA[Replace the thumbnail with the video and disable the lightbox?]]></source>
<target><![CDATA[Das Thumbnail durch das Video ersetzen und die Lightbox deaktivieren?]]></target>
<source><![CDATA[Replace the thumbnail with the video and disable the lightbox]]></source>
<target><![CDATA[Das Thumbnail durch das Video ersetzen und die Lightbox deaktivieren]]></target>
</trans-unit>
<trans-unit id="flexform.id" approved="yes">
<source><![CDATA[ID of Channel (UC), Playlist (PL) or Single Video (youtube.com/watch?v=%ID%)]]></source>
......
......@@ -21,7 +21,7 @@
<source><![CDATA[Aspect Ratio (only used if thumbnail type is set to check that)]]></source>
</trans-unit>
<trans-unit id="flexform.disableLightbox">
<source><![CDATA[Replace the thumbnail with the video and disable the lightbox?]]></source>
<source><![CDATA[Replace the thumbnail with the video and disable the lightbox]]></source>
</trans-unit>
<trans-unit id="flexform.id">
<source><![CDATA[ID of Channel (UC), Playlist (PL) or Single Video (youtube.com/watch?v=%ID%)]]></source>
......
......@@ -45,14 +45,17 @@ module.exports = function() {
let $youtubeItem = $(event.currentTarget);
// This needs to be done, because the height of inline elements is always 0, if on auto...
$youtubeItem.css('display', 'inherit');
$youtubeItem.css('display', 'block');
let queryString = prepareVideoUrl($youtubeItem.attr('href')),
width = $youtubeItem.outerWidth() + 'px',
height = $youtubeItem.outerHeight() + 'px';
$youtubeItem.replaceWith('<div class="sg-youtube-item sg-card-shadow" style="height: ' + height + '"><iframe ' +
'width="100%" height="' + height + '" ' +
$youtubeItem.replaceWith('<div class="sg-youtube-item sg-card-shadow" ' +
'style="height: ' + height + '; width: ' + width + ';"><iframe ' +
'width="' + width + '" height="' + height + '" ' +
'src="https://www.youtube-nocookie.com/embed/' + queryString + '" frameborder="0" ' +
'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>')
'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" ' +
'allowfullscreen></iframe></div>')
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment