r58804 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58803‎ | r58804 | r58805 >
Date:05:10, 9 November 2009
Author:dale
Status:deferred
Tags:
Comment:
* minor code clean up for remote add-media-wizard
Modified paths:
  • /trunk/phase3/js2/editPage.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)
  • /trunk/phase3/js2/remoteMwEmbed.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -1175,8 +1175,8 @@
11761176 }
11771177
11781178 //js2AddOnloadHook: ensure jQuery and the DOM are ready
1179 -function js2AddOnloadHook( func ) {
1180 - //js_log('js2AddOnloadHook:: jquery:' + typeof window.jQuery + ' $j: ' + typeof $j);
 1179+function js2AddOnloadHook( func ) {
 1180+ js_log('js2AddOnloadHook:: jquery:' +func);
11811181 //check for jQuery then add the load event (to run after video tag rewrites (if present)
11821182 mvJsLoader.jQueryCheck( function() {
11831183 if( mvJsLoader.doneReadyEvents ) {
Index: trunk/phase3/js2/remoteMwEmbed.js
@@ -10,7 +10,7 @@
1111 reqArguments = urlparts[1];
1212
1313 //setup up request Params:
14 -var reqParts = urlparts[1].split('&');
 14+var reqParts = urlparts[1].substring(1).split('&');
1515 var reqParam={};
1616 for(var i=0;i< reqParts.length; i++){
1717 var p = reqParts[i].split('=');
@@ -28,7 +28,7 @@
2929 function doPageSpecificRewrite() {
3030 // Add media wizard
3131 if( wgAction == 'edit' || wgAction == 'submit' ) {
32 - load_mv_embed( function() {
 32+ load_mv_embed( function() {
3333 loadExternalJs( mwEmbedHostPath + '/editPage.js' + reqArguments );
3434 } );
3535 }
@@ -177,8 +177,12 @@
178178 }else{
179179 rurl+='&urid=' + mwRemoteVersion;
180180 }
 181+ if(reqParam['debug'])
 182+ rurl+='&debug=true';
 183+
181184 if(reqParam['uselang'] )
182185 rurl+='&uselang=' + reqParam['uselang'];
 186+
183187 //do import url:
184188 importScriptURI(rurl);
185189 }else{
Index: trunk/phase3/js2/editPage.js
@@ -23,13 +23,14 @@
2424 js2AddOnloadHook( function() {
2525 var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig );
2626 // kind of tricky, it would be nice to use run on ready "loader" call here
27 - var didWikiEditorBind = false;
 27+ var didWikiEditorBind = false;
2828
2929 //setup the drag drop binding (will only work for html5 upload browsers)
30 - //$j( 'textarea#wpTextbox1' ).dragFileUpload();
 30+ //$j('textarea#wpTextbox1').dragFileUpload();
3131
3232 //set up the add-media-wizard binding:
3333 if( typeof $j.wikiEditor != 'undefined' ) {
 34+ //the below seems to be broken :(
3435 $j( 'textarea#wpTextbox1' ).bind( 'wikiEditor-toolbar-buildSection-main',
3536 function( e, section ) {
3637 didWikiEditorBind = true;
@@ -46,19 +47,20 @@
4748 );
4849 }
4950 //add to old toolbar if wikiEditor did not remove '#toolbar' from the page:
50 - setTimeout(function(){
 51+ setTimeout(function(){
5152 if( $j('#btn-add-media-wiz').length == 0 && $j( '#toolbar' ).length != 0 ){
 53+ js_log(' old toolbar bind:');
5254 $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' +
5355 mv_skin_img_path + 'Button_add_media.png">' );
5456 $j( '#btn-add-media-wiz' ).addMediaWiz(
5557 amwConf
5658 );
5759 }else{
 60+ js_log('failed to bind via build section bind via target:');
5861 //make sure the wikieditor got binded:
5962 if( !didWikiEditorBind )
60 - $j(".tool [rel='file']").addMediaWiz( amwConf );
 63+ $j(".tool[rel='file']").unbind().addMediaWiz( amwConf );
6164 }
6265 }, 120)
63 - //drag drop for editbar:
64 - //$j('textarea#wpTextbox1').dragFileUpload();
 66+
6567 });

Status & tagging log