Index: branches/js2-work/phase3/js/mwEmbed/tests/Player_Themable.html |
— | — | @@ -3,8 +3,12 @@ |
4 | 4 | <html> |
5 | 5 | <head> |
6 | 6 | <title>Sample Themed Player</title> |
7 | | - <!--<script type="text/javascript" src="../jsScriptLoader.php?class=mwEmbed&debug=true"></script> --> |
8 | | - <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> |
| 7 | + <!-- Stuff likely needed for video display --> |
| 8 | + <script type="text/javascript" src="../jsScriptLoader.php?class=window.jQuery,mwEmbed,$j.ui,mw.EmbedPlayer,nativeEmbed,ctrlBuilder,mvpcfConfig,kskinConfig,$j.fn.menu,$j.cookie,$j.ui.slider,mw.TimedText&debug=true"></script> |
| 9 | + <link rel="stylesheet" href="../skins/styles.css" type="text/css" media="screen" /> |
| 10 | + <link rel="stylesheet" href="../skins/mvpcf/playerSkin.css" type="text/css" media="screen" /> |
| 11 | + <link rel="stylesheet" href="../skins/kskin/playerSkin.css" type="text/css" media="screen" /> |
| 12 | + <!-- <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> --> |
9 | 13 | </head> |
10 | 14 | <script type="text/javascript"> |
11 | 15 | </script> |
Index: branches/js2-work/phase3/js/mwEmbed/tests/Player_Timed_Text.html |
— | — | @@ -3,12 +3,13 @@ |
4 | 4 | <html> |
5 | 5 | <head> |
6 | 6 | <title>sample mv embed</title> |
7 | | - <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> |
| 7 | + <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> |
8 | 8 | </head> |
9 | 9 | <body> |
10 | 10 | <h3> mwEmbed Timed Text Examples:</h3> |
11 | 11 | Click on the little lower right "CC" icon to expose the timed text |
12 | 12 | <table border="1" cellpadding="6" width="950"> |
| 13 | + |
13 | 14 | <tr> |
14 | 15 | <td valign="top" width="410"> |
15 | 16 | |
— | — | @@ -32,9 +33,9 @@ |
33 | 34 | </td> |
34 | 35 | </tr> |
35 | 36 | |
36 | | - |
37 | | - |
38 | 37 | <!-- |
| 38 | + |
| 39 | + |
39 | 40 | <tr> |
40 | 41 | <td valign="top" width="410"> |
41 | 42 | |
— | — | @@ -58,6 +59,7 @@ |
59 | 60 | |
60 | 61 | </tr> |
61 | 62 | |
| 63 | + |
62 | 64 | <tr> |
63 | 65 | <td valign="top" width="410"> |
64 | 66 | |
— | — | @@ -148,17 +150,16 @@ |
149 | 151 | src="media/elephants_dream/chapters.srt"></itext> |
150 | 152 | </itextlist> |
151 | 153 | |
152 | | - </video> |
153 | | - |
154 | | - |
| 154 | + </video> |
155 | 155 | </td> |
156 | | - |
157 | 156 | <td valign="top"> |
158 | 157 | <h4>Mirrors Silvia's iText example</h4> |
159 | 158 | see: <a href="http://www.annodex.net/~silvia/itext/elephant_no_skin_v2.html">Video Player Accessibility</a> |
160 | 159 | </td> |
161 | 160 | </tr> |
162 | | - --> |
| 161 | + |
| 162 | +--> |
| 163 | + |
163 | 164 | </table> |
164 | 165 | |
165 | 166 | </body> |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js |
— | — | @@ -78,21 +78,26 @@ |
79 | 79 | /** |
80 | 80 | * The list of enabled sources |
81 | 81 | */ |
82 | | - enabledSources: [ ], |
| 82 | + enabledSources: null, |
83 | 83 | |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Stores the last text string per category to avoid dom checks |
87 | 87 | * for updated text |
88 | 88 | */ |
89 | | - prevText: [], |
| 89 | + prevText: null, |
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Text sources ( a set of textSource objects ) |
93 | 93 | */ |
94 | | - textSources: [ ], |
| 94 | + textSources: null, |
95 | 95 | |
96 | 96 | /** |
| 97 | + * Text Source(s) Setup Flag |
| 98 | + */ |
| 99 | + textSourceSetupFlag: null, |
| 100 | + |
| 101 | + /** |
97 | 102 | * Valid "iText" categories |
98 | 103 | */ |
99 | 104 | validCategoriesKeys: [ |
— | — | @@ -138,6 +143,12 @@ |
139 | 144 | this.embedPlayer = embedPlayer; |
140 | 145 | this.options = options; |
141 | 146 | |
| 147 | + //Init internal variables: |
| 148 | + this.enabledSources = []; |
| 149 | + this.prevText = ''; |
| 150 | + this.textSources = []; |
| 151 | + this.textSourceSetupFlag = false; |
| 152 | + |
142 | 153 | //Load user prefrences config: |
143 | 154 | preferenceConfig = mw.getUserConfig( 'timedTextConfig' ); |
144 | 155 | if( typeof preferenceConfig == 'object' ) { |
— | — | @@ -149,6 +160,24 @@ |
150 | 161 | _this.monitor(); |
151 | 162 | } ) |
152 | 163 | |
| 164 | + embedPlayer.addHook( 'play', function(){ |
| 165 | + // Will load and setup timedText sources (if not loaded already loaded ) |
| 166 | + _this.setupTextSources(); |
| 167 | + } ); |
| 168 | + }, |
| 169 | + |
| 170 | + /** |
| 171 | + * Setups available text sources |
| 172 | + * loads text sources |
| 173 | + * auto-selects a source based on the user language |
| 174 | + * @param {Function} callback Function to be called once text sources are setup. |
| 175 | + */ |
| 176 | + setupTextSources: function( callback ){ |
| 177 | + var _this = this; |
| 178 | + if( this.textSourceSetupFlag ){ |
| 179 | + callback(); |
| 180 | + return ; |
| 181 | + } |
153 | 182 | // Load textSources |
154 | 183 | _this.loadTextSources( function(){ |
155 | 184 | |
— | — | @@ -158,35 +187,46 @@ |
159 | 188 | // Load and parse the text value of enabled text sources: |
160 | 189 | _this.loadEnabledSources(); |
161 | 190 | |
162 | | - } ); |
163 | | - }, |
| 191 | + _this.textSourceSetupFlag = true; |
| 192 | + |
| 193 | + if( callback ) |
| 194 | + callback(); |
| 195 | + } ); |
| 196 | + }, |
164 | 197 | |
165 | 198 | /** |
166 | | - * Show the timed text menu |
| 199 | + * Binds the timed text menu |
| 200 | + * and updates its content from "getMenu" |
| 201 | + * |
167 | 202 | * @param {Object} target to display the menu |
168 | 203 | * @param {Bollean} autoShow If the menu should be displayed |
169 | 204 | */ |
170 | | - bindMenu: function( target , autoShow ){ |
| 205 | + bindMenu: function( target , autoShow){ |
171 | 206 | var _this = this; |
172 | 207 | mw.log( "TimedText:bindMenu" ); |
173 | | - _this.menuTarget = target; |
174 | | - // NOTE: Button target should be an option or config thing |
175 | | - var $menuButton = $j('#' + this.embedPlayer.id + ' .timed-text'); |
176 | | - $menuButton.unbind().menu( { |
177 | | - 'content' : this.buildMenu(), |
178 | | - 'crumbDefaultText' : ' ', |
179 | | - 'targetMenuContainer' : _this.menuTarget, |
180 | | - 'autoShow' : autoShow, |
181 | | - 'backLinkText' : gM( 'mwe-back-btn' ) |
182 | | - } ); |
183 | | - |
| 208 | + _this.menuTarget = target; |
| 209 | + var $menuButton = $j('#' + this.embedPlayer.id + ' .timed-text'); |
| 210 | + |
| 211 | + // Else bind and show the menu |
| 212 | + // We already have a loader in embedPlayer so the delay of |
| 213 | + // setupTextSources is already taken into account |
| 214 | + _this.setupTextSources( function(){ |
| 215 | + // NOTE: Button target should be an option or config |
| 216 | + $menuButton.unbind().menu( { |
| 217 | + 'content' : _this.getMenu(), |
| 218 | + 'crumbDefaultText' : ' ', |
| 219 | + 'targetMenuContainer' : _this.menuTarget, |
| 220 | + 'autoShow' : autoShow, |
| 221 | + 'backLinkText' : gM( 'mwe-back-btn' ) |
| 222 | + } ); |
| 223 | + }); |
184 | 224 | }, |
185 | 225 | |
186 | 226 | /** |
187 | 227 | * Refresh the menu |
188 | 228 | */ |
189 | 229 | refreshMenu: function( ){ |
190 | | - // Bind the menu without showing it: |
| 230 | + // update the menu |
191 | 231 | this.bindMenu( this.menuTarget, false ); |
192 | 232 | }, |
193 | 233 | |
— | — | @@ -347,7 +387,11 @@ |
348 | 388 | }, |
349 | 389 | |
350 | 390 | /** |
351 | | - * Builds the core timed Text menu |
| 391 | + * Builds the core timed Text menu and |
| 392 | + * returns the binded jquery object / dom set |
| 393 | + * |
| 394 | + * Assumes text sources have been setup: ( _this.setupTextSources ) |
| 395 | + * |
352 | 396 | * calls a few sub-functions: |
353 | 397 | * Basic menu layout: |
354 | 398 | * Chose Language |
— | — | @@ -360,15 +404,16 @@ |
361 | 405 | * [ All videos ] |
362 | 406 | * [ Chapters ] seek to chapter |
363 | 407 | */ |
364 | | - buildMenu: function(){ |
365 | | - var _this = this; |
366 | | - // Build the source list menu item: |
| 408 | + getMenu: function(){ |
| 409 | + var _this = this; |
| 410 | + |
367 | 411 | |
| 412 | + // Build the source list menu item: |
368 | 413 | $menu = $j( '<ul>' ); |
369 | 414 | // Chouse text menu item ( if there are sources) |
370 | 415 | if( _this.textSources.length != 0 ){ |
371 | 416 | $menu.append( |
372 | | - _this.getLi( gM( 'mwe-chose-text'), 'comment' ).append( |
| 417 | + _this.getLi( gM( 'mwe-chose-text'), 'comment' ).append( |
373 | 418 | _this.getLanguageMenu() |
374 | 419 | ), |
375 | 420 | // Layout Menu option |
— | — | @@ -377,7 +422,10 @@ |
378 | 423 | ), |
379 | 424 | |
380 | 425 | // Search Menu option |
381 | | - _this.getLi( gM('mwe-search'), 'search') |
| 426 | + _this.getLi( gM('mwe-search'), 'search'), |
| 427 | + |
| 428 | + //Include the "make transcript" link: |
| 429 | + _this.getLiAddText() |
382 | 430 | ); |
383 | 431 | } |
384 | 432 | // Put in the "Make Transcript" link |
— | — | @@ -819,7 +867,7 @@ |
820 | 868 | if( this.getSrc() ){ |
821 | 869 | // Issue the load request ( if we can ) |
822 | 870 | if ( mw.parseUri( document.URL ).host != mw.parseUri( this.getSrc() ).host ){ |
823 | | - mw.log("Error can't load non-json src via jsonp:" + this.getSrc() ) |
| 871 | + mw.log("Error: host mis-match: " + mw.parseUri( document.URL ).host != mw.parseUri( this.getSrc() ).host ) |
824 | 872 | return ; |
825 | 873 | } |
826 | 874 | $j.get( this.getSrc(), function( data ){ |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -84,13 +84,7 @@ |
85 | 85 | |
86 | 86 | // id: Auto-populated if unset |
87 | 87 | "id" : null, |
88 | | - |
89 | | - // Class: used to set the player "skin" |
90 | | - "class" : null, |
91 | 88 | |
92 | | - // Style: used to set player width and height |
93 | | - "style" : null, |
94 | | - |
95 | 89 | // Width: alternate to "style" to set player width |
96 | 90 | "width" : null, |
97 | 91 | |
— | — | @@ -334,14 +328,15 @@ |
335 | 329 | */ |
336 | 330 | addElement: function( element, attributes ) { |
337 | 331 | var _this = this; |
338 | | - |
339 | | - if ( $j( element ).attr( "id" ) == '' ) { |
340 | | - $j( element ).attr( "id", 'v' + this.playerList.length ); |
| 332 | + var element_id = $j( element ).attr( "id" ); |
| 333 | + if ( element_id == '' ) { |
| 334 | + element_id = 'v' + this.playerList.length; |
| 335 | + $j( element ).attr( "id", element_id); |
341 | 336 | } |
342 | | - var element_id = $j( element ).attr( "id" ); |
| 337 | + |
343 | 338 | |
344 | 339 | // Add the element id to playerList |
345 | | - this.playerList.push( $j( element ).attr( "id" ) ); |
| 340 | + this.playerList.push( element_id ); |
346 | 341 | |
347 | 342 | // Check for class based player skin ( could have been loaded before in 'EmbedPlayer' loader module ) |
348 | 343 | var skinClassRequest = [ ]; |
— | — | @@ -380,10 +375,10 @@ |
381 | 376 | var playerInx = _this.playerList.length; |
382 | 377 | var ranPlayerSwapFlag = false; |
383 | 378 | // Local callback to runPlayer swap once element has metadat |
384 | | - function runPlayerSwap(){ |
385 | | - mw.log("runPlayerSwap" ); |
| 379 | + function runPlayerSwap(){ |
386 | 380 | if( ranPlayerSwapFlag ) |
387 | 381 | return ; |
| 382 | + mw.log("runPlayerSwap::" + $j( element ).attr('id') ); |
388 | 383 | ranPlayerSwapFlag = true; |
389 | 384 | var playerInterface = new mw.EmbedPlayer( element , attributes); |
390 | 385 | _this.swapEmbedPlayerElement( element, playerInterface ); |
— | — | @@ -396,10 +391,10 @@ |
397 | 392 | mw.log(" WaitForMeta ( video missing height width info and has src )"); |
398 | 393 | element.removeEventListener( "loadedmetadata", runPlayerSwap, true ); |
399 | 394 | element.addEventListener( "loadedmetadata", runPlayerSwap, true ); |
400 | | - // Time-out of 3 seconds ( maybe still playable but no timely metadata ) |
401 | | - setTimeout( runPlayerSwap, 3000 ); |
| 395 | + // Time-out of 5 seconds ( maybe still playable but no timely metadata ) |
| 396 | + setTimeout( runPlayerSwap, 5000 ); |
402 | 397 | }else{ |
403 | | - runPlayerSwap( element_id ) |
| 398 | + runPlayerSwap() |
404 | 399 | } |
405 | 400 | break; |
406 | 401 | case 'playlist': |
— | — | @@ -444,7 +439,7 @@ |
445 | 440 | swapEmbedPlayerElement: function( targetElement, playerInterface ) { |
446 | 441 | |
447 | 442 | // Create a new element to swap the player interface into |
448 | | - var swapPlayerElement = document.createElement( 'div' ); |
| 443 | + var swapPlayerElement = document.createElement( 'div' ); |
449 | 444 | |
450 | 445 | // Make sure the new swapPlayerElement has height / width set: |
451 | 446 | $j( swapPlayerElement ).css( { |
— | — | @@ -453,28 +448,11 @@ |
454 | 449 | } ) |
455 | 450 | .html( mw.loading_spinner() ); |
456 | 451 | |
457 | | - // Apply the Player interface to the DOM element |
458 | | - for ( var method in playerInterface ) { // for in loop oky in Element context |
| 452 | + for ( var method in playerInterface ) { |
459 | 453 | if ( method != 'readyState' ) { // readyState crashes IE ( don't include ) |
460 | | - if ( method == 'style' ) { |
461 | | - swapPlayerElement.setAttribute( 'style', playerInterface[method] ); |
462 | | - } else if ( method == 'class' ) { |
463 | | - if ( $j.browser.msie ) |
464 | | - swapPlayerElement.setAttribute( "className", playerInterface['class'] ); |
465 | | - else |
466 | | - swapPlayerElement.setAttribute( "class", playerInterface['class'] ); |
467 | | - } else { |
468 | | - // Normal interface method: |
469 | | - swapPlayerElement[method] = playerInterface[method]; |
470 | | - } |
| 454 | + swapPlayerElement[method] = playerInterface[method]; |
471 | 455 | } |
472 | | - // String -> Boolean: |
473 | | - if ( swapPlayerElement[method] == "false" ) |
474 | | - swapPlayerElement[method] = false; |
475 | | - |
476 | | - if ( swapPlayerElement[method] == "true" ) |
477 | | - swapPlayerElement[method] = true; |
478 | | - } |
| 456 | + } |
479 | 457 | |
480 | 458 | // Now Swap out the video element for the embed_video obj: |
481 | 459 | $j( targetElement ) |
— | — | @@ -497,17 +475,10 @@ |
498 | 476 | // mw.log('checkClipsReady'); |
499 | 477 | var is_ready = true; |
500 | 478 | for ( var i = 0; i < this.playerList.length; i++ ) { |
501 | | - if ( $j( '#' + this.playerList[i] ).length != 0 ) { |
502 | | - var player = $j( '#' + this.playerList[i] ).get( 0 ); |
503 | | - |
| 479 | + var player = $j( '#' + this.playerList[i] ).get( 0 ); |
| 480 | + if ( player ) { |
504 | 481 | // Check if the current video is ready |
505 | | - is_ready = ( player.ready_to_play ) ? is_ready : false; |
506 | | - |
507 | | - if ( !is_ready && player.load_error ) { |
508 | | - is_ready = true; |
509 | | - // Update the player with its load error: |
510 | | - $j( player ).html( player.load_error ); |
511 | | - } |
| 482 | + is_ready = ( player.ready_to_play || player.load_error ) ? is_ready : false; |
512 | 483 | } |
513 | 484 | } |
514 | 485 | if ( is_ready ) { |
— | — | @@ -519,7 +490,7 @@ |
520 | 491 | // Continue checking the playerList |
521 | 492 | setTimeout( function(){ |
522 | 493 | _this.waitPlayersReadyCallback(); |
523 | | - }, 25 ); |
| 494 | + }, 10 ); |
524 | 495 | } |
525 | 496 | } |
526 | 497 | } |
— | — | @@ -594,20 +565,22 @@ |
595 | 566 | } |
596 | 567 | for ( var i = 0; i < default_source_attributes.length; i++ ) { // array loop: |
597 | 568 | var attr = default_source_attributes[ i ]; |
598 | | - if ( $j( element ).attr( attr ) ) { |
599 | | - this[ attr ] = $j( element ).attr( attr ); |
| 569 | + var attr_value = element.getAttribute( attr ); |
| 570 | + if ( attr_value ) { |
| 571 | + this[ attr ] = attr_value; |
600 | 572 | } |
601 | 573 | } |
602 | 574 | |
603 | 575 | |
604 | | - if ( $j( element ).attr( 'type' ) ) |
| 576 | + if ( $j( element ).attr( 'type' ) ){ |
605 | 577 | this.mime_type = $j( element ).attr( 'type' ); |
606 | | - else if ( $j( element ).attr( 'content-type' ) ) |
| 578 | + }else if ( $j( element ).attr( 'content-type' ) ){ |
607 | 579 | this.mime_type = $j( element ).attr( 'content-type' ); |
608 | | - else |
| 580 | + }else{ |
609 | 581 | this.mime_type = this.detectType( this.src ); |
| 582 | + } |
610 | 583 | |
611 | | - // Check for parent elements ( supplies catagories in "itext" ) |
| 584 | + // Check for parent elements ( supplies categories in "itext" ) |
612 | 585 | if( $j( element ).parent().attr('category') ){ |
613 | 586 | this.category = $j( element ).parent().attr('category'); |
614 | 587 | } |
— | — | @@ -1058,8 +1031,8 @@ |
1059 | 1032 | */ |
1060 | 1033 | tryAddSource: function( element ) { |
1061 | 1034 | mw.log( 'f:tryAddSource:' + $j( element ).attr( "src" ) ); |
1062 | | - if ( $j( element ).attr( "src" ) ) { |
1063 | | - var new_src = $j( element ).attr( 'src' ); |
| 1035 | + var new_src = $j( element ).attr( 'src' ); |
| 1036 | + if ( new_src ) { |
1064 | 1037 | // make sure an existing element with the same src does not already exist: |
1065 | 1038 | for ( var i = 0; i < this.sources.length; i++ ) { |
1066 | 1039 | if ( this.sources[i].src == new_src ) { |
— | — | @@ -1250,9 +1223,9 @@ |
1251 | 1224 | this.pid = 'pid_' + this.id; |
1252 | 1225 | |
1253 | 1226 | // Grab any innerHTML and set it to missing_plugin_html |
1254 | | - // @@todo we should strip source tags instead of checking and skipping |
| 1227 | + // @@todo we should strip "source" tags instead of checking and skipping |
1255 | 1228 | if ( element.innerHTML != '' && element.getElementsByTagName( 'source' ).length == 0 ) { |
1256 | | - mw.log( 'innerHTML: ' + element.innerHTML ); |
| 1229 | + //mw.log( 'innerHTML: ' + element.innerHTML ); |
1257 | 1230 | this.user_missing_plugin_html = element.innerHTML; |
1258 | 1231 | } |
1259 | 1232 | |
— | — | @@ -1331,11 +1304,7 @@ |
1332 | 1305 | * @return {Number} pixle height of the video |
1333 | 1306 | */ |
1334 | 1307 | getPlayerWidth: function(){ |
1335 | | - var player = $j( '#mv_embedded_player_' + this.id ).get( 0 ); |
1336 | | - if ( typeof player != 'undefined' && player['offsetWidth'] ) |
1337 | | - return player.offsetWidth; |
1338 | | - else |
1339 | | - return parseInt( this.width ); |
| 1308 | + return parseInt( this.width ); |
1340 | 1309 | }, |
1341 | 1310 | |
1342 | 1311 | /** |
— | — | @@ -1343,12 +1312,8 @@ |
1344 | 1313 | * |
1345 | 1314 | * @return {Number} pixle height of the video |
1346 | 1315 | */ |
1347 | | - getPlayerHeight: function(){ |
1348 | | - var player = $j( '#mv_embedded_player_' + this.id ).get( 0 ); |
1349 | | - if ( typeof player != 'undefined' && player['offsetHeight'] ) |
1350 | | - return player.offsetHeight; |
1351 | | - else |
1352 | | - return parseInt( this.height ); |
| 1316 | + getPlayerHeight: function(){ |
| 1317 | + return parseInt( this.height ); |
1353 | 1318 | }, |
1354 | 1319 | |
1355 | 1320 | /** |
— | — | @@ -1400,7 +1365,7 @@ |
1401 | 1366 | |
1402 | 1367 | /** |
1403 | 1368 | * Check for timed Text support |
1404 | | - * and load nessesary libraries |
| 1369 | + * and load necessary libraries |
1405 | 1370 | * |
1406 | 1371 | * @param {Function} callback Function to call once timed text check is done |
1407 | 1372 | */ |
— | — | @@ -1461,7 +1426,7 @@ |
1462 | 1427 | var missing_type = this.pc.type; |
1463 | 1428 | |
1464 | 1429 | mw.log( 'No player found for given source type ' + missing_type ); |
1465 | | - this.load_error = this.getPluginMissingHTML( missing_type ); |
| 1430 | + $(this).html( this.getPluginMissingHTML( missing_type ) ); |
1466 | 1431 | } |
1467 | 1432 | }, |
1468 | 1433 | |
— | — | @@ -2005,7 +1970,7 @@ |
2006 | 1971 | |
2007 | 1972 | /** |
2008 | 1973 | * Show the player |
2009 | | - * NOTE: the player area is dobule <div> encapsulation will be factored out shortly |
| 1974 | + * NOTE: the player area is double <div> encapsulation will be factored out shortly |
2010 | 1975 | */ |
2011 | 1976 | showPlayer : function () { |
2012 | 1977 | // set-up the local ctrlBuilder instance: |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -57,10 +57,8 @@ |
58 | 58 | */ |
59 | 59 | var mwDefaultConf = { |
60 | 60 | |
61 | | - |
62 | 61 | 'enabledModules' : mwEnabledModuleList, |
63 | 62 | |
64 | | - |
65 | 63 | // Default skin name |
66 | 64 | 'skinName' : 'mvpcf', |
67 | 65 | |
— | — | @@ -199,8 +197,8 @@ |
200 | 198 | //debugger; |
201 | 199 | |
202 | 200 | setupUserConfigFlag = true; |
203 | | - if( callback ) |
204 | | - callback(); |
| 201 | + if( callback ) |
| 202 | + callback(); |
205 | 203 | }); |
206 | 204 | } |
207 | 205 | |
— | — | @@ -958,7 +956,7 @@ |
959 | 957 | // Try loading as a "file"? |
960 | 958 | if( loadRequest ) { |
961 | 959 | mw.log("Loading as \"file\" : " + loadRequest ); |
962 | | - if( loadRequest.indexOf( '.js' ) == -1 ){ |
| 960 | + if( loadRequest.indexOf( '.js' ) == -1 && !mw.getScriptLoaderPath() ){ |
963 | 961 | mw.log( 'Error: are you sure ' + loadRequest + ' is a file ( is it missing a class path? ) ' ); |
964 | 962 | } |
965 | 963 | mw.getScript( loadRequest, callback ); |
— | — | @@ -984,7 +982,12 @@ |
985 | 983 | |
986 | 984 | // Check if we can load via the "script-loader" ( mwEmbed was included via scriptLoader ) |
987 | 985 | if( mw.getScriptLoaderPath() ){ |
988 | | - loadStates = this.getGroupLoadState( loadSet ); |
| 986 | + loadStates = this.getGroupLoadState( loadSet ); |
| 987 | + //if loadStates is empty issue the callback direclty: |
| 988 | + if( mw.isEmpty( loadStates ) ){ |
| 989 | + callback(); |
| 990 | + return ; |
| 991 | + } |
989 | 992 | }else{ |
990 | 993 | // Check if its a dependency set ( nested objects ) |
991 | 994 | if( typeof loadSet [ 0 ] == 'object' ){ |
— | — | @@ -1016,7 +1019,7 @@ |
1017 | 1020 | } |
1018 | 1021 | // Run the parent scope callback for "loadMany" |
1019 | 1022 | if( loadDone ){ |
1020 | | - callback( loadName ); |
| 1023 | + callback( ); |
1021 | 1024 | } |
1022 | 1025 | } ); |
1023 | 1026 | } |
— | — | @@ -1027,7 +1030,7 @@ |
1028 | 1031 | * Groups the loadSet into a single sequential array |
1029 | 1032 | * |
1030 | 1033 | * Groups the scriptRequest where possible: |
1031 | | - * Modules include "loader code" so they are seperated |
| 1034 | + * Modules include "loader code" so they are separated |
1032 | 1035 | * into pre-condition code to be run for subsequent requests |
1033 | 1036 | * |
1034 | 1037 | * @param {Object} loadSet Loadset to return grouped |
— | — | @@ -1037,6 +1040,7 @@ |
1038 | 1041 | getGroupLoadState: function( loadSet ){ |
1039 | 1042 | var groupedLoadSet = []; |
1040 | 1043 | var loadStates = { }; |
| 1044 | + |
1041 | 1045 | // Merge load set into new groupedLoadSet |
1042 | 1046 | if( typeof loadSet[0] == 'object' ){ |
1043 | 1047 | for( var i in loadSet ){ |
— | — | @@ -1049,12 +1053,13 @@ |
1050 | 1054 | groupedLoadSet = loadSet; |
1051 | 1055 | } |
1052 | 1056 | |
1053 | | - // Setup grouped loadStates Set: |
| 1057 | + // Build the loadStates Set as a single string: |
1054 | 1058 | var groupClassKey = ''; |
1055 | 1059 | var coma = ''; |
1056 | 1060 | for( var i=0; i < groupedLoadSet.length; i++ ) { |
1057 | 1061 | var loadName = groupedLoadSet[ i ]; |
1058 | | - if( this.classPaths[ loadName ] ) { |
| 1062 | + //Check if its a classPath key, if so make sure it does not exist (before adding it to the grouped request) |
| 1063 | + if( this.classPaths[ loadName ] && ! mw.isset( loadName ) ) { |
1059 | 1064 | groupClassKey += coma + loadName |
1060 | 1065 | coma = ','; |
1061 | 1066 | }else if( this.moduleLoaders[ loadName ] ) { |
— | — | @@ -1068,12 +1073,13 @@ |
1069 | 1074 | } |
1070 | 1075 | } |
1071 | 1076 | |
1072 | | - // Add groupClassKey if set: |
| 1077 | + // Add groupClassKey is empty return false |
1073 | 1078 | if( groupClassKey != '' ){ |
1074 | | - loadStates [ groupClassKey ] = 0; |
1075 | | - } |
| 1079 | + //return the loadStates |
| 1080 | + loadStates [ groupClassKey ] = 0; |
| 1081 | + } |
1076 | 1082 | |
1077 | | - return loadStates; |
| 1083 | + return loadStates; |
1078 | 1084 | }, |
1079 | 1085 | |
1080 | 1086 | |
Index: branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php |
— | — | @@ -412,7 +412,9 @@ |
413 | 413 | if ( isset( $_GET['urid'] ) && $_GET['urid'] != '' ) { |
414 | 414 | $urid = htmlspecialchars( $_GET['urid'] ); |
415 | 415 | }else{ |
416 | | - die( 'missing urid param'); |
| 416 | + // If no urid is set use special "cache" version. |
| 417 | + // (this requires that the cache is removed for updates to take effect.) |
| 418 | + $urid = 'cache'; |
417 | 419 | } |
418 | 420 | |
419 | 421 | // Get the language code (if not provided use the "default" language |
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | mw.log( "Error: empty rewrite html" ); |
149 | 149 | return ; |
150 | 150 | }else{ |
151 | | - mw.log(" rewrite: " + rewriteHTML + "\n of type: " + typeof rewriteHTML); |
| 151 | + //mw.log(" rewrite: " + rewriteHTML + "\n of type: " + typeof rewriteHTML); |
152 | 152 | } |
153 | 153 | var re = new RegExp( /videoUrl(":?\s*)*([^&]*)/ ); |
154 | 154 | src = re.exec( rewriteHTML )[2]; |
— | — | @@ -192,13 +192,13 @@ |
193 | 193 | .css( 'height', pheight + 30 ); |
194 | 194 | |
195 | 195 | // Do the actual rewrite |
196 | | - $j( '#mwe_' + vidId ).embedPlayer( function() { |
197 | | - if ( vidIdList.length != 0 ) { |
198 | | - setTimeout( function() { |
199 | | - procVidId( vidIdList.pop() ) |
200 | | - }, 10 ); |
201 | | - } |
202 | | - } ); |
| 196 | + $j( '#mwe_' + vidId ).embedPlayer(); |
| 197 | + //issue an async request to rewrite the next clip |
| 198 | + if ( vidIdList.length != 0 ) { |
| 199 | + setTimeout( function() { |
| 200 | + procVidId( vidIdList.pop() ) |
| 201 | + }, 1 ); |
| 202 | + } |
203 | 203 | |
204 | 204 | } |
205 | 205 | }; |