WordPress.org

Make WordPress Core

Changeset 26202


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

Fix JSHint errors in autosave.js.

props seanchayes.
fixes #26035.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/autosave.js

    r25874 r26202  
    1 var autosave, autosaveLast = '', autosavePeriodical, autosaveDelayPreview = false, notSaved = true, blockSave = false, fullscreen, autosaveLockRelease = true;
     1/* global switchEditors, autosaveL10n, tinymce, ajaxurl, wpAjax, makeSlugeditClickable, wpCookies */
     2var autosave, autosavePeriodical, fullscreen, doPreview,
     3    autosaveLast = '',
     4    autosaveDelayPreview = false,
     5    notSaved = true,
     6    blockSave = false,
     7    autosaveLockRelease = true;
    28
    39jQuery(document).ready( function($) {
     
    1622
    1723    //Disable autosave after the form has been submitted
    18     $("#post").submit(function() {
     24    $('#post').submit(function() {
    1925        $.cancel(autosavePeriodical);
    2026        autosaveLockRelease = false;
     
    107113
    108114        $('input#wp-preview').val('');
    109     }
     115    };
    110116
    111117    // This code is meant to allow tabbing from Title to Post content.
     
    121127
    122128            if ( ed && !ed.isHidden() ) {
    123                 $(this).one('keyup', function(e){
     129                $(this).one('keyup', function(){
    124130                    $('#content_tbl td.mceToolbar > a').focus();
    125131                });
     
    283289
    284290    // No autosave while thickbox is open (media buttons)
    285     if ( jQuery("#TB_window").css('display') == 'block' )
     291    if ( jQuery('#TB_window').css('display') == 'block' )
    286292        return false;
    287293
     
    293299
    294300    autosaveLast = compareString;
    295     jQuery(document).triggerHandler('wpcountwords', [ post_data["content"] ]);
     301    jQuery(document).triggerHandler('wpcountwords', [ post_data.content ]);
    296302
    297303    // Disable buttons until we know the save completed.
    298304    autosave_disable_buttons();
    299305
    300     if ( post_data["auto_draft"] == '1' ) {
     306    if ( post_data.auto_draft == '1' ) {
    301307        successCallback = autosave_saved_new; // new post
    302308    } else {
     
    307313        data: post_data,
    308314        beforeSend: autosave_loading,
    309         type: "POST",
     315        type: 'POST',
    310316        url: ajaxurl,
    311317        success: successCallback
     
    313319
    314320    return true;
    315 }
     321};
    316322
    317323// Autosave in localStorage
     
    348354
    349355    if ( typeof fullscreen != 'undefined' && fullscreen.settings.visible ) {
    350         data['post_title'] = $('#wp-fullscreen-title').val() || '';
    351         data['content'] = $('#wp_mce_fullscreen').val() || '';
     356        data.post_title = $('#wp-fullscreen-title').val() || '';
     357        data.content = $('#wp_mce_fullscreen').val() || '';
    352358    } else {
    353         data['post_title'] = $('#title').val() || '';
    354         data['content'] = $('#content').val() || '';
     359        data.post_title = $('#title').val() || '';
     360        data.content = $('#content').val() || '';
    355361    }
    356362
     
    365371        cats.push(this.value);
    366372    });
    367     data['catslist'] = cats.join(',');
     373    data.catslist = cats.join(',');
    368374
    369375    if ( post_name = $('#post_name').val() )
    370         data['post_name'] = post_name;
     376        data.post_name = post_name;
    371377
    372378    if ( parent_id = $('#parent_id').val() )
    373         data['parent_id'] = parent_id;
     379        data.parent_id = parent_id;
    374380
    375381    if ( $('#comment_status').prop('checked') )
    376         data['comment_status'] = 'open';
     382        data.comment_status = 'open';
    377383
    378384    if ( $('#ping_status').prop('checked') )
    379         data['ping_status'] = 'open';
     385        data.ping_status = 'open';
    380386
    381387    if ( $('#auto_draft').val() == '1' )
    382         data['auto_draft'] = '1';
     388        data.auto_draft = '1';
    383389
    384390    return data;
     
    521527            return false;
    522528
    523         post_data['save_time'] = (new Date()).getTime();
    524         post_data['status'] = $('#post_status').val() || '';
     529        post_data.save_time = (new Date()).getTime();
     530        post_data.status = $('#post_status').val() || '';
    525531        result = this.setData( post_data );
    526532
Note: See TracChangeset for help on using the changeset viewer.