Index: branches/MwEmbedStandAlone/mwEmbed.js |
— | — | @@ -1158,7 +1158,7 @@ |
1159 | 1159 | * undefined |
1160 | 1160 | */ |
1161 | 1161 | mw.isset = function( objectPath ) { |
1162 | | - if ( !objectPath ) { |
| 1162 | + if ( !objectPath || typeof objectPath != 'string') { |
1163 | 1163 | return false; |
1164 | 1164 | } |
1165 | 1165 | var pathSet = objectPath.split( '.' ); |
Index: branches/MwEmbedStandAlone/modules/Playlist/MediaRss.i18n.php |
— | — | @@ -1,12 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation for SmilPlayer |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -$messages = array(); |
11 | | -$messages['en'] = array( |
12 | | - 'mwe-mediarss-untitled' => 'Untitled media asset' |
13 | | -); |
Index: branches/MwEmbedStandAlone/modules/Playlist/loader.js |
— | — | @@ -6,7 +6,6 @@ |
7 | 7 | ( function( mw ) { |
8 | 8 | |
9 | 9 | mw.addResourcePaths( { |
10 | | - "iScroll" : "iScroll.js", |
11 | 10 | "mw.Playlist" : "mw.Playlist.js", |
12 | 11 | "mw.PlaylistHandlerMediaRss" : "mw.PlaylistHandlerMediaRss.js" |
13 | 12 | }); |
— | — | @@ -32,10 +31,6 @@ |
33 | 32 | // Module loader |
34 | 33 | mw.addModuleLoader( 'Playlist', function(){ |
35 | 34 | var resourceList = ["mw.Playlist", "mw.PlaylistHandlerMediaRss" ] |
36 | | - // xxx should detect touch support rather than mobile safari check |
37 | | - if( mw.isMobileSafari() ){ |
38 | | - resourceList.push( "iScroll" ); |
39 | | - } |
40 | 35 | return resourceList; |
41 | 36 | }); |
42 | 37 | |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js |
— | — | @@ -386,12 +386,12 @@ |
387 | 387 | var assetId = this.smil.getPageDomId( smilElement ); |
388 | 388 | // Make sure the image is in the dom ( load it ) |
389 | 389 | this.loadElement( smilElement ); |
390 | | - mw.log("loadImageCallback:: drwa img: " + assetId + $j( '#' + assetId ).length ); |
| 390 | + mw.log( "loadImageCallback:: drwa img: " + assetId + $j( '#' + assetId ).length ); |
391 | 391 | // If we already have naturalHeight no need for loading callback |
392 | | - if( $j( '#' + assetId).get(0).naturalHeight ){ |
| 392 | + if( $j( '#' + assetId ).get(0).naturalHeight ){ |
393 | 393 | callback(); |
394 | | - }else { |
395 | | - $j( '#' + assetId).load( callback ); |
| 394 | + } else { |
| 395 | + $j( '#' + assetId ).load( callback ); |
396 | 396 | } |
397 | 397 | }, |
398 | 398 | |
— | — | @@ -437,8 +437,12 @@ |
438 | 438 | } |
439 | 439 | } |
440 | 440 | |
441 | | - // Issue the seek |
442 | | - vid.currentTime = seekTime; |
| 441 | + // Issue the seek if the vid still exists |
| 442 | + try{ |
| 443 | + vid.currentTime = seekTime; |
| 444 | + } catch ( e ){ |
| 445 | + mw.log( 'Error: in SmilBuffer could not set currentTime' ); |
| 446 | + } |
443 | 447 | } |
444 | 448 | |
445 | 449 | // Read the video state: http://www.w3.org/TR/html5/video.html#dom-media-have_nothing |
Index: branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/flickrSearch.js |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | this.init( options ); |
18 | 18 | } |
19 | 19 | flickrSearch.prototype = { |
20 | | - dtUrl : 'http://www.flickr.com/photos/', |
| 20 | + detailsUrl : 'http://www.flickr.com/photos/', |
21 | 21 | // @@todo probably would be good to read the api-key from configuration |
22 | 22 | apikey : '2867787a545cc66c0bce6f2e57aca1d1', |
23 | 23 | // What license we are interested in |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | var resource = { |
104 | 104 | 'titleKey' : flickrResource.title + '.jpg', |
105 | 105 | 'resourceKey': flickrResource.id, |
106 | | - 'link' : _this.dtUrl + flickrResource.pathalias + '/' + flickrResource.id, |
| 106 | + 'link' : _this.detailsUrl + flickrResource.pathalias + '/' + flickrResource.id, |
107 | 107 | 'title' : flickrResource.title, |
108 | 108 | 'thumbwidth' : flickrResource.width_t, |
109 | 109 | 'thumbheight': flickrResource.height_t, |
Index: branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -278,7 +278,10 @@ |
279 | 279 | 'this_wiki': { |
280 | 280 | 'enabled': 1, |
281 | 281 | 'apiUrl': ( wgServer && wgScriptPath ) ? |
282 | | - wgServer + wgScriptPath + '/api.php' : null, |
| 282 | + wgServer + wgScriptPath + '/api.php' : null, |
| 283 | + |
| 284 | + 'detailsUrl' : wgServer + wgArticlePath, |
| 285 | + |
283 | 286 | 'lib': 'mediaWiki', |
284 | 287 | 'homepage' : ( wgServer && wgScript ) ? |
285 | 288 | wgServer + wgScript : null, |
— | — | @@ -293,6 +296,8 @@ |
294 | 297 | 'enabled': 1, |
295 | 298 | 'homepage': 'http://kaltura.com', |
296 | 299 | 'apiUrl': 'http://kaldev.kaltura.com/michael/aggregator.php', |
| 300 | + |
| 301 | + 'detailsUrl' : wgServer + wgArticlePath, |
297 | 302 | 'lib': 'kaltura', |
298 | 303 | 'resource_prefix' : '', |
299 | 304 | 'tab_image':false |
— | — | @@ -536,6 +541,8 @@ |
537 | 542 | } |
538 | 543 | return this; |
539 | 544 | }, |
| 545 | + |
| 546 | + |
540 | 547 | |
541 | 548 | /** |
542 | 549 | * Get license icon html |
— | — | @@ -936,40 +943,50 @@ |
937 | 944 | // Setup base cancel button binding |
938 | 945 | this.onCancelResourceEdit(); |
939 | 946 | }, |
| 947 | + /** |
| 948 | + * public function to get enabled content providers |
| 949 | + */ |
| 950 | + getEnabledProviders: function(){ |
| 951 | + var enabledProviders = {}; |
| 952 | + for ( var providerName in this.content_providers ) { |
| 953 | + var content_providers = this.content_providers; |
| 954 | + var provider = content_providers[ providerName ]; |
| 955 | + if ( provider.enabled && provider.apiUrl ) { |
| 956 | + enabledProviders[providerName] = provider; |
| 957 | + } |
| 958 | + } |
| 959 | + return enabledProviders; |
| 960 | + }, |
940 | 961 | |
941 | 962 | createProviderSelection: function(){ |
942 | 963 | var _this = this; |
943 | 964 | var $providerSelection = $j( '<ul />' ) |
944 | 965 | .addClass( "ui-provider-selection" ); |
945 | 966 | // Add enabled search providers. |
946 | | - for ( var providerName in this.content_providers ) { |
947 | | - var content_providers = this.content_providers; |
948 | | - var provider = content_providers[ providerName ]; |
949 | | - if ( provider.enabled && provider.apiUrl ) { |
950 | | - var $anchor = $j( '<div />' ) |
951 | | - .text( gM( 'rsd-' + providerName + '-title' ) ) |
952 | | - .attr({ |
953 | | - name: providerName |
954 | | - }); |
955 | | - if ( this.current_provider == providerName) { |
956 | | - $anchor.addClass( 'ui-selected' ); |
957 | | - } |
958 | | - |
959 | | - $anchor.click( function() { |
960 | | - $j( this ).parent().parent().find( '.ui-selected' ) |
961 | | - .removeClass( 'ui-selected' ); |
962 | | - $j( this ).addClass( 'ui-selected' ); |
963 | | - _this.current_provider = $j( this ).attr( "name" ); |
964 | | - // Update the search results on provider selection |
965 | | - _this.updateResults( _this.current_provider, true ); |
966 | | - return false; |
| 967 | + $j.each( _this.getEnabledProviders(), function(providerName, provider){ |
| 968 | + var $anchor = $j( '<div />' ) |
| 969 | + .text( gM( 'rsd-' + providerName + '-title' ) ) |
| 970 | + .attr({ |
| 971 | + name: providerName |
967 | 972 | }); |
968 | | - |
969 | | - var $listItem = $j( '<li />' ); |
970 | | - $listItem.append( $anchor ); |
971 | | - $providerSelection.append( $listItem ); |
| 973 | + if ( _this.current_provider == providerName) { |
| 974 | + $anchor.addClass( 'ui-selected' ); |
972 | 975 | } |
973 | | - } |
| 976 | + |
| 977 | + $anchor.click( function() { |
| 978 | + $j( this ).parent().parent().find( '.ui-selected' ) |
| 979 | + .removeClass( 'ui-selected' ); |
| 980 | + $j( this ).addClass( 'ui-selected' ); |
| 981 | + _this.current_provider = $j( this ).attr( "name" ); |
| 982 | + // Update the search results on provider selection |
| 983 | + _this.updateResults( _this.current_provider, true ); |
| 984 | + return false; |
| 985 | + }); |
| 986 | + |
| 987 | + var $listItem = $j( '<li />' ); |
| 988 | + $listItem.append( $anchor ); |
| 989 | + $providerSelection.append( $listItem ); |
| 990 | + }); |
974 | 991 | return $providerSelection; |
975 | 992 | }, |
976 | 993 | /** |
— | — | @@ -3229,7 +3246,7 @@ |
3230 | 3247 | }, |
3231 | 3248 | |
3232 | 3249 | /* |
3233 | | - * Sets the dispaly mode |
| 3250 | + * Sets the display mode |
3234 | 3251 | * @param {String} mode Either "box" or "list" |
3235 | 3252 | */ |
3236 | 3253 | setDisplayMode: function( mode ) { |
Index: branches/MwEmbedStandAlone/modules/Sequencer/loader.js |
— | — | @@ -13,6 +13,7 @@ |
14 | 14 | |
15 | 15 | "mw.SequencerServer" : "mw.SequencerServer.js", |
16 | 16 | "mw.SequencerAddMedia" : "mw.SequencerAddMedia.js", |
| 17 | + "mw.SequencerAddByUrl" : "mw.SequencerAddByUrl.js", |
17 | 18 | "mw.SequencerPlayer" : "mw.SequencerPlayer.js", |
18 | 19 | "mw.SequencerTimeline" : "mw.SequencerTimeline.js", |
19 | 20 | "mw.SequencerKeyBindings" : "mw.SequencerKeyBindings.js", |
— | — | @@ -56,7 +57,8 @@ |
57 | 58 | [ |
58 | 59 | '$j.contextMenu', |
59 | 60 | |
60 | | - 'mw.SequencerServer', |
| 61 | + 'mw.SequencerServer', |
| 62 | + 'mw.SequencerAddByUrl', |
61 | 63 | 'mw.SequencerAddMedia', |
62 | 64 | 'mw.SequencerPlayer', |
63 | 65 | 'mw.SequencerRender', |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | } |
274 | 274 | return this.timeline; |
275 | 275 | }, |
276 | | - getEditTools: function(){ |
| 276 | + getTools: function(){ |
277 | 277 | if( !this.editTools ){ |
278 | 278 | this.editTools = new mw.SequencerTools( this ); |
279 | 279 | } |
— | — | @@ -284,6 +284,12 @@ |
285 | 285 | } |
286 | 286 | return this.addMedia; |
287 | 287 | }, |
| 288 | + getAddByUrl: function(){ |
| 289 | + if( ! this.addByUrl ){ |
| 290 | + this.addByUrl = new mw.SequencerAddByUrl( this ); |
| 291 | + } |
| 292 | + return this.addByUrl |
| 293 | + }, |
288 | 294 | getKeyBindings:function(){ |
289 | 295 | if( ! this.keyBindings ){ |
290 | 296 | this.keyBindings = new mw.SequencerKeyBindings( this ); |
— | — | @@ -319,6 +325,7 @@ |
320 | 326 | * Get the UI layout |
321 | 327 | */ |
322 | 328 | getUiLayout: function(){ |
| 329 | + var _this = this; |
323 | 330 | // xxx There is probably a cleaner way to generate a list of jQuery objects than $j('new').children(); |
324 | 331 | return $j('<div />').append( |
325 | 332 | $j('<div />') |
— | — | @@ -346,7 +353,7 @@ |
347 | 354 | .append( |
348 | 355 | $j('<div />') |
349 | 356 | .addClass( "ui-layout-center mwseq-edit" ) |
350 | | - .html( gM('mwe-sequencer-no_selected_resource') ), |
| 357 | + .html( _this.getTools().getDefaultText() ), |
351 | 358 | $j('<div />') |
352 | 359 | .addClass( "ui-layout-east mwseq-player" ) |
353 | 360 | .text( gM('mwe-sequencer-loading-player') ), |
Index: branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | } else { |
148 | 148 | $dialog.empty().text( gM('mwe-sequencer-already-published') ) |
149 | 149 | var buttons = {}; |
150 | | - buttons[ gm('mwe-ok') ] = function(){ |
| 150 | + buttons[ gM('mwe-ok') ] = function(){ |
151 | 151 | $j( this ).dialog( 'close' ); |
152 | 152 | } |
153 | 153 | $dialog.dialog( 'option', 'buttons', buttons); |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js |
— | — | @@ -14,8 +14,49 @@ |
15 | 15 | |
16 | 16 | init: function( sequencer ){ |
17 | 17 | this.sequencer = sequencer; |
| 18 | + }, |
| 19 | + getDefaultSearchText: function(){ |
| 20 | + return gM( 'mwe-sequencer-url-or-search'); |
18 | 21 | }, |
19 | | - |
| 22 | + getSearchDriver: function( callback ){ |
| 23 | + var _this = this; |
| 24 | + if( ! _this.remoteSearchDriver ){ |
| 25 | + // Get any sequencer configured options |
| 26 | + var addMediaOptions = _this.sequencer.getOption('AddMedia'); |
| 27 | + addMediaOptions = $j.extend( { |
| 28 | + 'target_container' : _this.sequencer.getEditToolTarget(), |
| 29 | + 'target_search_input' : _this.sequencer.getMenuTarget().find('input.searchMedia'), |
| 30 | + 'displaySearchInput': false, |
| 31 | + 'displayResourceInfoIcons' : false, |
| 32 | + 'resourceSelectionCallback' : function( resource ){ |
| 33 | + mw.addLoaderDialog( gM( 'mwe-sequencer-loading-asset' ) ); |
| 34 | + // Get convert resource to smilClip and insert into the timeline |
| 35 | + _this.getSmilClipFromResource( resource, function( smilClip ) { |
| 36 | + _this.sequencer.getTimeline().insertSmilClipEdit( smilClip ); |
| 37 | + mw.closeLoaderDialog(); |
| 38 | + }); |
| 39 | + return false; |
| 40 | + }, |
| 41 | + 'displaySearchResultsCallback' : function(){ |
| 42 | + _this.addSearchResultsDrag(); |
| 43 | + } |
| 44 | + }, addMediaOptions ); |
| 45 | + |
| 46 | + // Update the search value if has changed from the default search text helper: |
| 47 | + var inputValue = _this.sequencer.getMenuTarget().find('input.searchMedia').val(); |
| 48 | + if( inputValue != _this.getDefaultSearchText() ) |
| 49 | + addMediaOptions.default_query = inputValue; |
| 50 | + |
| 51 | + |
| 52 | + // set the tool target to loading |
| 53 | + mw.load( 'AddMedia.addMediaWizard', function(){ |
| 54 | + _this.remoteSearchDriver = new mw.RemoteSearchDriver( addMediaOptions ); |
| 55 | + callback( _this.remoteSearchDriver ); |
| 56 | + }); |
| 57 | + } else { |
| 58 | + callback (_this.remoteSearchDriver ) |
| 59 | + } |
| 60 | + }, |
20 | 61 | // Get the menu widget that drives the search and upload tab selection |
21 | 62 | getMenuWidget: function(){ |
22 | 63 | var _this = this; |
— | — | @@ -26,7 +67,7 @@ |
27 | 68 | $j('<input />') |
28 | 69 | .addClass( 'searchMedia') |
29 | 70 | .val( |
30 | | - gM( 'mwe-sequencer-url-or-search') |
| 71 | + _this.getDefaultSearchText() |
31 | 72 | ) |
32 | 73 | .css({'color': '#888', 'zindex': 2}) |
33 | 74 | .focus( function(){ |
— | — | @@ -61,7 +102,7 @@ |
62 | 103 | 'icon' : 'plus' |
63 | 104 | }) |
64 | 105 | .click(function(){ |
65 | | - // only do the search if the user has given the search input focus |
| 106 | + // Only do the search if the user has given the search input focus |
66 | 107 | if( widgetFocus ){ |
67 | 108 | _this.proccessRequest(); |
68 | 109 | } |
— | — | @@ -72,43 +113,39 @@ |
73 | 114 | }, |
74 | 115 | proccessRequest: function(){ |
75 | 116 | var _this = this; |
76 | | - // get the input text |
77 | | - var inputValue = this.sequencer.getMenuTarget().find('input.searchMedia').val(); |
78 | | - |
| 117 | + |
79 | 118 | this.sequencer.getEditToolTarget() |
80 | 119 | .empty() |
81 | 120 | .loadingSpinner(); |
82 | 121 | |
83 | | - if( ! _this.remoteSearchDriver ){ |
84 | | - // set the tool target to loading |
85 | | - mw.load( 'AddMedia.addMediaWizard', function(){ |
86 | | - _this.remoteSearchDriver = new mw.RemoteSearchDriver({ |
87 | | - 'target_container' : _this.sequencer.getEditToolTarget(), |
88 | | - 'target_search_input' : _this.sequencer.getMenuTarget().find('input.searchMedia'), |
89 | | - 'displaySearchInput': false, |
90 | | - 'default_query' : inputValue, |
91 | | - 'displayResourceInfoIcons' : false, |
92 | | - 'resourceSelectionCallback' : function( resource ){ |
93 | | - mw.addLoaderDialog( gM( 'mwe-sequencer-loading-asset' ) ); |
94 | | - // Get convert resource to smilClip and insert into the timeline |
95 | | - _this.getSmilClipFromResource( resource, function( smilClip ) { |
96 | | - _this.sequencer.getTimeline().insertSmilClipEdit( smilClip ); |
97 | | - mw.closeLoaderDialog(); |
98 | | - }); |
99 | | - return false; |
100 | | - }, |
101 | | - 'displaySearchResultsCallback' : function(){ |
102 | | - _this.addSearchResultsDrag(); |
103 | | - } |
104 | | - }); |
105 | | - // Create the search user interface: |
106 | | - _this.remoteSearchDriver.createUI(); |
107 | | - }); |
108 | | - } else { |
109 | | - this.remoteSearchDriver.createUI() |
110 | | - } |
| 122 | + this.getSearchDriver( function( remoteSearchDriver ){ |
| 123 | + // Check if input value can be handled by url |
| 124 | + var inputValue = _this.sequencer.getMenuTarget().find('input.searchMedia').val(); |
| 125 | + if( _this.sequencer.getAddByUrl().isUrl( inputValue) ){ |
| 126 | + _this.sequencer.addByUrlDialog().addByUrl( remoteSearchDriver, inputValue ); |
| 127 | + } else { |
| 128 | + // Else just use the remoteSearchDriver search interface |
| 129 | + remoteSearchDriver.createUI(); |
| 130 | + } |
| 131 | + }); |
| 132 | + }, |
| 133 | + /** |
| 134 | + * Handles url asset importing |
| 135 | + * xxx should probably re factor into separate class |
| 136 | + * |
| 137 | + * Checks for commons ulr profile, future profiles could include flickr, youtube etc. |
| 138 | + * tries to ascertain content type by url and directly load the media |
| 139 | + * @param {String} url to be imported to the sequence |
| 140 | + */ |
| 141 | + proccessUrlRequest: function( url ){ |
| 142 | + // Check if its a local domain ( we can directly request the "head" of the file to get its type ) |
| 143 | + |
| 144 | + // Check url type |
| 145 | + var parsedUrl = mw.parseUri( url ); |
| 146 | + if( host == 'commons.wikimedia.org' ){ |
| 147 | + } |
| 148 | + }, |
111 | 149 | |
112 | | - }, |
113 | 150 | /** |
114 | 151 | * Get the resource object from a provided asset |
115 | 152 | */ |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | |
94 | 94 | // Close / empty the toolWindow |
95 | 95 | _this.sequencer.getEditToolTarget().html( |
96 | | - _this.defaultText |
| 96 | + _this.getDefaultText() |
97 | 97 | ) |
98 | 98 | } |
99 | 99 | } |
— | — | @@ -217,11 +217,13 @@ |
218 | 218 | } |
219 | 219 | } |
220 | 220 | }, |
| 221 | + getDefaultText: function(){ |
| 222 | + return gM('mwe-sequencer-no_selected_resource'); |
| 223 | + }, |
221 | 224 | getEditToolId: function( toolId, attributeName){ |
222 | 225 | return 'editTool_' + toolId + '_' + attributeName; |
223 | | - }, |
| 226 | + }, |
224 | 227 | |
225 | | - |
226 | 228 | drawClipEditTools: function( $target, smilClip){ |
227 | 229 | |
228 | 230 | var toolId = ''; |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerConfig.js |
— | — | @@ -21,8 +21,12 @@ |
22 | 22 | "Sequencer.AddMediaImageDuration" : 2, |
23 | 23 | |
24 | 24 | // Default image source width |
25 | | - "Sequencer.AddMediaImageWidth" : 640, |
| 25 | + "Sequencer.AddMediaImageWidth" : 640, |
26 | 26 | |
| 27 | + // If a asset can be directly added to the sequence by url |
| 28 | + // ( if disabled only urls that are part addMedia can be added ) |
| 29 | + "Sequencer.AddAssetByUrl" : true, |
| 30 | + |
27 | 31 | // Default timeline clip timeline track height |
28 | 32 | "Sequencer.TimelineTrackHeight" : 100, |
29 | 33 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js |
— | — | @@ -306,7 +306,7 @@ |
307 | 307 | // get the smil element for the edit tool: |
308 | 308 | var smilClip = smil.$dom.find( '#' + $j( selectedClip ).data('smilId') ); |
309 | 309 | var toolTarget = this.sequencer.getEditToolTarget(); |
310 | | - this.sequencer.getEditTools().drawClipEditTools( toolTarget, smilClip ); |
| 310 | + this.sequencer.getTools().drawClipEditTools( toolTarget, smilClip ); |
311 | 311 | }, |
312 | 312 | |
313 | 313 | /** |
— | — | @@ -453,7 +453,7 @@ |
454 | 454 | }, |
455 | 455 | |
456 | 456 | /** |
457 | | - * Handle multiple selections based on what clips was just "cliked" |
| 457 | + * Handle multiple selections based on what clips was just selected |
458 | 458 | */ |
459 | 459 | handleMultiSelect: function( clickClip ){ |
460 | 460 | var _this = this; |
— | — | @@ -535,7 +535,7 @@ |
536 | 536 | ) |
537 | 537 | } else { |
538 | 538 | // A single clip is selected edit that clip |
539 | | - _this.editClip( clickClip ); |
| 539 | + _this.editClip( clickClip ); |
540 | 540 | } |
541 | 541 | // Register the edit tools update for undo |
542 | 542 | _this.sequencer.getActionsEdit().registerEdit(); |
— | — | @@ -593,8 +593,11 @@ |
594 | 594 | .hide() |
595 | 595 | .buttonHover() |
596 | 596 | .click( function(){ |
| 597 | + _this.getTimelineContainer().find('.selectedClip').removeClass( 'selectedClip' ); |
597 | 598 | _this.editClip( $timelineClip ) |
598 | 599 | $timelineClip.addClass( 'selectedClip' ); |
| 600 | + // Seek to the edit clip |
| 601 | + _this.seekToStartOfClip( $timelineClip ); |
599 | 602 | return false; |
600 | 603 | }), |
601 | 604 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +/** |
| 3 | +* Sequencer add by url support ( ties into mwEmbed AddMedia remoteSearchDriver module ) |
| 4 | +*/ |
| 5 | + |
| 6 | +//Wrap in mw closure |
| 7 | +( function( mw ) { |
| 8 | + |
| 9 | +mw.SequencerAddByUrl = function( sequencer ) { |
| 10 | + return this.init( sequencer ); |
| 11 | +}; |
| 12 | +mw.SequencerAddByUrl.prototype = { |
| 13 | + init: function( sequencer ){ |
| 14 | + this.sequencer = sequencer; |
| 15 | + }, |
| 16 | + |
| 17 | + /** |
| 18 | + * Does a basic parseUri check to see if a string is likely a url: |
| 19 | + */ |
| 20 | + isUrl: function( inputString ){ |
| 21 | + return ( mw.parseUri( inputString ).authority != mw.parseUri( inputString ).host ) ; |
| 22 | + }, |
| 23 | + |
| 24 | + /** |
| 25 | + * Try to add media via url and present a dialog if failed |
| 26 | + * or user input is required |
| 27 | + * |
| 28 | + * Uses remoteSearchDriver to help in retrieving entry info |
| 29 | + * @param {Object} remoteSearchDriver The remote search driver |
| 30 | + */ |
| 31 | + addByUrlDialog: function( remoteSearchDriver, url ){ |
| 32 | + // see if the asset matches the key type of any enabled content provider: |
| 33 | + $j.each( remoteSearchDriver.getEnabledProviders(), function(providerName, provider){ |
| 34 | + |
| 35 | + }); |
| 36 | + |
| 37 | + if( mw.getConfig( 'Sequencer.AddAssetByUrl' )){ |
| 38 | + // try directly adding the asset |
| 39 | + } |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +} )( window.mw ); |
\ No newline at end of file |
Index: branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /** |
3 | 3 | * Stop-gap for php sequencer support does some transformations |
4 | | -* to normal page views to support sequences edits |
| 4 | +* to page views to support sequence namespace |
5 | 5 | * |
6 | 6 | * Supports basic "sequencer" functionality as a javascript rewrite system. |
7 | 7 | */ |
— | — | @@ -77,128 +77,128 @@ |
78 | 78 | }, |
79 | 79 | displayPlayerEmbed: function(){ |
80 | 80 | var _this = this; |
81 | | - |
82 | | - // Check if the sequence has been flattened and is up to date: |
83 | | - var request = { |
84 | | - 'action': 'query', |
85 | | - 'titles': _this.getSequenceFileKey( wgPageName ), |
86 | | - 'prop': 'imageinfo|revisions', |
87 | | - 'iiprop': 'url|metadata', |
88 | | - 'iiurlwidth': '400', |
89 | | - 'redirects' : true // automatically follow redirects |
90 | | - }; |
91 | | - var $embedPlayer = $j('<div />'); |
92 | | - mw.getJSON( request, function( data ){ |
93 | | - if(!data.query || !data.query.pages || data.query.pages[-1]){ |
94 | | - // no flattened file found |
95 | | - $embedPlayer.append( |
96 | | - $j( '<div />').append( |
97 | | - gM('mwe-sequencer-not-published') |
| 81 | + // load the embedPlayer module: |
| 82 | + mw.load('EmbedPlayer', function(){ |
| 83 | + // Check if the sequence has been flattened and is up to date: |
| 84 | + var request = { |
| 85 | + 'action': 'query', |
| 86 | + 'titles': _this.getSequenceFileKey( wgPageName ), |
| 87 | + 'prop': 'imageinfo|revisions', |
| 88 | + 'iiprop': 'url|metadata', |
| 89 | + 'iiurlwidth': '400', |
| 90 | + 'redirects' : true // automatically follow redirects |
| 91 | + }; |
| 92 | + var $embedPlayer = $j('<div />'); |
| 93 | + mw.getJSON( request, function( data ){ |
| 94 | + if(!data.query || !data.query.pages || data.query.pages[-1]){ |
| 95 | + // no flattened file found |
| 96 | + $embedPlayer.append( |
| 97 | + $j( '<div />').append( |
| 98 | + gM('mwe-sequencer-not-published') |
| 99 | + ) |
| 100 | + .addClass( 'ui-state-highlight' ) |
98 | 101 | ) |
99 | | - .addClass( 'ui-state-highlight' ) |
100 | | - ) |
101 | | - return ; |
102 | | - } |
103 | | - for( var pageId in data.query.pages) { |
104 | | - var page = data.query.pages[ pageId ]; |
105 | | - |
106 | | - // Check that the file has a later revision than the |
107 | | - // page. ( up to date sequences always are later than |
108 | | - // the revision of the page saved ). |
109 | | - if( page.revisions && page.revisions[0] ){ |
110 | | - if( page.revisions[0].revid < wgCurRevisionId ){ |
111 | | - // flattened file out of date |
112 | | - $embedPlayer.append( |
113 | | - $j('<div />').append( |
114 | | - gM('mwe-sequencer-published-out-of-date') |
115 | | - ).addClass( 'ui-state-highlight' ) |
116 | | - ) |
| 102 | + return ; |
| 103 | + } |
| 104 | + for( var pageId in data.query.pages) { |
| 105 | + var page = data.query.pages[ pageId ]; |
| 106 | + |
| 107 | + // Check that the file has a later revision than the |
| 108 | + // page. ( up to date sequences always are later than |
| 109 | + // the revision of the page saved ). |
| 110 | + if( page.revisions && page.revisions[0] ){ |
| 111 | + if( page.revisions[0].revid < wgCurRevisionId ){ |
| 112 | + // flattened file out of date |
| 113 | + $embedPlayer.append( |
| 114 | + $j('<div />').append( |
| 115 | + gM('mwe-sequencer-published-out-of-date') |
| 116 | + ).addClass( 'ui-state-highlight' ) |
| 117 | + ) |
| 118 | + } |
117 | 119 | } |
118 | | - } |
119 | | - if( page.imageinfo && page.imageinfo[0] ){ |
120 | | - var imageinfo = page.imageinfo[0]; |
121 | | - var duration = 0; |
122 | | - for( var i=0;i< imageinfo.metadata.length; i++){ |
123 | | - if( imageinfo.metadata[i].name == 'length' ){ |
124 | | - duration = Math.round( |
125 | | - imageinfo.metadata[i].value * 1000 |
126 | | - ) / 1000; |
| 120 | + if( page.imageinfo && page.imageinfo[0] ){ |
| 121 | + var imageinfo = page.imageinfo[0]; |
| 122 | + var duration = 0; |
| 123 | + for( var i=0;i< imageinfo.metadata.length; i++){ |
| 124 | + if( imageinfo.metadata[i].name == 'length' ){ |
| 125 | + duration = Math.round( |
| 126 | + imageinfo.metadata[i].value * 1000 |
| 127 | + ) / 1000; |
| 128 | + } |
127 | 129 | } |
| 130 | + // Append a player to the embedPlayer target |
| 131 | + // -- special title key sequence name bound |
| 132 | + $embedPlayer.append( |
| 133 | + $j('<video />') |
| 134 | + .attr({ |
| 135 | + 'id' : 'embedSequencePlayer', |
| 136 | + 'poster' : imageinfo.thumburl, |
| 137 | + 'durationHint' : duration, |
| 138 | + 'apiTitleKey' : page.title.replace('File:',''), |
| 139 | + }) |
| 140 | + .addClass('kskin') |
| 141 | + .css({ |
| 142 | + 'width': imageinfo.thumbwidth, |
| 143 | + 'height' : imageinfo.thumbheight |
| 144 | + }) |
| 145 | + .append( |
| 146 | + // ogg source |
| 147 | + $j('<source />') |
| 148 | + .attr({ |
| 149 | + 'type': 'video/ogg', |
| 150 | + 'src' : imageinfo.url |
| 151 | + }) |
| 152 | + ) |
| 153 | + ) |
128 | 154 | } |
129 | | - // Append a player to the embedPlayer target |
130 | | - // -- special title key sequence name bound |
131 | | - $embedPlayer.append( |
132 | | - $j('<video />') |
133 | | - .attr({ |
134 | | - 'poster' : imageinfo.thumburl, |
135 | | - 'durationHint' : duration, |
136 | | - 'apiTitleKey' : page.title.replace('File:',''), |
137 | | - }) |
138 | | - .addClass('kskin') |
139 | | - .css({ |
140 | | - 'width': imageinfo.thumbwidth, |
141 | | - 'height' : imageinfo.thumbheight |
142 | | - }) |
143 | | - .append( |
144 | | - // ogg source |
145 | | - $j('<source />') |
146 | | - .attr({ |
147 | | - 'type': 'video/ogg', |
148 | | - 'src' : imageinfo.url |
149 | | - }) |
150 | | - ) |
| 155 | + } |
| 156 | + // Display embed sequence |
| 157 | + $j( _this.target ).empty().append( |
| 158 | + $j('<div />') |
| 159 | + .addClass( 'sequencer-player') |
| 160 | + .css( { |
| 161 | + 'float' : 'left', |
| 162 | + 'width' : imageinfo.thumbwidth |
| 163 | + }) |
| 164 | + .append( |
| 165 | + $embedPlayer |
151 | 166 | ) |
152 | | - } |
153 | | - } |
154 | | - // Display embed sequence |
155 | | - $j( _this.target ).empty().append( |
156 | | - $j('<div />') |
157 | | - .addClass( 'sequencer-player') |
158 | | - .css( { |
159 | | - 'float' : 'left', |
160 | | - 'width' : imageinfo.thumbwidth |
161 | | - }) |
162 | | - .append( |
163 | | - $embedPlayer |
164 | | - ) |
165 | | - , |
166 | | - |
167 | | - // Embed player |
168 | | - $j('<div />') |
169 | | - .addClass( 'sequencer-embed-helper') |
170 | | - .css({ |
171 | | - 'margin-left': '430px' |
172 | | - }) |
173 | | - |
174 | | - // Text embed code |
175 | | - .append( |
176 | | - $j('<h3 />') |
177 | | - .text( gM('mwe-sequencer-embed-sequence') ) |
178 | 167 | , |
179 | | - $j('<span />' ) |
180 | | - .text( gM('mwe-sequencer-embed-sequence-desc') ) |
181 | | - , |
182 | | - $j('<br />'), |
183 | | - $j('<textarea />') |
| 168 | + |
| 169 | + // Embed player |
| 170 | + $j('<div />') |
| 171 | + .addClass( 'sequencer-embed-helper') |
184 | 172 | .css({ |
185 | | - 'width' : '100%', |
186 | | - 'height' : '200px' |
187 | | - }).focus(function(){ |
188 | | - $j(this).select(); |
| 173 | + 'margin-left': '430px' |
189 | 174 | }) |
| 175 | + |
| 176 | + // Text embed code |
190 | 177 | .append( |
191 | | - _this.getSequenceEmbedCode() |
192 | | - ) |
193 | | - ), |
194 | | - |
195 | | - // Add a clear both to give content body height |
196 | | - $j('<div />').css({'clear': 'both'}) |
197 | | - ) |
198 | | - |
199 | | - }); // load json player data |
200 | | - |
201 | | - mw.load('EmbedPlayer', function(){ |
202 | | - $j( _this.target ).find('video').embedPlayer(); |
| 178 | + $j('<h3 />') |
| 179 | + .text( gM('mwe-sequencer-embed-sequence') ) |
| 180 | + , |
| 181 | + $j('<span />' ) |
| 182 | + .text( gM('mwe-sequencer-embed-sequence-desc') ) |
| 183 | + , |
| 184 | + $j('<br />'), |
| 185 | + $j('<textarea />') |
| 186 | + .css({ |
| 187 | + 'width' : '100%', |
| 188 | + 'height' : '200px' |
| 189 | + }).focus(function(){ |
| 190 | + $j(this).select(); |
| 191 | + }) |
| 192 | + .append( |
| 193 | + _this.getSequenceEmbedCode() |
| 194 | + ) |
| 195 | + ), |
| 196 | + |
| 197 | + // Add a clear both to give content body height |
| 198 | + $j('<div />').css({'clear': 'both'}) |
| 199 | + ) |
| 200 | + // Rewrite the player |
| 201 | + $j('#embedSequencePlayer').embedPlayer(); |
| 202 | + }); // load json player data |
203 | 203 | }) |
204 | 204 | }, |
205 | 205 | getSequenceEmbedCode: function(){ |