WordPress/wp-admin/js/tags-box.min.js
Aaron Jorbin 0e21d32900 Build/Test: Bump devDependencies for WordPress 5.3
This upgrades a number of devDependencies.  Some of these include changes to how the tasks are configured.

Uglify: There are deprecated options from 2.x to 4.x, see: https://github.com/gruntjs/grunt-contrib-uglify#options

Autoprefixer: Browserslist now warns when passing in the browser list, so that is put into package.json

As with most changes to uglify, this changes every minified JS file.

Fixes #48203.



Built from https://develop.svn.wordpress.org/trunk@46408


git-svn-id: http://core.svn.wordpress.org/trunk@46206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-05 19:49:10 +00:00

1 line
3.0 KiB
JavaScript

!function(r){var u=window.tagsSuggestL10n&&window.tagsSuggestL10n.tagDelimiter||",";window.array_unique_noempty=function(t){var a=[];return r.each(t,function(t,e){(e=r.trim(e))&&-1===r.inArray(e,a)&&a.push(e)}),a},window.tagBox={clean:function(t){return","!==u&&(t=t.replace(new RegExp(u,"g"),",")),t=t.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,""),","!==u&&(t=t.replace(/,/g,u)),t},parseTags:function(t){var e=t.id.split("-check-num-")[1],a=r(t).closest(".tagsdiv"),s=a.find(".the-tags"),i=s.val().split(u),n=[];return delete i[e],r.each(i,function(t,e){(e=r.trim(e))&&n.push(e)}),s.val(this.clean(n.join(u))),this.quickClicks(a),!1},quickClicks:function(t){var e,i,a=r(".the-tags",t),n=r(".tagchecklist",t),c=r(t).attr("id");a.length&&(i=a.prop("disabled"),e=a.val().split(u),n.empty(),r.each(e,function(t,e){var a,s;(e=r.trim(e))&&(a=r("<li />").text(e),i||((s=r('<button type="button" id="'+c+"-check-num-"+t+'" class="ntdelbutton"><span class="remove-tag-icon" aria-hidden="true"></span><span class="screen-reader-text">'+window.tagsSuggestL10n.removeTerm+" "+a.html()+"</span></button>")).on("click keypress",function(t){"click"!==t.type&&13!==t.keyCode&&32!==t.keyCode||(13!==t.keyCode&&32!==t.keyCode||r(this).closest(".tagsdiv").find("input.newtag").focus(),tagBox.userAction="remove",tagBox.parseTags(this))}),a.prepend("&nbsp;").prepend(s)),n.append(a))}),tagBox.screenReadersMessage())},flushTags:function(t,e,a){var s,i,n,c=r(".the-tags",t),o=r("input.newtag",t);return void 0===(n=(e=e||!1)?r(e).text():o.val())||""===n||(i=(s=c.val())?s+u+n:n,i=this.clean(i),i=array_unique_noempty(i.split(u)).join(u),c.val(i),this.quickClicks(t),e||o.val(""),void 0===a&&o.focus()),!1},get:function(a){var s=a.substr(a.indexOf("-")+1);r.post(ajaxurl,{action:"get-tagcloud",tax:s},function(t,e){0!==t&&"success"==e&&(t=r('<div id="tagcloud-'+s+'" class="the-tagcloud">'+t+"</div>"),r("a",t).click(function(){return tagBox.userAction="add",tagBox.flushTags(r("#"+s),this),!1}),r("#"+a).after(t))})},userAction:"",screenReadersMessage:function(){var t;switch(this.userAction){case"remove":t=window.tagsSuggestL10n.termRemoved;break;case"add":t=window.tagsSuggestL10n.termAdded;break;default:return}window.wp.a11y.speak(t,"assertive")},init:function(){var t=r("div.ajaxtag");r(".tagsdiv").each(function(){tagBox.quickClicks(this)}),r(".tagadd",t).click(function(){tagBox.userAction="add",tagBox.flushTags(r(this).closest(".tagsdiv"))}),r("input.newtag",t).keypress(function(t){13==t.which&&(tagBox.userAction="add",tagBox.flushTags(r(this).closest(".tagsdiv")),t.preventDefault(),t.stopPropagation())}).each(function(t,e){r(e).wpTagsSuggest()}),r("#post").submit(function(){r("div.tagsdiv").each(function(){tagBox.flushTags(this,!1,1)})}),r(".tagcloud-link").click(function(){tagBox.get(r(this).attr("id")),r(this).attr("aria-expanded","true").unbind().click(function(){r(this).attr("aria-expanded","false"===r(this).attr("aria-expanded")?"true":"false").siblings(".the-tagcloud").toggle()})})}}}(jQuery);