Ticket #26041: 26041.patch
| File 26041.patch, 3.5 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/js/plupload/handlers.js
1 /* global plupload:false, pluploadL10n:false, post_id:false, resize_width:false, 2 resize_height:false, shortform:false, ajaxurl:false, wpUploaderInit:false, 3 deleteUserSetting:false, setUserSetting:false, getUserSetting:false 4 */ 1 5 var topWin = window.dialogArguments || opener || parent || top, uploader, uploader_init; 2 6 3 7 function fileDialogStart() { 4 jQuery( "#media-upload-error").empty();8 jQuery('#media-upload-error').empty(); 5 9 } 6 10 7 11 // progress and success handlers for media multi uploads … … 49 53 50 54 if ( max > hundredmb && file.size > hundredmb ) { 51 55 setTimeout(function(){ 52 var done; 53 54 if ( file.status < 3 && file.loaded == 0 ) { // not uploading 56 57 if ( file.status < 3 && file.loaded === 0 ) { // not uploading 55 58 wpFileError(file, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>')); 56 59 up.stop(); // stops the whole queue 57 60 up.removeFile(file); … … 106 109 function setResize(arg) { 107 110 if ( arg ) { 108 111 if ( uploader.features.jpgresize ) 109 uploader.settings ['resize']= { width: resize_width, height: resize_height, quality: 100 };112 uploader.settings.resize = { width: resize_width, height: resize_height, quality: 100 }; 110 113 else 111 114 uploader.settings.multipart_params.image_resize = true; 112 115 } else { … … 129 132 item.append(serverData); 130 133 prepareMediaItemInit(fileObj); 131 134 } else { // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server 132 item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm() });135 item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm();}); 133 136 } 134 137 } 135 138 … … 171 174 action: 'untrash-post', 172 175 _ajax_nonce: this.href.replace(/^.*wpnonce=/,'') 173 176 }, 174 success: function( data, textStatus){177 success: function( ){ 175 178 var item = jQuery('#media-item-' + fileObj.id); 176 179 177 180 if ( type = jQuery('#type-of-' + fileObj.id).val() ) 178 181 jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-0+1); 179 182 … … 210 213 if ( last_err == id ) // prevent firing an error for the same file twice 211 214 return; 212 215 213 item.html('<div class="error-div">' 214 + '<a class="dismiss" href="#">' + pluploadL10n.dismiss + '</a>'215 + '<strong>' + pluploadL10n.error_uploading.replace('%s', jQuery.trim(filename)) + '</strong> '216 + message217 +'</div>').data('last-err', id);216 item.html('<div class="error-div">' + 217 '<a class="dismiss" href="#">' + pluploadL10n.dismiss + '</a>' + 218 '<strong>' + pluploadL10n.error_uploading.replace('%s', jQuery.trim(filename)) + '</strong> ' + 219 message + 220 '</div>').data('last-err', id); 218 221 } 219 222 220 function deleteSuccess(data , textStatus) {223 function deleteSuccess(data) { 221 224 if ( data == '-1' ) 222 225 return itemAjaxError(this.id, 'You do not have permission. Has your session expired?'); 223 226 … … 480 483 uploadSuccess(file, response.response); 481 484 }); 482 485 483 uploader.bind('UploadComplete', function( up, files) {486 uploader.bind('UploadComplete', function() { 484 487 uploadComplete(); 485 488 }); 486 } 489 }; 487 490 488 if ( typeof(wpUploaderInit) == 'object' ) 491 if ( typeof(wpUploaderInit) == 'object' ) { 489 492 uploader_init(); 493 } 490 494 491 495 });