Skip to content

Commit 43b535a

Browse files
committed
Merge branch 'release/v3.2.0'
2 parents 44a1371 + c15757d commit 43b535a

19 files changed

+240
-236
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ The EmbedVideo parser function expects to be called in any of the following ways
124124
* `{{#ev:service|id|dimensions|alignment|description}}`
125125
* `{{#ev:service|id|dimensions|alignment|description|container}}`
126126
* `{{#ev:service|id|dimensions|alignment|description|container|urlargs}}`
127-
* `{{#ev:service|id|dimensions|alignment|description|container|urlargs|autoresize}}`
128127

129128
However, if needed optional arguments may be left blank by not putting anything between the pipes:
130129

@@ -137,7 +136,8 @@ Alternatively each parameter can be used in any order as a named parameter. The
137136
* `description`
138137
* `container`
139138
* `urlArgs`
140-
* `autoResize`
139+
* `autoresize`
140+
* Set `|autoresize=true` to have the embed automatically use all available width of the parent element
141141
* `vAlignment`
142142
* `width`
143143
* `height`

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "starcitizenwiki/embedvideo",
3-
"version": "3.1.0",
3+
"version": "3.2.0",
44
"type": "mediawiki-extension",
55
"description": "Adds a parser function embedding video from popular sources.",
66
"license": "MIT",

