WordPress.org

Make WordPress Core

Ticket #31577: wp-util.js.patch

File wp-util.js.patch, 2.8 KB (added by TikiTDO, 6 years ago)
  • wp-includes/js/wp-util.js

    From 221cf0fd536dd30a2dc9704aad04e9241815bf07 Mon Sep 17 00:00:00 2001
    From: Tikhon Botchkarev <TikiTDO@gmail.com>
    Date: Mon, 9 Mar 2015 21:35:05 -0400
    Subject: [PATCH] Add dataType to wp.ajax.send JS function
    
    ---
     wp-includes/js/wp-util.js     | 1 +
     wp-includes/js/wp-util.min.js | 2 +-
     2 files changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/wp-includes/js/wp-util.js b/wp-includes/js/wp-util.js
    index 1985b35..d76a7e8 100644
    a b window.wp = window.wp || {}; 
    7676                        }
    7777
    7878                        options = _.defaults( options || {}, {
     79                                dataType: 'json',
    7980                                type:    'POST',
    8081                                url:     wp.ajax.settings.url,
    8182                                context: this
  • wp-includes/js/wp-util.min.js

    diff --git a/wp-includes/js/wp-util.min.js b/wp-includes/js/wp-util.min.js
    index a74a80f..9847024 100644
    a b  
    1 window.wp=window.wp||{},function(a){var b="undefined"==typeof _wpUtilSettings?{}:_wpUtilSettings;wp.template=_.memoize(function(b){var c,d={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(e){return(c=c||_.template(a("#tmpl-"+b).html(),null,d))(e)}}),wp.ajax={settings:b.ajax||{},post:function(a,b){return wp.ajax.send({data:_.isObject(a)?a:_.extend(b||{},{action:a})})},send:function(b,c){return _.isObject(b)?c=b:(c=c||{},c.data=_.extend(c.data||{},{action:b})),c=_.defaults(c||{},{type:"POST",url:wp.ajax.settings.url,context:this}),a.Deferred(function(b){c.success&&b.done(c.success),c.error&&b.fail(c.error),delete c.success,delete c.error,a.ajax(c).done(function(a){("1"===a||1===a)&&(a={success:!0}),_.isObject(a)&&!_.isUndefined(a.success)?b[a.success?"resolveWith":"rejectWith"](this,[a.data]):b.rejectWith(this,[a])}).fail(function(){b.rejectWith(this,arguments)})}).promise()}}}(jQuery);
    2  No newline at end of file
     1window.wp=window.wp||{},function(a){var b="undefined"==typeof _wpUtilSettings?{}:_wpUtilSettings;wp.template=_.memoize(function(b){var c,d={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(e){return(c=c||_.template(a("#tmpl-"+b).html(),null,d))(e)}}),wp.ajax={settings:b.ajax||{},post:function(a,b){return wp.ajax.send({data:_.isObject(a)?a:_.extend(b||{},{action:a})})},send:function(b,c){return _.isObject(b)?c=b:(c=c||{},c.data=_.extend(c.data||{},{action:b})),c=_.defaults(c||{},{dataType:'json',type:"POST",url:wp.ajax.settings.url,context:this}),a.Deferred(function(b){c.success&&b.done(c.success),c.error&&b.fail(c.error),delete c.success,delete c.error,a.ajax(c).done(function(a){("1"===a||1===a)&&(a={success:!0}),_.isObject(a)&&!_.isUndefined(a.success)?b[a.success?"resolveWith":"rejectWith"](this,[a.data]):b.rejectWith(this,[a])}).fail(function(){b.rejectWith(this,arguments)})}).promise()}}}(jQuery);