0 Votes

Changes for page JW Player

Last modified by Ryan C on 2025/04/30 07:54

From version 2.1
edited by Ryan C
on 2025/03/07 20:27
Change comment: Install extension [org.xwiki.contrib:macro-jwplayer-ui/2.2.1]
To version 1.1
edited by Ryan C
on 2025/03/06 16:50
Change comment: Install extension [org.xwiki.contrib:macro-jwplayer/2.1.3]

Summary

Details

XWiki.JavaScriptExtension[0]
Code
... ... @@ -10,24 +10,17 @@
10 10  });
11 11  require(['jQueryNoConflict', 'jwplayer'], function($, jwplayer) {
12 12   jwplayer.key="QowE9R/MhMc1H2U6HxMlLTxvbtbk+uhwkexhBQ==";
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);
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 + });
33 33  });
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -10,8 +10,8 @@
10 10   #set ($attachmentReference = $services.model.resolveAttachment($reference, 'explicit', $doc.documentReference))
11 11   #set ($reference = $xwiki.getAttachmentURL($services.model.serialize($attachmentReference.parent), $attachmentReference.name))
12 12  #end
13 -#set ($width = $numbertool.toNumber($xcontext.macro.params.width).intValue())
14 -#set ($height = $numbertool.toNumber($xcontext.macro.params.height).intValue())
13 +#set ($width = $mathtool.toInteger($xcontext.macro.params.width))
14 +#set ($height = $mathtool.toInteger($xcontext.macro.params.height))
15 15  #set ($autostart = $xcontext.macro.params.autostart == 'true')
16 16  #set ($repeat = $xcontext.macro.params.repeat == 'true')
17 17  #set ($attributes = [