extension.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "EmbedVideo",
3-
"version": "3.1.0",
3+
"version": "3.2.0",
44
"author": [
5-
"Octfx",
6-
"Alistair3149",
5+
"[https://www.mediawiki.org/wiki/User:Octfx Octfx]",
6+
"[https://www.mediawiki.org/wiki/User:Alistair3149 Alistair3149]",
77
"Jim R. Wilson",
88
"Andrew Whitworth",
99
"Alexia E. Smith",
@@ -35,16 +35,6 @@
3535
"embedvideo": "MediaWiki\\Extension\\EmbedVideo\\ApiEmbedVideo"
3636
},
3737
"ResourceModules": {
38-
"ext.embedVideo": {
39-
"scripts": [
40-
"ext.embedVideo.js"
41-
],
42-
"position": "top",
43-
"targets": [
44-
"desktop",
45-
"mobile"
46-
]
47-
},
4838
"ext.embedVideo.consent": {
4939
"es6": true,
5040
"packageFiles": [

i18n/ia.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"@metadata": {
3+
"authors": [
4+
"McDutchie"
5+
]
6+
},
7+
"embedvideo-description": "Iste version bifurcate adde un function de analysator syntactic pro integrar videos de fontes popular.",
8+
"embedvideo-load": "Cargar $1",
9+
"embedvideo-type-audio": "audio",
10+
"embedvideo-type-content": "contento",
11+
"embedvideo-type-video": "video",
12+
"embedvideo-consent-privacy-policy": "Politica de confidentialitate",
13+
"embedvideo-consent-privacy-notice-text": "$1 pote colliger datos personal.",
14+
"embedvideo-consent-privacy-notice-continue": "Continuar",
15+
"embedvideo-consent-privacy-notice-dismiss": "Clauder",
16+
"embedvideo-service-archiveorg": "Archive.org",
17+
"embedvideo-service-bilibili": "Bilibili",
18+
"embedvideo-service-kakaotv": "KakaoTV",
19+
"embedvideo-service-navertv": "NaverTV",
20+
"embedvideo-service-niconico": "Niconico",
21+
"embedvideo-service-soundcloud": "SoundCloud",
22+
"embedvideo-service-spotify": "Spotify",
23+
"embedvideo-service-twitch": "Twitch",
24+
"embedvideo-service-vimeo": "Vimeo",
25+
"embedvideo-service-youtube": "YouTube",
26+
"embedvideo-play": "Reproducer video",
27+
"embedvideo-error-missingparams": "Manca un parametro requirite a EmbedVideo.",
28+
"embedvideo-error-service": "EmbedVideo non recognosce le servicio de video \"$1\".",
29+
"embedvideo-error-id": "EmbedVideo ha recipite le ID mal \"$2\" pro le servicio \"$1\".",
30+
"embedvideo-error-width": "EmbedVideo ha recipe le parametro de latitude mal \"$1\".",
31+
"embedvideo-error-height": "EmbedVideo ha recipe le parametro de altitude mal \"$1\".",
32+
"embedvideo-error-alignment": "EmbedVideo ha recipite un valor non valide pro le parametro de alineamento \"$1\". Valores valide es \"left\", \"center\", \"right\", o \"inline\".",
33+
"embedvideo-error-valignment": "EmbedVideo ha recipite un valor non valide pro le parametro de alineamento vertical \"$1\". Valores valide es \"top\", \"middle\", \"bottom\", o \"baseline\".",
34+
"embedvideo-error-urlargs": "EmbedVideo ha recipite un lista de argumentos de URL que contineva datos mal formate o argumentos vacue.",
35+
"embedvideo-error-unknown": "EmbedVideo ha incontrate un error incognite durante le tentativa de generar iste bloco de incastration de video. ($1)",
36+
"embedvideo-error-evp_deprecated": "Le function de analysator #evp ha devenite obsolescente in EmbedVideo 2.0. Per favor converte tu etiquetta de function de analysator a #ev.",
37+
"embedvideo-error-container": "Le parametro fornite pro 'container' non es valide.",
38+
"embedvideo-video-long-desc": "$1, codec $2, longitude $3, $4x$5 pixels, $6 in total",
39+
"embedvideo-audio-long-desc": "$1, codec $2, longitude $3, $4 in total",
40+
"embedvideo-error-cantdecode_evu": "Non poteva analysar video de $1",
41+
"apihelp-embedvideo-summary": "Obtener codice de incastration de video generate pro le parametros date.",
42+
"apihelp-embedvideo-param-service": "Nomine del servicio (youtube, twitch, etc)",
43+
"apihelp-embedvideo-param-id": "Le ID del video pro ille servicio",
44+
"apihelp-embedvideo-param-dimensions": "O un latitude numeric (100) o latitude per altitude (100x100)",
45+
"apihelp-embedvideo-param-alignment": "Alineamento de video",
46+
"apihelp-embedvideo-param-description": "Description del video",
47+
"apihelp-embedvideo-param-container": "Accepta quadro, o lassa vacue",
48+
"apihelp-embedvideo-param-urlargs": "Argumentos additional a passar in le url de video (pro alcun servicios)",
49+
"apihelp-embedvideo-param-autoresize": "Redimensionar automaticamente le video? (ver o false)"
50+
}

i18n/pt-br.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22
"@metadata": {
33
"authors": [
44
"Eduardoaddad",
5+
"Fúlvio",
56
"SaldırganSincap"
67
]
78
},
89
"embedvideo-description": "Esta versão bifurcada adiciona uma função de parser para incorporar vídeos de fontes populares.",
10+
"embedvideo-load": "Carregar $1",
11+
"embedvideo-type-audio": "áudio",
12+
"embedvideo-type-content": "conteúdo",
13+
"embedvideo-type-video": "vídeo",
914
"embedvideo-consent-privacy-policy": "Politica de privacidade",
1015
"embedvideo-consent-privacy-notice-text": "$1 pode coligir dados pessoais.",
1116
"embedvideo-consent-privacy-notice-continue": "Continuar",
1217
"embedvideo-consent-privacy-notice-dismiss": "Dispensar",
18+
"embedvideo-play": "Reproduzir vídeo",
1319
"embedvideo-error-missingparams": "O EmbedVideo está faltando um parâmetro requerido.",
1420
"embedvideo-error-width": "O EmbedVideo recebeu o parâmetro de largura ruim \"$1\".",
1521
"embedvideo-error-height": "EmbedVideo recebeu o parâmetro de altura ruim \"$1\".",
@@ -22,5 +28,6 @@
2228
"apihelp-embedvideo-param-dimensions": "Uma largura numérica (100) ou largura por altura (100x100)",
2329
"apihelp-embedvideo-param-alignment": "Alinhamento de vídeo",
2430
"apihelp-embedvideo-param-description": "Descrição do vídeo",
25-
"apihelp-embedvideo-param-urlargs": "Argumentos adicionais para passar no URL de vídeo (por alguns serviços)"
31+
"apihelp-embedvideo-param-urlargs": "Argumentos adicionais para passar no URL de vídeo (por alguns serviços)",
32+
"apihelp-embedvideo-param-autoresize": "Redimensionar o vídeo automaticamente? (verdadeiro ou falso)"
2633
}

i18n/sl.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
"embedvideo-service-spotify": "Spotify",
2222
"embedvideo-service-twitch": "Twitch",
2323
"embedvideo-service-vimeo": "Vimeo",
24-
"embedvideo-service-youtube": "YouTube"
24+
"embedvideo-service-youtube": "YouTube",
25+
"embedvideo-error-missingparams": "EmbedVideo manjka obvezen parameter."
2526
}

