r61140 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61139‎ | r61140 | r61141 >
Date:18:02, 16 January 2010
Author:dale
Status:deferred
Tags:
Comment:
loading tweeks
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -465,15 +465,16 @@
466466 }
467467 }
468468
 469+ // Remove the targetElement
 470+ $j( targetElement ).replaceWith( swapPlayerElement );
 471+
469472 // Now Swap out the video element for the embed_video obj:
470 - $j( targetElement )
 473+ //$j( targetElement )
471474 // Put the swapPlayerElement after the targetElement
472 - .after( swapPlayerElement )
473 - // Remove the targetElement
474 - .remove();
 475+ //.after( swapPlayerElement );
475476
476477
477 - // Set swapPlayerElement has height / width set:
 478+ // Set swapPlayerElement has height / width set and set to loading:
478479 $j( swapPlayerElement ).css( {
479480 'width' : playerInterface.width + 'px',
480481 'height' : playerInterface.height + 'px'
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -942,6 +942,8 @@
943943 loadRequest = loadRequest[0];
944944 }
945945 }
 946+ //Add a class callback hook ( for script-loader onDone callback )
 947+ mwLoadDoneCB[ loadRequest ] = callback;
946948
947949 // Check for the module name loader function
948950 if( this.moduleLoaders[ loadRequest ] &&
@@ -1169,17 +1171,7 @@
11701172 }
11711173
11721174 // Include class defined check for older browsers
1173 - var classDone = false;
1174 -
1175 - //Add a class callback hook ( for script-loader onDone callback )
1176 - mwLoadDoneCB[ className ] = function(){
1177 - mw.log('run callback for: ' + className );
1178 - if( callback ){
1179 - callback( className );
1180 - }
1181 - callback = null;
1182 - mwLoadDoneCB[ className ] = 'done';
1183 - };
 1175+ var classDone = false;
11841176
11851177 // Issue the request to load the class (include class name in result callback:
11861178 mw.getScript( scriptRequest, function( scriptRequest ) {
@@ -1762,15 +1754,15 @@
17631755 var script = document.createElement("script");
17641756 script.setAttribute( 'src', url );
17651757
1766 - // Attach handlers ( if not using script loader that issues onDone callback )
1767 - if( !mw.getScriptLoaderPath() ){
1768 - script.onload = script.onreadystatechange = function(){
1769 - if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") {
1770 - if( callback )
1771 - callback( scriptRequest );
1772 - }
1773 - };
1774 - }
 1758+ // Attach handlers ( if using script loader it issues onDone callback as well )
 1759+ script.onload = script.onreadystatechange = function(){
 1760+ if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") {
 1761+ if( callback ){
 1762+ callback( scriptRequest );
 1763+ callback = null;
 1764+ }
 1765+ }
 1766+ };
17751767 // Append the script to the DOM:
17761768 head.appendChild( script );
17771769 }

Status & tagging log