Merge "SpecialMovepage: Convert form to use OOUI controls"
[lhc/web/wiklou.git] / resources / src / mediawiki.api / mediawiki.api.upload.js
index d05ba57..4abff28 100644 (file)
@@ -1,5 +1,6 @@
 /**
  * Provides an interface for uploading files to MediaWiki.
+ *
  * @class mw.Api.plugin.upload
  * @singleton
  */
@@ -18,6 +19,7 @@
        /**
         * @private
         * Get nonce for iframe IDs on the page.
+        *
         * @return {number}
         */
        function getNonce() {
@@ -27,6 +29,7 @@
        /**
         * @private
         * Get new iframe object for an upload.
+        *
         * @return {HTMLIframeElement}
         */
        function getNewIframe( id ) {
        /**
         * @private
         * Shortcut for getting hidden inputs
+        *
         * @return {jQuery}
         */
        function getHiddenInput( name, val ) {
-               return $( '<input type="hidden" />')
+               return $( '<input type="hidden" />' )
                        .attr( 'name', name )
                        .val( val );
        }
@@ -58,7 +62,7 @@
         */
        function processIframeResult( iframe ) {
                var json,
-                       doc = iframe.contentDocument || frames[iframe.id].document;
+                       doc = iframe.contentDocument || frames[ iframe.id ].document;
 
                if ( doc.XMLDocument ) {
                        // The response is a document property in IE
                        isFileInput = file && file.nodeType === Node.ELEMENT_NODE;
 
                        if ( formDataAvailable() && isFileInput && file.files ) {
-                               file = file.files[0];
+                               file = file.files[ 0 ];
                        }
 
                        if ( !file ) {
                                $iframe = $( iframe );
 
                        for ( key in data ) {
-                               if ( !fieldsAllowed[key] ) {
-                                       delete data[key];
+                               if ( !fieldsAllowed[ key ] ) {
+                                       delete data[ key ];
                                }
                        }
 
                                deferred = $.Deferred();
 
                        for ( key in data ) {
-                               if ( !fieldsAllowed[key] ) {
-                                       delete data[key];
+                               if ( !fieldsAllowed[ key ] ) {
+                                       delete data[ key ];
                                }
                        }
 
                 * This function will return a promise, which when resolved, will pass back a function
                 * to finish the stash upload. You can call that function with an argument containing
                 * more, or conflicting, data to pass to the server. For example:
+                *
                 *     // upload a file to the stash with a placeholder filename
                 *     api.uploadToStash( file, { filename: 'testing.png' } ).done( function ( finish ) {
                 *         // finish is now the function we can use to finalize the upload
                 *             // the upload is complete, data holds the API response
                 *         } );
                 *     } );
+                *
                 * @param {File|HTMLInputElement} file
                 * @param {Object} [data]
                 * @return {jQuery.Promise}