Widget:YouTube — различия между версиями

Материал из rock63.ru
Перейти к: навигация, поиск
 
(не показано 37 промежуточных версий этого же участника)
Строка 1: Строка 1:
<noinclude>
+
<noinclude>{{doc-inline}}
Виджет для вставки видео с YouTube на страницу. Автор виджета: [http://www.mediawikiwidgets.org/User:Yaron_Koren Yaron Koren].
+
Виджет для вставки видео с YouTube на страницу.
  
Для вставки используйте следущий код:
 
 
== Использование ==
 
== Использование ==
 
=== Одно видео ===
 
=== Одно видео ===
Строка 13: Строка 12:
 
* '''id''' - video id (from the URL)
 
* '''id''' - video id (from the URL)
 
* '''playlist''' - playlist name (starts with PL) - first clip is played ('''id''' is ignored)
 
* '''playlist''' - playlist name (starts with PL) - first clip is played ('''id''' is ignored)
* '''height''' and '''width''' define view dimensions, 350x267 is default
+
* '''width''' and '''height''' define view dimensions, 350x267 is default{{doc-end}}
</noinclude><includeonly>
+
</noinclude><includeonly><div class=widget-youtube style="width: <!--{$width|validate:int|default:350}-->px;"><div class="video-container" style="background-image: url(https://i.ytimg.com/vi/<!--{$id|escape:'urlpathinfo'|default:''}-->/hqdefault.jpg);"><a href="#" onclick="LazyLoadYoutubeOnClick('<!--{$id|escape:'urlpathinfo'|default:''}-->', <!--{$width|validate:int|default:350}-->, <!--{$height|validate:int|default:267}-->);return false;" id="lazy-yt-<!--{$id|escape:'urlpathinfo'|default:''}-->"><div class="play"></div></a></div><div class="desc"><!--{$desc|escape:'html'|default:''}--></div></div></includeonly>
<iframe width="<!--{$width|escape:'html'|default:'350'}-->" height="<!--{{{#expr: ($width/4)*3}}|escape:'html'|default:'{{#expr: (350/4)*3}}'}-->"   1 src="http://www.youtube.com/embed/<!--{$id|escape:'urlpathinfo'}-->" frameborder="0" allowfullscreen></iframe></includeonly>
 

Текущая версия на 23:48, 10 ноября 2020

Виджет для вставки видео с YouTube на страницу.

Использование

Одно видео

{{#widget:YouTube|id=Ukytqe9pwDM}}

Плейлист

{{#widget:YouTube|playlist=PL6FD8256CD24CFF1F}}

Параметры

  • id - video id (from the URL)
  • playlist - playlist name (starts with PL) - first clip is played (id is ignored)
  • width and height define view dimensions, 350x267 is default