2013-07-10 20:22:41 -04:00
|
|
|
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.ajax={settings:a.ajax||{},post:function(d,c){return wp.ajax.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.ajax.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));
|