init : function() {
var t = this, row = $('#inline-edit');
- t.type = $('#the-list').attr('className').substr(5);
+ t.type = $('#the-list').attr('class').substr(5);
t.what = '#'+t.type+'-';
- // get all editable rows
- t.rows = $('tr.iedit');
+ $('.editinline').live('click', function(){
+ inlineEditTax.edit(this);
+ return false;
+ });
// prepare the edit row
row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); });
$('a.save', row).click(function() { return inlineEditTax.save(this); });
$('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); });
- // add events
- t.addEvents(t.rows);
-
- $('#posts-filter input[type="submit"]').click(function(e){
- if ( $('form#posts-filter tr.inline-editor').length > 0 )
- t.revert();
+ $('#posts-filter input[type="submit"]').mousedown(function(e){
+ t.revert();
});
},
$(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
},
- addEvents : function(r) {
- r.each(function() {
- $(this).find('a.editinline').click(function() { inlineEditTax.edit(this); return false; });
- });
- },
-
edit : function(id) {
var t = this, editRow;
t.revert();
taxonomy: tax
};
- fields = $('#edit-'+id+' :input').fieldSerialize();
+ fields = $('#edit-'+id+' :input').serialize();
params = fields + '&' + $.param(params);
// make ajax request
- $.post('admin-ajax.php', params,
+ $.post( ajaxurl, params,
function(r) {
var row, new_id;
$('table.widefat .inline-edit-save .waiting').hide();
$('#edit-'+id).before(r).remove();
row = new_id ? $('#'+new_id) : $(inlineEditTax.what+id);
- row.hide();
-
- inlineEditTax.addEvents(row);
- row.fadeIn();
+ row.hide().fadeIn();
} else
$('#edit-'+id+' .inline-edit-save .error').html(r).show();
} else