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