Remove unused category parent settings from inline-edit-tax.js

git-svn-id: http://svn.automattic.com/wordpress/trunk@10342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-01-10 14:09:06 +00:00
parent 1c20ec7120
commit 05ed1d870d
3 changed files with 7 additions and 29 deletions

View File

@ -39,7 +39,7 @@ inlineEditTax = {
},
edit : function(id) {
var t = this, editRow, cat_parent, pageOpt;
var t = this, editRow;
t.revert();
if ( typeof(id) == 'object' )
@ -56,29 +56,6 @@ inlineEditTax = {
$(':input[name="name"]', editRow).val( $('.name', rowData).text() );
$(':input[name="slug"]', editRow).val( $('.slug', rowData).text() );
// cat parents
cat_parent = $('.cat_parent', rowData).text();
if ( cat_parent != '0' )
$('select[name="parent"]', editRow).val(cat_parent);
// remove the current parent and children from the parent dropdown
pageOpt = $('select[name="parent"] option[value="'+id+'"]', editRow);
if ( pageOpt.length > 0 ) {
var pageLevel = pageOpt[0].className.split('-')[1], nextPage, pageLoop = true, nextLevel;
while ( pageLoop ) {
nextPage = nextPage.next('option');
if (nextPage.length == 0) break;
nextLevel = nextPage[0].className.split('-')[1];
if ( nextLevel <= pageLevel ) {
pageLoop = false;
} else {
nextPage.remove();
nextPage = pageOpt;
}
}
pageOpt.remove();
}
$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
$('.ptitle', editRow).eq(0).focus();
@ -105,15 +82,16 @@ inlineEditTax = {
// make ajax request
$.post('admin-ajax.php', params,
function(r) {
var row, new_id;
$('table.widefat .inline-edit-save .waiting').hide();
if (r) {
if ( -1 != r.indexOf('<tr') ) {
$(inlineEditTax.what+id).remove();
$('#edit-'+id).before(r).remove();
new_id = $(r).attr('id');
var row = $(inlineEditTax.what+id);
$('#edit-'+id).before(r).remove();
row = new_id ? $('#'+new_id) : $(inlineEditTax.what+id);
row.hide();
inlineEditTax.addEvents(row);

View File

@ -1 +1 @@
(function(a){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("className").substr(5);b.what="#"+b.type+"-";b.rows=a("tr.iedit");c.keyup(function(d){if(d.which==27){return inlineEditTax.revert()}});a("a.cancel",c).click(function(){return inlineEditTax.revert()});a("a.save",c).click(function(){return inlineEditTax.save(this)});a("input, select",c).keydown(function(d){if(d.which==13){return inlineEditTax.save(this)}});b.addEvents(b.rows);a('#posts-filter input[type="submit"]').click(function(d){if(a("form#posts-filter tr.inline-editor").length>0){b.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},addEvents:function(b){b.each(function(){a(this).find("a.editinline").click(function(){inlineEditTax.edit(this);return false})})},edit:function(b){var i=this,d,e,f;i.revert();if(typeof(b)=="object"){b=i.getId(b)}d=a("#inline-edit").clone(true),rowData=a("#inline_"+b);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(i.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(i.what+b).hide().after(d);a(':input[name="name"]',d).val(a(".name",rowData).text());a(':input[name="slug"]',d).val(a(".slug",rowData).text());e=a(".cat_parent",rowData).text();if(e!="0"){a('select[name="parent"]',d).val(e)}f=a('select[name="parent"] option[value="'+b+'"]',d);if(f.length>0){var h=f[0].className.split("-")[1],g,c=true,j;while(c){g=g.next("option");if(g.length==0){break}j=g[0].className.split("-")[1];if(j<=h){c=false}else{g.remove();g=f}}f.remove()}a(d).attr("id","edit-"+b).addClass("inline-editor").show();a(".ptitle",d).eq(0).focus();return false},save:function(d){var c,b;if(typeof(d)=="object"){d=this.getId(d)}a("table.widefat .inline-edit-save .waiting").show();c={action:"inline-save-tax",tax_type:this.type,tax_ID:d};b=a("#edit-"+d+" :input").fieldSerialize();c=b+"&"+a.param(c);a.post("admin-ajax.php",c,function(e){a("table.widefat .inline-edit-save .waiting").hide();if(e){if(-1!=e.indexOf("<tr")){a(inlineEditTax.what+d).remove();a("#edit-"+d).before(e).remove();var f=a(inlineEditTax.what+d);f.hide();inlineEditTax.addEvents(f);f.fadeIn()}else{a("#edit-"+d+" .inline-edit-save .error").html(e).show()}}else{a("#edit-"+d+" .inline-edit-save .error").html(inlineEditL10n.error).show()}});return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditTax.init()})})(jQuery);
(function(a){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("className").substr(5);b.what="#"+b.type+"-";b.rows=a("tr.iedit");c.keyup(function(d){if(d.which==27){return inlineEditTax.revert()}});a("a.cancel",c).click(function(){return inlineEditTax.revert()});a("a.save",c).click(function(){return inlineEditTax.save(this)});a("input, select",c).keydown(function(d){if(d.which==13){return inlineEditTax.save(this)}});b.addEvents(b.rows);a('#posts-filter input[type="submit"]').click(function(d){if(a("form#posts-filter tr.inline-editor").length>0){b.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},addEvents:function(b){b.each(function(){a(this).find("a.editinline").click(function(){inlineEditTax.edit(this);return false})})},edit:function(d){var c=this,b;c.revert();if(typeof(d)=="object"){d=c.getId(d)}b=a("#inline-edit").clone(true),rowData=a("#inline_"+d);a("td",b).attr("colspan",a(".widefat:first thead th:visible").length);if(a(c.what+d).hasClass("alternate")){a(b).addClass("alternate")}a(c.what+d).hide().after(b);a(':input[name="name"]',b).val(a(".name",rowData).text());a(':input[name="slug"]',b).val(a(".slug",rowData).text());a(b).attr("id","edit-"+d).addClass("inline-editor").show();a(".ptitle",b).eq(0).focus();return false},save:function(d){var c,b;if(typeof(d)=="object"){d=this.getId(d)}a("table.widefat .inline-edit-save .waiting").show();c={action:"inline-save-tax",tax_type:this.type,tax_ID:d};b=a("#edit-"+d+" :input").fieldSerialize();c=b+"&"+a.param(c);a.post("admin-ajax.php",c,function(f){var g,e;a("table.widefat .inline-edit-save .waiting").hide();if(f){if(-1!=f.indexOf("<tr")){a(inlineEditTax.what+d).remove();e=a(f).attr("id");a("#edit-"+d).before(f).remove();g=e?a("#"+e):a(inlineEditTax.what+d);g.hide();inlineEditTax.addEvents(g);g.fadeIn()}else{a("#edit-"+d+" .inline-edit-save .error").html(f).show()}}else{a("#edit-"+d+" .inline-edit-save .error").html(inlineEditL10n.error).show()}});return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditTax.init()})})(jQuery);

View File

@ -295,7 +295,7 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
) );
$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'jquery-form' ), '20090102' );
$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'jquery-form' ), '20090109' );
$scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
'error' => __('Error while saving the changes.'),
'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'