2009-01-02 16:08:58 +01:00
|
|
|
jQuery(document).ready(function($) {
|
2009-02-07 16:26:01 +01:00
|
|
|
var options = false, addAfter, addAfter2, delBefore, delAfter;
|
2009-01-02 16:08:58 +01:00
|
|
|
if ( document.forms['addcat'].category_parent )
|
|
|
|
options = document.forms['addcat'].category_parent.options;
|
|
|
|
|
|
|
|
addAfter = function( r, settings ) {
|
|
|
|
var name, id;
|
|
|
|
|
|
|
|
name = $("<span>" + $('name', r).text() + "</span>").html();
|
|
|
|
id = $('cat', r).attr('id');
|
|
|
|
options[options.length] = new Option(name, id);
|
|
|
|
|
|
|
|
addAfter2( r, settings );
|
|
|
|
}
|
|
|
|
|
|
|
|
addAfter2 = function( x, r ) {
|
|
|
|
var t = $(r.parsed.responses[0].data);
|
|
|
|
if ( t.length == 1 )
|
|
|
|
inlineEditTax.addEvents($(t.id));
|
|
|
|
}
|
|
|
|
|
|
|
|
delAfter = function( r, settings ) {
|
|
|
|
var id = $('cat', r).attr('id'), o;
|
|
|
|
for ( o = 0; o < options.length; o++ )
|
|
|
|
if ( id == options[o].value )
|
|
|
|
options[o] = null;
|
|
|
|
}
|
|
|
|
|
2009-02-07 16:26:01 +01:00
|
|
|
delBefore = function(s) {
|
|
|
|
if ( 'undefined' != showNotice )
|
|
|
|
return showNotice.warn() ? s : false;
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2009-01-02 16:08:58 +01:00
|
|
|
if ( options )
|
2009-02-07 16:26:01 +01:00
|
|
|
$('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } );
|
2009-01-02 16:08:58 +01:00
|
|
|
else
|
2009-02-07 16:26:01 +01:00
|
|
|
$('#the-list').wpList({ addAfter: addAfter2, delBefore: delBefore });
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-02-07 16:26:01 +01:00
|
|
|
$('.delete a[class^="delete"]').click(function(){return false;});
|
2009-01-02 16:08:58 +01:00
|
|
|
});
|