2009-01-02 10:08:58 -05:00
|
|
|
jQuery(document).ready(function($) {
|
2009-07-01 04:12:39 -04:00
|
|
|
var options = false, addAfter, delBefore, delAfter;
|
2009-01-02 10:08:58 -05: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);
|
|
|
|
}
|
|
|
|
|
|
|
|
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 10:26:01 -05:00
|
|
|
delBefore = function(s) {
|
|
|
|
if ( 'undefined' != showNotice )
|
|
|
|
return showNotice.warn() ? s : false;
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2009-01-02 10:08:58 -05:00
|
|
|
if ( options )
|
2009-02-07 10:26:01 -05:00
|
|
|
$('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } );
|
2009-01-02 10:08:58 -05:00
|
|
|
else
|
2009-07-01 04:12:39 -04:00
|
|
|
$('#the-list').wpList({ delBefore: delBefore });
|
2009-01-02 10:08:58 -05:00
|
|
|
|
2009-02-07 10:26:01 -05:00
|
|
|
$('.delete a[class^="delete"]').click(function(){return false;});
|
2009-01-02 10:08:58 -05:00
|
|
|
});
|