' + mw.message( 'largefileserver', file.size, maxSize ).escaped() + '
' ); $( '#wpUploadFile' ).after( error ); return false; } return true; } /** * Initialization */ if ( hasFileAPI() ) { // Update thumbnail when the file selection control is updated. $( '#wpUploadFile' ).change( function () { clearPreview(); if ( this.files && this.files.length ) { // Note: would need to be updated to handle multiple files. var file = this.files[0]; if ( !checkMaxUploadSize( file ) ) { return; } if ( fileIsPreviewable( file ) ) { showPreview( file ); } } } ); } } ); /** * Disable all upload source fields except the selected one */ $( function ( $ ) { var i, row, rows = $( '.mw-htmlform-field-UploadSourceField' ); for ( i = rows.length; i; i-- ) { row = rows[i - 1]; $( 'input[name="wpSourceType"]', row ).change( ( function () { var currentRow = row; // Store current row in our own scope return function () { $( '.mw-upload-source-error' ).remove(); if ( this.checked ) { // Disable all inputs $( 'input[name!="wpSourceType"]', rows ).prop( 'disabled', true ); // Re-enable the current one $( 'input', currentRow ).prop( 'disabled', false ); } }; }() ) ); } } ); }( mediaWiki, jQuery ) );