User:MarkTraceur/commonsUploadForEditDialog.js

( function ( mw, $ ) {	var udscript = importScript( 'User:MarkTraceur/commonsUploadDialog.js' ),		ready = $.Deferred;

udscript.addEventListener( 'load', function {		mw.commonsUploadDialogPromise.then( ready.resolve, ready.reject );	} );

mw.uploadEditToolPromise = ready.then( function {		mw.CommonsUploadForEdit = function ( apiconfig ) {			mw.CommonsUploadForEdit.parent.call( this, apiconfig );			this.caption = '';		};

OO.inheritClass( mw.CommonsUploadForEdit, mw.CommonsUpload ); mw.CommonsUploadForEdit.prototype.getLicense = function { return ''; };

mw.CommonsUploadForEdit.prototype.getCaption = function { return this.caption; };

mw.CommonsUploadForEdit.prototype.setCaption = function ( caption ) { this.caption = caption; };

mw.CommonsUploadForEditDialog = function ( config ) { mw.CommonsUploadForEditDialog.parent.call( this, config ); };

OO.inheritClass( mw.CommonsUploadForEditDialog, mw.CommonsUploadDialog );

mw.CommonsUploadForEditDialog.prototype.getFields = function { var fields = mw.CommonsUploadForEditDialog.parent.prototype.getFields.call( this );

this.captionWidget = new OO.ui.TextInputWidget( {} ); this.captionField = new OO.ui.FieldLayout( this.captionWidget, {				label: 'Caption'			} );

fields.push( this.captionField );

return fields; };

mw.CommonsUploadForEditDialog.prototype.setCaption = function ( caption ) { this.captionWidget.setValue( caption ); };

mw.CommonsUploadForEditDialog.prototype.getCaption = function { return this.captionWidget.getValue; };

mw.CommonsUploadForEditDialog.prototype.finalizeUpload = function { mw.CommonsUploadForEditDialog.parent.prototype.finalizeUpload.call( this ); this.upload.setCaption( this.getCaption ); };

mw.CommonsUploadForEditDialog.prototype.getUploadObject = function { return new mw.CommonsUploadForEdit( {} ); };	} ); }( mediaWiki, jQuery ) );