Зміни в документі JW Player

Остання зміна 2026/01/15 12:29 автором superadmin

Від версії 1.1
редаговано superadmin
дата 2020/04/29 22:56
Змінити коментар: Install extension [org.xwiki.contrib:macro-jwplayer/2.1.3]
До версії 3.1
редаговано superadmin
дата 2021/08/12 16:28
Змінити коментар: Install extension [org.xwiki.contrib:macro-jwplayer/2.1.6]

Підсумок

Подробиці

XWiki.JavaScriptExtension[0]
Код
... ... @@ -10,17 +10,24 @@
10 10  });
11 11  require(['jQueryNoConflict', 'jwplayer'], function($, jwplayer) {
12 12   jwplayer.key="QowE9R/MhMc1H2U6HxMlLTxvbtbk+uhwkexhBQ==";
13 - $('.jwplayer').each(function(index) {
14 - var options = {
15 - file: $(this).attr('data-source'),
16 - autostart: $(this).hasClass('autostart'),
17 - repeat: $(this).hasClass('repeat')
18 - };
19 - var width = $(this).attr('data-width');
20 - width && (options.width = width);
21 - var height = $(this).attr('data-height');
22 - height && (options.height = height);
23 - this.id = this.id || ('jwplayer' + index);
24 - jwplayer(this.id).setup(options);
25 - });
13 +
14 + var init = function(event, data) {
15 + var container = $((data && data.elements) || document);
16 + container.find('.jwplayer').each(function(index) {
17 + var options = {
18 + file: $(this).attr('data-source'),
19 + autostart: $(this).hasClass('autostart'),
20 + repeat: $(this).hasClass('repeat')
21 + };
22 + var width = $(this).attr('data-width');
23 + width && (options.width = width);
24 + var height = $(this).attr('data-height');
25 + height && (options.height = height);
26 + this.id = this.id || ('jwplayer' + index);
27 + jwplayer(this.id).setup(options);
28 + });
29 + };
30 +
31 + $(document).on('xwiki:dom:updated', init);
32 + $(init);
26 26  });