Make WordPress Core

Ticket #24291: 24291.27.diff

File 24291.27.diff, 1.1 KB (added by azaozz, 12 years ago)
  • wp-admin/js/post-formats.js

     
    5959                '</div>'].join( '' ) );
    6060        }
    6161
     62        function imageFormatUploadFilesAdded( uploader, files ) {
     63                $.each( files, function( i, file ) {
     64                        if ( i > 0 )
     65                                uploader.removeFile(file);
     66                });
     67        }
     68
    6269        var uploader = {
    6370                dropzone:  $('.wp-format-media-holder[data-format=image]'),
    6471                success:   imageFormatUploadSuccess,
    65                 error: imageFormatUploadError,
    66                 plupload:  {},
     72                error:     imageFormatUploadError,
     73                plupload:  {
     74                        runtimes: 'html5',
     75                        filters: [ {title: 'Image', extensions: 'jpg,jpeg,gif,png'} ]
     76                },
    6777                params:    {}
    6878        };
    6979        uploader = new wp.Uploader( uploader );
    7080        uploader.uploader.bind( 'BeforeUpload', imageFormatUploadStart );
    7181        uploader.uploader.bind( 'UploadProgress', imageFormatUploadProgress );
     82        uploader.uploader.bind( 'FilesAdded', imageFormatUploadFilesAdded );
    7283
    7384        function switchFormatClass( format ) {
    7485                formatField.val( format );