WordPress/wp-includes/js/wp-ajax-response.min.js
desrosj e4a97cc8e9 Build/Test Tools: Update NPM dependencies to their latest versions.
The following dependencies are being updated:

- `copy-webpack-plugin` from `10.2.4` to `11.0.0`.
- `dotenv` from `16.0.1` to `16.0.2`.
- `dotenv-expand` from `8.0.3` to `9.0.0`.
- `sass` from `1.53.0` to `1.55.0`.
- `sinon-test` from `3.1.3` to `3.1.4`.
- `source-map-loader` from `3.0.1` to `4.0.0`.
- `terser-webpack-plugin` from `5.3.1` to `5.3.6`.
- `uglify-js` from `3.16.1` to `3.17.1`.
- `uuid` from `8.3.2` to `9.0.0`.
- `webpack` from `5.72.0` to `5.74.0`.

This also contains changes after running `npm audit fix`.

Fixes #56641.
Built from https://develop.svn.wordpress.org/trunk@54296


git-svn-id: http://core.svn.wordpress.org/trunk@53855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 19:55:30 +00:00

2 lines
2.4 KiB
JavaScript

/*! This file is auto-generated */
window.wpAjax=jQuery.extend({unserialize:function(e){var t,r,i,n,a={};if(e)for(i in r=(e=(t=e.split("?"))[1]?t[1]:e).split("&"))"function"==typeof r.hasOwnProperty&&!r.hasOwnProperty(i)||(a[(n=r[i].split("="))[0]]=n[1]);return a},parseAjaxResponse:function(n,e,a){var o={},e=jQuery("#"+e).empty(),s="",r="";return n&&"object"==typeof n&&n.getElementsByTagName("wp_ajax")?(o.responses=[],o.errors=!1,jQuery("response",n).each(function(){var e=jQuery(this),t=jQuery(this.firstChild),i={action:e.attr("action"),what:t.get(0).nodeName,id:t.attr("id"),oldId:t.attr("old_id"),position:t.attr("position")};i.data=jQuery("response_data",t).text(),i.supplemental={},jQuery("supplemental",t).children().each(function(){"notice"===this.nodeName?r+=jQuery(this).text():i.supplemental[this.nodeName]=jQuery(this).text()}).length||(i.supplemental=!1),i.errors=[],jQuery("wp_error",t).each(function(){var e=jQuery(this).attr("code"),t={code:e,message:this.firstChild.nodeValue,data:!1},r=jQuery('wp_error_data[code="'+e+'"]',n);r&&(t.data=r.get()),(r=jQuery("form-field",r).text())&&(e=r),a&&wpAjax.invalidateForm(jQuery("#"+a+' :input[name="'+e+'"]').parents(".form-field:first")),s+="<p>"+t.message+"</p>",i.errors.push(t),o.errors=!0}).length||(i.errors=!1),o.responses.push(i)}),s.length?(e.html('<div class="notice notice-error">'+s+"</div>"),wp.a11y.speak(s)):r.length&&(e.html('<div class="notice notice-success is-dismissible"><p>'+r+"</p></div>"),jQuery(document).trigger("wp-updates-notice-added"),wp.a11y.speak(r)),o):isNaN(n)?(wp.a11y.speak(n),!e.html('<div class="notice notice-error"><p>'+n+"</p></div>")):-1===(n=parseInt(n,10))?(wp.a11y.speak(wpAjax.noPerm),!e.html('<div class="notice notice-error"><p>'+wpAjax.noPerm+"</p></div>")):0!==n||(wp.a11y.speak(wpAjax.broken),!e.html('<div class="notice notice-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(function(e){e("form.validate").on("submit",function(){return wpAjax.validateForm(e(this))})});