diff --git a/src/wp-includes/js/plupload/handlers.js b/src/wp-includes/js/plupload/handlers.js index 0b9937c4db..7b1a7b0953 100644 --- a/src/wp-includes/js/plupload/handlers.js +++ b/src/wp-includes/js/plupload/handlers.js @@ -1,9 +1,7 @@ +/* global plupload, pluploadL10n, ajaxurl, post_id, wpUploaderInit, deleteUserSetting, setUserSetting, getUserSetting */ +/* global resize_width, resize_height, shortform */ var topWin = window.dialogArguments || opener || parent || top, uploader, uploader_init; -function fileDialogStart() { - jQuery("#media-upload-error").empty(); -} - // progress and success handlers for media multi uploads function fileQueued(fileObj) { // Get rid of unused form @@ -49,9 +47,8 @@ function fileUploading(up, file) { if ( max > hundredmb && file.size > hundredmb ) { setTimeout(function(){ - var done; - - if ( file.status < 3 && file.loaded == 0 ) { // not uploading + + if ( file.status < 3 && file.loaded === 0 ) { // not uploading wpFileError(file, pluploadL10n.big_upload_failed.replace('%1$s', '').replace('%2$s', '')); up.stop(); // stops the whole queue up.removeFile(file); @@ -106,7 +103,7 @@ function uploadSuccess(fileObj, serverData) { function setResize(arg) { if ( arg ) { if ( uploader.features.jpgresize ) - uploader.settings['resize'] = { width: resize_width, height: resize_height, quality: 100 }; + uploader.settings.resize = { width: resize_width, height: resize_height, quality: 100 }; else uploader.settings.multipart_params.image_resize = true; } else { @@ -129,7 +126,7 @@ function prepareMediaItem(fileObj, serverData) { item.append(serverData); prepareMediaItemInit(fileObj); } else { // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server - item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()}); + item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm();}); } } @@ -171,9 +168,10 @@ function prepareMediaItemInit(fileObj) { action: 'untrash-post', _ajax_nonce: this.href.replace(/^.*wpnonce=/,'') }, - success: function(data, textStatus){ - var item = jQuery('#media-item-' + fileObj.id); - + success: function( ){ + var type, + item = jQuery('#media-item-' + fileObj.id); + if ( type = jQuery('#type-of-' + fileObj.id).val() ) jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-0+1); @@ -210,21 +208,23 @@ function itemAjaxError(id, message) { if ( last_err == id ) // prevent firing an error for the same file twice return; - item.html('