jenkins-bot has submitted this change and it was merged. Change subject: Enclose every JS file in per-file closures ......................................................................
Enclose every JS file in per-file closures Per https://www.mediawiki.org/wiki/CC/JS#Closure Also made sure the style was pretty consistent. Bug: 53067 Change-Id: I0db18f24af2dc145f517e9844ef29ac5ad01b687 --- M UploadWizardPage.js M resources/mw.ApiUploadFormDataHandler.js M resources/mw.ApiUploadHandler.js M resources/mw.ConfirmCloseWindow.js M resources/mw.DestinationChecker.js M resources/mw.ErrorDialog.js M resources/mw.Firefogg.js M resources/mw.FirefoggHandler.js M resources/mw.FirefoggTransport.js M resources/mw.FlickrChecker.js M resources/mw.FormDataTransport.js M resources/mw.GroupProgressBar.js M resources/mw.IframeTransport.js M resources/mw.LanguageUpWiz.js M resources/mw.MockUploadHandler.js M resources/mw.UploadWizard.js M resources/mw.UploadWizardDeed.js M resources/mw.UploadWizardDescription.js M resources/mw.UploadWizardDetails.js M resources/mw.UploadWizardLicenseInput.js M resources/mw.UploadWizardUpload.js M resources/mw.UploadWizardUploadInterface.js M resources/mw.UploadWizardUtil.js M resources/mw.UtilitiesTime.js M resources/mw.fileApi.js 25 files changed, 56 insertions(+), 47 deletions(-) Approvals: Yuvipanda: Looks good to me, approved jenkins-bot: Verified diff --git a/UploadWizardPage.js b/UploadWizardPage.js index 85d51a1..21f9c8d 100644 --- a/UploadWizardPage.js +++ b/UploadWizardPage.js @@ -7,7 +7,7 @@ */ // Create UploadWizard -( function ( $, mw, undefined ) { +( function ( mw, $ ) { mw.UploadWizardPage = function () { @@ -26,4 +26,4 @@ mw.UploadWizardPage(); } ); -} )( jQuery, mediaWiki ); +} )( mediaWiki, jQuery ); diff --git a/resources/mw.ApiUploadFormDataHandler.js b/resources/mw.ApiUploadFormDataHandler.js index 59102db..c15644c 100644 --- a/resources/mw.ApiUploadFormDataHandler.js +++ b/resources/mw.ApiUploadFormDataHandler.js @@ -1,3 +1,4 @@ +( function ( mw, $ ) { /** * Represents an object which configures an html5 FormData object to upload. * Large files are uploaded in chunks. @@ -64,6 +65,4 @@ this.configureEditToken( ok, err ); } }; - - - +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.ApiUploadHandler.js b/resources/mw.ApiUploadHandler.js index da79e06..2ef34c0 100644 --- a/resources/mw.ApiUploadHandler.js +++ b/resources/mw.ApiUploadHandler.js @@ -6,6 +6,8 @@ // n.b. if there are message strings, or any assumption about HTML structure of the form. // then we probably did it wrong +( function ( mw, $ ) { + /** * Represents an object which configures a form to upload its files via an iframe talking to the MediaWiki API. * @param an UploadInterface object, which contains a .form property which points to a real HTML form in the DOM @@ -104,3 +106,4 @@ this.configureEditToken( ok, err ); } }; +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.ConfirmCloseWindow.js b/resources/mw.ConfirmCloseWindow.js index 57a87a5..99f487b 100644 --- a/resources/mw.ConfirmCloseWindow.js +++ b/resources/mw.ConfirmCloseWindow.js @@ -1,4 +1,4 @@ -( function( mw, $, undefined ) { +( function( mw, $ ) { /** * @method confirmCloseWindow * @member mw @@ -55,4 +55,4 @@ }; -} )( window.mediaWiki, jQuery ); +} )( mediaWiki, jQuery ); diff --git a/resources/mw.DestinationChecker.js b/resources/mw.DestinationChecker.js index b91529a..9d3c508 100644 --- a/resources/mw.DestinationChecker.js +++ b/resources/mw.DestinationChecker.js @@ -1,3 +1,4 @@ +( function ( mw, $ ) { /** * Object to attach to a file name input, to be run on its change() event * Largely derived from wgUploadWarningObj in old upload.js @@ -306,13 +307,12 @@ /** * jQuery extension to make a field upload-checkable */ -( function ( $ ) { - $.fn.destinationChecked = function( options ) { - var _this = this; - options.selector = _this; - var checker = new mw.DestinationChecker( options ); - // this should really be done with triggers - _this.checkTitle = function() { checker.checkTitle(); }; - return _this; - }; -} )( jQuery ); +$.fn.destinationChecked = function( options ) { + var _this = this; + options.selector = _this; + var checker = new mw.DestinationChecker( options ); + // this should really be done with triggers + _this.checkTitle = function() { checker.checkTitle(); }; + return _this; +}; +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.ErrorDialog.js b/resources/mw.ErrorDialog.js index 8fe40e0..dd0f99b 100644 --- a/resources/mw.ErrorDialog.js +++ b/resources/mw.ErrorDialog.js @@ -46,4 +46,4 @@ }; -} )( window.mediaWiki, jQuery ); +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.Firefogg.js b/resources/mw.Firefogg.js index c9cc3c8..9495180 100644 --- a/resources/mw.Firefogg.js +++ b/resources/mw.Firefogg.js @@ -1,4 +1,5 @@ // Firefogg utilities not related to the upload handler or transport +( function ( mw, $ ) { mw.Firefogg = { firefoggInstallLinks: { @@ -29,3 +30,4 @@ return typeof( Firefogg ) != 'undefined' && Firefogg().version >= '2.8.05'; } }; +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.FirefoggHandler.js b/resources/mw.FirefoggHandler.js index baf2275..1548219 100644 --- a/resources/mw.FirefoggHandler.js +++ b/resources/mw.FirefoggHandler.js @@ -1,3 +1,4 @@ +( function ( mw, $ ) { /** * Represents an object which configures a form to upload its files via an firefogg talking to the MediaWiki API. * @param an UploadInterface object, which contains a .form property which points to a real HTML form in the DOM @@ -66,3 +67,4 @@ _this.getTransport().doUpload(); } }; +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.FirefoggTransport.js b/resources/mw.FirefoggTransport.js index 5d026b7..bcaa8d7 100644 --- a/resources/mw.FirefoggTransport.js +++ b/resources/mw.FirefoggTransport.js @@ -1,3 +1,4 @@ +( function ( mw, $ ) { /** * Represents a "transport" for files to upload; in this case an firefogg. * @@ -166,3 +167,4 @@ return encodeSettings; } }; +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.FlickrChecker.js b/resources/mw.FlickrChecker.js index f0e11de..36fdf68 100644 --- a/resources/mw.FlickrChecker.js +++ b/resources/mw.FlickrChecker.js @@ -1,6 +1,4 @@ ( function( mw, $ ) { - - mw.FlickrChecker = function( wizard, upload ) { this.wizard = wizard; this.upload = upload; @@ -349,4 +347,4 @@ }; -} )( window.mediaWiki, jQuery ); +} )( mediaWiki, jQuery ); diff --git a/resources/mw.FormDataTransport.js b/resources/mw.FormDataTransport.js index 6d554f2..c983ebb 100644 --- a/resources/mw.FormDataTransport.js +++ b/resources/mw.FormDataTransport.js @@ -1,3 +1,4 @@ +( function ( mw, $ ) { /** * Represents a "transport" for files to upload; using html5 FormData. * @@ -324,3 +325,4 @@ return formData; } }; +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.GroupProgressBar.js b/resources/mw.GroupProgressBar.js index 4a629c1..b02695d 100644 --- a/resources/mw.GroupProgressBar.js +++ b/resources/mw.GroupProgressBar.js @@ -1,3 +1,4 @@ +( function ( mw, $ ) { /** * this is a progress bar for monitoring multiple objects, giving summary view */ @@ -192,5 +193,4 @@ } }; - - +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.IframeTransport.js b/resources/mw.IframeTransport.js index 761542b..e9c2d1c 100644 --- a/resources/mw.IframeTransport.js +++ b/resources/mw.IframeTransport.js @@ -1,3 +1,4 @@ +( function ( mw, $ ) { /** * Represents a "transport" for files to upload; in this case an iframe. * XXX dubious whether this is really separated from "ApiUploadHandler", which does a lot of form config. @@ -107,5 +108,4 @@ _this.transportedCb( response ); } }; - - +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.LanguageUpWiz.js b/resources/mw.LanguageUpWiz.js index a31df5f..3a2d5da 100644 --- a/resources/mw.LanguageUpWiz.js +++ b/resources/mw.LanguageUpWiz.js @@ -1,4 +1,4 @@ -( function( mw ) { +( function( mw, $ ) { mediaWiki.messages.set( { "mwe-upwiz-code-unknown": "Unknown language" } ); @@ -142,4 +142,4 @@ } }; -} )( window.mediaWiki ); +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.MockUploadHandler.js b/resources/mw.MockUploadHandler.js index d87e55c..cbefb3a 100644 --- a/resources/mw.MockUploadHandler.js +++ b/resources/mw.MockUploadHandler.js @@ -1,3 +1,4 @@ +( function ( mw ) { // TODO copy interface from ApiUploadHandler -- it changed // Currently this doesn't at all follow the interface that Mdale made in UploadHandler @@ -33,5 +34,4 @@ } }; - - +}( mediaWiki ) ); diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js index 366b2df..bcf75af 100644 --- a/resources/mw.UploadWizard.js +++ b/resources/mw.UploadWizard.js @@ -2,7 +2,7 @@ * Object that reperesents the entire multi-step Upload Wizard */ -( function( mw, $, undefined ) { +( function( mw, $ ) { mw.UploadWizard = function( config ) { @@ -1617,4 +1617,4 @@ errorClass: 'mwe-validator-error' } ); -} )( jQuery ); +} )( mediaWiki, jQuery ); diff --git a/resources/mw.UploadWizardDeed.js b/resources/mw.UploadWizardDeed.js index 763e83b..d72d853 100644 --- a/resources/mw.UploadWizardDeed.js +++ b/resources/mw.UploadWizardDeed.js @@ -1,7 +1,7 @@ /** * Sort of an abstract class for deeds */ -( function( $, undefined ) { +( function( mw, $ ) { mw.UploadWizardDeed = function() { var _this = this; @@ -524,4 +524,4 @@ }; // end UploadWizardDeed.prototype -} )( jQuery ); +} )( mediaWiki, jQuery ); diff --git a/resources/mw.UploadWizardDescription.js b/resources/mw.UploadWizardDescription.js index 7be5e8e..7752ed7 100644 --- a/resources/mw.UploadWizardDescription.js +++ b/resources/mw.UploadWizardDescription.js @@ -1,4 +1,4 @@ - +( function ( mw, $ ) { /** * Object that represents an indvidual language description, in the details portion of Upload Wizard * @param languageCode -- string @@ -108,3 +108,4 @@ } ); } }; +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.UploadWizardDetails.js b/resources/mw.UploadWizardDetails.js index cef0446..44cd57e 100644 --- a/resources/mw.UploadWizardDetails.js +++ b/resources/mw.UploadWizardDetails.js @@ -11,7 +11,7 @@ * @param API * @param containerDiv The div to put the interface into */ -( function( mw, $, undefined ) { +( function( mw, $ ) { var fileNsId = mw.config.get( 'wgNamespaceIds' ).file; @@ -1492,4 +1492,4 @@ }; -}) ( window.mediaWiki, jQuery ); +}) ( mediaWiki, jQuery ); diff --git a/resources/mw.UploadWizardLicenseInput.js b/resources/mw.UploadWizardLicenseInput.js index 74f41ab..6216a09 100644 --- a/resources/mw.UploadWizardLicenseInput.js +++ b/resources/mw.UploadWizardLicenseInput.js @@ -13,7 +13,7 @@ * @param {mw.Api} api object; useful for previews */ -( function( mw, $, undefined ) { +( function( mw, $ ) { var catNsId = mw.config.get( 'wgNamespaceIds' ).category, templateNsId = mw.config.get( 'wgNamespaceIds' ).template; @@ -594,4 +594,4 @@ }; -} )( window.mediaWiki, jQuery ); +} )( mediaWiki, jQuery ); diff --git a/resources/mw.UploadWizardUpload.js b/resources/mw.UploadWizardUpload.js index e738282..bd44486 100644 --- a/resources/mw.UploadWizardUpload.js +++ b/resources/mw.UploadWizardUpload.js @@ -5,7 +5,7 @@ * 'new' 'transporting' 'transported' 'metadata' 'stashed' 'details' 'submitting-details' 'complete' 'error' * should fork this into two -- local and remote, e.g. filename */ -( function( $, undefined ) { +( function( mw, $ ) { var fileNsId = mw.config.get( 'wgNamespaceIds' ).file; @@ -1158,4 +1158,4 @@ }; -} )( jQuery ); +} )( mediaWiki, jQuery ); diff --git a/resources/mw.UploadWizardUploadInterface.js b/resources/mw.UploadWizardUploadInterface.js index f7fefcd..f494098 100644 --- a/resources/mw.UploadWizardUploadInterface.js +++ b/resources/mw.UploadWizardUploadInterface.js @@ -4,7 +4,7 @@ * @param div to insert file interface * @param providedFile a File object that this ui component should use (optional) */ -( function( mw, $, undefined ) { +( function( mw, $ ) { mw.UploadWizardUploadInterface = function( upload, filesDiv, providedFile ) { var _this = this; @@ -688,4 +688,4 @@ }; -}) ( window.mediaWiki, jQuery ); +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.UploadWizardUtil.js b/resources/mw.UploadWizardUtil.js index 0708895..3a941bb 100644 --- a/resources/mw.UploadWizardUtil.js +++ b/resources/mw.UploadWizardUtil.js @@ -1,7 +1,7 @@ /** * Miscellaneous utilities */ -( function ( mw, $, undefined ) { +( function ( mw, $ ) { mw.UploadWizardUtil = { /** @@ -92,4 +92,4 @@ }; -}) ( window.mediaWiki, jQuery ); +}( mediaWiki, jQuery ) ); diff --git a/resources/mw.UtilitiesTime.js b/resources/mw.UtilitiesTime.js index c216f21..ccfb029 100644 --- a/resources/mw.UtilitiesTime.js +++ b/resources/mw.UtilitiesTime.js @@ -90,4 +90,4 @@ return parseInt( hour * 3600, 10 ) + parseInt( min * 60, 10 ) + parseFloat( sec ); }; -} )( window.mediaWiki ); +}( mediaWiki ) ); diff --git a/resources/mw.fileApi.js b/resources/mw.fileApi.js index 586ef57..f46990f 100644 --- a/resources/mw.fileApi.js +++ b/resources/mw.fileApi.js @@ -1,6 +1,6 @@ /* miscellaneous fileApi routines -- partially copied from mediawiki.special.upload.js, must refactor... */ -( function( $, mw ) { +( function( mw, $ ) { mw.fileApi = { @@ -55,4 +55,4 @@ ( $.browser.msie && parseFloat($.browser.version) >= 10 ) ); } }; -} )( jQuery, mediaWiki ); +}( mediaWiki, jQuery ) ); -- To view, visit https://gerrit.wikimedia.org/r/80122 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0db18f24af2dc145f517e9844ef29ac5ad01b687 Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/UploadWizard Gerrit-Branch: master Gerrit-Owner: MarkTraceur <[email protected]> Gerrit-Reviewer: Yuvipanda <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
