mirror of
https://github.com/WordPress/WordPress.git
synced 2024-08-25 15:22:53 +02:00
Updates package dependencies to more modern versions, also adds .nvmrc and package-lock.json as followups to [43683] and [43571]. See #44600. Fixes #45064. Built from https://develop.svn.wordpress.org/branches/5.0@43684 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
2.0 KiB
JavaScript
1 line
2.0 KiB
JavaScript
var wpAjax=jQuery.extend({unserialize:function(e){var r,t,a,i,n={};if(!e)return n;for(a in(r=e.split("?"))[1]&&(e=r[1]),t=e.split("&"))jQuery.isFunction(t.hasOwnProperty)&&!t.hasOwnProperty(a)||(n[(i=t[a].split("="))[0]]=i[1]);return n},parseAjaxResponse:function(n,e,o){var s={},r=jQuery("#"+e).empty(),u="";return n&&"object"==typeof n&&n.getElementsByTagName("wp_ajax")?(s.responses=[],s.errors=!1,jQuery("response",n).each(function(){var i,e=jQuery(this),r=jQuery(this.firstChild);(i={action:e.attr("action"),what:r.get(0).nodeName,id:r.attr("id"),oldId:r.attr("old_id"),position:r.attr("position")}).data=jQuery("response_data",r).text(),i.supplemental={},jQuery("supplemental",r).children().each(function(){i.supplemental[this.nodeName]=jQuery(this).text()}).length||(i.supplemental=!1),i.errors=[],jQuery("wp_error",r).each(function(){var e,r,t,a=jQuery(this).attr("code");e={code:a,message:this.firstChild.nodeValue,data:!1},(r=jQuery('wp_error_data[code="'+a+'"]',n))&&(e.data=r.get()),(t=jQuery("form-field",r).text())&&(a=t),o&&wpAjax.invalidateForm(jQuery("#"+o+' :input[name="'+a+'"]').parents(".form-field:first")),u+="<p>"+e.message+"</p>",i.errors.push(e),s.errors=!0}).length||(i.errors=!1),s.responses.push(i)}),u.length&&r.html('<div class="error">'+u+"</div>"),s):isNaN(n)?!r.html('<div class="error"><p>'+n+"</p></div>"):-1==(n=parseInt(n,10))?!r.html('<div class="error"><p>'+wpAjax.noPerm+"</p></div>"):0!==n||!r.html('<div class="error"><p>'+wpAjax.broken+"</p></div>")},invalidateForm:function(e){return jQuery(e).addClass("form-invalid").find("input").one("change wp-check-valid-field",function(){jQuery(this).closest(".form-invalid").removeClass("form-invalid")})},validateForm:function(e){return e=jQuery(e),!wpAjax.invalidateForm(e.find(".form-required").filter(function(){return""===jQuery("input:visible",this).val()})).length}},wpAjax||{noPerm:"Sorry, you are not allowed to do that.",broken:"Something went wrong."});jQuery(document).ready(function(e){e("form.validate").submit(function(){return wpAjax.validateForm(e(this))})}); |