Changeset 26265
- Timestamp:
- 11/19/2013 04:34:29 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/inline-edit-tax.js
r26123 r26265 1 /* global inlineEditL10n, ajaxurl */ 1 2 3 var inlineEditTax; 2 4 (function($) { 3 5 inlineEditTax = { … … 15 17 16 18 // 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 }); 18 24 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 }); 22 36 23 $( '#posts-filter input[type="submit"]').mousedown(function(e){37 $( '#posts-filter input[type="submit"]' ).mousedown( function() { 24 38 t.revert(); 25 39 }); … … 28 42 toggle : function(el) { 29 43 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); 31 45 }, 32 46 33 47 edit : function(id) { 34 var t = this, editRow; 48 var editRow, rowData, 49 t = this; 35 50 t.revert(); 36 51 37 if ( typeof(id) == 'object' )52 if ( typeof(id) === 'object' ) { 38 53 id = t.getId(id); 54 } 39 55 40 56 editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id); 41 57 $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length); 42 58 43 if ( $( t.what+id).hasClass('alternate') )59 if ( $( t.what + id ).hasClass( 'alternate' ) ) { 44 60 $(editRow).addClass('alternate'); 61 } 45 62 46 63 $(t.what+id).hide().after(editRow); … … 58 75 var params, fields, tax = $('input[name="taxonomy"]').val() || ''; 59 76 60 if( typeof(id) == 'object' )77 if( typeof(id) === 'object' ) { 61 78 id = this.getId(id); 79 } 62 80 63 81 $('table.widefat .spinner').show(); … … 80 98 81 99 if (r) { 82 if ( -1 != r.indexOf('<tr') ) {100 if ( -1 !== r.indexOf( '<tr' ) ) { 83 101 $(inlineEditTax.what+id).remove(); 84 102 new_id = $(r).attr('id'); … … 87 105 row = new_id ? $('#'+new_id) : $(inlineEditTax.what+id); 88 106 row.hide().fadeIn(); 89 } else 107 } else { 90 108 $('#edit-'+id+' .inline-edit-save .error').html(r).show(); 91 } else 109 } 110 } else { 92 111 $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show(); 112 } 93 113 94 if ( $(row).prev('tr').hasClass('alternate'))114 if ( $( row ).prev( 'tr' ).hasClass( 'alternate' ) ) { 95 115 $(row).removeClass('alternate'); 116 } 96 117 } 97 118 ); … … 113 134 114 135 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('-'); 116 137 return parts[parts.length - 1]; 117 138 }
Note: See TracChangeset
for help on using the changeset viewer.