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;
|
|
|
|
|
2009-11-19 20:54:12 -05:00
|
|
|
name = $("<span>" + $('name', r).text() + "</span>").text();
|
2009-01-02 10:08:58 -05: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 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-12-01 18:51:04 -05:00
|
|
|
$('.delete a[class^="delete"]').live('click', function(){return false;});
|
2009-01-02 10:08:58 -05:00
|
|
|
});
|