Make WordPress Core

Changeset 26205


Ignore:
Timestamp:
11/15/2013 05:55:24 AM (11 years ago)
Author:
nacin
Message:

Fix JSHint errors in plupload handlers.js.

props mdbitz.
fixes #26041.

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 */
    13var topWin = window.dialogArguments || opener || parent || top, uploader, uploader_init;
    2 
    3 function fileDialogStart() {
    4     jQuery("#media-upload-error").empty();
    5 }
    64
    75// progress and success handlers for media multi uploads
     
    5048    if ( max > hundredmb && file.size > hundredmb ) {
    5149        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
    5552                wpFileError(file, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>'));
    5653                up.stop(); // stops the whole queue
     
    107104    if ( arg ) {
    108105        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 };
    110107        else
    111108            uploader.settings.multipart_params.image_resize = true;
     
    130127        prepareMediaItemInit(fileObj);
    131128    } 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();});
    133130    }
    134131}
     
    172169                _ajax_nonce: this.href.replace(/^.*wpnonce=/,'')
    173170            },
    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               
    177175                if ( type = jQuery('#type-of-' + fileObj.id).val() )
    178176                    jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-0+1);
     
    211209        return;
    212210
    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
     218function deleteSuccess(data) {
     219    var type, id, item;
    221220    if ( data == '-1' )
    222221        return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
     
    225224        return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
    226225
    227     var id = this.id, item = jQuery('#media-item-' + id);
     226    id = this.id;
     227    item = jQuery('#media-item-' + id);
    228228
    229229    // Decrement the counters.
     
    253253}
    254254
    255 function deleteError(X, textStatus, errorThrown) {
     255function deleteError() {
    256256    // TODO
    257257}
     
    271271        setUserSetting('uploader', '1'); // 1 == html uploader
    272272        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';
    283273    }
    284274}
     
    460450        });
    461451
    462         uploader.bind('BeforeUpload', function(up, file) {
    463             // something
    464         });
     452        // uploader.bind('BeforeUpload', function(up, file) {});
    465453
    466454        uploader.bind('UploadFile', function(up, file) {
     
    481469        });
    482470
    483         uploader.bind('UploadComplete', function(up, files) {
     471        uploader.bind('UploadComplete', function() {
    484472            uploadComplete();
    485473        });
    486     }
    487 
    488     if ( typeof(wpUploaderInit) == 'object' )
     474    };
     475
     476    if ( typeof(wpUploaderInit) == 'object' ) {
    489477        uploader_init();
     478    }
    490479
    491480});
Note: See TracChangeset for help on using the changeset viewer.