i18n/tr.json

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,41 @@
22
"@metadata": {
33
"authors": [
44
"Hedda",
5-
"SaldırganSincap"
5+
"SaldırganSincap",
6+
"ToprakM"
67
]
78
},
89
"embedvideo-description": "Bu çatallı sürüm, popüler kaynaklardan videoları gömmek için bir ayrıştırıcı işlevi ekler.",
10+
"embedvideo-load": "$1 yükle",
11+
"embedvideo-type-audio": "ses",
12+
"embedvideo-type-content": "içerik",
13+
"embedvideo-type-video": "video",
14+
"embedvideo-consent-privacy-policy": "Gizlilik Politikası",
15+
"embedvideo-consent-privacy-notice-text": "$1 kişisel verileri toplayabilir.",
16+
"embedvideo-consent-privacy-notice-continue": "Devam et",
17+
"embedvideo-consent-privacy-notice-dismiss": "Kapat",
18+
"embedvideo-service-archiveorg": "Archive.org",
19+
"embedvideo-service-bilibili": "Bilibili",
20+
"embedvideo-service-kakaotv": "KakaoTV",
21+
"embedvideo-service-navertv": "NaverTV",
22+
"embedvideo-service-niconico": "Niconico",
23+
"embedvideo-service-soundcloud": "SoundCloud",
24+
"embedvideo-service-spotify": "Spotify",
25+
"embedvideo-service-twitch": "Twitch",
26+
"embedvideo-service-vimeo": "Vimeo",
27+
"embedvideo-service-youtube": "YouTube",
928
"embedvideo-play": "Videoyu Oynat",
1029
"embedvideo-error-missingparams": "EmbedVideo'da kullanılması zorunlu bir parametre eksik.",
1130
"embedvideo-error-service": "EmbedVideo, \"$1\" video hizmetini tanımıyor.",
1231
"embedvideo-error-id": "EmbedVideo, \"$1\" hizmeti için \"$2\" hatalı kimliğine sahip.",
1332
"embedvideo-error-width": "EmbedVideo, \"$1\" hatalı genişlik parametresine sahip.",
1433
"embedvideo-error-height": "EmbedVideo, \"$1\" hatalı yükseklik parametresine sahip.",
15-
"embedvideo-error-alignment": "EmbedVideo'ya \"$1\" hizalama parametresi için geçersiz bir değer verildi. Geçerli değerler \"sol\", \"orta\", \"sağ\" veya \"satır içi\"dir.",
16-
"embedvideo-error-valignment": "EmbedVideo'ya \"$1\" doğrulama parametresi için geçersiz bir değer verildi. Geçerli değerler \"üst\", \"orta\", \"alt\" veya \"taban çizgisi\" değerleridir.",
34+
"embedvideo-error-alignment": "EmbedVideo'ya \"$1\" hizalama parametresi için geçersiz bir değer verildi. Geçerli değerler \"left\", \"center\", \"right\" veya \"inline\"dir.",
35+
"embedvideo-error-valignment": "EmbedVideo'ya \"$1\" doğrulama parametresi için geçersiz bir değer verildi. Geçerli değerler \"top\", \"middle\", \"bottom\" veya \"baseline\" değerleridir.",
1736
"embedvideo-error-urlargs": "EmbedVideo, hatalı biçimlendirilmiş veriler veya boş bağımsız değişkenler içeren bir URL parametre listesine sahip.",
1837
"embedvideo-error-unknown": "EmbedVideo, bu video yerleştirme bloğunu oluşturmaya çalışırken bilinmeyen bir hatayla karşılaştı. ($1)",
1938
"embedvideo-error-evp_deprecated": "#evp ayrıştırıcı işlevi EmbedVideo 2.0'da kullanımdan kaldırıldı. Lütfen ayrıştırıcı işlev etiketinizi #ev olarak değiştirin.",
20-
"embedvideo-error-container": "'Kapsayıcı' için sağlanan parametre geçersiz.",
39+
"embedvideo-error-container": "'container' için sağlanan parametre geçersiz.",
2140
"embedvideo-video-long-desc": "$1, $2 kodlayıcı, uzunluk $3, $4x$5 piksel, toplamda $6",
2241
"embedvideo-audio-long-desc": "$1, $2 kodlayıcı, uzunluk $3, toplamda $4",
2342
"embedvideo-error-cantdecode_evu": "$1 ile video ayrıştırılamadı",
@@ -29,5 +48,5 @@
2948
"apihelp-embedvideo-param-description": "Videonun açıklaması",
3049
"apihelp-embedvideo-param-container": "Çerçeveyi kabul eder veya boş bırakır",
3150
"apihelp-embedvideo-param-urlargs": "Video URL'sine iletilecek ek bağımsız değişkenler (bazı hizmetler için)",
32-
"apihelp-embedvideo-param-autoresize": "Video otomatik olarak yeniden boyutlandırılsın mı? (doğru ya da yanlış)"
51+
"apihelp-embedvideo-param-autoresize": "Video otomatik olarak yeniden boyutlandırılsın mı? (true veya false)"
3352
}

