Index: branches/MwEmbedStandAlone/mwEmbed.js |
— | — | @@ -1132,13 +1132,13 @@ |
1133 | 1133 | var $dialog = $j( '#mwTempLoaderDialog' ).show().dialog( options ); |
1134 | 1134 | // center the dialog |
1135 | 1135 | // xxx figure out why jquery ui is messing up here |
1136 | | - $j( '#mwTempLoaderDialog' ).parent('.ui-dialog').css({ |
| 1136 | + /*$j( '#mwTempLoaderDialog' ).parent('.ui-dialog').css({ |
1137 | 1137 | 'position' : 'absolute', |
1138 | 1138 | 'left' : '50%', |
1139 | 1139 | 'margin-left': -1 * $dialog.width()/2, |
1140 | 1140 | 'top' : '50%', |
1141 | 1141 | 'margin-top': -1 * $dialog.height()/2 |
1142 | | - }); |
| 1142 | + }); */ |
1143 | 1143 | } ); |
1144 | 1144 | return $j( '#mwTempLoaderDialog' ); |
1145 | 1145 | } |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js |
— | — | @@ -449,6 +449,16 @@ |
450 | 450 | |
451 | 451 | return $html; |
452 | 452 | }, |
| 453 | + getTitleKey: function( smilElement ){ |
| 454 | + // check directly for the attribute: |
| 455 | + if( $j(smilElement).attr('apititlekey') ){ |
| 456 | + return $j(smilElement).attr('apititlekey') ; |
| 457 | + } |
| 458 | + if( $j(smilElement).find("param[name='apiTitleKey']").length ) { |
| 459 | + return $j(smilElement).find("param[name='apiTitleKey']").attr('value'); |
| 460 | + } |
| 461 | + return false; |
| 462 | + }, |
453 | 463 | /** |
454 | 464 | * Get the smil resource type based on nodeName and type attribute |
455 | 465 | */ |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js |
— | — | @@ -241,6 +241,7 @@ |
242 | 242 | // Check if we reached playSegmentEndTime and pause playback |
243 | 243 | if( this.playSegmentEndTime && this.smilPlayTime >= this.playSegmentEndTime ) { |
244 | 244 | mw.log("monitor:: Reached playSegmentEndTime pause playback: " + this.playSegmentEndTime ); |
| 245 | + $j( this ).trigger( 'playSegmentEnd' ); |
245 | 246 | this.playSegmentEndTime= null; |
246 | 247 | this.pause(); |
247 | 248 | this.parent_monitor(); |
Index: branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -331,6 +331,9 @@ |
332 | 332 | if ( size.width ) { |
333 | 333 | request['iiurlwidth'] = size.width; |
334 | 334 | } |
| 335 | + if( size.height ){ |
| 336 | + request['iiurlheight'] = size.height; |
| 337 | + } |
335 | 338 | |
336 | 339 | mw.getJSON( this.provider.apiUrl, request, function( data ) { |
337 | 340 | var imObj = { }; |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -3039,10 +3039,8 @@ |
3040 | 3040 | // Call monitor at 250ms interval. ( use setInterval to avoid stacking monitor requests ) |
3041 | 3041 | //mw.log("EmbedPlayer::monitor: continue?:" + !this.isStopped() + ' monitorInterval: ' + this.monitorInterval ); |
3042 | 3042 | if( ! this.isStopped() ) { |
3043 | | - if( !this.monitorInterval ){ |
3044 | | - |
3045 | | - this.monitorInterval = setInterval( function(){ |
3046 | | - mw.log("monitorInterval!!"); |
| 3043 | + if( !this.monitorInterval ){ |
| 3044 | + this.monitorInterval = setInterval( function(){ |
3047 | 3045 | if( _this.monitor ){ |
3048 | 3046 | _this.monitor(); |
3049 | 3047 | } |
Index: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php |
— | — | @@ -55,9 +55,13 @@ |
56 | 56 | 'mwe-sequencer-clip-transin' => 'Transition in', |
57 | 57 | 'mwe-sequencer-clip-transout' => 'Transition out', |
58 | 58 | |
| 59 | + 'mwe-sequencer-clip-cancel-edit' => 'Cancel clip edit', |
59 | 60 | 'mwe-sequencer-preview' => 'Preview', |
| 61 | + 'mwe-sequencer-preview-pause' => 'Pause preview', |
| 62 | + 'mwe-sequencer-preview-continue' => 'Continue preview', |
60 | 63 | 'mwe-sequencer-apply-changes' => 'Apply changes', |
61 | 64 | 'mwe-sequencer-start-time' => 'Start time', |
| 65 | + 'mwe-sequencer-asset-source' => 'Source page', |
62 | 66 | |
63 | 67 | |
64 | 68 | 'mwe-sequencer-loading_user_rights' => 'Loading user rights ...', |
— | — | @@ -110,6 +114,7 @@ |
111 | 115 | 'mwe-sequencer-save-no-changes' => 'There are no new edits to save', |
112 | 116 | 'mwe-sequencer-save-summary' => 'Please enter a short summary of changes:', |
113 | 117 | 'mwe-sequencer-edit_cancel' => 'Cancel sequence edit', |
| 118 | + |
114 | 119 | 'mwe-sequencer-saving_wait' => 'Save in progress (please wait)', |
115 | 120 | 'mwe-sequencer-save_done' => 'Save complete', |
116 | 121 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js |
— | — | @@ -167,7 +167,7 @@ |
168 | 168 | if( !_this.sequencer.getServer().hasLocalChanges() ){ |
169 | 169 | $dialog.html( gM('mwe-sequencer-save-no-changes') ); |
170 | 170 | var closeButton = {}; |
171 | | - closeButton[gM('mwe-ok')]= function(){ $j(this).dialog('close') }; |
| 171 | + closeButton[ gM('mwe-ok') ]= function(){ $j(this).dialog('close') }; |
172 | 172 | $dialog.dialog( "option", "buttons", closeButton); |
173 | 173 | return ; |
174 | 174 | } |
Index: branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsView.js |
— | — | @@ -22,14 +22,14 @@ |
23 | 23 | // For now just show the sequence output |
24 | 24 | $viewSmilXmlDialog = mw.addDialog({ |
25 | 25 | 'title' : gM('mwe-sequencer-menu-view-smilxml'), |
26 | | - 'dragable': true, |
27 | | - 'height' : 480, |
28 | | - 'width' : 640, |
29 | | - 'resizable': true, |
30 | | - 'content' : $j('<div />') |
| 26 | + 'dragable': true, |
| 27 | + 'width' : 800, |
| 28 | + 'height' : 600, |
| 29 | + 'resizable': false, |
| 30 | + 'content' : $j('<div />') |
31 | 31 | .append( |
32 | 32 | // Add a loading div |
33 | | - $j('<div />') |
| 33 | + $j('<div />') |
34 | 34 | .addClass('syntaxhighlighter_loader') |
35 | 35 | .loadingSpinner(), |
36 | 36 | |
— | — | @@ -47,6 +47,7 @@ |
48 | 48 | // load and run the syntax highlighter: |
49 | 49 | $j( $viewSmilXmlDialog.find('pre') ).syntaxHighlighter( function(){ |
50 | 50 | $viewSmilXmlDialog.find('.syntaxhighlighter_loader').remove(); |
| 51 | + $viewSmilXmlDialog.find('.syntaxhighlighter').css('height', '520px'); |
51 | 52 | $viewSmilXmlDialog.find('pre').fadeIn(); |
52 | 53 | }); |
53 | 54 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js |
— | — | @@ -195,6 +195,9 @@ |
196 | 196 | * ref node that can be inserted into a smil xml tree |
197 | 197 | */ |
198 | 198 | getSmilClipFromResource: function( resource, callback ){ |
| 199 | + // fist check if we |
| 200 | + |
| 201 | + |
199 | 202 | var tagType = 'ref'; |
200 | 203 | if( resource.mime.indexOf( 'image/' ) != -1 ){ |
201 | 204 | tagType = 'img'; |
— | — | @@ -249,24 +252,37 @@ |
250 | 253 | }) |
251 | 254 | ) |
252 | 255 | } |
| 256 | + } |
| 257 | + // Check if the source asset is smaller than our target import size in both width and height: |
| 258 | + if( resource.width < mw.getConfig( 'Sequencer.AddMediaImageWidth' ) |
| 259 | + && |
| 260 | + resource.height < mw.getConfig( 'Sequencer.AddMediaImageHeight' ) |
| 261 | + ) { |
| 262 | + callback( $smilRef.get(0) ); |
| 263 | + return ; |
253 | 264 | } |
254 | | - // Make sure we have source for the asset. |
255 | | - if( $smilRef.attr('src') ){ |
256 | | - callback( $smilRef.get(0) ) |
257 | | - } else { |
258 | | - // the resource includes a pointer to its parent search object |
259 | | - // from the search object grab the image object for the target resolution |
260 | | - resource.pSobj.getImageObj( |
261 | | - resource, |
262 | | - { |
263 | | - 'width' : mw.getConfig( 'Sequencer.AddMediaImageWidth' ) |
264 | | - }, |
265 | | - function( imageObj ){ |
266 | | - $smilRef.attr('src', imageObj.url ) |
267 | | - callback( $smilRef.get(0) ); |
268 | | - } |
269 | | - ) |
| 265 | + |
| 266 | + // Get the dominate aspect ratio so we can |
| 267 | + var targetAspect = mw.getConfig( 'Sequencer.AddMediaImageWidth' ) / mw.getConfig( 'Sequencer.AddMediaImageHeight' ) |
| 268 | + var fileAspect = resource.width / resource.height; |
| 269 | + |
| 270 | + var requestWidth = mw.getConfig( 'Sequencer.AddMediaImageWidth' ); |
| 271 | + if( targetAspect > fileAspect ){ |
| 272 | + requestWidth = parseInt( mw.getConfig( 'Sequencer.AddMediaImageHeight' ) * fileAspect ); |
270 | 273 | } |
| 274 | + |
| 275 | + // the resource includes a pointer to its parent search object |
| 276 | + // from the search object grab the image object for the target resolution |
| 277 | + resource.pSobj.getImageObj( |
| 278 | + resource, |
| 279 | + { |
| 280 | + 'width' : requestWidth |
| 281 | + }, |
| 282 | + function( imageObj ){ |
| 283 | + $smilRef.attr('src', imageObj.url ) |
| 284 | + callback( $smilRef.get(0) ); |
| 285 | + } |
| 286 | + ) |
271 | 287 | } |
272 | 288 | } |
273 | 289 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerPlayer.js |
— | — | @@ -58,7 +58,7 @@ |
59 | 59 | }); |
60 | 60 | }, |
61 | 61 | |
62 | | - previewClip: function( smilClip ){ |
| 62 | + previewClip: function( smilClip, donePreivewCallback ){ |
63 | 63 | var _this = this; |
64 | 64 | // Seek and play start of smilClip |
65 | 65 | var startOffset = $j( smilClip ).data('startOffset'); |
— | — | @@ -67,6 +67,8 @@ |
68 | 68 | this.getEmbedPlayer().setCurrentTime( startOffset, function(){ |
69 | 69 | mw.log("SequencerPlayer::Preview clip: " + startOffset + ' to ' + clipEndTime); |
70 | 70 | _this.getEmbedPlayer().play( clipEndTime ); |
| 71 | + // bind end of segment action |
| 72 | + $j( _this.sequencer.getEmbedPlayer() ).bind( 'playSegmentEnd', donePreivewCallback); |
71 | 73 | }) |
72 | 74 | }, |
73 | 75 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js |
— | — | @@ -149,18 +149,80 @@ |
150 | 150 | } |
151 | 151 | }, |
152 | 152 | editActions: { |
| 153 | + 'sourcePage':{ |
| 154 | + 'displayCheck': function( _this, smilElement ){ |
| 155 | + if( _this.sequencer.getSmil().getTitleKey( smilElement ) |
| 156 | + && |
| 157 | + _this.sequencer.getServer().isConfigured() |
| 158 | + ){ |
| 159 | + return true; |
| 160 | + } |
| 161 | + return false; |
| 162 | + }, |
| 163 | + 'icon': 'info', |
| 164 | + 'title': gM('mwe-sequencer-asset-source'), |
| 165 | + 'action' : function( clickButton, _this, smilElement ){ |
| 166 | + // Update the link |
| 167 | + $j( clickButton ) |
| 168 | + .attr({ |
| 169 | + 'href': _this.sequencer.getServer().getAssetViewUrl( |
| 170 | + $j(smilElement).find("param[name='apiTitleKey']").attr('value') |
| 171 | + ) |
| 172 | + , |
| 173 | + 'target' : '_new' |
| 174 | + }) |
| 175 | + // follow the link the link |
| 176 | + return true; |
| 177 | + } |
| 178 | + }, |
153 | 179 | 'preview' : { |
154 | 180 | 'icon' : 'play', |
155 | 181 | 'title' : gM('mwe-sequencer-preview'), |
156 | | - 'action': function( _this, smilElement ){ |
157 | | - _this.sequencer.getPlayer().previewClip( smilElement ); |
| 182 | + 'action': function( clickButton, _this, smilElement ){ |
| 183 | + _this.sequencer.getPlayer().previewClip( smilElement, function(){ |
| 184 | + // preview done, restore original state: |
| 185 | + $j(clickButton).replaceWith ( |
| 186 | + _this.getEditAction( smilElement, 'preview' ) |
| 187 | + ) |
| 188 | + }); |
158 | 189 | // xxx todo update preview button to "pause" / "play" |
| 190 | + var doPause = function(){ |
| 191 | + $j( clickButton ).find( '.ui-icon') |
| 192 | + .removeClass( 'ui-icon-pause' ) |
| 193 | + .addClass( 'ui-icon-play' ) |
| 194 | + $j( clickButton ).find('.btnText').text( |
| 195 | + gM('mwe-sequencer-preview-continue') |
| 196 | + ) |
| 197 | + _this.sequencer.getEmbedPlayer().pause(); |
| 198 | + } |
| 199 | + var doPlay = function(){ |
| 200 | + // setup pause button: |
| 201 | + $j( clickButton ).find( '.ui-icon') |
| 202 | + .removeClass( 'ui-icon-play' ) |
| 203 | + .addClass( 'ui-icon-pause' ) |
| 204 | + $j( clickButton ).find('.btnText').text( |
| 205 | + gM('mwe-sequencer-preview-pause') |
| 206 | + ) |
| 207 | + // keep the target preview end time: |
| 208 | + // xxx should probably refactor this.. a bit of abstraction leak here: |
| 209 | + _this.sequencer.getEmbedPlayer().play( |
| 210 | + _this.sequencer.getEmbedPlayer().playSegmentEndTime |
| 211 | + ); |
| 212 | + } |
| 213 | + $j( clickButton ).unbind().click(function(){ |
| 214 | + if( _this.sequencer.getEmbedPlayer().paused ){ |
| 215 | + doPlay(); |
| 216 | + } else { |
| 217 | + doPause(); |
| 218 | + } |
| 219 | + }) |
| 220 | + doPlay(); |
159 | 221 | } |
160 | | - }, |
| 222 | + }, |
161 | 223 | 'cancel' : { |
162 | 224 | 'icon': 'close', |
163 | | - 'title' : gM('mwe-cancel'), |
164 | | - 'action' : function( _this, smilElement ){ |
| 225 | + 'title' : gM('mwe-sequencer-clip-cancel-edit'), |
| 226 | + 'action' : function(clickButton, _this, smilElement ){ |
165 | 227 | $j.each( |
166 | 228 | _this.getToolSet( |
167 | 229 | _this.sequencer.getSmil().getRefType( smilElement ) |
— | — | @@ -724,16 +786,21 @@ |
725 | 787 | }); |
726 | 788 | |
727 | 789 | // Add tab bindings |
728 | | - $toolsContainer.tabs({ |
729 | | - select: function(event, ui) { |
| 790 | + $toolsContainer.tabs(); |
| 791 | + |
| 792 | + // Build out global edit Actions buttons after the container |
| 793 | + for( var editActionId in this.editActions ){ |
| 794 | + // Check if the edit action has a conditional display: |
| 795 | + var displayEidtAction = true; |
730 | 796 | |
| 797 | + if( this.editActions[ editActionId ].displayCheck ){ |
| 798 | + displayEidtAction = this.editActions[ editActionId ].displayCheck( _this, smilElement ); |
| 799 | + } |
| 800 | + if( displayEidtAction ){ |
| 801 | + $toolsContainer.after( |
| 802 | + this.getEditAction( smilElement, editActionId ) |
| 803 | + ) |
731 | 804 | } |
732 | | - }) |
733 | | - // Build out global edit Actions buttons after the container |
734 | | - for( var editActionId in this.editActions ){ |
735 | | - $toolsContainer.after( |
736 | | - this.getEditAction( smilElement, editActionId ) |
737 | | - ) |
738 | 805 | } |
739 | 806 | }, |
740 | 807 | getCurrentsmilElement: function(){ |
— | — | @@ -765,7 +832,7 @@ |
766 | 833 | 'margin': '5px' |
767 | 834 | }) |
768 | 835 | .click( function(){ |
769 | | - editAction.action( _this, smilElement ); |
| 836 | + return editAction.action( this, _this, smilElement ); |
770 | 837 | }) |
771 | 838 | return $actionButton; |
772 | 839 | }, |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerConfig.js |
— | — | @@ -27,9 +27,16 @@ |
28 | 28 | // Default image duration |
29 | 29 | "Sequencer.AddMediaImageDuration" : 2, |
30 | 30 | |
31 | | - // Default image source width |
32 | | - "Sequencer.AddMediaImageWidth" : 640, |
| 31 | + // NOTE these values 800x600 are the default display |
| 32 | + // size for assets in wikimedia commons and helps avoid server side resizes |
| 33 | + // and gives the asset a better chance of being served from the cache |
33 | 34 | |
| 35 | + // Default import image source width |
| 36 | + "Sequencer.AddMediaImageWidth" : 800, |
| 37 | + |
| 38 | + // Default import image source height |
| 39 | + "Sequencer.AddMediaImageHeight" : 600, |
| 40 | + |
34 | 41 | // If a asset can be directly added to the sequence by url |
35 | 42 | // ( if disabled only urls that are part addMedia can be added ) |
36 | 43 | "Sequencer.AddAssetByUrl" : true, |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js |
— | — | @@ -349,6 +349,15 @@ |
350 | 350 | } |
351 | 351 | return this.pagePathUrl.replace( '$1', 'Sequence:' + titleKey); |
352 | 352 | }, |
| 353 | + |
| 354 | + getAssetViewUrl: function( titleKey ){ |
| 355 | + // Check that we have a pagePathUrl config: |
| 356 | + if( !this.pagePathUrl ){ |
| 357 | + return false; |
| 358 | + } |
| 359 | + return this.pagePathUrl.replace( '$1', titleKey ); |
| 360 | + }, |
| 361 | + |
353 | 362 | /** |
354 | 363 | * Get the sequencer 'edit' url |
355 | 364 | */ |
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js |
— | — | @@ -449,19 +449,13 @@ |
450 | 450 | // close the dialog |
451 | 451 | $j(this).dialog( 'close' ).remove(); |
452 | 452 | }; |
453 | | - mw.addDialog( { |
| 453 | + var $dialog = mw.addDialog( { |
454 | 454 | 'title' : decodeURIComponent( apiTitleKey.replace(/_/g, ' ') ), |
455 | 455 | 'content' : html_out, |
456 | | - 'buttons' : buttons |
457 | | - }) |
458 | | - // Dialog size setup is a bit strange: |
459 | | - .css( { |
460 | | - 'height' : dialogHeight + 'px' |
461 | | - }) |
462 | | - .parent().css( { |
463 | | - // we hard code the default resolution to 400 above |
464 | | - 'width' : '435px', |
465 | | - } ) |
| 456 | + 'buttons' : buttons, |
| 457 | + 'height' : dialogHeight, |
| 458 | + 'width' : 425 |
| 459 | + }) |
466 | 460 | |
467 | 461 | // Update the embed code to use the mwEmbed player: |
468 | 462 | $j( '#mwe_' + vidId ).embedPlayer( function(){ |