WordPress/wp-admin/js/tags.min.js
Dominik Schilling 31d93c553a I18N: Use wp.i18n for translatable strings in wp-admin/js/tags.js.
This removes the usage of `wp_localize_script()` for passing translations to the script and instead adds the translatable strings in the script directly through the use of `wp.i18n` and its utilities.

Props swissspidy, ocean90.
See #20491.
Fixes #50577.
Built from https://develop.svn.wordpress.org/trunk@48347


git-svn-id: http://core.svn.wordpress.org/trunk@48116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-06 19:47:03 +00:00

2 lines
1.8 KiB
JavaScript

/*! This file is auto-generated */
jQuery(document).ready(function(i){var p=!1;i("#the-list").on("click",".delete-tag",function(){var t,e=i(this),n=e.parents("tr"),a=!0;return"undefined"!=showNotice&&(a=showNotice.warn()),a&&(t=e.attr("href").replace(/[^?]*\?/,"").replace(/action=delete/,"action=delete-tag"),i.post(ajaxurl,t,function(e){"1"==e?(i("#ajax-response").empty(),n.fadeOut("normal",function(){n.remove()}),i('select#parent option[value="'+t.match(/tag_ID=(\d+)/)[1]+'"]').remove(),i("a.tag-link-"+t.match(/tag_ID=(\d+)/)[1]).remove()):("-1"==e?i("#ajax-response").empty().append('<div class="error"><p>'+wp.i18n.__("Sorry, you are not allowed to do that.")+"</p></div>"):i("#ajax-response").empty().append('<div class="error"><p>'+wp.i18n.__("Something went wrong.")+"</p></div>"),n.children().css("backgroundColor",""))}),n.children().css("backgroundColor","#f33")),!1}),i("#edittag").on("click",".delete",function(e){if("undefined"==typeof showNotice)return!0;showNotice.warn()||e.preventDefault()}),i("#submit").click(function(){var o=i(this).parents("form");return validateForm(o)&&(p||(p=!0,o.find(".submit .spinner").addClass("is-active"),i.post(ajaxurl,i("#addtag").serialize(),function(e){var t,n,a,s,r;if(p=!1,o.find(".submit .spinner").removeClass("is-active"),i("#ajax-response").empty(),(t=wpAjax.parseAjaxResponse(e,"ajax-response"))&&!t.errors){if(0<(n=o.find("select#parent").val())&&0<i("#tag-"+n).length?i(".tags #tag-"+n).after(t.responses[0].supplemental.noparents):i(".tags").prepend(t.responses[0].supplemental.parents),i(".tags .no-items").remove(),o.find("select#parent")){for(a=t.responses[1].supplemental,s="",r=0;r<t.responses[1].position;r++)s+="&nbsp;&nbsp;&nbsp;";o.find("select#parent option:selected").after('<option value="'+a.term_id+'">'+s+a.name+"</option>")}i('input[type="text"]:visible, textarea:visible',o).val("")}}))),!1})});