if ( max > hundredmb && file.size > hundredmb ) {
setTimeout(function(){
- if ( file.status == 2 && file.loaded == 0 ) { // not uploading
- wpFileError(file, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>'));
+ var done;
- if ( up.current && up.current.file.id == file.id && up.current.xhr.abort )
- up.current.xhr.abort();
+ 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);
+ up.start(); // restart the queue
}
}, 10000); // wait for 10 sec. for the file to start uploading
}
serverData = serverData.replace(/^<pre>(\d+)<\/pre>$/, '$1');
// if async-upload returned an error message, place it in the media item div and return
- if ( serverData.match('media-upload-error') ) {
+ if ( serverData.match(/media-upload-error|error-div/) ) {
item.html(serverData);
return;
} else {
jQuery('a.delete', item).click(function(){
// Tell the server to delete it. TODO: handle exceptions
jQuery.ajax({
- url: 'admin-ajax.php',
+ url: ajaxurl,
type: 'post',
success: deleteSuccess,
error: deleteError,
jQuery('a.undo', item).click(function(){
// Tell the server to untrash it. TODO: handle exceptions
jQuery.ajax({
- url: 'admin-ajax.php',
+ url: ajaxurl,
type: 'post',
id: fileObj.id,
data: {
if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment
tr = target.closest('tr');
- if ( $(tr).hasClass('align') )
+ if ( tr.hasClass('align') )
setUserSetting('align', target.val());
- else if ( $(tr).hasClass('image-size') )
+ else if ( tr.hasClass('image-size') )
setUserSetting('imgsize', target.val());
} else if ( target.is('button.button') ) { // remember the last used image link url
if ( c && c[1] ) {
setUserSetting('urlbutton', c[1]);
- target.siblings('.urlfield').val( target.attr('title') );
+ target.siblings('.urlfield').val( target.data('link-url') );
}
} else if ( target.is('a.dismiss') ) {
target.parents('.media-item').fadeOut(200, function(){
} else if ( target.is('.upload-flash-bypass a') || target.is('a.uploader-html') ) { // switch uploader to html4
$('#media-items, p.submit, span.big-file-warning').css('display', 'none');
switchUploader(0);
- return false;
+ e.preventDefault();
} else if ( target.is('.upload-html-bypass a') ) { // switch uploader to multi-file
$('#media-items, p.submit, span.big-file-warning').css('display', '');
switchUploader(1);
- return false;
+ e.preventDefault();
} else if ( target.is('a.describe-toggle-on') ) { // Show
target.parent().addClass('open');
target.siblings('.slidetoggle').fadeIn(250, function(){
}
}
});
- return false;
+ e.preventDefault();
} else if ( target.is('a.describe-toggle-off') ) { // Hide
target.siblings('.slidetoggle').fadeOut(250, function(){
target.parent().removeClass('open');
});
- return false;
+ e.preventDefault();
}
});
setResize( getUserSetting('upload_resize', false) );
- if ( up.features.dragdrop ) {
+ if ( up.features.dragdrop && ! $(document.body).hasClass('mobile') ) {
uploaddiv.addClass('drag-drop');
$('#drag-drop-area').bind('dragover.wp-uploader', function(){ // dragenter doesn't fire right :(
uploaddiv.addClass('drag-over');