Changes for page YouTube-Video (Makro)
Last modified by Christian Holzner on 2026/09/17 13:49
From version 3.1
edited by Christian Holzner
on 2026/09/17 13:49
on 2026/09/17 13:49
Change comment:
Wiki-Makro youtube (schlankes iframe-Embedding) anlegen/aktualisieren
To version 1.1
edited by Christian Holzner
on 2026/09/17 13:44
on 2026/09/17 13:44
Change comment:
Wiki-Makro youtube (schlankes iframe-Embedding) anlegen/aktualisieren
Summary
-
Objects (1 modified, 0 added, 0 removed)
Details
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -14,12 +14,6 @@ 14 14 #if ($height == '') 15 15 #set ($height = '400px') 16 16 #end 17 -## Maximalbreite fuer den Festhoehe-Modus, passend zu 16:9 bei der gewaehlten 18 -## Hoehe -- verhindert, dass das Video (und YouTubes eigenes Vorschaubild) 19 -## auf breiten Bildschirmen ins extrem Breite/Verzerrte gezogen wird. Links/ 20 -## rechts bleibt dann einfach der normale weisse Seitenrand. 21 -#set ($heightNum = $mathtool.toDouble($height.replaceAll('[^0-9.]', ''))) 22 -#set ($maxWidth = $mathtool.toInteger($mathtool.mul($heightNum, 1.7778))) 23 23 {{/velocity}} 24 24 {{velocity}}#if ("$!videoId" == '' || $videoId == $url) 25 25 {{warning}}Die YouTube-URL ($!url) konnte nicht erkannt werden. Bitte eine normale YouTube-Video-URL verwenden (z.B. https://www.youtube.com/watch?v=... oder https://youtu.be/...).{{/warning}} ... ... @@ -35,9 +35,9 @@ 35 35 </div> 36 36 {{/html}} 37 37 #else 38 - ## Standardmodus: feste Hoehe, Breite bis max. 16:9-Verhaeltnis (siehe oben)32 + ## Standardmodus: feste Hoehe, volle Breite 39 39 {{html clean="false"}} 40 - <div class="ai-youtube-wrapper" style="max-width: ${maxWidth}px;margin:0auto">34 + <div class="ai-youtube-wrapper" style="max-width:100%"> 41 41 <iframe src="https://www.youtube-nocookie.com/embed/${videoId}" style="display:block;width:100%;height:${height};border:0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" loading="lazy" allowfullscreen></iframe> 42 42 </div> 43 43 {{/html}}


