jQuery(document).ready(function(a){var b=!1;a("#the-list").on("click",".delete-tag",function(){var b,c=a(this),d=c.parents("tr"),e=!0;return"undefined"!=showNotice&&(e=showNotice.warn()),e&&(b=c.attr("href").replace(/[^?]*\?/,"").replace(/action=delete/,"action=delete-tag"),a.post(ajaxurl,b,function(c){"1"==c?(a("#ajax-response").empty(),d.fadeOut("normal",function(){d.remove()}),a('select#parent option[value="'+b.match(/tag_ID=(\d+)/)[1]+'"]').remove(),a("a.tag-link-"+b.match(/tag_ID=(\d+)/)[1]).remove()):"-1"==c?(a("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.noPerm+"</p></div>"),d.children().css("backgroundColor","")):(a("#ajax-response").empty().append('<div class="error"><p>'+tagsl10n.broken+"</p></div>"),d.children().css("backgroundColor",""))}),d.children().css("backgroundColor","#f33")),!1}),a("#edittag").on("click",".delete",function(a){if("undefined"==typeof showNotice)return!0;var b=showNotice.warn();b||a.preventDefault()}),a("#submit").click(function(){var c=a(this).parents("form");return!!validateForm(c)&&(!b&&(b=!0,c.find(".submit .spinner").addClass("is-active"),a.post(ajaxurl,a("#addtag").serialize(),function(d){var e,f,g,h,i;if(b=!1,c.find(".submit .spinner").removeClass("is-active"),a("#ajax-response").empty(),e=wpAjax.parseAjaxResponse(d,"ajax-response"),e&&!e.errors){if(f=c.find("select#parent").val(),f>0&&a("#tag-"+f).length>0?a(".tags #tag-"+f).after(e.responses[0].supplemental.noparents):a(".tags").prepend(e.responses[0].supplemental.parents),a(".tags .no-items").remove(),c.find("select#parent")){for(g=e.responses[1].supplemental,h="",i=0;i<e.responses[1].position;i++)h+="&nbsp;&nbsp;&nbsp;";c.find("select#parent option:selected").after('<option value="'+g.term_id+'">'+h+g.name+"</option>")}a('input[type="text"]:visible, textarea:visible',c).val("")}}),!1))})});