Make WordPress Core

Changeset 26265


Ignore:
Timestamp:
11/19/2013 04:34:29 AM (11 years ago)
Author:
nacin
Message:

JSHint fixes for inline-edit-tax.js.

props dougwollison.
fixes #26002.

File:
1 edited

Legend:

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

    r26123 r26265  
     1/* global inlineEditL10n, ajaxurl */
    12
     3var inlineEditTax;
    24(function($) {
    35inlineEditTax = {
     
    1517
    1618        // prepare the edit row
    17         row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); });
     19        row.keyup( function( e ) {
     20            if ( e.which === 27 ) {
     21                return inlineEditTax.revert();
     22            }
     23        });
    1824
    19         $('a.cancel', row).click(function() { return inlineEditTax.revert(); });
    20         $('a.save', row).click(function() { return inlineEditTax.save(this); });
    21         $('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); });
     25        $( 'a.cancel', row ).click( function() {
     26            return inlineEditTax.revert();
     27        });
     28        $( 'a.save', row ).click( function() {
     29            return inlineEditTax.save(this);
     30        });
     31        $( 'input, select', row ).keydown( function( e ) {
     32            if ( e.which === 13 ) {
     33                return inlineEditTax.save( this );
     34            }
     35        });
    2236
    23         $('#posts-filter input[type="submit"]').mousedown(function(e){
     37        $( '#posts-filter input[type="submit"]' ).mousedown( function() {
    2438            t.revert();
    2539        });
     
    2842    toggle : function(el) {
    2943        var t = this;
    30         $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
     44        $(t.what+t.getId(el)).css('display') === 'none' ? t.revert() : t.edit(el);
    3145    },
    3246
    3347    edit : function(id) {
    34         var t = this, editRow;
     48        var editRow, rowData,
     49            t = this;
    3550        t.revert();
    3651
    37         if ( typeof(id) == 'object' )
     52        if ( typeof(id) === 'object' ) {
    3853            id = t.getId(id);
     54        }
    3955
    4056        editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id);
    4157        $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);
    4258
    43         if ( $(t.what+id).hasClass('alternate') )
     59        if ( $( t.what + id ).hasClass( 'alternate' ) ) {
    4460            $(editRow).addClass('alternate');
     61        }
    4562
    4663        $(t.what+id).hide().after(editRow);
     
    5875        var params, fields, tax = $('input[name="taxonomy"]').val() || '';
    5976
    60         if( typeof(id) == 'object' )
     77        if( typeof(id) === 'object' ) {
    6178            id = this.getId(id);
     79        }
    6280
    6381        $('table.widefat .spinner').show();
     
    8098
    8199                if (r) {
    82                     if ( -1 != r.indexOf('<tr') ) {
     100                    if ( -1 !== r.indexOf( '<tr' ) ) {
    83101                        $(inlineEditTax.what+id).remove();
    84102                        new_id = $(r).attr('id');
     
    87105                        row = new_id ? $('#'+new_id) : $(inlineEditTax.what+id);
    88106                        row.hide().fadeIn();
    89                     } else
     107                    } else {
    90108                        $('#edit-'+id+' .inline-edit-save .error').html(r).show();
    91                 } else
     109                    }
     110                } else {
    92111                    $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show();
     112                }
    93113
    94                 if ($(row).prev('tr').hasClass('alternate'))
     114                if ( $( row ).prev( 'tr' ).hasClass( 'alternate' ) ) {
    95115                    $(row).removeClass('alternate');
     116                }
    96117            }
    97118        );
     
    113134
    114135    getId : function(o) {
    115         var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id'), parts = id.split('-');
     136        var id = o.tagName === 'TR' ? o.id : $(o).parents('tr').attr('id'), parts = id.split('-');
    116137        return parts[parts.length - 1];
    117138    }
Note: See TracChangeset for help on using the changeset viewer.