- addAfter = function( r, settings ) {
- var name = $("<span>" + $('name', r).text() + "</span>").html(), id = $('tag', r).attr('id');
- options[options.length] = new Option(name, id);
- }
+ $('.delete-tag').live('click', function(e){
+ var t = $(this), tr = t.parents('tr'), r = true, data;
+ if ( 'undefined' != showNotice )
+ r = showNotice.warn();
+ if ( r ) {
+ data = t.attr('href').replace(/[^?]*\?/, '').replace(/action=delete/, 'action=delete-tag');
+ $.post(ajaxurl, data, function(r){
+ if ( '1' == r ) {
+ $('#ajax-response').empty();
+ tr.fadeOut('normal', function(){ tr.remove(); });
+ // Remove the term from the parent box and tag cloud
+ $('select#parent option[value="' + data.match(/tag_ID=(\d+)/)[1] + '"]').remove();
+ $('a.tag-link-' + data.match(/tag_ID=(\d+)/)[1]).remove();
+ } else if ( '-1' == r ) {
+ $('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.noPerm + '</p></div>');
+ tr.children().css('backgroundColor', '');
+ } else {
+ $('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.broken + '</p></div>');
+ tr.children().css('backgroundColor', '');
+ }
+ });
+ tr.children().css('backgroundColor', '#f33');
+ }
+ return false;
+ });