WordPress/wp-includes/js/wp-util.min.js

2 lines
1.3 KiB
JavaScript

/*! This file is auto-generated */
window.wp=window.wp||{},function(s){var e="undefined"==typeof _wpUtilSettings?{}:_wpUtilSettings;wp.template=_.memoize(function(t){var a,n={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(e){return(a=a||_.template(s("#tmpl-"+t).html(),n))(e)}}),wp.ajax={settings:e.ajax||{},post:function(e,t){return wp.ajax.send({data:_.isObject(e)?e:_.extend(t||{},{action:e})})},send:function(n,e){var t,a;return _.isObject(n)?e=n:(e=e||{}).data=_.extend(e.data||{},{action:n}),e=_.defaults(e||{},{type:"POST",url:wp.ajax.settings.url,context:this}),(t=(a=s.Deferred(function(a){e.success&&a.done(e.success),e.error&&a.fail(e.error),delete e.success,delete e.error,a.jqXHR=s.ajax(e).done(function(e){var t;"1"!==e&&1!==e||(e={success:!0}),_.isObject(e)&&!_.isUndefined(e.success)?(t=this,a.done(function(){"query-attachments"===n.data.action&&a.jqXHR.hasOwnProperty("getResponseHeader")&&a.jqXHR.getResponseHeader("X-WP-Total")?t.totalAttachments=parseInt(a.jqXHR.getResponseHeader("X-WP-Total"),10):t.totalAttachments=0}),a[e.success?"resolveWith":"rejectWith"](this,[e.data])):a.rejectWith(this,[e])}).fail(function(){a.rejectWith(this,arguments)})})).promise()).abort=function(){return a.jqXHR.abort(),this},t}}}(jQuery);