Index: branches/MwEmbedStandAlone/modules/SwarmTransport/loader.js |
— | — | @@ -15,23 +15,23 @@ |
16 | 16 | /** |
17 | 17 | * If SwarmTransport should be enabled by default as video transport mechanism |
18 | 18 | */ |
19 | | - 'SwarmTransport.enable': true, |
| 19 | + 'SwarmTransport.Enable': true, |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * If the swarm transport plugin should be recommended if the user does not have it installed. |
23 | 23 | */ |
24 | | - 'SwarmTransport.recommend' : false, |
| 24 | + 'SwarmTransport.Recommend' : false, |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Lookup service url |
28 | 28 | */ |
29 | | - 'SwarmTransport.torrentLookupUrl' : 'http://url2torrent.net/get/' |
| 29 | + 'SwarmTransport.TorrentLookupUrl' : 'http://url2torrent.net/get/' |
30 | 30 | }); |
31 | 31 | |
32 | 32 | // Add the mw.SwarmTransport to the embedPlayer loader: |
33 | 33 | $j( mw ).bind( 'LoaderEmbedPlayerUpdateRequest', function( event, playerElement, classRequest ) { |
34 | 34 | // If the swarm transport is enabled add mw.SwarmTransport to the request. |
35 | | - if( mw.getConfig( 'SwarmTransport.enable' ) ) { |
| 35 | + if( mw.getConfig( 'SwarmTransport.Enable' ) ) { |
36 | 36 | if( $j.inArray( 'mw.SwarmTransport', classRequest ) == -1 ) { |
37 | 37 | classRequest.push( [ 'mw.SwarmTransport' ]); |
38 | 38 | } |
Index: branches/MwEmbedStandAlone/modules/SwarmTransport/tests/SwarmTransprot_Url.html |
— | — | @@ -12,9 +12,9 @@ |
13 | 13 | <script type="text/javascript"> |
14 | 14 | |
15 | 15 | // Set configuration: |
16 | | - mw.setConfig( 'SwarmTransport.enable', true ); |
| 16 | + mw.setConfig( 'SwarmTransport.Enable', true ); |
17 | 17 | |
18 | | - mw.setConfig( 'SwarmTransport.recommend', true ); |
| 18 | + mw.setConfig( 'SwarmTransport.Recommend', true ); |
19 | 19 | |
20 | 20 | </script> |
21 | 21 | </head> |
Index: branches/MwEmbedStandAlone/modules/SwarmTransport/tests/SwarmTransport_CommonsApi.html |
— | — | @@ -12,9 +12,9 @@ |
13 | 13 | <script type="text/javascript"> |
14 | 14 | |
15 | 15 | // Set configuration: |
16 | | - mw.setConfig( 'SwarmTransport.enable', true ); |
| 16 | + mw.setConfig( 'SwarmTransport.Enable', true ); |
17 | 17 | |
18 | | - mw.setConfig( 'SwarmTransport.recommend', true ); |
| 18 | + mw.setConfig( 'SwarmTransport.Recommend', true ); |
19 | 19 | |
20 | 20 | </script> |
21 | 21 | </head> |
Index: branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | // Check if we have a "recommend" binding and provide an xpi install link |
34 | 34 | mw.log('SwarmTransport::bind:addControlBindingsEvent'); |
35 | 35 | $j( embedPlayer ).bind( 'addControlBindingsEvent', function(){ |
36 | | - if( mw.getConfig( 'SwarmTransport.recommend' ) && |
| 36 | + if( mw.getConfig( 'SwarmTransport.Recommend' ) && |
37 | 37 | typeof window['swarmTransport'] == 'undefined' && |
38 | 38 | $j.browser.mozilla ) |
39 | 39 | { |
— | — | @@ -75,10 +75,10 @@ |
76 | 76 | 'url' : mw.absoluteUrl( source.getSrc() ) |
77 | 77 | } |
78 | 78 | |
79 | | - mw.log( 'SwarmTransport:: lookup torrent url: ' + mw.getConfig( 'SwarmTransport.torrentLookupUrl' ) + "\n" + mw.absoluteUrl( source.getSrc() )); |
| 79 | + mw.log( 'SwarmTransport:: lookup torrent url: ' + mw.getConfig( 'SwarmTransport.TorrentLookupUrl' ) + "\n" + mw.absoluteUrl( source.getSrc() )); |
80 | 80 | // Setup function to run in context based on callback result |
81 | 81 | $j.getJSON( |
82 | | - mw.getConfig( 'SwarmTransport.torrentLookupUrl' ) + '?jsonp=?', |
| 82 | + mw.getConfig( 'SwarmTransport.TorrentLookupUrl' ) + '?jsonp=?', |
83 | 83 | torrentLookupRequest, |
84 | 84 | function( data ){ |
85 | 85 | // Check if the torrent is ready: |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -2049,7 +2049,7 @@ |
2050 | 2050 | 'runBaseControlDone' : true |
2051 | 2051 | } |
2052 | 2052 | |
2053 | | - // run the ended trigger ( allow the ended object to prevent default actions ) |
| 2053 | + // Run the ended trigger ( allow the ended object to prevent default actions ) |
2054 | 2054 | $j( this ).trigger( 'ended', onDoneActionObject ); |
2055 | 2055 | |
2056 | 2056 | if( onDoneActionObject.runBaseControlDone ){ |
— | — | @@ -2750,11 +2750,13 @@ |
2751 | 2751 | * There is no general way to pause the video |
2752 | 2752 | * must be overwritten by embed object to support this functionality. |
2753 | 2753 | */ |
2754 | | - pause: function() { |
2755 | | - var _this = this; |
2756 | | - // mw.log('mwEmbed:do pause'); |
2757 | | - // (playing) do pause |
2758 | | - this.paused = true; |
| 2754 | + pause: function( event ) { |
| 2755 | + var _this = this; |
| 2756 | + if( this.paused === false ){ |
| 2757 | + this.paused = true; |
| 2758 | + $j( this ).trigger('pause'); |
| 2759 | + } |
| 2760 | + mw.log('mwEmbed:embedPlayer::pause() '); |
2759 | 2761 | |
2760 | 2762 | // update the ctrl "paused state" |
2761 | 2763 | this.$interface.find('.play-btn span' ) |
— | — | @@ -2767,7 +2769,7 @@ |
2768 | 2770 | .click( function() { |
2769 | 2771 | _this.play(); |
2770 | 2772 | } ) |
2771 | | - .attr( 'title', gM( 'mwe-embedplayer-play_clip' ) ); |
| 2773 | + .attr( 'title', gM( 'mwe-embedplayer-play_clip' ) ); |
2772 | 2774 | }, |
2773 | 2775 | |
2774 | 2776 | /** |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js |
— | — | @@ -495,16 +495,15 @@ |
496 | 496 | * Handle the native paused event |
497 | 497 | */ |
498 | 498 | onPaused: function(){ |
499 | | - mw.log("native:paused:trigger"); |
500 | | - this.pause(); |
501 | | - $j( this ).trigger( 'pause' ); |
| 499 | + mw.log("native:paused"); |
| 500 | + this.pause(); |
502 | 501 | }, |
503 | 502 | |
504 | 503 | /** |
505 | 504 | * Handle the native play event |
506 | 505 | */ |
507 | 506 | onPlay: function(){ |
508 | | - mw.log("native::play::trigger"); |
| 507 | + mw.log("native::play"); |
509 | 508 | if( !this.isPlaying () ){ |
510 | 509 | this.play(); |
511 | 510 | } |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | 'panzoom' : { |
37 | 37 | 'editWidgets' : ['panzoom'], |
38 | 38 | 'editableAttributes' : [ 'panZoom' ], |
39 | | - 'contentTypes': ['video', 'img'], |
| 39 | + 'contentTypes': [ 'img'], // xxx todo add video support |
40 | 40 | 'animate' : 'true' |
41 | 41 | }, |
42 | 42 | 'transitions' : { |
— | — | @@ -153,6 +153,12 @@ |
154 | 154 | 'onChange': function( _this, target, smilClip ){ |
155 | 155 | var panZoomVal = $j('#' +_this.getEditToolInputId( 'panzoom', 'panZoom')).val(); |
156 | 156 | mw.log("panzoom change:" + panZoomVal ); |
| 157 | + // Update on the current smil clip display: |
| 158 | + _this.sequencer.getSmil() |
| 159 | + .getLayout() |
| 160 | + .panZoomLayout( |
| 161 | + smilClip |
| 162 | + ); |
157 | 163 | }, |
158 | 164 | 'draw': function( _this, target, smilClip ){ |
159 | 165 | var orginalHelperCss = { |
— | — | @@ -223,19 +229,27 @@ |
224 | 230 | var updatePanZoomFromUiValue = function( layout ){ |
225 | 231 | var pz = startPanZoomVal.split(','); |
226 | 232 | // Set the new percent offset to x/2 |
227 | | - if( layout.left ) |
228 | | - pz[0] = ( parseInt( pz[0] ) + ( layout.left / 2 ) ) + '%'; |
| 233 | + if( layout.left ){ |
| 234 | + pz[0] = ( parseInt( pz[0] ) - ( layout.left ) ) + '%'; |
| 235 | + } |
229 | 236 | |
230 | | - if( layout.top ) |
231 | | - pz[1] = ( parseInt( pz[1] ) + ( layout.top / 2 ) )+ '%'; |
| 237 | + if( layout.top ){ |
| 238 | + pz[1] = ( parseInt( pz[1] ) - ( layout.top ) )+ '%'; |
| 239 | + } |
232 | 240 | |
233 | | - if( layout.width ) |
234 | | - pz[2] = ( parseInt( pz[2] ) + ( layout.width / 2 ) ) + '%' |
| 241 | + if( layout.width ) { |
| 242 | + pz[2] = ( parseInt( pz[2] ) - ( layout.width / 2) ) + '%' |
235 | 243 | |
236 | | - if( layout.height ) |
237 | | - pz[2] = ( parseInt( pz[2] ) + ( layout.width / 2 ) ) + '%' |
238 | | - |
239 | | - var smilPanZoomValue = pz.join(', '); |
| 244 | + // right now only keep aspect is supported do size hack:: |
| 245 | + pz[3] = parseInt( pz[2] ) * _this.sequencer.getSmil().getLayout().getTargetAspectRatio(); |
| 246 | + // only have 2 significant digits |
| 247 | + pz[3] = ( Math.round( pz[3]* 100 ) / 100 ) + '%'; |
| 248 | + } |
| 249 | + // Trim all the values |
| 250 | + for(var i=0; i < pz.length; i++){ |
| 251 | + pz[i] = $j.trim( pz[i] ); |
| 252 | + } |
| 253 | + var smilPanZoomValue = pz.join(', '); |
240 | 254 | |
241 | 255 | // Update the smil DOM: |
242 | 256 | $j( smilClip ).attr( 'panZoom', smilPanZoomValue ); |
— | — | @@ -461,7 +475,8 @@ |
462 | 476 | $toolsContainer = $j('<div />') |
463 | 477 | .addClass( 'editToolsContainer' ) |
464 | 478 | .css( { |
465 | | - 'height': '80%' |
| 479 | + 'height': '80%', |
| 480 | + 'overflow': 'auto' |
466 | 481 | }) |
467 | 482 | .append( |
468 | 483 | $j('<ul />') |
— | — | @@ -499,7 +514,7 @@ |
500 | 515 | // Append the tooltab container |
501 | 516 | $toolsContainer.append( |
502 | 517 | $j('<div />') |
503 | | - .css({'height' : '100%', 'overflow': 'auto'}) |
| 518 | + .css({'height' : '100%' }) |
504 | 519 | .attr('id', 'tooltab_' + toolId ) |
505 | 520 | .append( |
506 | 521 | $j('<h3 />').text( gM('mwe-sequencer-tools-' + toolId + '-desc') ) |
Index: branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js |
— | — | @@ -5,6 +5,10 @@ |
6 | 6 | * Supports basic "sequencer" functionality as a javascript rewrite system. |
7 | 7 | */ |
8 | 8 | |
| 9 | +// Wrap in mw to not pollute global namespace |
| 10 | +( function( mw ) { |
| 11 | + |
| 12 | + |
9 | 13 | mw.addMessageKeys( [ |
10 | 14 | "mwe-sequencer-no-sequence-create", |
11 | 15 | "mwe-sequencer-create-sequence", |
— | — | @@ -20,7 +24,9 @@ |
21 | 25 | "mwe-sequencer-loading-publish-render", |
22 | 26 | |
23 | 27 | "mwe-sequencer-not-published", |
24 | | - "mwe-sequencer-published-out-of-date" |
| 28 | + "mwe-sequencer-published-out-of-date", |
| 29 | + "mwe-sequencer-you-can-edit-this-video", |
| 30 | + "mwe-sequencer-using-kaltura-video-editor" |
25 | 31 | ]); |
26 | 32 | |
27 | 33 | /* exported functions */ |
— | — | @@ -43,6 +49,140 @@ |
44 | 50 | return url; |
45 | 51 | }, |
46 | 52 | |
| 53 | +// Add player pause binding if config is set:: |
| 54 | +$j( mw ).bind( 'newEmbedPlayerEvent', function( event, embedPlayerId ) { |
| 55 | + if( mw.getConfig( 'Sequencer.KalturaPlayerEditOverlay' )){ |
| 56 | + var embedPlayer = $j( '#' + embedPlayerId ).get(0); |
| 57 | + |
| 58 | + $j( embedPlayer ).bind( 'pause', function() { |
| 59 | + // For now don't overlay smil players ( used in editor ) |
| 60 | + // xxx in the future we should have an editor class |
| 61 | + if( embedPlayer.supports['overlays'] && embedPlayer.instanceOf.toLowerCase() != 'smil' ){ |
| 62 | + mw.remoteSequencerAddEditOverlay( embedPlayerId ) |
| 63 | + // xxx should use getter setter |
| 64 | + embedPlayer.controlBuilder.displayOptionsMenuFlag = true; |
| 65 | + } |
| 66 | + return true; |
| 67 | + }) |
| 68 | + $j( embedPlayer ).bind( 'onend', function( onDoneAction ){ |
| 69 | + // pause event should fire |
| 70 | + //mw.remoteSequencerAddEditOverlay( embedPlayerId ) |
| 71 | + |
| 72 | + // show the credits screen after 3 seconds |
| 73 | + setTimeout(function(){ |
| 74 | + $j( embedPlayer ).siblings( '.kalturaEditOverlay' ).fadeOut( 'fast' ); |
| 75 | + embedPlayer.$interface.find('.k-menu').fadeIn('fast'); |
| 76 | + },3000) |
| 77 | + |
| 78 | + // On end runs before interface bindings (give the dom 10ms to build out the menu ) |
| 79 | + setTimeout(function(){ |
| 80 | + $j( embedPlayer ).siblings( '.k-menu' ).hide(); |
| 81 | + },10) |
| 82 | + }); |
| 83 | + $j( embedPlayer ).bind( 'play', function(){ |
| 84 | + $j( embedPlayer ).siblings( '.kalturaEditOverlay' ).fadeOut( 'fast' ); |
| 85 | + embedPlayer.controlBuilder.displayOptionsMenuFlag = false; |
| 86 | + return true ; |
| 87 | + }); |
| 88 | + } |
| 89 | +}); |
| 90 | +mw.remoteSequencerAddEditOverlay = function( embedPlayerId ){ |
| 91 | + var embedPlayer = $j( '#' + embedPlayerId ).get(0); |
| 92 | + if(! $j( '#' + embedPlayerId ).siblings( '.kalturaEditOverlay' ).length ){ |
| 93 | + var editLink = '#'; |
| 94 | + if( mw.isLocalDomain( mw.getApiProviderURL( embedPlayer.apiProvider ) ) |
| 95 | + && |
| 96 | + embedPlayer.apiTitleKey ) |
| 97 | + { |
| 98 | + var seqTitle = embedPlayer.apiTitleKey |
| 99 | + .replace( 'Sequence-', 'Sequence:') |
| 100 | + // strip the extension |
| 101 | + seqTitle = seqTitle.substr(0, seqTitle.length -4 ); |
| 102 | + // not ideal details page builder but 'should work' :: |
| 103 | + editLink = mw.getApiProviderURL( embedPlayer.apiProvider ).replace( 'api.php', 'index.php' ); |
| 104 | + editLink = mw.replaceUrlParams( editLink, |
| 105 | + { |
| 106 | + 'title' : seqTitle, |
| 107 | + 'action' : 'edit' |
| 108 | + } |
| 109 | + ); |
| 110 | + } |
| 111 | + var kalturaLinkAttr = { |
| 112 | + 'href': 'http://kaltura.com', |
| 113 | + 'target' : '_new', |
| 114 | + 'title' : gM('mwe-embedplayer-kaltura-platform-title') |
| 115 | + }; |
| 116 | + $j( '#' + embedPlayerId ).before( |
| 117 | + $j( '<div />' ) |
| 118 | + .addClass( 'kalturaEditOverlay' ) |
| 119 | + .css({ |
| 120 | + 'position' : 'absolute', |
| 121 | + 'width' : '100%', |
| 122 | + 'top' : '0px', |
| 123 | + 'bottom' : '22px', |
| 124 | + 'background' : 'none repeat scroll 0 0 #FFF', |
| 125 | + 'color' : 'black', |
| 126 | + 'opacity': 0.9, |
| 127 | + 'z-index': 999 |
| 128 | + }) |
| 129 | + .append( |
| 130 | + $j('<div />') |
| 131 | + .css({ |
| 132 | + 'position' : 'absolute', |
| 133 | + |
| 134 | + 'width' : '200px', |
| 135 | + 'margin-left' : '-100px', |
| 136 | + |
| 137 | + 'height' : '100px', |
| 138 | + 'margin-top' : '-50px', |
| 139 | + |
| 140 | + 'top' : '50%', |
| 141 | + 'left' : '50%', |
| 142 | + 'text-align' : 'center' |
| 143 | + }) |
| 144 | + .append( |
| 145 | + gM('mwe-sequencer-you-can-edit-this-video', |
| 146 | + $j('<a />') |
| 147 | + .attr({ |
| 148 | + 'href': editLink, |
| 149 | + 'target': '_new' |
| 150 | + }) |
| 151 | + .click(function(){ |
| 152 | + // load the editor in-place if on the same domain as the sequence |
| 153 | + if( editLink == '#' ){ |
| 154 | + if( ! window.mwSequencerRemote ){ |
| 155 | + window.mwSequencerRemote = new mw.MediaWikiRemoteSequencer({ |
| 156 | + 'title' : embedPlayer.apiTitleKey |
| 157 | + }); |
| 158 | + } |
| 159 | + window.mwSequencerRemote.showEditor(); |
| 160 | + return false; |
| 161 | + } |
| 162 | + return true; |
| 163 | + }) |
| 164 | + ), |
| 165 | + $j( '<br />' ) |
| 166 | + , |
| 167 | + gM( 'mwe-sequencer-using-kaltura-video-editor', |
| 168 | + $j('<a />') |
| 169 | + .attr( kalturaLinkAttr ) |
| 170 | + ) |
| 171 | + , |
| 172 | + $j('<a />') |
| 173 | + .attr( kalturaLinkAttr ) |
| 174 | + .append( |
| 175 | + $j('<div />') |
| 176 | + .addClass('mwe-kalturaLogoLarge') |
| 177 | + ) |
| 178 | + ) |
| 179 | + ) |
| 180 | + .hide() // hide .kalturaEditOverlay by default |
| 181 | + ); |
| 182 | + } |
| 183 | + |
| 184 | + $j( '#' + embedPlayerId ).siblings( '.kalturaEditOverlay' ) |
| 185 | + .fadeIn('fast'); |
| 186 | +} |
47 | 187 | mw.MediaWikiRemoteSequencer = function( options ) { |
48 | 188 | return this.init( options ); |
49 | 189 | }; |
— | — | @@ -150,7 +290,7 @@ |
151 | 291 | }, |
152 | 292 | |
153 | 293 | |
154 | | - getSequenceFileKey: function( wgPageName ){ |
| 294 | + getSequenceFileKey: function(){ |
155 | 295 | return 'File:' + wgPageName.replace( 'Sequence:', 'Sequence-') + '.ogv'; |
156 | 296 | }, |
157 | 297 | |
— | — | @@ -161,7 +301,7 @@ |
162 | 302 | // Check if the sequence has been flattened and is up to date: |
163 | 303 | var request = { |
164 | 304 | 'action': 'query', |
165 | | - 'titles': _this.getSequenceFileKey( wgPageName ), |
| 305 | + 'titles': _this.getSequenceFileKey(), |
166 | 306 | 'prop': 'imageinfo|revisions', |
167 | 307 | 'iiprop': 'url|metadata', |
168 | 308 | 'iiurlwidth': '400', |
— | — | @@ -291,8 +431,16 @@ |
292 | 432 | }) |
293 | 433 | }, |
294 | 434 | getSequenceEmbedCode: function(){ |
295 | | - return 'embed code here'; |
| 435 | + var editLink = wgServer + wgArticlePath.replace('$1', wgTitle ); |
| 436 | + editLink = mw.replaceUrlParams( editLink, {'action' : 'edit' }); |
| 437 | + |
| 438 | + return '[[' + this.getSequenceFileKey() + "|thumb|400px|right|\n\n" + |
| 439 | + "Sequence " + this.getTitle() + " \n\n" + |
| 440 | + "<br/>Edit this sequence with the [" + |
| 441 | + mw.getRemoteSequencerLink ( editLink ) + |
| 442 | + ' kaltura editor] ]]'; |
296 | 443 | }, |
| 444 | + |
297 | 445 | showEditor: function(){ |
298 | 446 | var _this = this; |
299 | 447 | |
— | — | @@ -327,8 +475,10 @@ |
328 | 476 | return { |
329 | 477 | // The title for this sequence: |
330 | 478 | title : _this.getTitle(), |
331 | | - // If the sequence is new |
| 479 | + |
| 480 | + // If the sequence is new |
332 | 481 | newSequence : ( wgArticleId == 0 ), |
| 482 | + |
333 | 483 | // Server config: |
334 | 484 | server: { |
335 | 485 | 'type' : 'mediaWiki', |
— | — | @@ -376,4 +526,6 @@ |
377 | 527 | // set page to loading |
378 | 528 | // display sequence editor in "body" with -> full-screen link |
379 | 529 | }; //Setup the remote configuration |
380 | | - |
\ No newline at end of file |
| 530 | + |
| 531 | + |
| 532 | +} )( window.mw ); |
\ No newline at end of file |
Index: branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.style.SequencerRemote.css |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +.mwe-kalturaLogoLarge{ |
| 3 | + width: 50px; |
| 4 | + height: 50px; |
| 5 | + background: url( 'images/kaltura_logo_transparent_large.png'); |
| 6 | + margin : auto; |
| 7 | + cursor : pointer; |
| 8 | +} |
Index: branches/MwEmbedStandAlone/modules/Sequencer/remotes/images/kaltura_logo_transparent_large.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/remotes/images/kaltura_logo_transparent_large.png |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 9 | + application/octet-stream |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js |
— | — | @@ -197,11 +197,10 @@ |
198 | 198 | 'titles' : _this.titleKey, |
199 | 199 | 'rvprop' : 'user|comment|timestamp' |
200 | 200 | }; |
201 | | - mw.getJSON( _this.getApiUrl(), request, function( data ) { |
202 | | - debugger; |
203 | | - if( data.query && data.pages ){ |
204 | | - for( page_id in data.pages ){ |
205 | | - var page = data.pages[page_id]; |
| 201 | + mw.getJSON( _this.getApiUrl(), request, function( data ) { |
| 202 | + if( data.query && data.query.pages ){ |
| 203 | + for( page_id in data.query.pages ){ |
| 204 | + var page = data.query.pages[page_id]; |
206 | 205 | if( page.revisions && page.revisions[0] && page.revisions[0].comment ){ |
207 | 206 | callback( page.revisions[0].comment ); |
208 | 207 | return; |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js |
— | — | @@ -434,9 +434,9 @@ |
435 | 435 | _this.sequencer.getActionsEdit().registerEdit(); |
436 | 436 | |
437 | 437 | // Select the current clip |
438 | | - var $timelineClip = $clipTrackSet.find('#' + this.getTimelineClipId( smilClip ) ) |
| 438 | + var $timelineClip = $clipTrackSet.find('#' + _this.getTimelineClipId( smilClip ) ) |
439 | 439 | if( $timelineClip.length == 0 ){ |
440 | | - mw.log("Error: insertSmilClipEdit: could not find clip: " + this.getTimelineClipId( smilClip ) ); |
| 440 | + mw.log("Error: insertSmilClipEdit: could not find clip: " + _this.getTimelineClipId( smilClip ) ); |
441 | 441 | } |
442 | 442 | _this.getTimelineContainer().find( '.selectedClip' ).removeClass( 'selectedClip' ); |
443 | 443 | $timelineClip.addClass( 'selectedClip' ); |
Index: branches/MwEmbedStandAlone/modules/Sequencer/loader.js |
— | — | @@ -5,9 +5,15 @@ |
6 | 6 | // Wrap in mw to not pollute global namespace |
7 | 7 | ( function( mw ) { |
8 | 8 | |
| 9 | + // Loader configuration options ( all runtime options are stored in mw.SequencerConfig.js ) |
| 10 | + mw.setDefaultConfig({ |
| 11 | + 'Sequencer.KalturaPlayerEditOverlay' : true |
| 12 | + }); |
| 13 | + |
| 14 | + |
9 | 15 | mw.addResourcePaths( { |
10 | 16 | "mw.Sequencer" : "mw.Sequencer.js", |
11 | | - "mw.style.Sequencer" : "mw.style.Sequencer.css", |
| 17 | + "mw.style.Sequencer" : "mw.style.Sequencer.css", |
12 | 18 | |
13 | 19 | "mw.SequencerConfig" : "mw.SequencerConfig.js", |
14 | 20 | |
— | — | @@ -30,6 +36,8 @@ |
31 | 37 | "$j.fn.layout" : "ui.layout/ui.layout-1.2.0.js", |
32 | 38 | |
33 | 39 | "mw.MediaWikiRemoteSequencer" : "remotes/mw.MediaWikiRemoteSequencer.js", |
| 40 | + "mw.style.SequencerRemote" : "remotes/mw.style.SequencerRemote.css", |
| 41 | + |
34 | 42 | "mw.style.Sequencer" : "css/mw.style.Sequencer.css" |
35 | 43 | |
36 | 44 | } ); |
— | — | @@ -91,5 +99,16 @@ |
92 | 100 | ]; |
93 | 101 | }); |
94 | 102 | |
| 103 | + // If doing player overlays include remote for player hooks |
| 104 | + $j( mw ).bind( 'LoaderEmbedPlayerUpdateRequest', function( event, playerElement, classRequest ) { |
| 105 | + if( mw.getConfig( 'Sequencer.KalturaPlayerEditOverlay' )){ |
| 106 | + if( $j.inArray( 'mw.MediaWikiRemoteSequencer', classRequest ) == -1 ) { |
| 107 | + classRequest.push('mw.MediaWikiRemoteSequencer'); |
| 108 | + classRequest.push('mw.style.SequencerRemote'); |
| 109 | + } |
| 110 | + } |
| 111 | + }) |
| 112 | + |
| 113 | + |
95 | 114 | } )( window.mw ); |
96 | 115 | |
\ No newline at end of file |
Index: branches/MwEmbedStandAlone/modules/Sequencer/css/mw.style.Sequencer.css |
— | — | @@ -1,5 +1,4 @@ |
2 | 2 | |
3 | | - |
4 | 3 | .mwe-sequencer .timelineTrackContainer{ |
5 | 4 | position: absolute; |
6 | 5 | border: solid thin #999; |
Index: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php |
— | — | @@ -8,8 +8,11 @@ |
9 | 9 | |
10 | 10 | $messages = array(); |
11 | 11 | $messages['en'] = array( |
12 | | - 'mwe-sequencer-loading-sequencer' => 'Loading sequencer ...', |
13 | | - |
| 12 | + 'mwe-sequencer-loading-sequencer' => 'Loading sequencer ...', |
| 13 | + |
| 14 | + 'mwe-sequencer-you-can-edit-this-video' => 'You can [$1 edit this video]', |
| 15 | + 'mwe-sequencer-using-kaltura-video-editor' => 'Using the [$1 Kaltura] video editor', |
| 16 | + |
14 | 17 | 'mwe-sequencer-visual-editor'=> "Visual sequence editor", |
15 | 18 | 'mwe-sequencer-text-editor-warn'=> 'Text XML editor ( not recommended ) ', |
16 | 19 | 'mwe-sequencer-restore-text-edit' => '[$1 Restore text editor] ( note this <i>highly</i> recommended that you use the visual editor )', |
— | — | @@ -58,7 +61,7 @@ |
59 | 62 | 'mwe-sequencer-create-sequence' => 'Create sequence', |
60 | 63 | 'mwe-sequencer-edit-sequence' => 'Edit sequence', |
61 | 64 | |
62 | | - 'mwe-sequencer-embed-sequence' => 'Embed Sequence into article', |
| 65 | + 'mwe-sequencer-embed-sequence' => 'Embed Sequence into an article', |
63 | 66 | 'mwe-sequencer-embed-sequence-desc' => 'Copy the following code into an article to embed this sequence', |
64 | 67 | |
65 | 68 | 'mwe-sequencer-menu-sequence' => 'Sequence', |
Index: branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsEdit.js |
— | — | @@ -26,6 +26,7 @@ |
27 | 27 | getNumberOfUndos: function(){ |
28 | 28 | return mw.getConfig( 'Sequencer.NumberOfUndos' ); |
29 | 29 | }, |
| 30 | + |
30 | 31 | selectAll: function(){ |
31 | 32 | // Select all the items in the timeline |
32 | 33 | $target = this.sequencer.getTimeline().getTimelineContainer(); |
— | — | @@ -92,9 +93,11 @@ |
93 | 94 | // index out of range set to 0 |
94 | 95 | this.editIndex = 0; |
95 | 96 | mw.log("Error: SequenceActionsEdit:: undo Already at oldest index:" + this.editIndex); |
| 97 | + // make sure to disable the menu item: |
| 98 | + this.sequencer.getMenu().disableMenuItem( 'edit', 'undo' ); |
96 | 99 | } |
97 | 100 | // if at oldest undo disable undo option |
98 | | - if( ( this.editIndex - 1 ) < 0 ){ |
| 101 | + if( ( this.editIndex - 1 ) <= 0 ){ |
99 | 102 | this.sequencer.getMenu().disableMenuItem( 'edit', 'undo' ); |
100 | 103 | } |
101 | 104 | }, |
Index: branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js |
— | — | @@ -225,7 +225,7 @@ |
226 | 226 | }; |
227 | 227 | |
228 | 228 | $dialog.empty().append( |
229 | | - gM('mwe-sequencer-save-summary' ), |
| 229 | + gM('mwe-sequencer-save-summary' ), |
230 | 230 | $j('<input />') |
231 | 231 | .css({ 'width': 400 }) |
232 | 232 | .attr({ |
— | — | @@ -286,12 +286,13 @@ |
287 | 287 | $dialog.dialog( 'option', 'buttons', buttons); |
288 | 288 | } |
289 | 289 | }); |
290 | | - |
291 | | - |
292 | | - |
293 | 290 | }, |
294 | 291 | doPublish: function( $dialog ){ |
295 | 292 | var _this = this; |
| 293 | + // disable drag and resize |
| 294 | + $dialog.dialog("option", "draggable", false ) |
| 295 | + $dialog.dialog( "option", "resizable", false ); |
| 296 | + |
296 | 297 | // Get a Firefogg object to check if firefogg is installed |
297 | 298 | var myFogg = new mw.Firefogg( { |
298 | 299 | 'only_fogg':true |
— | — | @@ -326,7 +327,12 @@ |
327 | 328 | $j('<span />').attr('id', 'firefoggPercentDone') |
328 | 329 | .css('float', 'right') |
329 | 330 | .text("%"), |
330 | | - $j('<div />').attr( 'id', 'firefoggProgressbar') |
| 331 | + $j('<div />') |
| 332 | + .attr( 'id', 'firefoggProgressbar') |
| 333 | + .css({ |
| 334 | + 'width': '100%', |
| 335 | + 'height' : '20px' |
| 336 | + }) |
331 | 337 | |
332 | 338 | ); |
333 | 339 | // Embed the player and continue application flow |
— | — | @@ -345,10 +351,11 @@ |
346 | 352 | progressPrecent + |
347 | 353 | '%' |
348 | 354 | ) |
349 | | - mw.log( "set progrees to: " + Math.round( progress * 100 ) ); |
350 | 355 | $j("#firefoggProgressbar").progressbar({ |
351 | 356 | "value" : Math.round( progress * 100 ) |
352 | 357 | }); |
| 358 | + // xxx WTF? no idea why progressbar above is not working |
| 359 | + $j("#firefoggProgressbar .ui-progressbar-value").css('width', Math.round( progress * 10000 ) / 100 + '%'); |
353 | 360 | }, |
354 | 361 | 'doneRenderCallback': function( fogg ){ |
355 | 362 | _this.uploadRenderedVideo( $dialog, fogg ); |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | var _this = this; |
24 | 24 | if( ! _this.remoteSearchDriver ){ |
25 | 25 | // Get any sequencer configured options |
26 | | - var addMediaOptions = _this.sequencer.getOption('AddMedia'); |
| 26 | + var addMediaOptions = _this.sequencer.getOption('addMedia'); |
27 | 27 | addMediaOptions = $j.extend( { |
28 | 28 | 'target_container' : _this.sequencer.getEditToolTarget(), |
29 | 29 | 'target_search_input' : _this.sequencer.getMenuTarget().find('input.searchMedia'), |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js |
— | — | @@ -427,8 +427,13 @@ |
428 | 428 | $j.each( $j( this.smil.getEmbedPlayer() ).find('.smilRootLayout'), function(inx, pageNode){ |
429 | 429 | // Check if the node is in the smil dom |
430 | 430 | if( _this.smil.$dom.find( '#' + _this.smil.getSmilDomId( pageNode ) ).length == 0 ){ |
431 | | - // remove from pageDom |
432 | | - $j( pageNode ).remove(); |
| 431 | + // check for parent layout helper: |
| 432 | + if( $j( pageNode ).parent('.refTransformWrap').length ){ |
| 433 | + $j( pageNode ).parent('.refTransformWrap').remove(); |
| 434 | + } else { |
| 435 | + // Remove the pageNode |
| 436 | + $j( pageNode ).remove(); |
| 437 | + } |
433 | 438 | } |
434 | 439 | }); |
435 | 440 | }, |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js |
— | — | @@ -35,6 +35,10 @@ |
36 | 36 | } |
37 | 37 | }, |
38 | 38 | |
| 39 | + getTargetAspectRatio:function(){ |
| 40 | + return this.smil.embedPlayer.getHeight() / this.smil.embedPlayer.getWidth(); |
| 41 | + }, |
| 42 | + |
39 | 43 | /* |
40 | 44 | * Get layout |
41 | 45 | */ |
— | — | @@ -82,7 +86,7 @@ |
83 | 87 | drawElement: function( smilElement ) { |
84 | 88 | var _this = this; |
85 | 89 | // Check for quick "show" path: |
86 | | - var $targetElement = this.$rootLayout.find( '#' + this.smil.getPageDomId( smilElement ) ) |
| 90 | + var $targetElement = $j( '#' + this.smil.getPageDomId( smilElement ) ); |
87 | 91 | if( $targetElement.length ){ |
88 | 92 | $targetElement.show(); |
89 | 93 | return ; |
— | — | @@ -98,22 +102,13 @@ |
99 | 103 | if( !$regionTarget ){ |
100 | 104 | return ; |
101 | 105 | } |
102 | | - |
103 | | - // Check that the element is already in the dom |
104 | | - var $targetElement = $regionTarget.find( '#' + this.smil.getPageDomId( smilElement ) ); |
105 | | - if( $targetElement.length == 0 ){ |
106 | | - mw.log(" drawElement:: " + this.smil.getPageDomId( smilElement ) ); |
107 | | - // Append the Smil to the target region |
108 | | - $regionTarget.append( |
109 | | - _this.getSmilElementHtml( smilElement ) |
110 | | - ) |
111 | | - } else { |
112 | | - // Make sure the element is visible ( may be faster to just call |
113 | | - // show directly) |
114 | | - if( $targetElement.is(':hidden') ) { |
115 | | - $targetElement.show(); |
116 | | - } |
117 | | - } |
| 106 | + |
| 107 | + // Append the Smil element to the target region |
| 108 | + _this.addSmilElementHtml($regionTarget, smilElement ) |
| 109 | + mw.log( "addSmilElementHtml Added " + |
| 110 | + this.smil.getPageDomId( smilElement ) + |
| 111 | + ' to target: ' + |
| 112 | + $j( '#' + this.smil.getPageDomId( smilElement ) ).length ); |
118 | 113 | }, |
119 | 114 | |
120 | 115 | drawElementThumb: function( $target, $node, relativeTime, callback){ |
— | — | @@ -274,44 +269,48 @@ |
275 | 270 | }, |
276 | 271 | |
277 | 272 | /** |
278 | | - * Get the transformed smil element in html format |
| 273 | + * Add the transformed smil element to the $regionTarget |
279 | 274 | * |
280 | 275 | * @param |
281 | 276 | */ |
282 | | - getSmilElementHtml: function( smilElement ) { |
283 | | - var smilType = this.smil.getRefType( smilElement ) |
284 | | - |
| 277 | + addSmilElementHtml: function( $regionTarget, smilElement ) { |
| 278 | + var _this = this; |
| 279 | + var smilType = this.smil.getRefType( smilElement ) |
285 | 280 | switch( smilType ){ |
286 | 281 | // Not part of strict smil, but saves time being able have an "html" |
287 | 282 | // display mode |
288 | 283 | case 'cdata_html': |
289 | | - return this.getSmilCDATAHtml( smilElement ); |
| 284 | + $regionTarget.append( this.getSmilCDATAHtml( smilElement ) ); |
| 285 | + return ; |
290 | 286 | break; |
291 | 287 | case 'video': |
292 | | - return this.getSmilVideoHtml( smilElement ); |
| 288 | + $regionTarget.append( this.getSmilVideoHtml( smilElement ) ); |
| 289 | + return ; |
293 | 290 | break; |
294 | 291 | case 'img': |
295 | | - return this.getSmilImgHtml( smilElement ); |
| 292 | + $regionTarget.append( this.getSmilImgHtml( smilElement ) ); |
| 293 | + // Update the asset layout ( only img supports layout atm ) |
| 294 | + _this.doSmilElementLayout( smilElement ); |
| 295 | + return ; |
296 | 296 | break; |
297 | 297 | case 'audio': |
298 | | - return this.getSmilAudioHtml( smilElement ); |
| 298 | + $regionTarget.append( this.getSmilAudioHtml( smilElement ) ); |
| 299 | + return ; |
299 | 300 | break; |
300 | | - // Smil Text: http://www.w3.org/TR/SMIL/smil-text.html ( obviously |
301 | | - // we support a subset ) |
| 301 | + // Smil Text: http://www.w3.org/TR/SMIL/smil-text.html |
| 302 | + // We support a subset |
302 | 303 | case 'smiltext': |
303 | | - return this.getSmilTextHtml( smilElement ); |
| 304 | + $regionTarget.append( this.getSmilTextHtml( smilElement ) ) ; |
| 305 | + return ; |
304 | 306 | break; |
305 | 307 | } |
| 308 | + |
306 | 309 | mw.log( "Error: Could not find smil layout transform for element type: " + |
307 | | - smilType + ' of type ' + $j( smilElement ).attr( 'type' ) ); |
308 | | - |
309 | | - return $j('<span />') |
310 | | - .attr( 'id' , this.smil.getPageDomId( smilElement ) ) |
311 | | - .css( { |
312 | | - 'position' : 'absolute', |
313 | | - 'zindex' : 9999 // xxx need to clean up z-index system |
314 | | - }) |
315 | | - .text( 'Error: unknown type:' + smilType ); |
| 310 | + smilType + ' of type ' + $j( smilElement ).attr( 'type' ) ); |
| 311 | + $regionTarget.append( $j('<span />') |
| 312 | + .attr( 'id' , this.smil.getPageDomId( smilElement ) ) |
| 313 | + .text( 'Error: unknown type:' + smilType ) |
| 314 | + ) |
316 | 315 | }, |
317 | 316 | |
318 | 317 | /** |
— | — | @@ -466,18 +465,26 @@ |
467 | 466 | .attr( { |
468 | 467 | 'id' : this.smil.getPageDomId( smilImg ), |
469 | 468 | 'src' : this.smil.getAssetUrl( $j( smilImg ).attr( 'src' ) ) |
470 | | - } ); |
471 | | - |
472 | | - _this.getNaturalSize( $image.get(0), function( naturalSize) { |
473 | | - _this.doAssetLayout( smilImg , naturalSize); |
474 | | - }) |
| 469 | + } ) |
| 470 | + // default width 100% |
| 471 | + .css('width', '100%') |
| 472 | + |
475 | 473 | return $image; |
476 | 474 | }, |
| 475 | + doSmilElementLayout: function( smilElement ){ |
| 476 | + var _this = this; |
| 477 | + |
| 478 | + var img = $j( '#' + this.smil.getPageDomId( smilElement ) ).get(0); |
| 479 | + _this.getNaturalSize( img, function( naturalSize) { |
| 480 | + _this.doAssetLayout( smilElement , naturalSize); |
| 481 | + }); |
| 482 | + }, |
477 | 483 | // xxx should really use a callback instead of failing if the media is not |
478 | 484 | // loaded |
479 | 485 | getNaturalSize: function( img , callback){ |
480 | 486 | // note this just works for images atm |
481 | 487 | if( !img ){ |
| 488 | + mw.log("Error getNaturalSize for null image "); |
482 | 489 | callback( false ); |
483 | 490 | } |
484 | 491 | if( img.naturalWidth ){ |
— | — | @@ -498,7 +505,7 @@ |
499 | 506 | * Layout an asset |
500 | 507 | */ |
501 | 508 | doAssetLayout: function( smilElement, naturalSize ){ |
502 | | - |
| 509 | + var _this = this; |
503 | 510 | // We default smil layout to meetBest |
504 | 511 | var fitMode = $j( smilElement).attr('fit'); |
505 | 512 | if( !fitMode ){ |
— | — | @@ -518,7 +525,7 @@ |
519 | 526 | mw.log("Layout mode: " + fitMode + ' not yet supported'); |
520 | 527 | } |
521 | 528 | |
522 | | - // Check for panZoom attribute |
| 529 | + // Check for panZoom attribute ( if animation is set it will override this value ) |
523 | 530 | if( $j( smilElement).attr('panZoom') ){ |
524 | 531 | _this.panZoomLayout( smilElement ); |
525 | 532 | } |
— | — | @@ -530,28 +537,48 @@ |
531 | 538 | var _this = this; |
532 | 539 | |
533 | 540 | // xxx Should read smil "imgElement" fill type |
534 | | - var imageCss = {}; |
535 | | - |
| 541 | + var imageCss = _this.getDominateAspectTransform( natrualSize, targetSize, 100 ); |
| 542 | + |
| 543 | + // update the layout of the element |
| 544 | + $j( element ).css( imageCss ); |
| 545 | + }, |
| 546 | + |
| 547 | + getDominateAspectTransform: function(natrualSize, targetSize, transformPercent ){ |
| 548 | + var _this = this; |
| 549 | + var transformCss = {} |
| 550 | + if( ! targetSize ){ |
| 551 | + targetSize = { |
| 552 | + 'width' : this.smil.embedPlayer.getWidth(), |
| 553 | + 'height' : this.smil.embedPlayer.getHeight() |
| 554 | + }; |
| 555 | + } |
536 | 556 | // Fit the image per the provided targetWidth closure |
537 | | - if( natrualSize.width > targetSize.width ){ |
538 | | - imageCss.width = '100%'; |
539 | | - imageCss.height = ( 100 * ( natrualSize.height / natrualSize.width ) ) + '%'; |
| 557 | + if( natrualSize.width / natrualSize.height > targetSize.width / targetSize.height ){ |
| 558 | + transformCss.width = transformPercent + '%'; |
| 559 | + transformCss.height = ( transformPercent * ( |
| 560 | + ( natrualSize.height / natrualSize.width ) / |
| 561 | + _this.getTargetAspectRatio() |
| 562 | + ) |
| 563 | + ) + '%'; |
540 | 564 | } |
541 | 565 | |
542 | 566 | // Fit vertically |
543 | | - if(! imageCss.height || imageCss.height > targetSize.height ){ |
544 | | - imageCss.height = '100%'; |
545 | | - imageCss.width = ( 100 * ( natrualSize.width / natrualSize.height ) ) + '%'; |
| 567 | + if(! transformCss.height || natrualSize.width / natrualSize.height < targetSize.width / targetSize.height ){ |
| 568 | + transformCss.height = transformPercent + '%'; |
| 569 | + transformCss.width = ( transformPercent * |
| 570 | + ( natrualSize.width / natrualSize.height ) / |
| 571 | + _this.getTargetAspectRatio() |
| 572 | + ) + '%'; |
546 | 573 | } |
547 | | - // update the layout of the element |
548 | | - $j( element ).css( imageCss ); |
| 574 | + return transformCss; |
549 | 575 | }, |
| 576 | + |
550 | 577 | /** |
551 | 578 | * layout function |
552 | 579 | */ |
553 | 580 | panZoomLayout: function( smilElement ){ |
554 | | - var _this = this; |
555 | | - var panZoom = this.parsePanZoom( $j( smilElement).attr('panZoom') ); |
| 581 | + var _this = this; |
| 582 | + var panZoom = $j( smilElement).attr('panZoom').split(','); |
556 | 583 | var img = $j( '#' + this.smil.getPageDomId( smilElement ) ).get(0); |
557 | 584 | |
558 | 585 | _this.getNaturalSize( img, function( natrualSize ){ |
— | — | @@ -567,11 +594,11 @@ |
568 | 595 | // no transform is needed |
569 | 596 | return ; |
570 | 597 | } |
571 | | - // Get percent values |
572 | | - var percentValues = _this.smil.getAnimate().getPercentFromPanZoomValues( panZoomValues, natrualSize ); |
573 | | - |
| 598 | + // Get percent values |
| 599 | + var percentValues = _this.smil.getAnimate().getPercentFromPanZoomValues( panZoom, natrualSize ); |
| 600 | + |
574 | 601 | // Update the layout via the animation engine updateElementLayout method |
575 | | - _this.smil.getAnimate().updateElementLayout( smilElement, panZoomValues ); |
| 602 | + _this.smil.getAnimate().updateElementLayout( smilElement, percentValues ); |
576 | 603 | }); |
577 | 604 | }, |
578 | 605 | /** |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js |
— | — | @@ -380,6 +380,7 @@ |
381 | 381 | * http://www.w3.org/TR/SMIL/smil-extended-media-object.html#q32 |
382 | 382 | */ |
383 | 383 | transformPanZoom: function( smilImgElement, animateElement, animateTime ){ |
| 384 | + var _this = this; |
384 | 385 | var begin = this.smil.parseTime( $j( animateElement ).attr( 'begin') ); |
385 | 386 | var duration = this.smil.parseTime( $j( animateElement ).attr( 'dur') ); |
386 | 387 | |
— | — | @@ -397,32 +398,32 @@ |
398 | 399 | // Let Top Width Height |
399 | 400 | // translate values into % values |
400 | 401 | // NOTE this is dependent on the media being "loaded" and having natural width and height |
401 | | - |
402 | | - var percentValues = this.getPercentFromPanZoomValues( targetValue, |
403 | | - this.smil.getLayout().getNaturalSize( smilImgElement ) |
404 | | - ); |
405 | | - |
406 | | - // Now we have "hard" layout info try and render it. |
407 | | - this.updateElementLayout( smilImgElement, percentValues ); |
| 402 | + this.smil.getLayout().getNaturalSize(smilImgElement, function( naturalSize ){ |
| 403 | + var percentValues = _this.getPercentFromPanZoomValues( targetValue, naturalSize ); |
| 404 | + // Now we have "hard" layout info try and render it. |
| 405 | + _this.updateElementLayout( smilImgElement, percentValues ); |
| 406 | + }); |
408 | 407 | }, |
409 | 408 | // transforms pan zoom target value into layout percentages |
410 | 409 | getPercentFromPanZoomValues: function(targetValue, naturalSize){ |
411 | | - var namedValueOrder = ['left', 'top', 'width', 'height' ]; |
| 410 | + var namedValueOrder = [ 'left', 'top', 'width', 'height' ]; |
412 | 411 | var percentValues = {}; |
413 | 412 | for( var i =0 ;i < targetValue.length ; i++ ){ |
414 | 413 | if( targetValue[i].indexOf('%') == -1 ) { |
415 | 414 | switch( namedValueOrder[i] ){ |
416 | 415 | case 'left': |
417 | 416 | case 'width': |
418 | | - percentValues[ namedValueOrder[i] ] = parseFloat( targetValue[i] ) / naturalSize.width; |
| 417 | + percentValues[ namedValueOrder[i] ] = |
| 418 | + ( parseFloat( targetValue[i] ) / naturalSize.width ) * 100 |
419 | 419 | break; |
420 | 420 | case 'height': |
421 | 421 | case 'top': |
422 | | - percentValues[ namedValueOrder[i] ] = parseFloat( targetValue[i] ) / naturalSize.height |
| 422 | + percentValues[ namedValueOrder[i] ] = |
| 423 | + ( parseFloat( targetValue[i] ) / naturalSize.height ) * 100 |
423 | 424 | break; |
424 | 425 | } |
425 | 426 | } else { |
426 | | - percentValues[ namedValueOrder[i] ] = parseFloat( targetValue[i] ) / 100; |
| 427 | + percentValues[ namedValueOrder[i] ] = parseFloat( targetValue[i] ); |
427 | 428 | } |
428 | 429 | } |
429 | 430 | return percentValues; |
— | — | @@ -430,38 +431,22 @@ |
431 | 432 | |
432 | 433 | // xxx need to refactor move to "smilLayout" |
433 | 434 | updateElementLayout: function( smilElement, percentValues ){ |
| 435 | + var _this = this; |
| 436 | + mw.log("updateElementLayout::" + ' ' + percentValues.left + ' ' + percentValues.top + ' ' + percentValues.width + ' ' + percentValues.height ); |
434 | 437 | |
435 | | - //mw.log("updateElementLayout::" + percentValues.top + ' ' + percentValues.left + ' ' + percentValues.width + ' ' + percentValues.height ); |
436 | | - |
437 | 438 | // get a pointer to the html target: |
438 | | - var $target = $j( '#' + this.smil.getPageDomId( smilElement )); |
439 | | - |
440 | | - var htmlAsset = $j( '#' + this.smil.getPageDomId( smilElement ) ).get(0); |
441 | | - |
442 | | - // xxx best way may be to use canvas and a fitting system. |
443 | | - |
444 | | - // Setup target height width based target region size |
445 | | - var fullWidth = $target.parents('.smilRegion').width() ; |
446 | | - var fullHeight = $target.parents('.smilRegion').height() ; |
447 | | - var targetWidth = fullWidth; |
448 | | - var targetHeight = targetWidth * ( |
449 | | - ( parseInt( percentValues['height'] ) * htmlAsset.naturalHeight ) |
450 | | - / |
451 | | - ( parseInt( percentValues['width'] ) * htmlAsset.naturalWidth ) |
452 | | - ) |
453 | | - // Check if it exceeds the height constraint: |
454 | | - var sourceScale = ( targetHeight < fullHeight ) |
455 | | - ? (1 / parseInt( percentValues['width'] ) ) |
456 | | - : (1 / parseInt( percentValues['height'] ) ) |
457 | | - |
458 | | - |
459 | | - // Wrap the target and absolute the image layout ( if not already ) |
460 | | - if( $target.parent('.refTransformWrap').length === 0 ){ |
| 439 | + var $target = $j( '#' + this.smil.getPageDomId( smilElement )); |
| 440 | + var htmlElement = $j( '#' + this.smil.getPageDomId( smilElement ) ).get(0); |
| 441 | + |
| 442 | + // Wrap the target with its natura size ( if not already ) |
| 443 | + if( $target.parent('.refTransformWrap').length == 0 ){ |
461 | 444 | $target |
462 | 445 | .wrap( |
463 | 446 | $j( '<div />' ) |
464 | 447 | .css( { |
465 | | - 'position' : 'relative', |
| 448 | + 'top' : '0px', |
| 449 | + 'left' : '0px', |
| 450 | + 'position' : 'absolute', |
466 | 451 | 'overflow' : 'hidden', |
467 | 452 | 'width' : '100%', |
468 | 453 | 'height' : '100%' |
— | — | @@ -469,14 +454,17 @@ |
470 | 455 | .addClass('refTransformWrap') |
471 | 456 | ) |
472 | 457 | } |
473 | | - // Run the css transform |
474 | | - $target.css( { |
475 | | - 'position' : 'absolute', |
476 | | - 'width' : sourceScale *100 + '%', |
477 | | - 'height' : sourceScale *100 + '%', |
478 | | - 'top' : (-1 * parseInt( percentValues['top'] ) )*100 + '%', |
479 | | - 'left' : (-1 * parseInt( percentValues['left'] ) )*100 + '%', |
480 | | - } ); |
| 458 | + |
| 459 | + _this.smil.getLayout().getNaturalSize( htmlElement, function( natrualSize ){ |
| 460 | + // XXX note we have locked aspect so we can use 'width' here: |
| 461 | + var sizeCss = _this.smil.getLayout().getDominateAspectTransform( natrualSize, null, percentValues.width ); |
| 462 | + // Run the css transform |
| 463 | + $target.css( { |
| 464 | + 'position' : 'absolute', |
| 465 | + 'left' : percentValues.left, |
| 466 | + 'top' : percentValues.top |
| 467 | + }).css( sizeCss ); |
| 468 | + }); |
481 | 469 | }, |
482 | 470 | |
483 | 471 | /** |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/loader.js |
— | — | @@ -7,12 +7,10 @@ |
8 | 8 | mw.setDefaultConfig( { |
9 | 9 | // The framerate for the smil player |
10 | 10 | 'SmilPlayer.framerate': 30 |
11 | | - } ); |
12 | | - |
| 11 | + } ); |
13 | 12 | |
14 | 13 | mw.addResourcePaths( { |
15 | | - "mw.SmilHooks" : "mw.SmilHooks.js", |
16 | | - |
| 14 | + "mw.SmilHooks" : "mw.SmilHooks.js", |
17 | 15 | "mw.Smil" : "mw.Smil.js", |
18 | 16 | "mw.SmilLayout" : "mw.SmilLayout.js", |
19 | 17 | "mw.style.SmilLayout" : "mw.style.SmilLayout.css", |
— | — | @@ -55,11 +53,11 @@ |
56 | 54 | return true; |
57 | 55 | } |
58 | 56 | var loadSmil = false; |
59 | | - $j( element ).find( 'source' ).each( function(inx, sourceElement){ |
| 57 | + $j( element ).find( 'source' ).each( function( inx, sourceElement ){ |
60 | 58 | if( mw.CheckElementForSMIL( sourceElement ) ){ |
61 | 59 | loadSmil = true; |
62 | 60 | return true; |
63 | | - } |
| 61 | + } |
64 | 62 | }); |
65 | 63 | return loadSmil; |
66 | 64 | }; |
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js |
— | — | @@ -134,17 +134,22 @@ |
135 | 135 | var body = document.getElementById( 'bodyContent' ); |
136 | 136 | body.innerHTML = "<div class=\"loadingSpinner sequenceLoader\"></div>" + body.innerHTML; |
137 | 137 | } |
138 | | - loadMwEmbed( [ 'mw.MediaWikiRemoteSequencer' ], function(){ |
139 | | - $j('#editform,.mw-newarticletext').hide(); |
140 | | - $j('.sequenceLoader').hide(); |
141 | | - |
142 | | - var remote = new mw.MediaWikiRemoteSequencer({ |
143 | | - 'action': wgAction, |
144 | | - 'title' : wgTitle, |
145 | | - 'target' : '#bodyContent' |
146 | | - }); |
147 | | - remote.drawUI(); |
148 | | - } ); |
| 138 | + if( window.mwSequencerRemote ){ |
| 139 | + window.mwSequencerRemote.drawUI(); |
| 140 | + } else { |
| 141 | + loadMwEmbed( [ 'mw.MediaWikiRemoteSequencer', 'mw.style.SequencerRemote' ], function(){ |
| 142 | + $j('#editform,.mw-newarticletext').hide(); |
| 143 | + $j('.sequenceLoader').hide(); |
| 144 | + |
| 145 | + window.mwSequencerRemote = new mw.MediaWikiRemoteSequencer({ |
| 146 | + 'action': wgAction, |
| 147 | + 'title' : wgTitle, |
| 148 | + 'target' : '#bodyContent' |
| 149 | + }); |
| 150 | + window.mwSequencerRemote.drawUI(); |
| 151 | + } ); |
| 152 | + } |
| 153 | + |
149 | 154 | } |
150 | 155 | return ; |
151 | 156 | } |
— | — | @@ -175,9 +180,9 @@ |
176 | 181 | // Special api proxy page |
177 | 182 | if ( wgPageName == 'MediaWiki:ApiProxy' ) { |
178 | 183 | var wgEnableIframeApiProxy = true; |
179 | | - loadMwEmbed( [ 'mw.ApiProxy' ], function() { |
| 184 | + loadMwEmbed( [ 'mw.ApiProxy' ], function(){ |
180 | 185 | mw.load( mwEmbedHostPath + '/modules/ApiProxy/ApiProxyPage.js?' + mwGetReqArgs() ); |
181 | | - } ); |
| 186 | + }); |
182 | 187 | return ; |
183 | 188 | } |
184 | 189 | |
— | — | @@ -338,8 +343,8 @@ |
339 | 344 | // Check if file is from commons and therefore should explicitly set apiProvider to commons: |
340 | 345 | var apiProviderAttr = ( src.indexOf( 'wikipedia\/commons' ) != -1 )?'apiProvider="commons" ': ''; |
341 | 346 | |
342 | | - // If in a gallery box we will be displaying the video larger in a lightbox |
343 | | - if( $j( '#' + vidId ).parents( '.gallerybox' ).length ){ |
| 347 | + // If in a gallery box or filehistory we will be displaying the video larger in a lightbox |
| 348 | + if( $j( '#' + vidId ).parents( '.gallerybox,.filehistory' ).length ){ |
344 | 349 | // Update the width to 400 and keep scale |
345 | 350 | pwidth = 400; |
346 | 351 | if( pheight != 0 ) { |
— | — | @@ -372,7 +377,7 @@ |
373 | 378 | } |
374 | 379 | |
375 | 380 | // If the video is part of a "gallery box" use light-box linker instead |
376 | | - if( $j( '#' + vidId ).parents( '.gallerybox' ).length ){ |
| 381 | + if( $j( '#' + vidId ).parents( '.gallerybox,.filehistory' ).length ){ |
377 | 382 | $j( '#' + vidId ).after( |
378 | 383 | $j( '<div />') |
379 | 384 | .css( { |
— | — | @@ -392,7 +397,7 @@ |
393 | 398 | |
394 | 399 | // A play button: |
395 | 400 | $j( '<div />' ) |
396 | | - .css( { |
| 401 | + .css({ |
397 | 402 | 'position' : 'absolute', |
398 | 403 | 'top' : ( parseInt( $pimg.attr( 'height' ) ) /2 ) -25, |
399 | 404 | 'maring-left' : 'auto', |
Index: branches/MwEmbedStandAlone/loader.js |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | |
98 | 98 | // Set the default loader group strategy |
99 | 99 | 'loader.groupStrategy' : 'module' |
100 | | - |
| 100 | + |
101 | 101 | } ); |
102 | 102 | |
103 | 103 | /** |