Template:Youtube: Difference between revisions

Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.
been wondering why videos weren't scaling correctly...turns out the code was quite broken. Updated to use Box instead of a table, and simplified the switch logic.
(changed default width, height, AR)
(been wondering why videos weren't scaling correctly...turns out the code was quite broken. Updated to use Box instead of a table, and simplified the switch logic.)
Line 1: Line 1:
<includeonly>{|style="margin: 0.5em; margin-top:0 !important; padding: 3px 0 3px 0 !important; margin-{{#switch:{{{3|}}}|{{Void}}=left|left=left|right=right|center=center|#default=left}}:0 !important; background-color:#F2F2F2; border: 2px solid #AAA;width:100px;float:{{#switch:{{{3|}}}|{{Void}}=left|left=left|right=right|center=center|#default=left}}"
<includeonly>{{Box|{{#switch:{{{3|}}}|right=right|center=center|#default=left}}
|<div>
| {{#widget:YouTube
|{{#widget:YouTube|{{#ifexpr:{{#len:{{{1}}}}}=11|id={{{1}}}|playlist={{{1}}}}}|at={{{at|0}}}|width={{{2|560}}}|height={{#expr:{{{2|560}}}*0.5625 round 0}}}}{{#switch:{{{3|}}}|{{Void}}={{#ifeq:{{{4|}}}|{{Void}}|{{Void}}|<br>{{{4|}}}}}|left={{#ifeq:{{{4|}}}|{{Void}}|{{Void}}|<br>{{{4|}}}}}|right={{#ifeq:{{{4|}}}|{{Void}}|{{Void}}|<br>{{{4|}}}}}|center={{#ifeq:{{{4|}}}|{{Void}}|{{Void}}|<br>{{{4|}}}}}|#default={{#ifeq:{{{3|}}}|{{Void}}|{{Void}}|<br>{{{3|}}}}}}}
  | {{#ifexpr:{{#len:{{{1}}}}}=11|id={{{1}}}|playlist={{{1}}}}}
|</div>
  | at = {{{at|0}}}
|}
  | width = {{{2|560}}}
</includeonly><noinclude>
  | height = {{#expr:{{{2|560}}}*0.5625 round 0}}
  }}{{#switch:{{{3|}}}
  | left | right | center | {{Void}} = {{#if:{{{4|}}}|<br>{{{4}}}}}
  | #default = {{#if:{{{3|}}}|<br>{{{3}}}}}
  }}
}}</includeonly><noinclude>
{{Clear}}
{{Clear}}
==Purpose==
==Purpose==
Line 18: Line 23:
*'''''Location''''' is where to have the video. (i.e. right, left, or center.) Defaults to left if blank.
*'''''Location''''' is where to have the video. (i.e. right, left, or center.) Defaults to left if blank.
*'''''Caption''''' is an optional caption to describe the video.
*'''''Caption''''' is an optional caption to describe the video.
**If ''location'' is neither '''left''', '''right''', nor '''center''', then the it is assumed to be a caption and the video's location is set to "left".
*'''''at''''' is an optional named parameter for the start time, in seconds (or in the form ##m##s).
*'''''at''''' is an optional named parameter for the start time, in seconds (or in the form ##m##s).
**If ''location'' is neither '''left''', '''right''', nor '''center''', then the it is assumed to be a caption and the video's location is set to "left".


{{Cat|Formatting Templates}}
{{Cat|Formatting Templates}}
</noinclude>
</noinclude>

Navigation menu