mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-18 00:25:37 +01:00
61668d18de
git-svn-id: http://core.svn.wordpress.org/trunk@24375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
1005 B
JavaScript
1 line
1005 B
JavaScript
window.wp=window.wp||{};(function(b){var a=typeof _wpUtilSettings==="undefined"?{}:_wpUtilSettings;wp.template=_.memoize(function(e){var d,c={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(f){d=d||_.template(b("#tmpl-"+e).html(),null,c);return d(f)}});wp.xhr={settings:a.xhr||{},post:function(d,c){return wp.xhr.send({data:_.isObject(d)?d:_.extend(c||{},{action:d})})},send:function(d,c){if(_.isObject(d)){c=d}else{c=c||{};c.data=_.extend(c.data||{},{action:d})}c=_.defaults(c||{},{type:"POST",url:wp.xhr.settings.url,context:this});return b.Deferred(function(e){if(c.success){e.done(c.success)}if(c.error){e.fail(c.error)}delete c.success;delete c.error;b.ajax(c).done(function(f){if(f==="1"||f===1){f={success:true}}if(_.isObject(f)&&!_.isUndefined(f.success)){e[f.success?"resolveWith":"rejectWith"](this,[f.data])}else{e.rejectWith(this,[f])}}).fail(function(){e.rejectWith(this,arguments)})}).promise()}}}(jQuery)); |