i18n/zh-hant.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"authors": [
44
"Alistair3149",
55
"Kly",
6-
"Lakejason0"
6+
"Lakejason0",
7+
"Winston Sung"
78
]
89
},
910
"embedvideo-description": "此分叉版本添加可用於內嵌來自熱門來源的影片之解析功能。",
@@ -12,7 +13,7 @@
1213
"embedvideo-type-content": "內容",
1314
"embedvideo-type-video": "影片",
1415
"embedvideo-consent-privacy-policy": "隱私權政策",
15-
"embedvideo-consent-privacy-notice-text": "$1可能會收集個人數據",
16+
"embedvideo-consent-privacy-notice-text": "$1可能會收集個人資料",
1617
"embedvideo-consent-privacy-notice-continue": "繼續",
1718
"embedvideo-consent-privacy-notice-dismiss": "關閉",
1819
"embedvideo-service-archiveorg": "Archive.org",

includes/EmbedService/AbstractEmbedService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ abstract class AbstractEmbedService {
2020
*/
2121
// phpcs:disable Generic.Files.LineLength.TooLong
2222
protected $iframeAttributes = [
23+
'class' => 'embedvideo-player',
2324
'loading' => 'lazy',
2425
'frameborder' => 0,
2526
'allow' => 'accelerometer; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; autoplay',

includes/EmbedService/Bilibili.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getContentType(): ?string {
6262
* @inheritDoc
6363
*/
6464
public function getPrivacyPolicyUrl(): ?string {
65-
return 'https://www.bilibili.tv/en/privacy-policy';
65+
return 'https://www.bilibili.com/blackboard/privacy-pc.html';
6666
}
6767

6868
/**

includes/EmbedService/EmbedHtmlFormatter.php

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ final class EmbedHtmlFormatter {
2121
*
2222
* @param AbstractEmbedService $service
2323
* @param array $config Array containing the following keys:
24-
* outerClass: String - Class added to the thumb div,
25-
* class: String - Class added to the div following .thumb,
26-
* style: String - CSS Style added to the div,
27-
* innerClass: String - Class added to the inner div,
24+
* class: String - Class added to the container,
25+
* style: String - CSS Style added to the container,
2826
* withConsent: Boolean - Whether to add the consent HTML,
2927
* description: String - Optional Description
3028
* @return string
@@ -35,42 +33,66 @@ public static function toHtml( AbstractEmbedService $service, array $config = []
3533
}
3634

3735
$width = (int)$service->getWidth();
38-
$widthPad = $width + 8;
36+
$height = (int)$service->getHeight();
3937

4038
$config = array_merge(
4139
[
42-
'outerClass' => 'embedvideo',
43-
'class' => 'embedvideo thumbinner',
40+
'class' => 'embedvideo',
4441
'style' => '',
45-
'innerClass' => 'embedvideo-wrapper',
4642
'service' => '',
4743
'withConsent' => false,
44+
'autoresize' => false,
4845
'description' => '',
4946
],
5047
$config
5148
);
5249

50+
$inlineStyles = [
51+
'container' => $config['style'] ?? '',
52+
'wrapper' => '',
53+
];
54+
55+
if ( $config['autoresize'] === true ) {
56+
$config['class'] .= ' embedvideo--autoresize';
57+
} else {
58+
// Autoresize does not need inline width and height
59+
$inlineStyles['container'] .= sprintf( 'width:%dpx', $width );
60+
$inlineStyles['wrapper'] .= sprintf( 'height:%dpx', $height );
61+
}
62+
5363
$caption = !empty( $config['description'] ?? '' )
54-
? sprintf( '<div class="thumbcaption">%s</div>', $config['description'] )
64+
? sprintf( '<figcaption>%s</figcaption>', $config['description'] )
5565
: '';
5666

67+
foreach ( $inlineStyles as &$inlineStyle ) {
68+
if ( !empty( $inlineStyle ) ) {
69+
$inlineStyle = sprintf( 'style="%s"', $inlineStyle );
70+
}
71+
}
72+
73+
/**
74+
* TODO: Sync syntax with core image syntax
75+
* @see: https://www.mediawiki.org/wiki/Help:Images
76+
*
77+
* 1. Make caption/description acts the same as core, any unnamed attribute will become caption
78+
* 2. Sync container attribute with core
79+
* 3. typeof should be set according to attribute instead of hard-coded
80+
*/
81+
/**
82+
* @see https://www.mediawiki.org/wiki/Specs/HTML/2.7.0#Audio/Video
83+
*/
5784
$template = <<<HTML
58-
<div class="thumb %s" style="width: %dpx;">
59-
<div class="%s" style="%s">
60-
<div class="%s" data-service="%s" style="width: %dpx">%s%s</div>%s
61-
</div>
62-
</div>
85+
<figure class="%s" data-service="%s" %s>
86+
<span class="embedvideo-wrapper" %s>%s%s</span>%s
87+
</figure>
6388
HTML;
6489

6590
return sprintf(
6691
$template,
67-
$config['outerClass'] ?? '',
68-
$widthPad,
6992
$config['class'] ?? '',
70-
$config['style'] ?? '',
71-
$config['innerClass'] ?? '',
7293
$config['service'] ?? '',
73-
$width,
94+
$inlineStyles['container'],
95+
$inlineStyles['wrapper'],
7496
( $config['withConsent'] ?? false ) === true ? self::makeConsentContainerHtml( $service ) : '',
7597
$service,
7698
$caption
@@ -131,7 +153,11 @@ public static function makeThumbHtml( AbstractEmbedService $service ): string {
131153
}
132154

133155
try {
134-
$url = wfExpandUrl( $service->getLocalThumb()->getUrl() );
156+
if ( method_exists( MediaWikiServices::class, 'getUrlUtils' ) ) {
157+
$url = MediaWikiServices::getInstance()->getUrlUtils()->expand( $service->getLocalThumb()->getUrl() );
158+
} else {
159+
$url = wfExpandUrl( $service->getLocalThumb()->getUrl() );
160+
}
135161

136162
// phpcs:disable
137163
return <<<HTML

0 commit comments

Comments
 (0)