1 jQuery(document).ready(function($) {
3 $('.delete-tag').live('click', function(e){
4 var t = $(this), tr = t.parents('tr'), r = true, data;
5 if ( 'undefined' != showNotice )
8 data = t.attr('href').replace(/[^?]*\?/, '').replace(/action=delete/, 'action=delete-tag');
9 $.post(ajaxurl, data, function(r){
11 $('#ajax-response').empty();
12 tr.fadeOut('normal', function(){ tr.remove(); });
13 } else if ( '-1' == r ) {
14 $('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.noPerm + '</p></div>');
15 tr.children().css('backgroundColor', '');
17 $('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.broken + '</p></div>');
18 tr.children().css('backgroundColor', '');
21 tr.children().css('backgroundColor', '#f33');
26 $('#submit').click(function(){
27 var form = $(this).parents('form');
29 if ( !validateForm( form ) )
32 $.post(ajaxurl, $('#addtag').serialize(), function(r){
33 if ( r.indexOf('<div class="error"') === 0 ) {
34 $('#ajax-response').append(r);
36 $('#ajax-response').empty();
37 $('#the-list').prepend(r);
38 $('input[type="text"]:visible, textarea:visible', form).val('');