Fix JSHint errors in plupload handlers.js.
props mdbitz. fixes #26041. Built from https://develop.svn.wordpress.org/trunk@26205 git-svn-id: http://core.svn.wordpress.org/trunk@26113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
42dab0d17f
commit
eb1151b590
|
@ -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', '<a class="uploader-html" href="#">').replace('%2$s', '</a>'));
|
||||
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('<div class="error-div">'
|
||||
+ '<a class="dismiss" href="#">' + pluploadL10n.dismiss + '</a>'
|
||||
+ '<strong>' + pluploadL10n.error_uploading.replace('%s', jQuery.trim(filename)) + '</strong> '
|
||||
+ message
|
||||
+ '</div>').data('last-err', id);
|
||||
item.html('<div class="error-div">' +
|
||||
'<a class="dismiss" href="#">' + pluploadL10n.dismiss + '</a>' +
|
||||
'<strong>' + pluploadL10n.error_uploading.replace('%s', jQuery.trim(filename)) + '</strong> ' +
|
||||
message +
|
||||
'</div>').data('last-err', id);
|
||||
}
|
||||
|
||||
function deleteSuccess(data, textStatus) {
|
||||
function deleteSuccess(data) {
|
||||
var type, id, item;
|
||||
if ( data == '-1' )
|
||||
return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
|
||||
|
||||
if ( data == '0' )
|
||||
return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
|
||||
|
||||
var id = this.id, item = jQuery('#media-item-' + id);
|
||||
id = this.id;
|
||||
item = jQuery('#media-item-' + id);
|
||||
|
||||
// Decrement the counters.
|
||||
if ( type = jQuery('#type-of-' + id).val() )
|
||||
|
@ -252,7 +252,7 @@ function deleteSuccess(data, textStatus) {
|
|||
return;
|
||||
}
|
||||
|
||||
function deleteError(X, textStatus, errorThrown) {
|
||||
function deleteError() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
@ -273,16 +273,6 @@ function switchUploader(s) {
|
|||
}
|
||||
}
|
||||
|
||||
function dndHelper(s) {
|
||||
var d = document.getElementById('dnd-helper');
|
||||
|
||||
if ( s ) {
|
||||
d.style.display = 'block';
|
||||
} else {
|
||||
d.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function uploadError(fileObj, errorCode, message, uploader) {
|
||||
var hundredmb = 100 * 1024 * 1024, max;
|
||||
|
||||
|
@ -459,9 +449,7 @@ jQuery(document).ready(function($){
|
|||
up.start();
|
||||
});
|
||||
|
||||
uploader.bind('BeforeUpload', function(up, file) {
|
||||
// something
|
||||
});
|
||||
// uploader.bind('BeforeUpload', function(up, file) {});
|
||||
|
||||
uploader.bind('UploadFile', function(up, file) {
|
||||
fileUploading(up, file);
|
||||
|
@ -480,12 +468,13 @@ jQuery(document).ready(function($){
|
|||
uploadSuccess(file, response.response);
|
||||
});
|
||||
|
||||
uploader.bind('UploadComplete', function(up, files) {
|
||||
uploader.bind('UploadComplete', function() {
|
||||
uploadComplete();
|
||||
});
|
||||
};
|
||||
|
||||
if ( typeof(wpUploaderInit) == 'object' ) {
|
||||
uploader_init();
|
||||
}
|
||||
|
||||
if ( typeof(wpUploaderInit) == 'object' )
|
||||
uploader_init();
|
||||
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue