Index: branches/js2-work/phase3/js/mwEmbed/tests/Player_Timed_Text.html |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | <head> |
6 | 6 | <title>sample mv embed</title> |
7 | 7 | <!-- <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> --> |
8 | | - <script type="text/javascript" src="../jsScriptLoader.php?class=mwEmbed&debug=true"></script> |
| 8 | + <script type="text/javascript" src="../jsScriptLoader.php?class=window.jQuery,mwEmbed&debug=true"></script> |
9 | 9 | </head> |
10 | 10 | <body> |
11 | 11 | <h3> mwEmbed Timed Text Examples:</h3> |
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js |
— | — | @@ -1257,7 +1257,7 @@ |
1258 | 1258 | 'border' : 0, |
1259 | 1259 | 'width' : 15, |
1260 | 1260 | 'height' : 11, |
1261 | | - 'src' : mw.getConfig( 'images_path' ) + 'magnify-clip.png' |
| 1261 | + 'src' : mw.getConfig( 'imagesPath' ) + 'magnify-clip.png' |
1262 | 1262 | } ), |
1263 | 1263 | |
1264 | 1264 | $j('<span />') |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/loader.js |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | */ |
5 | 5 | // Scope everything in "mw" ( keeps the global namespace clean ) |
6 | 6 | ( function( mw ) { |
7 | | - |
| 7 | + |
8 | 8 | mw.addClassFilePaths( { |
9 | 9 | "mw.TimedText" : "mw.TimedText.js", |
10 | 10 | "mw.style.TimedText" : "css/mw.style.TimedText.css", |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | "mw.style.TimedTextEdit" : "css/mw.style.TimedTextEdit.css", |
14 | 14 | |
15 | 15 | "RemoteMwTimedText" : "remotes/RemoteMwTimedText.js" |
16 | | -}); |
| 16 | +} ); |
17 | 17 | |
18 | 18 | var mwTimedTextRequestSet = [ |
19 | 19 | '$j.fn.menu', |
— | — | @@ -29,18 +29,21 @@ |
30 | 30 | }); |
31 | 31 | |
32 | 32 | var mwLoadTimedTextFlag = false; |
33 | | -// Merge in the timed text libs |
| 33 | +// Always Merge in the timed text libs |
34 | 34 | if( mw.getConfig( 'textInterface' ) == 'always' ) { |
35 | 35 | mwLoadTimedTextFlag = true; |
36 | 36 | } |
| 37 | + |
37 | 38 | /** |
38 | | -* Setup the load embedPlayer visit tag function hook. |
| 39 | +* Setup the load embedPlayer visit tag addSetupHook function |
39 | 40 | * |
40 | 41 | * Check if the video tags in the page support timed text |
41 | 42 | * this way we can add our timed text libraries to the initial |
42 | 43 | * request and avoid an extra round trip to the server |
43 | 44 | */ |
44 | | -mw.addHook( 'LoaderEmbedPlayerVisitTag', function( playerElement ) { |
| 45 | + |
| 46 | +// Bind the loader embed player tag viewing |
| 47 | +$j( mw ).bind( 'LoaderEmbedPlayerVisitTag', function( event, playerElement ) { |
45 | 48 | // If add timed text flag not already set check for itext, and sources |
46 | 49 | if( ! mwLoadTimedTextFlag ) { |
47 | 50 | if( $j( playerElement ).find( 'itext' ).length != 0 ) { |
— | — | @@ -55,14 +58,15 @@ |
56 | 59 | } |
57 | 60 | } |
58 | 61 | } ); |
59 | | - |
60 | 62 | // Update the player loader request with timedText if the flag has been set |
61 | | -mw.addHook( 'LoaderEmbedPlayerUpdateRequest', function( classRequest ) { |
| 63 | +$j( mw ).bind( 'LoaderEmbedPlayerUpdateRequest', function( event, classRequest ) { |
62 | 64 | // Add timed text items if flag set. |
63 | 65 | if( mwLoadTimedTextFlag ) { |
64 | 66 | $j.merge( classRequest, mwTimedTextRequestSet ); |
65 | | - } |
| 67 | + } |
| 68 | + |
66 | 69 | } ); |
| 70 | + |
67 | 71 | |
68 | 72 | // TimedText editor: |
69 | 73 | mw.addModuleLoader( 'TimedText.Edit', function( callback ) { |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js |
— | — | @@ -158,11 +158,11 @@ |
159 | 159 | } |
160 | 160 | |
161 | 161 | // Set up embedPlayer hooks: |
162 | | - embedPlayer.addHook( 'monitor', function() { |
163 | | - _this.monitor(); |
164 | | - } ) |
| 162 | + $j( embedPlayer ).bind( 'onMonitor', function() { |
| 163 | + _this.monitor() |
| 164 | + } ); |
165 | 165 | |
166 | | - embedPlayer.addHook( 'play', function() { |
| 166 | + $j( embedPlayer ).bind( 'onPlay', function() { |
167 | 167 | // Will load and setup timedText sources (if not loaded already loaded ) |
168 | 168 | _this.setupTextSources(); |
169 | 169 | } ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js |
— | — | @@ -1018,7 +1018,7 @@ |
1019 | 1019 | 'border' : 0, |
1020 | 1020 | 'width' : 15, |
1021 | 1021 | 'height' : 11, |
1022 | | - 'src' : mw.getConfig( 'images_path' ) + 'magnify-clip.png' |
| 1022 | + 'src' : mw.getConfig( 'imagesPath' ) + 'magnify-clip.png' |
1023 | 1023 | } ), |
1024 | 1024 | |
1025 | 1025 | $j('<span />') |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -1188,7 +1188,7 @@ |
1189 | 1189 | |
1190 | 1190 | $j('<img />' ) |
1191 | 1191 | .attr( { |
1192 | | - 'src': mw.getConfig('images_path' ) + 'cookies_blocked_MSIE_eye.png', |
| 1192 | + 'src': mw.getConfig('imagesPath' ) + 'cookies_blocked_MSIE_eye.png', |
1193 | 1193 | 'alt' : gM('mwe-ie-eye-permision' ) |
1194 | 1194 | }) |
1195 | 1195 | ); |
— | — | @@ -1771,7 +1771,7 @@ |
1772 | 1772 | // Check for missing poster types for audio |
1773 | 1773 | if ( (resource.mime == 'audio/ogg' || resource.mime == 'application/ogg') |
1774 | 1774 | && !resource.poster ) { |
1775 | | - resource.poster = mw.getConfig( 'images_path' ) + 'sound_music_icon-80.png'; |
| 1775 | + resource.poster = mw.getConfig( 'imagesPath' ) + 'sound_music_icon-80.png'; |
1776 | 1776 | } |
1777 | 1777 | |
1778 | 1778 | var $resultThumb = $j( '<img />' ) |
— | — | @@ -2964,10 +2964,10 @@ |
2965 | 2965 | createLayoutSelector: function() { |
2966 | 2966 | |
2967 | 2967 | var _this = this; |
2968 | | - var darkBoxUrl = mw.getConfig( 'images_path' ) + 'box_layout_icon_dark.png'; |
2969 | | - var lightBoxUrl = mw.getConfig( 'images_path' ) + 'box_layout_icon.png'; |
2970 | | - var darkListUrl = mw.getConfig( 'images_path' ) + 'list_layout_icon_dark.png'; |
2971 | | - var lightListUrl = mw.getConfig( 'images_path' ) + 'list_layout_icon.png'; |
| 2968 | + var darkBoxUrl = mw.getConfig( 'imagesPath' ) + 'box_layout_icon_dark.png'; |
| 2969 | + var lightBoxUrl = mw.getConfig( 'imagesPath' ) + 'box_layout_icon.png'; |
| 2970 | + var darkListUrl = mw.getConfig( 'imagesPath' ) + 'list_layout_icon_dark.png'; |
| 2971 | + var lightListUrl = mw.getConfig( 'imagesPath' ) + 'list_layout_icon.png'; |
2972 | 2972 | |
2973 | 2973 | var defaultBoxUrl, defaultListUrl; |
2974 | 2974 | if ( _this.displayMode == 'box' ) { |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js |
— | — | @@ -108,57 +108,50 @@ |
109 | 109 | /** |
110 | 110 | * Add a DOM ready check for player tags |
111 | 111 | |
112 | | -* We use mw.addDOMReadyHook instead of mw.ready so that |
113 | | -* player interfaces are ready once mw.ready is called. |
| 112 | +* We use mw.addSetupHook instead of mw.ready() so that |
| 113 | +* player interfaces can be ready before mw.ready() is called. |
114 | 114 | */ |
115 | | -mw.addDOMReadyHook( function() { |
| 115 | +mw.addSetupHook( function( callback ) { |
116 | 116 | if( mw.documentHasPlayerTags() ) { |
117 | | - var rewriteElementCount = 0; |
| 117 | + var rewriteElementCount = 0; |
118 | 118 | |
119 | | - // Add the setup hook since we have player tags |
120 | | - mw.addSetupHook( function( callback ) { |
121 | | - |
122 | | - // Set each player to loading ( as early on as possible ) |
123 | | - $j( mw.getConfig( 'rewritePlayerTags' ) ).each( function( index, element ){ |
124 | | - |
125 | | - // Assign an the element an ID (if its missing one) |
126 | | - if ( $j( element ).attr( "id" ) == '' ) { |
127 | | - $j( element ).attr( "id", 'v' + ( rewriteElementCount++ ) ); |
128 | | - } |
129 | | - |
130 | | - // Add an absolute positioned loader |
131 | | - var pos = $j( element ).offset(); |
132 | | - var left = ( $j( element ).width() ) ? |
133 | | - parseInt( pos.left + ( .4 * $j( element ).width() ) ) : |
134 | | - pos.left + 30; |
135 | | - var top = ( $j( element ).height() ) ? |
136 | | - parseInt( pos.top + ( .4 * $j( element ).height() ) ) : |
137 | | - pos.left + 30; |
138 | | - $j('body').append( |
139 | | - $j('<div />') |
140 | | - .loadingSpinner() |
141 | | - .attr('id', 'loadSpiner_' + $j( element ).attr('id') ) |
142 | | - .css({ |
143 | | - 'width' : 32, |
144 | | - 'height' : 32, |
145 | | - 'position': 'absolute', |
146 | | - 'top' : top, |
147 | | - 'left' : left |
148 | | - }) |
149 | | - ) |
150 | | - //$j( element ).hide(); |
151 | | - }); |
152 | | - // Load the embedPlayer module ( then run queued hooks ) |
153 | | - mw.load( 'EmbedPlayer', function ( ) { |
154 | | - // Rewrite the rewritePlayerTags with the |
155 | | - $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer(); |
156 | | - // Run the setup callback now that we have setup all the players |
157 | | - callback(); |
158 | | - }) |
159 | | - }); |
160 | | - |
161 | | - // Tell mwEmbed to run setup |
162 | | - mw.setConfig( 'runSetupMwEmbed', true ); |
| 119 | + // Set each player to loading ( as early on as possible ) |
| 120 | + $j( mw.getConfig( 'rewritePlayerTags' ) ).each( function( index, element ){ |
| 121 | + |
| 122 | + // Assign an the element an ID (if its missing one) |
| 123 | + if ( $j( element ).attr( "id" ) == '' ) { |
| 124 | + $j( element ).attr( "id", 'v' + ( rewriteElementCount++ ) ); |
| 125 | + } |
| 126 | + |
| 127 | + // Add an absolute positioned loader |
| 128 | + var pos = $j( element ).offset(); |
| 129 | + var left = ( $j( element ).width() ) ? |
| 130 | + parseInt( pos.left + ( .4 * $j( element ).width() ) ) : |
| 131 | + pos.left + 30; |
| 132 | + var top = ( $j( element ).height() ) ? |
| 133 | + parseInt( pos.top + ( .4 * $j( element ).height() ) ) : |
| 134 | + pos.left + 30; |
| 135 | + $j('body').append( |
| 136 | + $j('<div />') |
| 137 | + .loadingSpinner() |
| 138 | + .attr('id', 'loadSpiner_' + $j( element ).attr('id') ) |
| 139 | + .css({ |
| 140 | + 'width' : 32, |
| 141 | + 'height' : 32, |
| 142 | + 'position': 'absolute', |
| 143 | + 'top' : top, |
| 144 | + 'left' : left |
| 145 | + }) |
| 146 | + ) |
| 147 | + //$j( element ).hide(); |
| 148 | + }); |
| 149 | + // Load the embedPlayer module ( then run queued hooks ) |
| 150 | + mw.load( 'EmbedPlayer', function ( ) { |
| 151 | + // Rewrite the rewritePlayerTags with the |
| 152 | + $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer(); |
| 153 | + // Run the setup callback now that we have setup all the players |
| 154 | + callback(); |
| 155 | + }) |
163 | 156 | } |
164 | 157 | }); |
165 | 158 | |
— | — | @@ -205,8 +198,8 @@ |
206 | 199 | // Add skin name to playerSkins |
207 | 200 | playerSkins[ mw.valid_skins[ n ] ] = true; |
208 | 201 | } |
209 | | - } |
210 | | - mw.runHook( 'LoaderEmbedPlayerVisitTag', playerElement ); |
| 202 | + } |
| 203 | + $j( mw ).trigger( 'LoaderEmbedPlayerVisitTag', playerElement ); |
211 | 204 | } ); |
212 | 205 | |
213 | 206 | // Add the player skins css and js to the load request: |
— | — | @@ -231,11 +224,14 @@ |
232 | 225 | // Safari gets slower load since we have to detect ogg support |
233 | 226 | if( typeof HTMLVideoElement == 'object' && !$j.browser.safari ) { |
234 | 227 | dependencyRequest[0].push( 'nativeEmbed' ) |
235 | | - } |
| 228 | + } |
| 229 | + |
| 230 | + // Run the EmbedPlayer loader hook ( so that modules can add dependencies to the request ) |
| 231 | + $j( mw ).trigger( 'LoaderEmbedPlayerUpdateRequest', |
| 232 | + [ dependencyRequest[ 0 ] ] /* Put into an array to be the first argument |
| 233 | + in jQuery trigger argument passing */ |
| 234 | + ); |
236 | 235 | |
237 | | - // Run the EmbedPlayer loader hook ( so that modules can add dependencies to the request ) |
238 | | - mw.runHook( 'LoaderEmbedPlayerUpdateRequest', dependencyRequest[ 0 ] ); |
239 | | - |
240 | 236 | |
241 | 237 | // Load the video libs: |
242 | 238 | mw.load( dependencyRequest, function() { |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -248,11 +248,11 @@ |
249 | 249 | * @param [ Optional ] {Function} callback Function to be called once video interfaces are ready |
250 | 250 | * |
251 | 251 | */ |
252 | | - $.fn.embedPlayer = function( attributes, callback ) { |
| 252 | + $.fn.embedPlayer = function( attributes, callback ) { |
253 | 253 | mw.log('embedPlayer on: ' + this.selector); |
254 | 254 | var player_select = this.selector; |
255 | 255 | |
256 | | - // Handle optional include of attributes argument: |
| 256 | + //Handle optional include of attributes argument: |
257 | 257 | if( typeof attributes == 'function' ){ |
258 | 258 | callback = attributes; |
259 | 259 | } |
— | — | @@ -263,14 +263,14 @@ |
264 | 264 | mw.playerManager = new EmbedPlayerManager(); |
265 | 265 | |
266 | 266 | // Run the global hooks that mw.playerManager is ready |
267 | | - mw.runHook( 'EmbedPlayerManagerReady' ); |
| 267 | + $j( mw ).trigger( 'EmbedPlayerManagerReady' ); |
268 | 268 | } |
269 | 269 | |
270 | | - // Add the embedPlayer ready callback |
271 | | - if( typeof callback == 'function' ) { |
| 270 | + //Add the embedPlayer ready callback |
| 271 | + if( typeof callback == 'function' ){ |
272 | 272 | mw.playerManager.addCallback( callback ); |
273 | | - } |
274 | | - |
| 273 | + } |
| 274 | + |
275 | 275 | // Add each selected element to the player manager: |
276 | 276 | $j( player_select ).each( function(na, playerElement) { |
277 | 277 | mw.playerManager.addElement( playerElement, attributes); |
— | — | @@ -299,7 +299,6 @@ |
300 | 300 | init: function( ) { |
301 | 301 | this.callbackFunctions = []; |
302 | 302 | this.playerList = []; |
303 | | - mw.addHookSystem ( this ); |
304 | 303 | }, |
305 | 304 | |
306 | 305 | /** |
— | — | @@ -372,11 +371,12 @@ |
373 | 372 | var playlistPlayer = new mw.PlayList( element, attributes ); |
374 | 373 | |
375 | 374 | // Swap in playlist player interface |
376 | | - _this.swapEmbedPlayerElement( element, playlistPlayer ); |
| 375 | + _this.swapEmbedPlayerElement( element, playerInterface ); |
377 | 376 | |
378 | | - // Pass the id to any hook that needs to interface prior to showPlayer code |
379 | | - _this.runHook( 'swapedPlayerId', playerInterface.id ); |
| 377 | + // Pass the id to any hook that needs to interface prior to checkPlayerSources |
| 378 | + $j( _this ).trigger ( 'swapedPlayerId', playerInterface.id ); |
380 | 379 | |
| 380 | + |
381 | 381 | // Issue the checkPlayerSources call to the new playlist interface: |
382 | 382 | $j( '#' + playlistPlayer.id ).get(0).showPlayer(); |
383 | 383 | } ); |
— | — | @@ -394,10 +394,10 @@ |
395 | 395 | mw.log("runPlayerSwap::" + $j( element ).attr('id') ); |
396 | 396 | ranPlayerSwapFlag = true; |
397 | 397 | var playerInterface = new mw.EmbedPlayer( element , attributes); |
398 | | - _this.swapEmbedPlayerElement( element, playerInterface ); |
| 398 | + _this.swapEmbedPlayerElement( element, playerInterface ); |
399 | 399 | |
400 | 400 | // Pass the id to any hook that needs to interface prior to checkPlayerSources |
401 | | - _this.runHook( 'swapedPlayerId', playerInterface.id ); |
| 401 | + $j( _this ).trigger ( 'swapedPlayerId', playerInterface.id ); |
402 | 402 | |
403 | 403 | // Issue the checkPlayerSources call to the new player interface: |
404 | 404 | // make sure to use the element that is in the DOM: |
— | — | @@ -560,10 +560,9 @@ |
561 | 561 | // Remove the player loader spinner: |
562 | 562 | $j('#loadSpiner_' + player.id ).remove(); |
563 | 563 | |
564 | | - // Run the player ready hook |
565 | | - player.runHook( 'playerReady' ); |
| 564 | + // Run the player ready trigger |
| 565 | + $j( player ).trigger( 'playerReady' ); |
566 | 566 | |
567 | | - // Check if all the players are ready |
568 | 567 | var is_ready = true; |
569 | 568 | for ( var i = 0; i < this.playerList.length; i++ ) { |
570 | 569 | var currentPlayer = $j( '#' + this.playerList[i] ).get( 0 ); |
— | — | @@ -595,7 +594,7 @@ |
596 | 595 | |
597 | 596 | mediaSource.prototype = { |
598 | 597 | // MIME type of the source. |
599 | | - mimeType: null, |
| 598 | + mimeType:null, |
600 | 599 | |
601 | 600 | // URI of the source. |
602 | 601 | uri:null, |
— | — | @@ -648,7 +647,7 @@ |
649 | 648 | if ( typeof pUrl[ 'queryKey' ][ 't' ] != 'undefined' ) { |
650 | 649 | this[ 'URLTimeEncoding' ] = true; |
651 | 650 | } |
652 | | - // Set the source attributes local var |
| 651 | + |
653 | 652 | var sourceAttr = mw.getConfig( 'embedPlayerSourceAttributes' ); |
654 | 653 | |
655 | 654 | for ( var i = 0; i < sourceAttr.length; i++ ) { // array loop: |
— | — | @@ -973,15 +972,15 @@ |
974 | 973 | * @return mediaSource elements. |
975 | 974 | * @type Array |
976 | 975 | */ |
977 | | - getSources: function( mime_filter ) { |
978 | | - if ( !mime_filter ) { |
| 976 | + getSources: function( mimeFilter ) { |
| 977 | + if ( !mimeFilter ) { |
979 | 978 | return this.sources; |
980 | 979 | } |
981 | 980 | // Apply mime filter: |
982 | 981 | var source_set = new Array(); |
983 | 982 | for ( var i = 0; i < this.sources.length ; i++ ) { |
984 | 983 | if ( this.sources[i].mimeType && |
985 | | - this.sources[i].mimeType.indexOf( mime_filter ) != -1 ) |
| 984 | + this.sources[i].mimeType.indexOf( mimeFilter ) != -1 ) |
986 | 985 | source_set.push( this.sources[i] ); |
987 | 986 | } |
988 | 987 | return source_set; |
— | — | @@ -1144,7 +1143,7 @@ |
1145 | 1144 | // make sure an existing element with the same src does not already exist: |
1146 | 1145 | for ( var i = 0; i < this.sources.length; i++ ) { |
1147 | 1146 | if ( this.sources[i].src == newSrc ) { |
1148 | | - // Source already exists update any new attributes: |
| 1147 | + // Source already exists update any new attr: |
1149 | 1148 | this.sources[i].updateSource( element ); |
1150 | 1149 | return this.sources[i]; |
1151 | 1150 | } |
— | — | @@ -1152,8 +1151,8 @@ |
1153 | 1152 | } |
1154 | 1153 | // Create a new source |
1155 | 1154 | var source = new mediaSource( element ); |
1156 | | - |
1157 | | - this.sources.push( source ); |
| 1155 | + |
| 1156 | + this.sources.push( source ); |
1158 | 1157 | mw.log( 'tryAddSource: added source ::' + source + 'sl:' + this.sources.length ); |
1159 | 1158 | return source; |
1160 | 1159 | }, |
— | — | @@ -1169,7 +1168,7 @@ |
1170 | 1169 | if ( this.isPlayableType( this.sources[i].mimeType ) ) { |
1171 | 1170 | playableSources.push( this.sources[i] ); |
1172 | 1171 | } else { |
1173 | | - mw.log( "type " + this.sources[i].mimeType + 'is not playable' ); |
| 1172 | + //mw.log( "type " + this.sources[i].mimeType + 'is not playable' ); |
1174 | 1173 | } |
1175 | 1174 | }; |
1176 | 1175 | return playableSources; |
— | — | @@ -1244,9 +1243,6 @@ |
1245 | 1244 | // Stores the loading errors |
1246 | 1245 | 'loadError' : false, |
1247 | 1246 | |
1248 | | - // Loading external data flag ( for delaying interface updates ) |
1249 | | - 'loading_external_data' : false, |
1250 | | - |
1251 | 1247 | // Thumbnail updating flag ( to avoid rewriting an thumbnail thats already being updated) |
1252 | 1248 | 'thumbnail_updating' : false, |
1253 | 1249 | |
— | — | @@ -1285,12 +1281,10 @@ |
1286 | 1282 | init: function( element, customAttributes ) { |
1287 | 1283 | var _this = this; |
1288 | 1284 | // Set customAttributes if unset: |
1289 | | - if ( !customAttributes ) |
| 1285 | + if ( !customAttributes ) { |
1290 | 1286 | customAttributes = { }; |
| 1287 | + } |
1291 | 1288 | |
1292 | | - //Add a hook system to the embedPlayer |
1293 | | - mw.addHookSystem( _this ); |
1294 | | - |
1295 | 1289 | var playerAttributes = mw.getConfig( 'embedPlayerAttributes' ); |
1296 | 1290 | // Setup the player Interface from supported attributes: |
1297 | 1291 | for ( var attr in playerAttributes ) { |
— | — | @@ -1371,8 +1365,8 @@ |
1372 | 1366 | } |
1373 | 1367 | |
1374 | 1368 | // Add the mediaElement object with the elements sources: |
1375 | | - this.mediaElement = new mediaElement( element ); |
1376 | | - |
| 1369 | + this.mediaElement = new mediaElement( element ); |
| 1370 | + |
1377 | 1371 | }, |
1378 | 1372 | |
1379 | 1373 | /** |
— | — | @@ -1431,6 +1425,7 @@ |
1432 | 1426 | ) { |
1433 | 1427 | var defaultSize = mw.getConfig( 'videoSize' ).split( 'x' ); |
1434 | 1428 | this['width'] = defaultSize[0]; |
| 1429 | + |
1435 | 1430 | // Special height default for audio tag ( if not set ) |
1436 | 1431 | if( element.tagName.toLowerCase() == 'audio' ) { |
1437 | 1432 | this['height'] = 0; |
— | — | @@ -1464,7 +1459,7 @@ |
1465 | 1460 | * If we need to get media sources form an external file |
1466 | 1461 | * that request is issued here |
1467 | 1462 | */ |
1468 | | - checkPlayerSources: function( callbackChain ) { |
| 1463 | + checkPlayerSources: function() { |
1469 | 1464 | mw.log( 'f:checkPlayerSources: ' + this.id ); |
1470 | 1465 | var _this = this; |
1471 | 1466 | var sourceCount = this.mediaElement.getPlayableSources().length; |
— | — | @@ -1482,19 +1477,16 @@ |
1483 | 1478 | } ); |
1484 | 1479 | return ; |
1485 | 1480 | } |
1486 | | - // Check for hooks to handle checkPlayerSources |
1487 | | - if( this.hooks[ 'checkPlayerSources' ].length ) { |
1488 | | - this.runHook( 'checkPlayerSources', function(){ |
1489 | | - _this.checkForTimedText(); |
1490 | | - }); |
1491 | | - } else { |
1492 | | - // no hooks run check for timed text directly |
1493 | | - _this.checkForTimedText(); |
1494 | | - } |
1495 | 1481 | |
| 1482 | + // Run embedPlayer sources hook |
| 1483 | + $j( this ).trigger ( 'checkPlayerSources', function(){ |
| 1484 | + // Continue application flow and check for Timed Text |
| 1485 | + _this.checkForTimedText(); |
| 1486 | + }); |
1496 | 1487 | }, |
| 1488 | + |
1497 | 1489 | /** |
1498 | | - * Load Source video info From Api title key ( this.apiTitleKey ) |
| 1490 | + * Load Source video info from mediaWiki Api title key ( this.apiTitleKey ) |
1499 | 1491 | * @param {Function} callback Function called once loading is complete |
1500 | 1492 | */ |
1501 | 1493 | loadSourceFromApi: function( callback ){ |
— | — | @@ -1610,7 +1602,7 @@ |
1611 | 1603 | // Auto select player based on default order |
1612 | 1604 | if ( !this.mediaElement.selectedSource ) { |
1613 | 1605 | // check for parent clip: |
1614 | | - if ( typeof this.pc != 'undefined' ) { |
| 1606 | + if ( typeof this.pc != 'undefined' ) { |
1615 | 1607 | mw.log( 'no sources, type:' + this.type + ' check for html' ); |
1616 | 1608 | // debugger; |
1617 | 1609 | // do load player if just displaying innerHTML: |
— | — | @@ -1629,7 +1621,6 @@ |
1630 | 1622 | // Inherit the playback system of the selected player: |
1631 | 1623 | this.inheritEmbedPlayer(); |
1632 | 1624 | } else { |
1633 | | - |
1634 | 1625 | // No source's playable |
1635 | 1626 | var missingType = ''; |
1636 | 1627 | var or = ''; |
— | — | @@ -1637,7 +1628,6 @@ |
1638 | 1629 | missingType += or + this.mediaElement.sources[i].mimeType; |
1639 | 1630 | or = ' or '; |
1640 | 1631 | } |
1641 | | - |
1642 | 1632 | // Get from parent playlist if set: |
1643 | 1633 | if ( this.pc ){ |
1644 | 1634 | missingType = this.pc.type; |
— | — | @@ -1780,32 +1770,21 @@ |
1781 | 1771 | mw.log( 'updated seek_time_sec: ' + mw.seconds2npt ( this.seek_time_sec ) ); |
1782 | 1772 | this.stop(); |
1783 | 1773 | this.didSeekJump = true; |
1784 | | - |
1785 | 1774 | // Update the slider |
1786 | 1775 | this.updatePlayHead( percent ); |
1787 | | - |
1788 | | - // Do play request in 100ms ( give the dom time to swap out the embed player ) |
1789 | | - setTimeout( function() { |
1790 | | - _this.play() |
1791 | | - }, 100 ); |
1792 | 1776 | } |
| 1777 | + // Do play request in 100ms ( give the dom time to swap out the embed player ) |
| 1778 | + setTimeout( function() { |
| 1779 | + _this.play() |
| 1780 | + }, 100 ); |
1793 | 1781 | |
1794 | 1782 | // Run the onSeeking interface update |
1795 | | - this.onSeek(); |
1796 | | - |
1797 | | - }, |
| 1783 | + // NOTE ctrlBuilder should really bind to html5 events rather |
| 1784 | + // than explicitly calling it or inheriting stuff. |
| 1785 | + this.ctrlBuilder.onSeek(); |
| 1786 | + }, |
1798 | 1787 | |
1799 | 1788 | /** |
1800 | | - * function fired once seeking is taking place |
1801 | | - */ |
1802 | | - onSeek: function(){ |
1803 | | - // Update the interface: |
1804 | | - this.setStatus( gM( 'mwe-seeking' ) ); |
1805 | | - // Run the seeking hook |
1806 | | - this.runHook( 'onSeek' ); |
1807 | | - }, |
1808 | | - |
1809 | | - /** |
1810 | 1789 | * Seeks to the requested time and issues a callback when ready |
1811 | 1790 | * (should be overwritten by client that supports frame serving) |
1812 | 1791 | */ |
— | — | @@ -1839,7 +1818,7 @@ |
1840 | 1819 | this.bufferStartFlag = false; |
1841 | 1820 | this.bufferEndFlag = false; |
1842 | 1821 | |
1843 | | - |
| 1822 | + // Make sure the player is |
1844 | 1823 | mw.log( 'performing embed for ' + _this.id ); |
1845 | 1824 | // mw.log('should embed:' + embed_code); |
1846 | 1825 | _this.doEmbedHTML() |
— | — | @@ -1851,7 +1830,8 @@ |
1852 | 1831 | * On clip done action. Called once a clip is done playing |
1853 | 1832 | */ |
1854 | 1833 | onClipDone: function() { |
1855 | | - mw.log( 'base:onClipDone' ); |
| 1834 | + mw.log( 'base:onClipDone' ); |
| 1835 | + |
1856 | 1836 | |
1857 | 1837 | // Stop the clip (load the thumbnail etc) |
1858 | 1838 | this.stop(); |
— | — | @@ -1870,11 +1850,11 @@ |
1871 | 1851 | } |
1872 | 1852 | // Do the ctrlBuilder onClip done interface |
1873 | 1853 | this.ctrlBuilder.onClipDone(); |
1874 | | - |
1875 | | - // Fire the html5 ended binding / event |
| 1854 | + |
| 1855 | + // Fire the html5 ended binding |
1876 | 1856 | $j( this ).trigger( 'ended' ); |
1877 | 1857 | |
1878 | | - //Set the clip done playing count: |
| 1858 | + // Update the clip done playing count: |
1879 | 1859 | this.donePlayingCount ++; |
1880 | 1860 | }, |
1881 | 1861 | |
— | — | @@ -1897,8 +1877,8 @@ |
1898 | 1878 | // Make sure the ctrlBuilder bindings are up-to-date |
1899 | 1879 | this.ctrlBuilder.addControlHooks(); |
1900 | 1880 | |
1901 | | - // Once the thumbnail is shown run the mediaReady hook |
1902 | | - this.runHook( 'mediaLoaded' ); |
| 1881 | + // Once the thumbnail is shown run the mediaReady trigger |
| 1882 | + $j( this ).trigger( 'mediaLoaded' ); |
1903 | 1883 | }, |
1904 | 1884 | |
1905 | 1885 | /** |
— | — | @@ -1923,7 +1903,6 @@ |
1924 | 1904 | this.ctrlBuilder = new ctrlBuilder( this ); |
1925 | 1905 | |
1926 | 1906 | var _this = this; |
1927 | | - |
1928 | 1907 | // Make sure we have interface_wrap |
1929 | 1908 | if( $j( this ).parent( '.interface_wrap' ).length == 0 ) { |
1930 | 1909 | // Select "player" |
— | — | @@ -1966,9 +1945,9 @@ |
1967 | 1946 | * @param {String} [misssingType] missing type mime |
1968 | 1947 | */ |
1969 | 1948 | showPluginMissingHTML : function( misssingType ) { |
1970 | | - //remove the loading spinner if present: |
| 1949 | + // Remove the loading spinner if present: |
1971 | 1950 | $j('#loadSpiner_' + this.id ).remove(); |
1972 | | - |
| 1951 | + |
1973 | 1952 | // If the native video is already displayed hide it: |
1974 | 1953 | if( $j( '#' + this.pid ).length != 0 ){ |
1975 | 1954 | $j('#loadSpiner_' + this.id ).remove(); |
— | — | @@ -2026,7 +2005,7 @@ |
2027 | 2006 | this.mediaElement.updateSourceTimes( start_npt, end_npt ); |
2028 | 2007 | |
2029 | 2008 | // update mv_time |
2030 | | - this.setStatus( start_npt + '/' + end_npt ); |
| 2009 | + this.ctrlBuilder.setStatus( start_npt + '/' + end_npt ); |
2031 | 2010 | |
2032 | 2011 | // reset slider |
2033 | 2012 | this.updatePlayHead( 0 ); |
— | — | @@ -2178,8 +2157,9 @@ |
2179 | 2158 | mw.log( 'embedPlayer:updateThumbnailHTML::' + this.id ); |
2180 | 2159 | var thumb_html = ''; |
2181 | 2160 | var class_atr = ''; |
2182 | | - var style_atr = ''; |
| 2161 | + var style_atr = ''; |
2183 | 2162 | |
| 2163 | + |
2184 | 2164 | if( this.useNativeControls() ){ |
2185 | 2165 | this.showNativePlayer(); |
2186 | 2166 | return ; |
— | — | @@ -2187,9 +2167,9 @@ |
2188 | 2168 | |
2189 | 2169 | // Set by default thumb value if not found |
2190 | 2170 | var posterSrc = ( this.poster ) ? this.poster : |
2191 | | - mw.getConfig( 'images_path' ) + 'vid_default_thumb.jpg'; |
| 2171 | + mw.getConfig( 'imagesPath' ) + 'vid_default_thumb.jpg'; |
2192 | 2172 | |
2193 | | - // Poster support is not very good in all browsers |
| 2173 | + // Poster support is not very consistant in browsers |
2194 | 2174 | // use a jpg poster image: |
2195 | 2175 | $j( this ).html( |
2196 | 2176 | $j( '<img />' ) |
— | — | @@ -2204,7 +2184,7 @@ |
2205 | 2185 | }) |
2206 | 2186 | .addClass( 'playerPoster' ) |
2207 | 2187 | ); |
2208 | | - |
| 2188 | + |
2209 | 2189 | if ( this.controls |
2210 | 2190 | && this.height > this.ctrlBuilder.getComponentHeight( 'playButtonLarge' ) |
2211 | 2191 | ) { |
— | — | @@ -2217,7 +2197,7 @@ |
2218 | 2198 | /** |
2219 | 2199 | * Checks if native controls should be used |
2220 | 2200 | * |
2221 | | - * @param [player] Object Optional player object to check controls attribute |
| 2201 | + * @param [player] Object Optional player object to check controls attribute |
2222 | 2202 | * @returns boolean true if the mwEmbed player interface should be used |
2223 | 2203 | * false if the mwEmbed player interface should not be used |
2224 | 2204 | */ |
— | — | @@ -2507,14 +2487,12 @@ |
2508 | 2488 | this.doPlayTracking(); |
2509 | 2489 | } |
2510 | 2490 | |
2511 | | - // Run play hook: |
2512 | | - this.runHook( 'play' ); |
2513 | | - |
2514 | | - // If we previusly finished playing this clip run the "replay hook" |
| 2491 | + //Run play hook: |
| 2492 | + $j( this ).trigger( 'onPlay' ); |
| 2493 | + // If we previusly finished playing this clip run the "replay hook" |
2515 | 2494 | if( this.donePlayingCount > 0 ){ |
2516 | | - this.runHook( 'replay' ); |
| 2495 | + $j( this ).trigger( 'onReplay' ); |
2517 | 2496 | } |
2518 | | - |
2519 | 2497 | }, |
2520 | 2498 | |
2521 | 2499 | /** |
— | — | @@ -2587,7 +2565,7 @@ |
2588 | 2566 | this.showThumbnail(); |
2589 | 2567 | this.bufferedPercent = 0; // reset buffer state |
2590 | 2568 | this.updatePlayHead( 0 ); |
2591 | | - this.setStatus( this.getTimeRange() ); |
| 2569 | + this.ctrlBuilder.setStatus( this.getTimeRange() ); |
2592 | 2570 | } |
2593 | 2571 | |
2594 | 2572 | //Bind play-btn-large play |
— | — | @@ -2710,14 +2688,13 @@ |
2711 | 2689 | if ( parseInt( this.startOffset ) != 0 ) { |
2712 | 2690 | // If start offset include that calculation |
2713 | 2691 | this.updatePlayHead( ( this.currentTime - this.startOffset ) / this.duration ); |
2714 | | - var et = ( this.ctrlBuilder.longTimeDisp ) ? '/' + mw.seconds2npt( parseFloat( this.startOffset ) + |
2715 | | - parseFloat( this.duration ) ) : ''; |
2716 | | - this.setStatus( mw.seconds2npt( this.currentTime ) + et ); |
| 2692 | + var et = ( this.ctrlBuilder.longTimeDisp ) ? '/' + mw.seconds2npt( parseFloat( this.startOffset ) + parseFloat( this.duration ) ) : ''; |
| 2693 | + this.ctrlBuilder.setStatus( mw.seconds2npt( this.currentTime ) + et ); |
2717 | 2694 | } else { |
2718 | 2695 | this.updatePlayHead( this.currentTime / this.duration ); |
2719 | 2696 | // Only include the end time if longTimeDisp is enabled: |
2720 | 2697 | var et = ( this.ctrlBuilder.longTimeDisp ) ? '/' + mw.seconds2npt( this.duration ) : ''; |
2721 | | - this.setStatus( mw.seconds2npt( this.currentTime ) + et ); |
| 2698 | + this.ctrlBuilder.setStatus( mw.seconds2npt( this.currentTime ) + et ); |
2722 | 2699 | } |
2723 | 2700 | } |
2724 | 2701 | // Check if we are "done" |
— | — | @@ -2729,16 +2706,16 @@ |
2730 | 2707 | } else { |
2731 | 2708 | // Media lacks duration just show end time |
2732 | 2709 | if ( this.isStoped() ) { |
2733 | | - this.setStatus( this.getTimeRange() ); |
| 2710 | + this.ctrlBuilder.setStatus( this.getTimeRange() ); |
2734 | 2711 | } else if ( this.isPaused() ) { |
2735 | | - this.setStatus( gM( 'mwe-paused' ) ); |
| 2712 | + this.ctrlBuilder.setStatus( gM( 'mwe-paused' ) ); |
2736 | 2713 | } else if ( this.isPlaying() ) { |
2737 | 2714 | if ( this.currentTime && ! this.duration ) |
2738 | | - this.setStatus( mw.seconds2npt( this.currentTime ) + ' /' ); |
| 2715 | + this.ctrlBuilder.setStatus( mw.seconds2npt( this.currentTime ) + ' /' ); |
2739 | 2716 | else |
2740 | | - this.setStatus( " - - - " ); |
| 2717 | + this.ctrlBuilder.setStatus( " - - - " ); |
2741 | 2718 | } else { |
2742 | | - this.setStatus( this.getTimeRange() ); |
| 2719 | + this.ctrlBuilder.setStatus( this.getTimeRange() ); |
2743 | 2720 | } |
2744 | 2721 | } |
2745 | 2722 | |
— | — | @@ -2751,14 +2728,13 @@ |
2752 | 2729 | }, 250 ) |
2753 | 2730 | } |
2754 | 2731 | |
2755 | | - this.runHook( 'monitor' ); |
| 2732 | + $j( this ).trigger( 'onMonitor' ); |
2756 | 2733 | }, |
2757 | 2734 | |
2758 | 2735 | /** |
2759 | 2736 | * Update the buffer status based on the local bufferedPercent var |
2760 | 2737 | */ |
2761 | 2738 | updateBufferStatus: function() { |
2762 | | - |
2763 | 2739 | // Get the buffer target based for playlist vs clip |
2764 | 2740 | $buffer = this.$interface.find( '.mw_buffer' ); |
2765 | 2741 | |
— | — | @@ -2778,15 +2754,14 @@ |
2779 | 2755 | // if we have not already run the buffer start hook |
2780 | 2756 | if( this.bufferedPercent > 0 && !this.bufferStartFlag ) { |
2781 | 2757 | this.bufferStartFlag = true; |
2782 | | - this.runHook( 'bufferStart' ); |
| 2758 | + $j( this ).trigger( 'onBufferStart' ); |
2783 | 2759 | } |
2784 | 2760 | |
2785 | 2761 | // if we have not already run the buffer end hook |
2786 | 2762 | if( this.bufferedPercent == 1 && !this.bufferEndFlag){ |
2787 | 2763 | this.bufferEndFlag = true; |
2788 | | - this.runHook( 'bufferEnd' ); |
| 2764 | + $j( this ).trigger( 'onBufferEnd' ); |
2789 | 2765 | } |
2790 | | - |
2791 | 2766 | }, |
2792 | 2767 | |
2793 | 2768 | /** |
— | — | @@ -2846,7 +2821,7 @@ |
2847 | 2822 | this.jump_time = options['start']; |
2848 | 2823 | this.seek_time_sec = mw.npt2seconds( options['start'] ); |
2849 | 2824 | // trim output to |
2850 | | - this.setStatus( gM( 'mwe-seek_to', mw.seconds2npt( this.seek_time_sec ) ) ); |
| 2825 | + this.ctrlBuilder.setStatus( gM( 'mwe-seek_to', mw.seconds2npt( this.seek_time_sec ) ) ); |
2851 | 2826 | mw.log( 'DO update: ' + this.jump_time ); |
2852 | 2827 | this.updateThumbTime( rel_start_sec ); |
2853 | 2828 | }, |
— | — | @@ -2857,20 +2832,10 @@ |
2858 | 2833 | hideHighlight: function() { |
2859 | 2834 | var eid = ( this.pc ) ? this.pc.pp.id:this.id; |
2860 | 2835 | $j( '#mv_seeker_' + eid + ' .mv_highlight' ).hide(); |
2861 | | - this.setStatus( this.getTimeRange() ); |
2862 | | - }, |
| 2836 | + this.ctrlBuilder.setStatus( this.getTimeRange() ); |
| 2837 | + }, |
2863 | 2838 | |
2864 | | - /** |
2865 | | - * Updates the player status that displays short text msgs and the play clock |
2866 | | - * @param {String} value Status string value to update |
2867 | | - */ |
2868 | | - setStatus: function( value ) { |
2869 | | - // update status: |
2870 | | - this.$interface.find( '.time-disp' ).html( value ); |
2871 | | - }, |
2872 | 2839 | |
2873 | | - |
2874 | | - |
2875 | 2840 | /** |
2876 | 2841 | * Helper Functions for selected source |
2877 | 2842 | */ |
— | — | @@ -3072,9 +3037,9 @@ |
3073 | 3038 | /** |
3074 | 3039 | * Checks if a player is supported by id |
3075 | 3040 | */ |
3076 | | - isSupportedPlayer: function( player_id ){ |
| 3041 | + isSupportedPlayer: function( playerId ){ |
3077 | 3042 | for( var i=0; i < this.players.length; i++ ){ |
3078 | | - if( this.players[i].id == player_id ){ |
| 3043 | + if( this.players[i].id == playerId ){ |
3079 | 3044 | return true; |
3080 | 3045 | } |
3081 | 3046 | } |
— | — | @@ -3133,26 +3098,26 @@ |
3134 | 3099 | /** |
3135 | 3100 | * Sets the format preference. |
3136 | 3101 | * |
3137 | | - * @param {String} mime_format Prefered format |
| 3102 | + * @param {String} mimeFormat Prefered format |
3138 | 3103 | */ |
3139 | | - setFormatPreference : function ( mime_format ) { |
3140 | | - this.preference['format_preference'] = mime_format; |
| 3104 | + setFormatPreference : function ( mimeFormat ) { |
| 3105 | + this.preference['format_preference'] = mimeFormat; |
3141 | 3106 | mw.setUserConfig( 'playerPref', this.preference); |
3142 | 3107 | }, |
3143 | 3108 | |
3144 | 3109 | /** |
3145 | 3110 | * Sets the player preference |
3146 | 3111 | * |
3147 | | - * @param {String} player_id Prefered player id |
| 3112 | + * @param {String} playerId Prefered player id |
3148 | 3113 | * @param {String} mimeType Mime type for the associated player stream |
3149 | 3114 | */ |
3150 | | - setPlayerPreference : function( player_id, mimeType ) { |
| 3115 | + setPlayerPreference : function( playerId, mimeType ) { |
3151 | 3116 | var selected_player = null; |
3152 | 3117 | for ( var i = 0; i < this.players.length; i++ ) { |
3153 | | - if ( this.players[i].id == player_id ) { |
| 3118 | + if ( this.players[i].id == playerId ) { |
3154 | 3119 | selected_player = this.players[i]; |
3155 | | - mw.log( 'choosing ' + player_id + ' for ' + mimeType ); |
3156 | | - this.preference[ mimeType ] = player_id; |
| 3120 | + mw.log( 'choosing ' + playerId + ' for ' + mimeType ); |
| 3121 | + this.preference[ mimeType ] = playerId; |
3157 | 3122 | mw.setUserConfig( 'playerPref', this.preference ); |
3158 | 3123 | break; |
3159 | 3124 | } |
— | — | @@ -3211,12 +3176,12 @@ |
3212 | 3177 | /** |
3213 | 3178 | * If the browsers supports a given mimetype |
3214 | 3179 | * |
3215 | | - * @param {String} mimetype Mime type for browser plug-in check |
| 3180 | + * @param {String} mimeType Mime type for browser plug-in check |
3216 | 3181 | */ |
3217 | | - supportedMimeType: function( mimetype ) { |
3218 | | - for ( var i = navigator.plugins.length; i-- > 0; ) { |
| 3182 | + supportedMimeType: function( mimeType ) { |
| 3183 | + for ( var i =0; i < navigator.plugins.length; i++ ) { |
3219 | 3184 | var plugin = navigator.plugins[i]; |
3220 | | - if ( typeof plugin[mimetype] != "undefined" ) |
| 3185 | + if ( typeof plugin[ mimeType ] != "undefined" ) |
3221 | 3186 | return true; |
3222 | 3187 | } |
3223 | 3188 | return false; |
— | — | @@ -3226,23 +3191,23 @@ |
3227 | 3192 | * Detects what plug-ins the client supports |
3228 | 3193 | */ |
3229 | 3194 | detect: function() { |
3230 | | - mw.log( "embedPlayer: running detect" ); |
| 3195 | + mw.log( "embedPlayer: running detect" ); |
3231 | 3196 | this.players = new mediaPlayers(); |
3232 | 3197 | // every browser supports html rendering: |
3233 | 3198 | this.players.addPlayer( htmlPlayer ); |
3234 | | - // In Mozilla, navigator.javaEnabled() only tells us about preferences, we need to |
3235 | | - // search navigator.mimeTypes to see if it's installed |
3236 | | - var javaEnabled = navigator.javaEnabled(); |
3237 | | - // Some browsers filter out duplicate mime types, hiding some plugins |
3238 | | - var uniqueMimesOnly = $j.browser.opera || $j.browser.safari; |
3239 | | - // Opera will switch off javaEnabled in preferences if java can't be found. |
3240 | | - // And it doesn't register an application/x-java-applet mime type like Mozilla does. |
3241 | | - if ( javaEnabled ) { |
3242 | | - this.players.addPlayer( cortadoPlayer ); |
3243 | | - } |
| 3199 | + // In Mozilla, navigator.javaEnabled() only tells us about preferences, we need to |
| 3200 | + // search navigator.mimeTypes to see if it's installed |
| 3201 | + var javaEnabled = navigator.javaEnabled(); |
| 3202 | + // Some browsers filter out duplicate mime types, hiding some plugins |
| 3203 | + var uniqueMimesOnly = $j.browser.opera || $j.browser.safari; |
| 3204 | + // Opera will switch off javaEnabled in preferences if java can't be found. |
| 3205 | + // And it doesn't register an application/x-java-applet mime type like Mozilla does. |
| 3206 | + if ( javaEnabled ) { |
| 3207 | + this.players.addPlayer( cortadoPlayer ); |
| 3208 | + } |
3244 | 3209 | |
3245 | | - // ActiveX plugins |
3246 | | - if ( $j.browser.msie ) { |
| 3210 | + // ActiveX plugins |
| 3211 | + if ( $j.browser.msie ) { |
3247 | 3212 | // check for flash |
3248 | 3213 | if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash' ) ) { |
3249 | 3214 | // try to get the flash version for omtk include: |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/skins/ctrlBuilder.js |
— | — | @@ -836,6 +836,25 @@ |
837 | 837 | // Related videos could be shown here |
838 | 838 | }, |
839 | 839 | |
| 840 | + /** |
| 841 | + * The ctrl builder updates the interface on seeking |
| 842 | + */ |
| 843 | + onSeek: function(){ |
| 844 | + // Update the interface: |
| 845 | + this.setStatus( gM( 'mwe-seeking' ) ); |
| 846 | + // Run the seeking hook |
| 847 | + $j( this.embedPlayer ).trigger( 'onSeek' ); |
| 848 | + }, |
| 849 | + |
| 850 | + /** |
| 851 | + * Updates the player status that displays short text msgs and the play clock |
| 852 | + * @param {String} value Status string value to update |
| 853 | + */ |
| 854 | + setStatus: function( value ) { |
| 855 | + // update status: |
| 856 | + this.embedPlayer.$interface.find( '.time-disp' ).html( value ); |
| 857 | + }, |
| 858 | + |
840 | 859 | /** |
841 | 860 | * Option menu items |
842 | 861 | * |
— | — | @@ -1585,9 +1604,9 @@ |
1586 | 1605 | embedPlayer.jump_time = mw.seconds2npt( parseFloat( parseFloat( embedPlayer.getDuration() ) * perc ) + embedPlayer.start_time_sec ); |
1587 | 1606 | // mw.log('perc:' + perc + ' * ' + embedPlayer.getDuration() + ' jt:'+ this.jump_time); |
1588 | 1607 | if ( _this.longTimeDisp ) { |
1589 | | - embedPlayer.setStatus( gM( 'mwe-seek_to', embedPlayer.jump_time ) ); |
| 1608 | + ctrlObj.setStatus( gM( 'mwe-seek_to', embedPlayer.jump_time ) ); |
1590 | 1609 | } else { |
1591 | | - embedPlayer.setStatus( embedPlayer.jump_time ); |
| 1610 | + ctrlObj.setStatus( embedPlayer.jump_time ); |
1592 | 1611 | } |
1593 | 1612 | // Update the thumbnail / frame |
1594 | 1613 | if ( embedPlayer.isPlaying == false ) { |
— | — | @@ -1605,7 +1624,7 @@ |
1606 | 1625 | // set seek time (in case we have to do a url seek) |
1607 | 1626 | embedPlayer.seek_time_sec = mw.npt2seconds( embedPlayer.jump_time, true ); |
1608 | 1627 | mw.log( 'do jump to: ' + embedPlayer.jump_time + ' perc:' + perc + ' sts:' + embedPlayer.seek_time_sec ); |
1609 | | - embedPlayer.setStatus( gM( 'mwe-seeking' ) ); |
| 1628 | + ctrlObj.setStatus( gM( 'mwe-seeking' ) ); |
1610 | 1629 | embedPlayer.doSeek( perc ); |
1611 | 1630 | } |
1612 | 1631 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/htmlEmbed.js |
— | — | @@ -275,7 +275,6 @@ |
276 | 276 | * Local implementation of swapPlayerElement |
277 | 277 | */ |
278 | 278 | swapPlayerElement:function() { |
279 | | - this.loading_external_data = false |
280 | 279 | this.ready_to_play = true; |
281 | 280 | return ; |
282 | 281 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/nativeEmbed.js |
— | — | @@ -104,12 +104,8 @@ |
105 | 105 | } else { |
106 | 106 | // Issue play request |
107 | 107 | vid.play(); |
108 | | - } |
| 108 | + } |
109 | 109 | |
110 | | - |
111 | | - // Run the "hook" for any extensions that need to bind things to the actual video elemnt |
112 | | - this.runHook( 'postEmbedJS' ) |
113 | | - |
114 | 110 | setTimeout( function() { |
115 | 111 | _this.monitor(); |
116 | 112 | }, 100 ); |
— | — | @@ -153,8 +149,9 @@ |
154 | 150 | // try to do a play then seek: |
155 | 151 | this.doPlayThenSeek( percentage ) |
156 | 152 | } |
| 153 | + |
157 | 154 | // Run the onSeeking interface update |
158 | | - this.onSeek(); |
| 155 | + this.ctrlBuilder.onSeek(); |
159 | 156 | }, |
160 | 157 | |
161 | 158 | /** |
— | — | @@ -380,10 +377,10 @@ |
381 | 378 | * Local method for seeking event |
382 | 379 | * fired when "seeking" |
383 | 380 | */ |
384 | | - onSeeking: function() { |
385 | | - //mw.log( "onseeking" ); |
386 | | - this.seeking = true; |
387 | | - this.setStatus( gM( 'mwe-seeking' ) ); |
| 381 | + onSeeking: function() { |
| 382 | + // Run the onSeeking interface update |
| 383 | + this.ctrlBuilder.onSeek(); |
| 384 | + |
388 | 385 | // Trigger the html5 seeking event |
389 | 386 | $j( this ).trigger( 'seeking' ); |
390 | 387 | }, |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -63,7 +63,9 @@ |
64 | 64 | * @param [Mixed] name Name of configuration value |
65 | 65 | * {Object} Will iderate through each key and call setConfig |
66 | 66 | * {String} Will set configuration by string name to value |
67 | | - * @param {String} value Value of configuration name |
| 67 | + * @param |
| 68 | + * {String} value Value of configuration name |
| 69 | + * {Object} value Set of values to be merged |
68 | 70 | */ |
69 | 71 | mw.setConfig = function ( name, value ) { |
70 | 72 | if( typeof name == 'object' ) { |
— | — | @@ -80,7 +82,7 @@ |
81 | 83 | } else { |
82 | 84 | mwConfig[ name ] = value; |
83 | 85 | } |
84 | | - } |
| 86 | + } |
85 | 87 | |
86 | 88 | /** |
87 | 89 | * Set a default config value |
— | — | @@ -122,8 +124,8 @@ |
123 | 125 | * Modules that want to use "User Config" should call |
124 | 126 | * this setup function in their moduleLoader code. |
125 | 127 | * |
126 | | - * For performance interfaces should load '$j.cookie' & 'JSON' |
127 | | - * in their grouped load request |
| 128 | + * For performance interfaces using "user config" |
| 129 | + * should load '$j.cookie' & 'JSON' in their module loader |
128 | 130 | * |
129 | 131 | * By abstracting user preference we could eventually integrate |
130 | 132 | * a persistent per-account preference system on the server. |
— | — | @@ -557,6 +559,7 @@ |
558 | 560 | instanceCallback = null; |
559 | 561 | } |
560 | 562 | } |
| 563 | + |
561 | 564 | // Check for empty loadRequest ( directly return the callback ) |
562 | 565 | if( mw.isEmpty( loadRequest ) ) { |
563 | 566 | mw.log( 'Empty load request: ' + loadRequest ); |
— | — | @@ -1039,7 +1042,7 @@ |
1040 | 1043 | * mediaWiki JSON a wrapper for jQuery getJSON: |
1041 | 1044 | * ( could also be named mw.apiRequest ) |
1042 | 1045 | * |
1043 | | - * The mediaWiki version lets you skip the url part |
| 1046 | + * The mwEmbed version lets you skip the url part |
1044 | 1047 | * mw.getJSON( [url], data, callback, [timeoutCallback] ); |
1045 | 1048 | * |
1046 | 1049 | * Lets you assume: |
— | — | @@ -1048,18 +1051,19 @@ |
1049 | 1052 | * callback parameter is not needed for the request data |
1050 | 1053 | * url param 'action'=>'query' is assumed ( if not set to something else in the "data" param |
1051 | 1054 | * format is set to "json" automatically |
1052 | | - * automatically issues request over "POST" if the request requires a post |
1053 | | - * automatically will setup apiProxy where needed. |
| 1055 | + * automatically issues request over "POST" if the request api post type |
| 1056 | + * automatically will setup apiProxy where request is cross domain |
1054 | 1057 | * |
1055 | 1058 | * @param {Mixed} url or data request |
1056 | 1059 | * @param {Mixed} data or callback |
1057 | 1060 | * @param {Function} callbcak function called on success |
1058 | 1061 | * @param {Function} callbackTimeout - optional function called on timeout |
1059 | | - * Setting timeout callback also avoids default dialog display for timed-out proxy calls. |
| 1062 | + * Setting timeout callback also avoids default timed-out dialog for proxy requests |
1060 | 1063 | */ |
1061 | | - mw.getJSON = function() { |
1062 | | - // Set up the url |
1063 | | - |
| 1064 | + mw.getJSON = function() { |
| 1065 | + // Proccess the arguments: |
| 1066 | + |
| 1067 | + // Set up the url |
1064 | 1068 | var url = false; |
1065 | 1069 | url = ( typeof arguments[0] == 'string' ) ? arguments[0] : mw.getLocalApiUrl(); |
1066 | 1070 | |
— | — | @@ -1203,7 +1207,8 @@ |
1204 | 1208 | * |
1205 | 1209 | * @param {String} [apiUrl] Optional target API URL (uses default local api if unset) |
1206 | 1210 | * @param {String} title The wiki page title you want to edit |
1207 | | - * @param {callback} callback Function to pass the token to returns false if token not retrived |
| 1211 | + * @param {callback} callback Function to pass the token to. |
| 1212 | + * issues callback with "false" if token not retrived |
1208 | 1213 | */ |
1209 | 1214 | mw.getToken = function( apiUrl, title, callback ) { |
1210 | 1215 | // Make the apiUrl be optional: |
— | — | @@ -1235,7 +1240,8 @@ |
1236 | 1241 | /** |
1237 | 1242 | * Api helper to grab the username |
1238 | 1243 | * @param {String} [apiUrl] Optional target API url (uses default local api if unset) |
1239 | | - * @param {Function} callback Function to callback with username or false if not found |
| 1244 | + * @param {Function} callback Function to callback with username or false if not found |
| 1245 | + * @param {Boolean} fresh A fresh check is issued. |
1240 | 1246 | */ |
1241 | 1247 | // Stub feature apiUserNameCache to avoid multiple calls |
1242 | 1248 | // ( a more general api cache framework should be devloped ) |
— | — | @@ -1295,7 +1301,7 @@ |
1296 | 1302 | * addLoaderDialog |
1297 | 1303 | * small helper for displaying a loading dialog |
1298 | 1304 | * |
1299 | | - * @param msg text text of the loader msg |
| 1305 | + * @param {String} msg_txt text text of the loader msg |
1300 | 1306 | */ |
1301 | 1307 | mw.addLoaderDialog = function( msg_txt ) { |
1302 | 1308 | mw.addDialog( msg_txt, msg_txt + '<br>' + mw.loading_spinner() ); |
— | — | @@ -1362,16 +1368,11 @@ |
1363 | 1369 | * Close the loader dialog created with addLoaderDialog |
1364 | 1370 | */ |
1365 | 1371 | mw.closeLoaderDialog = function() { |
1366 | | - mw.load( [ |
1367 | | - [ |
1368 | | - '$j.ui' |
1369 | | - ], |
1370 | | - [ |
1371 | | - '$j.ui.dialog' |
1372 | | - ] |
1373 | | - ], function() { |
1374 | | - $j( '#mwe_tmp_loader' ).dialog( 'destroy' ).remove(); |
1375 | | - } ); |
| 1372 | + // Make sure the dialog class is present |
| 1373 | + if( !mw.isset( '$j.ui.dialog' ) ) { |
| 1374 | + return false; |
| 1375 | + } |
| 1376 | + $j( '#mwe_tmp_loader' ).dialog( 'destroy' ).remove(); |
1376 | 1377 | } |
1377 | 1378 | |
1378 | 1379 | |
— | — | @@ -1517,7 +1518,7 @@ |
1518 | 1519 | var mwReadyFlag = false; |
1519 | 1520 | |
1520 | 1521 | /** |
1521 | | - * Enables load hooks to run once DOM is "ready" |
| 1522 | + * Enables load hooks to run once mwEmbeed is "ready" |
1522 | 1523 | * Will ensure jQuery is available, is in the $j namespace |
1523 | 1524 | * and mw interfaces and configuration has been loaded and applied |
1524 | 1525 | * |
— | — | @@ -1530,20 +1531,7 @@ |
1531 | 1532 | mw.ready = function( callback ) { |
1532 | 1533 | if( mwReadyFlag === false ) { |
1533 | 1534 | // Add the callbcak to the onLoad function stack |
1534 | | - mwOnLoadFunctions.push ( callback ); |
1535 | | - |
1536 | | - // Set the mwSetup flag. So that onLoad functions can |
1537 | | - // be called once mwEmbed interfaces are setup. |
1538 | | - if( !mwDomReadyFlag ) { |
1539 | | - //mw.log( 'set config flag' ); |
1540 | | - mw.setConfig( 'runSetupMwEmbed', true ); |
1541 | | - }else{ |
1542 | | - //DOM is already ready run setup directly ( will run mwOnLoadFunctions on finish ) |
1543 | | - // This is needed beccause we support dynamic setup once we hit a mw.ready |
1544 | | - // ( otherwise we would run setup on every include ) |
1545 | | - mw.setupMwEmbed(); |
1546 | | - } |
1547 | | - return ; |
| 1535 | + mwOnLoadFunctions.push ( callback ); |
1548 | 1536 | } |
1549 | 1537 | // If mwReadyFlag is already "true" issue the callback directly: |
1550 | 1538 | callback(); |
— | — | @@ -1551,6 +1539,7 @@ |
1552 | 1540 | |
1553 | 1541 | /** |
1554 | 1542 | * Runs all the queued functions |
| 1543 | + * called by mwEmbedSetup |
1555 | 1544 | */ |
1556 | 1545 | mw.runReadyFunctions = function ( ) { |
1557 | 1546 | // Run all the queued functions: |
— | — | @@ -1643,7 +1632,7 @@ |
1644 | 1633 | }; |
1645 | 1634 | //mw.log(" append script: " + script.src ); |
1646 | 1635 | // Append the script to the DOM: |
1647 | | - head.appendChild( script ); |
| 1636 | + head.appendChild( script ); |
1648 | 1637 | }; |
1649 | 1638 | |
1650 | 1639 | /** |
— | — | @@ -2165,60 +2154,70 @@ |
2166 | 2155 | } |
2167 | 2156 | |
2168 | 2157 | // Make sure we have jQuery and the common skin |
2169 | | - // NOTE mw.style.mwCommon should be factored out into |
2170 | | - // seperate module specifc classes |
2171 | | - mw.load( 'window.jQuery', function() { |
| 2158 | + mw.load( 'window.jQuery', function() { |
| 2159 | + |
| 2160 | + // Add jQuery to $j var. |
2172 | 2161 | if ( ! window[ '$j' ] ) { |
2173 | 2162 | window[ '$j' ] = jQuery.noConflict(); |
2174 | 2163 | } |
2175 | 2164 | |
2176 | | - mw.setConfig( 'images_path', mw.getMwEmbedPath() + 'skins/common/images/' ); |
2177 | | - |
2178 | | - // Set up AJAX to not send dynamic URLs for loading scripts |
2179 | | - $j.ajaxSetup( { |
2180 | | - cache: true |
2181 | | - } ); |
2182 | | - |
2183 | | - // Update the magic keywords |
2184 | | - mw.Language.magicSetup(); |
2185 | | - |
2186 | | - // Set up mvEmbed utility jQuery bindings |
2187 | | - mw.dojQueryBindings(); |
2188 | | - |
2189 | | - // Make sure style sheets are loaded: |
2190 | | - mw.load( [ |
2191 | | - 'mw.style.mwCommon', |
2192 | | - 'mw.style.' + mw.getConfig( 'jQueryUISkin' ) |
2193 | | - ], function(){ |
2194 | | - // Run all the setup function hooks |
2195 | | - // Once complete we can run .ready queued functions |
2196 | | - function runSetupFunctions() { |
2197 | | - if( mwSetupFunctions.length ) { |
2198 | | - mwSetupFunctions.pop()( function() { |
2199 | | - runSetupFunctions(); |
2200 | | - } ); |
2201 | | - }else{ |
2202 | | - mw.runReadyFunctions(); |
| 2165 | + // Get loader, config and language files |
| 2166 | + // ( if not already set via script-loader ) |
| 2167 | + mw.checkScriptLoaderFiles( function() { |
| 2168 | + |
| 2169 | + // Update the image path |
| 2170 | + mw.setConfig( 'imagesPath', mw.getMwEmbedPath() + 'skins/common/images/' ); |
| 2171 | + |
| 2172 | + // Set up AJAX to not send dynamic URLs for loading scripts |
| 2173 | + $j.ajaxSetup( { |
| 2174 | + cache: true |
| 2175 | + } ); |
| 2176 | + |
| 2177 | + // Update the magic keywords |
| 2178 | + mw.Language.magicSetup(); |
| 2179 | + |
| 2180 | + // Set up mvEmbed utility jQuery bindings |
| 2181 | + mw.dojQueryBindings(); |
| 2182 | + |
| 2183 | + // Make sure style sheets are loaded: |
| 2184 | + mw.load( [ |
| 2185 | + 'mw.style.mwCommon', |
| 2186 | + 'mw.style.' + mw.getConfig( 'jQueryUISkin' ) |
| 2187 | + ], function(){ |
| 2188 | + |
| 2189 | + // Run all the setup function hooks |
| 2190 | + // NOTE: setup functions are added via addSetupHook calls |
| 2191 | + // and must include a callback. |
| 2192 | + // |
| 2193 | + // Once complete we can run .ready() queued functions |
| 2194 | + function runSetupFunctions() { |
| 2195 | + if( mwSetupFunctions.length ) { |
| 2196 | + mwSetupFunctions.shift()( function() { |
| 2197 | + runSetupFunctions(); |
| 2198 | + } ); |
| 2199 | + }else{ |
| 2200 | + mw.runReadyFunctions(); |
| 2201 | + } |
2203 | 2202 | } |
2204 | | - } |
2205 | | - runSetupFunctions(); |
2206 | | - }); |
| 2203 | + runSetupFunctions(); |
| 2204 | + }); |
| 2205 | + } ); |
2207 | 2206 | }); |
2208 | 2207 | }; |
2209 | 2208 | |
2210 | 2209 | /** |
2211 | | - * Check for module loaders, and localization |
| 2210 | + * Check for script-loader module loaders, and localization files |
2212 | 2211 | * |
2213 | | - * Note if using a scriptLoader all the loaders and localization converters |
| 2212 | + * NOTE: if using the ScriptLoader all the loaders and localization converters |
2214 | 2213 | * are included automatically. |
2215 | 2214 | */ |
2216 | | - mw.moduleLoaderCheck = function( callback ) { |
| 2215 | + mw.checkScriptLoaderFiles = function( callback ) { |
2217 | 2216 | mw.log( 'doLoaderCheck::' ); |
2218 | 2217 | |
2219 | 2218 | // Check if we are using scriptloader ( handles loader include automatically ) |
2220 | 2219 | if( mw.getScriptLoaderPath() ) { |
2221 | 2220 | // Do a async call to callback in cases where DOM is ready before we get to |
2222 | | - // loader config code in the same file. |
| 2221 | + // loader config code |
2223 | 2222 | setTimeout(function() { |
2224 | 2223 | callback(); |
2225 | 2224 | }, 1); |
— | — | @@ -2226,12 +2225,12 @@ |
2227 | 2226 | } |
2228 | 2227 | |
2229 | 2228 | // Add the Core loader to the request |
2230 | | - // The follow code is only run in debug / raw file mode |
| 2229 | + // The follow code is ONLY RUN in debug / raw file mode |
| 2230 | + |
2231 | 2231 | mw.load( 'loader.js', function() { |
2232 | 2232 | // Load all the "loaders" of the enabled modules: |
2233 | 2233 | var loaderRequest = []; |
2234 | 2234 | |
2235 | | - |
2236 | 2235 | //Load enabled components |
2237 | 2236 | var enabledComponents = mw.getConfig( 'coreComponents' ); |
2238 | 2237 | function loadEnabledComponents( enabledComponents ){ |
— | — | @@ -2251,7 +2250,7 @@ |
2252 | 2251 | loadEnabledComponents( enabledComponents ); |
2253 | 2252 | |
2254 | 2253 | |
2255 | | - //Set the loader context and get each loader individually ( only in debug mode ) |
| 2254 | + // Set the loader context and get each loader individually |
2256 | 2255 | function loadEnabledModules( enabledModules ){ |
2257 | 2256 | if( ! enabledModules.length ){ |
2258 | 2257 | // If no more modules left load the LanguageFile |
— | — | @@ -2339,29 +2338,7 @@ |
2340 | 2339 | var mwDomReadyFlag = false; |
2341 | 2340 | |
2342 | 2341 | // Flag to register if the domreadyHooks have been called |
2343 | | - var mwModuleLoaderCheckFlag = false; |
2344 | | - |
2345 | | - // Functions to run on DOM ready |
2346 | | - var mwOnDOMReadyFunctions = []; |
2347 | | - |
2348 | | - /** |
2349 | | - * Dom ready hooks are for module loaders that want to conditionally |
2350 | | - * set setup hooks. |
2351 | | - * |
2352 | | - * This enables modules to build out interfaces asynchronously |
2353 | | - * to be "ready" at mw.ready call time. |
2354 | | - * |
2355 | | - * @param {Function} callback Function to be called at dom ready |
2356 | | - */ |
2357 | | - mw.addDOMReadyHook = function( callback ) { |
2358 | | - if ( mwModuleLoaderCheckFlag ) { |
2359 | | - mw.log( "Possible Error: calling mw.addDOMReadyHook after moduleLoader check ?" ); |
2360 | | - callback ( ); |
2361 | | - } else { |
2362 | | - // Add the dom ready check to the function queue: |
2363 | | - mwOnDOMReadyFunctions.push( callback ); |
2364 | | - } |
2365 | | - } |
| 2342 | + var mwModuleLoaderCheckFlag = false; |
2366 | 2343 | |
2367 | 2344 | /** |
2368 | 2345 | * This will get called when the DOM is ready |
— | — | @@ -2374,28 +2351,9 @@ |
2375 | 2352 | mw.log( 'run:domReady:: ' + document.getElementsByTagName('video').length ); |
2376 | 2353 | // Set the onDomReady Flag |
2377 | 2354 | mwDomReadyFlag = true; |
2378 | | - |
2379 | | - // Make sure we have all the module loader.js files included |
2380 | | - // ( where we are not using the script-loader ) |
2381 | | - mw.moduleLoaderCheck( function( ) { |
2382 | | - |
2383 | | - // Run dom ready hooks: |
2384 | | - while( mwOnDOMReadyFunctions.length ) { |
2385 | | - mwOnDOMReadyFunctions.pop()(); |
2386 | | - } |
2387 | | - |
2388 | | - // Check for the force setup flag: |
2389 | | - if ( mw.getConfig( 'runSetupMwEmbed' ) ) { |
2390 | | - mw.setupMwEmbed(); |
2391 | | - return ; |
2392 | | - } |
2393 | | - |
2394 | | - // Check for queued functions that use mw interfaces: |
2395 | | - if ( mwOnLoadFunctions.length ) { |
2396 | | - mw.setupMwEmbed(); |
2397 | | - return ; |
2398 | | - } |
2399 | | - }); |
| 2355 | + |
| 2356 | + // Setup MwEmbed |
| 2357 | + mw.setupMwEmbed(); |
2400 | 2358 | } |
2401 | 2359 | |
2402 | 2360 | /** |
— | — | @@ -2560,6 +2518,7 @@ |
2561 | 2519 | * mwEmbed.js is included without jQuery |
2562 | 2520 | * and we need our own "ready" system so that |
2563 | 2521 | * mwEmbed interfaces can support async built out |
| 2522 | +* and the inclution of jQuery. |
2564 | 2523 | */ |
2565 | 2524 | var mwDomIsReady = false; |
2566 | 2525 | function runMwDomReady(){ |
— | — | @@ -2638,8 +2597,13 @@ |
2639 | 2598 | } |
2640 | 2599 | |
2641 | 2600 | |
2642 | | -// Hack to keep jQuery in $ when its |
2643 | | -// already there, but also use noConflict to get $j = jQuery |
| 2601 | +/* |
| 2602 | + * Hack to keep jQuery in $ when its |
| 2603 | + * already there, but also use noConflict to get $j = jQuery |
| 2604 | + * |
| 2605 | + * This way sites that use $ for jQuery continue to work after |
| 2606 | + * including mwEmbed.js |
| 2607 | + */ |
2644 | 2608 | if( window.jQuery ){ |
2645 | 2609 | var dollarFlag = false; |
2646 | 2610 | if( $ && $.fn && $.fn.jquery ){ |
— | — | @@ -2647,8 +2611,13 @@ |
2648 | 2612 | // jQuery and do a removal call if too old |
2649 | 2613 | dollarFlag = true; |
2650 | 2614 | } |
2651 | | - window['$j'] = jQuery.noConflict(); |
| 2615 | + window[ '$j' ] = jQuery.noConflict(); |
2652 | 2616 | if( dollarFlag ) { |
2653 | | - window['$'] = jQuery.noConflict(); |
| 2617 | + window[ '$' ] = jQuery.noConflict(); |
2654 | 2618 | } |
2655 | 2619 | } |
| 2620 | + |
| 2621 | +// If using the script-loader and jQuery has not been set give a warning to the user: |
| 2622 | +if( mw.getScriptLoaderPath() && !window.jQuery ) { |
| 2623 | + alert( 'jQuery is required for mwEmbed, please update your script-loader request' ); |
| 2624 | +} |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php |
— | — | @@ -120,6 +120,7 @@ |
121 | 121 | |
122 | 122 | // mwEmbed is a core component so it includes loaders and other styles |
123 | 123 | if( $classKey == 'mwEmbed' && $this->outputFormat != 'messages' ){ |
| 124 | + |
124 | 125 | // Output core components ( parts of mwEmbed that are in different files ) |
125 | 126 | $this->output .= jsClassLoader::getCombinedComponentJs( $this ); |
126 | 127 | |
Index: branches/js2-work/phase3/js/editPage.js |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | mw.log( 'Do old toolbar bind:' ); |
63 | 63 | didWikiEditorBind = true; |
64 | 64 | $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' + |
65 | | - mw.getConfig( 'images_path' ) + 'Button_add_media.png">' ); |
| 65 | + mw.getConfig( 'imagesPath' ) + 'Button_add_media.png">' ); |
66 | 66 | |
67 | 67 | $j( '#btn-add-media-wiz' ).attr( 'title', gM( 'mwe-loading-add-media-wiz' ) ); |
68 | 68 | mw.load( 'AddMedia.addMediaWizard', function() { |