2009-01-02 16:08:58 +01:00
|
|
|
jQuery(document).ready(function($) {
|
2009-07-01 10:12:39 +02:00
|
|
|
var options = false, addAfter, 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;
|
|
|
|
|
2009-11-20 02:54:12 +01:00
|
|
|
name = $("<span>" + $('name', r).text() + "</span>").text();
|
2009-01-02 16:08:58 +01:00
|
|
|
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 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-07-01 10:12:39 +02:00
|
|
|
$('#the-list').wpList({ delBefore: delBefore });
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-12-02 00:51:04 +01:00
|
|
|
$('.delete a[class^="delete"]').live('click', function(){return false;});
|
2009-01-02 16:08:58 +01:00
|
|
|
});
|