Changeset 26205
- Timestamp:
- 11/15/2013 05:55:24 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/plupload/handlers.js
r24472 r26205 1 /* global plupload, pluploadL10n, ajaxurl, post_id, wpUploaderInit, deleteUserSetting, setUserSetting, getUserSetting */ 2 /* global resize_width, resize_height, shortform */ 1 3 var topWin = window.dialogArguments || opener || parent || top, uploader, uploader_init; 2 3 function fileDialogStart() {4 jQuery("#media-upload-error").empty();5 }6 4 7 5 // progress and success handlers for media multi uploads … … 50 48 if ( max > hundredmb && file.size > hundredmb ) { 51 49 setTimeout(function(){ 52 var done; 53 54 if ( file.status < 3 && file.loaded == 0 ) { // not uploading 50 51 if ( file.status < 3 && file.loaded === 0 ) { // not uploading 55 52 wpFileError(file, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>')); 56 53 up.stop(); // stops the whole queue … … 107 104 if ( arg ) { 108 105 if ( uploader.features.jpgresize ) 109 uploader.settings ['resize']= { width: resize_width, height: resize_height, quality: 100 };106 uploader.settings.resize = { width: resize_width, height: resize_height, quality: 100 }; 110 107 else 111 108 uploader.settings.multipart_params.image_resize = true; … … 130 127 prepareMediaItemInit(fileObj); 131 128 } 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() });129 item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm();}); 133 130 } 134 131 } … … 172 169 _ajax_nonce: this.href.replace(/^.*wpnonce=/,'') 173 170 }, 174 success: function(data, textStatus){ 175 var item = jQuery('#media-item-' + fileObj.id); 176 171 success: function( ){ 172 var type, 173 item = jQuery('#media-item-' + fileObj.id); 174 177 175 if ( type = jQuery('#type-of-' + fileObj.id).val() ) 178 176 jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-0+1); … … 211 209 return; 212 210 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 + message 217 + '</div>').data('last-err', id); 218 } 219 220 function deleteSuccess(data, textStatus) { 211 item.html('<div class="error-div">' + 212 '<a class="dismiss" href="#">' + pluploadL10n.dismiss + '</a>' + 213 '<strong>' + pluploadL10n.error_uploading.replace('%s', jQuery.trim(filename)) + '</strong> ' + 214 message + 215 '</div>').data('last-err', id); 216 } 217 218 function deleteSuccess(data) { 219 var type, id, item; 221 220 if ( data == '-1' ) 222 221 return itemAjaxError(this.id, 'You do not have permission. Has your session expired?'); … … 225 224 return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?'); 226 225 227 var id = this.id, item = jQuery('#media-item-' + id); 226 id = this.id; 227 item = jQuery('#media-item-' + id); 228 228 229 229 // Decrement the counters. … … 253 253 } 254 254 255 function deleteError( X, textStatus, errorThrown) {255 function deleteError() { 256 256 // TODO 257 257 } … … 271 271 setUserSetting('uploader', '1'); // 1 == html uploader 272 272 jQuery('.media-upload-form').addClass('html-uploader'); 273 }274 }275 276 function dndHelper(s) {277 var d = document.getElementById('dnd-helper');278 279 if ( s ) {280 d.style.display = 'block';281 } else {282 d.style.display = 'none';283 273 } 284 274 } … … 460 450 }); 461 451 462 uploader.bind('BeforeUpload', function(up, file) { 463 // something 464 }); 452 // uploader.bind('BeforeUpload', function(up, file) {}); 465 453 466 454 uploader.bind('UploadFile', function(up, file) { … … 481 469 }); 482 470 483 uploader.bind('UploadComplete', function( up, files) {471 uploader.bind('UploadComplete', function() { 484 472 uploadComplete(); 485 473 }); 486 } 487 488 if ( typeof(wpUploaderInit) == 'object' ) 474 }; 475 476 if ( typeof(wpUploaderInit) == 'object' ) { 489 477 uploader_init(); 478 } 490 479 491 480 });
Note: See TracChangeset
for help on using the changeset viewer.