r61147 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61146‎ | r61147 | r61148 >
Date:18:59, 16 January 2010
Author:dale
Status:deferred
Tags:
Comment:
* added some checks to mwLoadDoneCB to stop situation where callbacks is called twice.
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/mw.ClipEdit.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/mw.ClipEdit.js
@@ -97,6 +97,7 @@
9898 * initialises a clipEdit object with provided options.
9999 */
100100 init:function( options ) {
 101+ mw.log(' mw.ClipEdit' );
101102 // init object:
102103 for ( var i in default_clipedit_values ) {
103104 if ( options[i] ) {
@@ -777,10 +778,10 @@
778779 showImageControls:function() {
779780 var _this = this;
780781 var $tool_target = $j( '#' + this.target_control_display );
781 -
 782+ mw.log( 'tool target len: ' + $tool_target.length );
782783 // By default apply Crop tool
783784 if ( _this.enabled_tools == 'all' || _this.enabled_tools.length > 0 ) {
784 - $tool_target.append( '<h3>' + gM( 'mwe-edit-tools' ) + '</h3>' );
 785+ $tool_target.html( '<h3>' + gM( 'mwe-edit-tools' ) + '</h3>' );
785786 for ( var i in _this.toolset ) {
786787 var toolid = _this.toolset[i];
787788 if ( $j.inArray( toolid, _this.enabled_tools ) != -1 || _this.enabled_tools == 'all' )
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -1026,8 +1026,9 @@
10271027 loadDone = false;
10281028 }
10291029 // Run the parent scope callback for "loadMany"
1030 - if( loadDone && callback ){
 1030+ if( loadDone && callback && mwLoadDoneCB[ loadName ] != 'done' ){
10311031 callback( loadName );
 1032+ mwLoadDoneCB[ loadName ] = 'done';
10321033 }
10331034 } );
10341035 }
@@ -1178,8 +1179,11 @@
11791180 if(! mw.isset( className ) && callback){
11801181 mw.log( 'Possible Error: ' + className +' not set in time, or not defined in:' + "\n" + _this.classPaths[ className ] );
11811182 }
1182 - if( callback )
1183 - callback( className );
 1183+ // make sure callback is avaliable and mwLoadDoneCB has not been called
 1184+ if( callback && mwLoadDoneCB[className] != 'done'){
 1185+ mwLoadDoneCB[className] = 'done';
 1186+ callback( className );
 1187+ }
11841188 callback = null;
11851189 } );
11861190 //mw.log( 'done with running getScript request ' );
@@ -1266,8 +1270,9 @@
12671271 */
12681272 mw.loadDone = function( requestName ) {
12691273 mw.log( "LoadDone: " + requestName );
1270 - if( mwLoadDoneCB[ requestName ] ){
 1274+ if( mwLoadDoneCB[ requestName ] && mwLoadDoneCB[ requestName ] != 'done'){
12711275 mwLoadDoneCB[ requestName ]( requestName );
 1276+ mwLoadDoneCB[ requestName ] = 'done';
12721277 }
12731278 },
12741279
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js
@@ -4,7 +4,7 @@
55 */
66 var urlparts = getRemoteEmbedPath();
77 var mwEmbedHostPath = urlparts[0];
8 -var mwRemoteVersion = 'r76';
 8+var mwRemoteVersion = 'r77';
99 var mwUseScriptLoader = true;
1010
1111 // Setup up request Params:

Status & tagging log