From: Siebrand Mazeland Date: Sun, 27 Sep 2009 18:38:16 +0000 (+0000) Subject: update indentation and remove trailing whitespace X-Git-Tag: 1.31.0-rc.0~39505 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=d33758b7da37455f9d4e85fe1bb60208a59edcb7;p=lhc%2Fweb%2Fwiklou.git update indentation and remove trailing whitespace --- diff --git a/js2/README b/js2/README index 4daa7f5ad3..062bbd53eb 100644 --- a/js2/README +++ b/js2/README @@ -1,3 +1,3 @@ MediaWiki Javascript phase 2 -Documentaiton to follow: \ No newline at end of file +Documentation to follow:. \ No newline at end of file diff --git a/js2/editPage.js b/js2/editPage.js index 820aea2459..1c87a922cc 100644 --- a/js2/editPage.js +++ b/js2/editPage.js @@ -4,19 +4,19 @@ */ // Setup configuration vars -if( !mwAddMediaConfig ) +if( !mwAddMediaConfig ) { var mwAddMediaConfig = { - 'profile': 'mediawiki_edit', - 'target_textbox': '#wpTextbox1', - // Note: selections in the textbox will take over the default query - 'default_query': wgTitle, - 'target_title': wgPageName, - // Here we can setup the content provider overrides - 'enabled_cps':['wiki_commons'], - // The local wiki API URL: - 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php' - }; - + 'profile': 'mediawiki_edit', + 'target_textbox': '#wpTextbox1', + // Note: selections in the textbox will take over the default query + 'default_query': wgTitle, + 'target_title': wgPageName, + // Here we can setup the content provider overrides + 'enabled_cps':['wiki_commons'], + // The local wiki API URL: + 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php' + }; +} js2AddOnloadHook( function() { mwEditPageHelper.init(); @@ -30,13 +30,14 @@ var mwEditPageHelper = { if( typeof $j.wikiEditor != 'undefined' ) { setTimeout( function() { $j( '.wikiEditor-ui [rel=file]' ).unbind().addMediaWiz( - mwAddMediaConfig + mwAddMediaConfig ); - }, 100 ); + }, + 100 ); } else { // Add the add-media-wizard button for old toolbar: $j( '#toolbar' ).append( '' ); + mv_skin_img_path + 'Button_add_media.png">' ); $j( '#btn-add-media-wiz' ).addMediaWiz( mwAddMediaConfig ); @@ -44,7 +45,7 @@ var mwEditPageHelper = { // Add to new toolbar (need to use api) /*$j( '[rel=insert] tool-file' ).addMediaWiz( - mwAddMediaConfig + mwAddMediaConfig );*/ } } diff --git a/js2/remoteMwEmbed.js b/js2/remoteMwEmbed.js index bb68bbaf9e..6632aef707 100644 --- a/js2/remoteMwEmbed.js +++ b/js2/remoteMwEmbed.js @@ -3,7 +3,6 @@ * that are not yet running the new-upload branch */ - var urlparts = getRemoteEmbedPath(); var mwEmbedHostPath = urlparts[0]; var reqAguments = urlparts[1]; @@ -18,65 +17,66 @@ function doPageSpecificRewrite() { if( wgAction == 'edit' || wgAction == 'submit' ) { load_mv_embed( function() { importScriptURI( mwEmbedHostPath + '/editPage.js' + reqAguments ); - }); + } ); } // Firefogg integration if( wgPageName == "Special:Upload" ){ load_mv_embed( function() { importScriptURI( mwEmbedHostPath + '/uploadPage.js' + reqAguments ); - }); + } ); } // OggHandler rewrite var vidIdList = []; var divs = document.getElementsByTagName( 'div' ); for( var i = 0; i < divs.length; i++ ) { - if( divs[i].id && divs[i].id.substring( 0, 11 ) == 'ogg_player_' ) { - vidIdList.push( divs[i].getAttribute( "id" ) ); - } + if( divs[i].id && divs[i].id.substring( 0, 11 ) == 'ogg_player_' ) { + vidIdList.push( divs[i].getAttribute( "id" ) ); + } } if( vidIdList.length > 0 ) { - load_mv_embed( function() { - mvJsLoader.embedVideoCheck( function() { - // Do utilty rewrite of OggHandler content: - rewrite_for_OggHandler( vidIdList ); - }); - }); + load_mv_embed( function() { + mvJsLoader.embedVideoCheck( function() { + // Do utilty rewrite of OggHandler content: + rewrite_for_OggHandler( vidIdList ); + } ); + } ); } } + function getRemoteEmbedPath() { - for( var i = 0; i < document.getElementsByTagName( 'script' ).length; i++ ) { - var s = document.getElementsByTagName( 'script' )[i]; - if( s.src.indexOf( 'remoteMwEmbed.js' ) != -1 ) { - var reqStr = ''; - var scriptPath = ''; - if( s.src.indexOf( '?' ) != -1) { - reqStr = s.src.substr( s.src.indexOf( '?' ) ); - scriptPath = s.src.substr( 0, s.src.indexOf( '?' ) ).replace( 'remoteMwEmbed.js', '' ); - } else { - scriptPath = s.src.replace( 'remoteMwEmbed.js', '' ) - } - // Use the external_media_wizard path: - return [scriptPath, reqStr]; - } - } + for( var i = 0; i < document.getElementsByTagName( 'script' ).length; i++ ) { + var s = document.getElementsByTagName( 'script' )[i]; + if( s.src.indexOf( 'remoteMwEmbed.js' ) != -1 ) { + var reqStr = ''; + var scriptPath = ''; + if( s.src.indexOf( '?' ) != -1) { + reqStr = s.src.substr( s.src.indexOf( '?' ) ); + scriptPath = s.src.substr( 0, s.src.indexOf( '?' ) ).replace( 'remoteMwEmbed.js', '' ); + } else { + scriptPath = s.src.replace( 'remoteMwEmbed.js', '' ) + } + // Use the external_media_wizard path: + return [scriptPath, reqStr]; + } + } } function load_mv_embed( callback ) { - // Inject mv_embed if needed - if( typeof mvEmbed == 'undefined' ) { + // Inject mv_embed if needed + if( typeof mvEmbed == 'undefined' ) { importScriptURI( mwEmbedHostPath + '/mwEmbed/mv_embed.js' + reqAguments ); - check_for_mv_embed( callback ); - } else { - check_for_mv_embed( callback ); - } + check_for_mv_embed( callback ); + } else { + check_for_mv_embed( callback ); + } } + function check_for_mv_embed( callback ) { - if( typeof MV_EMBED_VERSION == 'undefined' ) { - setTimeout( 'check_for_mv_embed( ' + callback + ');', 25 ); - } else { - callback(); - } + if( typeof MV_EMBED_VERSION == 'undefined' ) { + setTimeout( 'check_for_mv_embed( ' + callback + ');', 25 ); + } else { + callback(); + } } - diff --git a/js2/uploadPage.js b/js2/uploadPage.js index 87158bfc50..41a391d5b9 100644 --- a/js2/uploadPage.js +++ b/js2/uploadPage.js @@ -4,7 +4,7 @@ */ js2AddOnloadHook( function() { mwUploadHelper.init(); -}); +} ); var mwUploadFormTarget = '#mw-upload-form'; // Set up the upload form bindings once all DOM manipulation is done var mwUploadHelper = { @@ -12,7 +12,7 @@ var mwUploadHelper = { var _this = this; // If wgEnableFirefogg is not boolean false, set to true if( typeof wgEnableFirefogg == 'undefined' ) - wgEnableFirefogg = true; + wgEnableFirefogg = true; if( wgEnableFirefogg ) { // Set up the upload handler to Firefogg. Should work with the HTTP uploads too. @@ -22,13 +22,13 @@ var mwUploadHelper = { 'form_rewrite': true, 'target_edit_from': mwUploadFormTarget, 'new_source_cb': function( orgFilename, oggName ) { - if( $j( '#wpDestFile' ).val() == "" ) - $j( '#wpDestFile' ).val( oggName ); + if( $j( '#wpDestFile' ).val() == "" ) + $j( '#wpDestFile' ).val( oggName ); $j( '#wpDestFile' ).doDestCheck({ 'warn_target': '#wpDestFile-warning' - }); + } ); } - }); + } ); } else { // Add basic upload profile support ( http status monitoring, progress box for // browsers that support it, etc.) @@ -36,7 +36,7 @@ var mwUploadHelper = { $j( '#wpUploadFileURL' ).baseUploadInterface( { 'api_url': wgServer + wgScriptPath + '/api.php', 'target_edit_from': mwUploadFormTarget - }); + } ); } } @@ -45,8 +45,8 @@ var mwUploadHelper = { $j( '#wpDestFile' ).change( function() { $j( '#wpDestFile' ).doDestCheck({ 'warn_target':'#wpDestFile-warning' - }); - }); + } ); + } ); } // Check if we have HTTP enabled & setup enable/disable toggle: @@ -56,24 +56,24 @@ var mwUploadHelper = { $j( "input[name='wpSourceType']" ).click( function() { _this.toggleUpType( this.id == 'wpSourceTypeFile' ); - }); + } ); } $j( '#wpUploadFile,#wpUploadFileURL' ) - .focus( function() { - _this.toggleUpType( this.id == 'wpUploadFile' ); - }) - // Also setup the onChange event binding: - .change( function() { - if ( wgUploadAutoFill ) { - mwUploadHelper.doDestinationFill( this ); - } - }); + .focus( function() { + _this.toggleUpType( this.id == 'wpUploadFile' ); + }) + // Also setup the onChange event binding: + .change( function() { + if ( wgUploadAutoFill ) { + mwUploadHelper.doDestinationFill( this ); + } + } ); }, /** - * Set the upload radio buttons - * - * boolean set - */ + * Set the upload radio buttons + * + * boolean set + */ toggleUpType: function( set ) { $j( '#wpSourceTypeFile' ).attr( 'checked', set ); $j( '#wpUploadFile' ).attr( 'disabled', !set ); @@ -85,12 +85,12 @@ var mwUploadHelper = { if( wgEnableFirefogg ) { $j( '#wpUploadFile' ).firefogg({ 'firefogg_form_action': $j( '#wpSourceTypeFile' ).attr( 'checked' ) - }); + } ); } }, /** - * Fill in a destination file-name based on a source asset name. - */ + * Fill in a destination file-name based on a source asset name. + */ doDestinationFill: function( targetElm ) { js_log( "doDestinationFill" ) // Remove any previously flagged errors @@ -115,7 +115,7 @@ var mwUploadHelper = { var ext = fname.substr( fname.lastIndexOf( '.' ) + 1 ); for( var i = 0; i < wgFileExtensions.length; i++ ) { if( wgFileExtensions[i].toLowerCase() == ext.toLowerCase() ) - found = true; + found = true; } } if( !found ) { @@ -134,7 +134,6 @@ var mwUploadHelper = { // Do a destination check $j( '#wpDestFile' ).doDestCheck({ 'warn_target': '#wpDestFile-warning' - }); + } ); } } -