Make WordPress Core

Ticket #26002: 26002.3.diff

File 26002.3.diff, 3.3 KB (added by dougwollison, 13 years ago)

Just the jshint fixes.

  • inline-edit-tax.js

     
     1/* global inlineEditL10n, ajaxurl */
    12
    23(function($) {
    3 inlineEditTax = {
     4var inlineEditTax = {
    45
    56        init : function() {
    67                var t = this, row = $('#inline-edit');
     
    1415                });
    1516
    1617                // prepare the edit row
    17                 row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); });
     18                row.keyup(function(e) {
     19                        if(e.which === 27) {
     20                                return inlineEditTax.revert();
     21                        }
     22                });
    1823
    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); });
     24                $('a.cancel', row).click(function() {
     25                        return inlineEditTax.revert();
     26                });
     27                $('a.save', row).click(function() {
     28                        return inlineEditTax.save(this);
     29                });
     30                $('input, select', row).keydown(function(e) {
     31                        if(e.which === 13) {
     32                                return inlineEditTax.save(this);
     33                        }
     34                });
    2235
    23                 $('#posts-filter input[type="submit"]').mousedown(function(e){
     36                $('#posts-filter input[type="submit"]').mousedown(function(){
    2437                        t.revert();
    2538                });
    2639        },
    2740
    2841        toggle : function(el) {
    2942                var t = this;
    30                 $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
     43                $(t.what+t.getId(el)).css('display') === 'none' ? t.revert() : t.edit(el);
    3144        },
    3245
    3346        edit : function(id) {
    34                 var t = this, editRow;
     47                var t = this, editRow, rowData;
    3548                t.revert();
    3649
    37                 if ( typeof(id) == 'object' )
     50                if ( typeof(id) === 'object' ) {
    3851                        id = t.getId(id);
     52                }
    3953
    4054                editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id);
    4155                $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);
    4256
    43                 if ( $(t.what+id).hasClass('alternate') )
     57                if ( $(t.what+id).hasClass('alternate') ) {
    4458                        $(editRow).addClass('alternate');
     59                }
    4560
    4661                $(t.what+id).hide().after(editRow);
    4762
     
    5772        save : function(id) {
    5873                var params, fields, tax = $('input[name="taxonomy"]').val() || '';
    5974
    60                 if( typeof(id) == 'object' )
     75                if( typeof(id) === 'object' ) {
    6176                        id = this.getId(id);
     77                }
    6278
    6379                $('table.widefat .spinner').show();
    6480
     
    7995                                $('table.widefat .spinner').hide();
    8096
    8197                                if (r) {
    82                                         if ( -1 != r.indexOf('<tr') ) {
     98                                        if ( -1 !== r.indexOf('<tr') ) {
    8399                                                $(inlineEditTax.what+id).remove();
    84100                                                new_id = $(r).attr('id');
    85101
    86102                                                $('#edit-'+id).before(r).remove();
    87103                                                row = new_id ? $('#'+new_id) : $(inlineEditTax.what+id);
    88104                                                row.hide().fadeIn();
    89                                         } else
     105                                        } else {
    90106                                                $('#edit-'+id+' .inline-edit-save .error').html(r).show();
    91                                 } else
     107                                        }
     108                                } else {
    92109                                        $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show();
     110                                }
    93111
    94                                 if ($(row).prev('tr').hasClass('alternate'))
     112                                if ($(row).prev('tr').hasClass('alternate')) {
    95113                                        $(row).removeClass('alternate');
     114                                }
    96115                        }
    97116                );
    98117                return false;
     
    112131        },
    113132
    114133        getId : function(o) {
    115                 var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id'), parts = id.split('-');
     134                var id = o.tagName === 'TR' ? o.id : $(o).parents('tr').attr('id'), parts = id.split('-');
    116135                return parts[parts.length - 1];
    117136        }
    118137};