Make WordPress Core

Changeset 26264


Ignore:
Timestamp:
11/19/2013 04:31:42 AM (13 years ago)
Author:
nacin
Message:

JShint fixes for inline-edit-post.js.

props dougwollison.
fixes #26001.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/inline-edit-post.js

    r26169 r26264  
     1/* global inlineEditL10n, ajaxurl, typenow */
     2
     3var inlineEditPost;
    14(function($) {
    25inlineEditPost = {
     
    1013                // prepare the edit rows
    1114                qeRow.keyup(function(e){
    12                         if (e.which == 27)
     15                        if ( e.which === 27 ) {
    1316                                return inlineEditPost.revert();
     17                        }
    1418                });
    1519                bulkRow.keyup(function(e){
    16                         if (e.which == 27)
     20                        if ( e.which === 27 ) {
    1721                                return inlineEditPost.revert();
     22                        }
    1823                });
    1924
     
    2530                });
    2631                $('td', qeRow).keydown(function(e){
    27                         if ( e.which == 13 )
     32                        if ( e.which === 13 ) {
    2833                                return inlineEditPost.save(this);
     34                        }
    2935                });
    3036
     
    5864                $('#doaction, #doaction2').click(function(e){
    5965                        var n = $(this).attr('id').substr(2);
    60                         if ( $('select[name="'+n+'"]').val() == 'edit' ) {
     66                        if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) {
    6167                                e.preventDefault();
    6268                                t.setBulk();
     
    6975        toggle : function(el){
    7076                var t = this;
    71                 $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
     77                $( t.what + t.getId( el ) ).css( 'display' ) === 'none' ? t.revert() : t.edit( el );
    7278        },
    7379
     
    8086                $('#bulk-edit').addClass('inline-editor').show();
    8187
    82                 $('tbody th.check-column input[type="checkbox"]').each(function(i){
     88                $( 'tbody th.check-column input[type="checkbox"]' ).each( function() {
    8389                        if ( $(this).prop('checked') ) {
    8490                                c = false;
     
    8995                });
    9096
    91                 if ( c )
     97                if ( c ) {
    9298                        return this.revert();
     99                }
    93100
    94101                $('#bulk-titles').html(te);
     
    101108
    102109                // enable autocomplete for tags
    103                 if ( 'post' == type ) {
     110                if ( 'post' === type ) {
    104111                        // support multi taxonomies?
    105112                        tax = 'post_tag';
     
    113120                t.revert();
    114121
    115                 if ( typeof(id) == 'object' )
     122                if ( typeof(id) === 'object' ) {
    116123                        id = t.getId(id);
     124                }
    117125
    118126                fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password', 'post_format', 'menu_order'];
    119                 if ( t.type == 'page' )
     127                if ( t.type === 'page' ) {
    120128                        fields.push('post_parent', 'page_template');
     129                }
    121130
    122131                // add the new blank row
     
    124133                $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);
    125134
    126                 if ( $(t.what+id).hasClass('alternate') )
     135                if ( $( t.what + id ).hasClass( 'alternate' ) ) {
    127136                        $(editRow).addClass('alternate');
     137                }
    128138                $(t.what+id).hide().after(editRow);
    129139
     
    134144                        $(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#' + t.type + '-' + id + ' .author').text() + '</option>');
    135145                }
    136                 if ( $(':input[name="post_author"] option', editRow).length == 1 ) {
     146                if ( $( ':input[name="post_author"] option', editRow ).length === 1 ) {
    137147                        $('label.inline-edit-author', editRow).hide();
    138148                }
     
    142152                $('option.unsupported', editRow).each(function() {
    143153                        var $this = $(this);
    144                         if ( $this.val() != cur_format )
     154                        if ( $this.val() !== cur_format ) {
    145155                                $this.remove();
     156                        }
    146157                });
    147158
     
    150161                }
    151162
    152                 if ( $('.comment_status', rowData).text() == 'open' )
    153                         $('input[name="comment_status"]', editRow).prop("checked", true);
    154                 if ( $('.ping_status', rowData).text() == 'open' )
    155                         $('input[name="ping_status"]', editRow).prop("checked", true);
    156                 if ( $('.sticky', rowData).text() == 'sticky' )
    157                         $('input[name="sticky"]', editRow).prop("checked", true);
     163                if ( $( '.comment_status', rowData ).text() === 'open' ) {
     164                        $( 'input[name="comment_status"]', editRow ).prop( 'checked', true );
     165                }
     166                if ( $( '.ping_status', rowData ).text() === 'open' ) {
     167                        $( 'input[name="ping_status"]', editRow ).prop( 'checked', true );
     168                }
     169                if ( $( '.sticky', rowData ).text() === 'sticky' ) {
     170                        $( 'input[name="sticky"]', editRow ).prop( 'checked', true );
     171                }
    158172
    159173                // hierarchical taxonomies
    160174                $('.post_category', rowData).each(function(){
    161                         var term_ids = $(this).text();
     175                        var taxname,
     176                                term_ids = $(this).text();
    162177
    163178                        if ( term_ids ) {
     
    175190
    176191                        if ( terms ) {
    177                                 if ( ',' !== comma )
     192                                if ( ',' !== comma ) {
    178193                                        terms = terms.replace(/,/g, comma);
     194                                }
    179195                                textarea.val(terms);
    180196                        }
     
    185201                // handle the post status
    186202                status = $('._status', rowData).text();
    187                 if ( 'future' != status )
     203                if ( 'future' !== status ) {
    188204                        $('select[name="_status"] option[value="future"]', editRow).remove();
    189 
    190                 if ( 'private' == status ) {
    191                         $('input[name="keep_private"]', editRow).prop("checked", true);
     205                }
     206
     207                if ( 'private' === status ) {
     208                        $('input[name="keep_private"]', editRow).prop('checked', true);
    192209                        $('input.inline-edit-password-input').val('').prop('disabled', true);
    193210                }
     
    200217                        while ( pageLoop ) {
    201218                                nextPage = nextPage.next('option');
    202                                 if (nextPage.length == 0) break;
     219                                if ( nextPage.length === 0 ) {
     220                                        break;
     221                                }
     222
    203223                                nextLevel = nextPage[0].className.split('-')[1];
     224
    204225                                if ( nextLevel <= pageLevel ) {
    205226                                        pageLoop = false;
     
    221242                var params, fields, page = $('.post_status_page').val() || '';
    222243
    223                 if ( typeof(id) == 'object' )
     244                if ( typeof(id) === 'object' ) {
    224245                        id = this.getId(id);
     246                }
    225247
    226248                $('table.widefat .spinner').show();
     
    243265
    244266                                if (r) {
    245                                         if ( -1 != r.indexOf('<tr') ) {
     267                                        if ( -1 !== r.indexOf( '<tr' ) ) {
    246268                                                $(inlineEditPost.what+id).remove();
    247269                                                $('#edit-'+id).before(r).remove();
     
    258280                                        $('#post-'+id).removeClass('alternate');
    259281                                }
    260                         }
    261                 , 'html');
     282                        },
     283                'html');
    262284                return false;
    263285        },
     
    269291                        $('table.widefat .spinner').hide();
    270292
    271                         if ( 'bulk-edit' == id ) {
     293                        if ( 'bulk-edit' === id ) {
    272294                                $('table.widefat #bulk-edit').removeClass('inline-editor').hide();
    273295                                $('#bulk-titles').html('');
     
    320342
    321343        $('#the-list tr').each( function(i, el) {
    322                 if ( el.id )
     344                if ( el.id ) {
    323345                        check.push( el.id );
     346                }
    324347        });
    325348
    326         if ( check.length )
     349        if ( check.length ) {
    327350                data['wp-check-locked-posts'] = check;
     351        }
    328352}).ready( function() {
    329353        // Set the heartbeat interval to 15 sec.
Note: See TracChangeset for help on using the changeset viewer.