Fix merge conflict and min scripts.

This commit is contained in:
splashingpixels 2014-03-18 20:42:53 -07:00 committed by Mike Jolley
parent ac53f7fbac
commit fabf19db37
7 changed files with 179 additions and 158 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
jQuery(function(e){var t=wc_address_i18n_params.locale.replace(/&quot;/g,'"'),n=e.parseJSON(t),r=' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>';e("body").bind("country_to_state_changing",function(t,i,s){var o=s,u;if(typeof n[i]!=="undefined"){u=n[i]}else{u=n["default"]}var a=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(a,function(e,t){var i=o.find(t);if(u[e]){if(u[e].label){i.find("label").html(u[e].label)}if(u[e].placeholder){i.find("input").attr("placeholder",u[e].placeholder)}i.find("label abbr").remove();if(typeof u[e].required==="undefined"&&n["default"][e].required===true){i.find("label").append(r)}else if(u[e].required===true){i.find("label").append(r)}if(e!=="state"){if(u[e].hidden===true){i.hide().find("input").val("")}else{i.show()}}}else if(n["default"][e]){if(n["default"][e].required===true){if(i.find("label abbr").size()===0)i.find("label").append(r)}if(e!=="state"){if(typeof n["default"][e].hidden==="undefined"||n["default"][e].hidden===false){i.show()}else if(n["default"][e].hidden===true){i.hide().find("input").val("")}}}});var f=o.find("#billing_postcode_field, #shipping_postcode_field"),l=o.find("#billing_city_field, #shipping_city_field"),c=o.find("#billing_state_field, #shipping_state_field");if(!f.attr("data-o_class")){f.attr("data-o_class",f.attr("class"));l.attr("data-o_class",l.attr("class"));c.attr("data-o_class",c.attr("class"))}if(u.postcode_before_city){f.add(l).add(c).removeClass("form-row-first form-row-last").addClass("form-row-wide");f.insertBefore(l)}else{f.attr("class",f.attr("data-o_class"));l.attr("class",l.attr("data-o_class"));c.attr("class",c.attr("data-o_class"));f.insertAfter(c)}})})
jQuery(function(a){var b=wc_address_i18n_params.locale.replace(/&quot;/g,'"'),c=a.parseJSON(b),d=' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>';a("body").bind("country_to_state_changing",function(b,e,f){var g,h=f;g="undefined"!=typeof c[e]?c[e]:c["default"];var i=a.parseJSON(wc_address_i18n_params.locale_fields);a.each(i,function(a,b){var e=h.find(b);g[a]?(g[a].label&&e.find("label").html(g[a].label),g[a].placeholder&&e.find("input").attr("placeholder",g[a].placeholder),e.find("label abbr").remove(),"undefined"==typeof g[a].required&&c["default"][a].required===!0?e.find("label").append(d):g[a].required===!0&&e.find("label").append(d),"state"!==a&&(g[a].hidden===!0?e.hide().find("input").val(""):e.show())):c["default"][a]&&(c["default"][a].required===!0&&0===e.find("label abbr").size()&&e.find("label").append(d),"state"!==a&&("undefined"==typeof c["default"][a].hidden||c["default"][a].hidden===!1?e.show():c["default"][a].hidden===!0&&e.hide().find("input").val("")))});var j=h.find("#billing_postcode_field, #shipping_postcode_field"),k=h.find("#billing_city_field, #shipping_city_field"),l=h.find("#billing_state_field, #shipping_state_field");j.attr("data-o_class")||(j.attr("data-o_class",j.attr("class")),k.attr("data-o_class",k.attr("class")),l.attr("data-o_class",l.attr("class"))),g.postcode_before_city?(j.add(k).add(l).removeClass("form-row-first form-row-last").addClass("form-row-wide"),j.insertBefore(k)):(j.attr("class",j.attr("data-o_class")),k.attr("class",k.attr("data-o_class")),l.attr("class",l.attr("data-o_class")),j.insertAfter(l))})});

View File

@ -1 +1 @@
jQuery(function(e){if(typeof wc_cart_fragments_params==="undefined"){return false}$supports_html5_storage="sessionStorage"in window&&window.sessionStorage!==null;$fragment_refresh={url:wc_cart_fragments_params.ajax_url,type:"POST",data:{action:"woocommerce_get_refreshed_fragments"},success:function(t){if(t&&t.fragments){e.each(t.fragments,function(t,n){e(t).replaceWith(n)});if($supports_html5_storage){sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(t.fragments));sessionStorage.setItem("wc_cart_hash",t.cart_hash)}e("body").trigger("wc_fragments_refreshed")}}};if($supports_html5_storage){e("body").bind("added_to_cart",function(e,t,n){sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(t));sessionStorage.setItem("wc_cart_hash",n)});try{var t=e.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),n=sessionStorage.getItem("wc_cart_hash"),r=e.cookie("woocommerce_cart_hash");if(n===null||n===undefined||n===""){n=""}if(r===null||r===undefined||r===""){r=""}if(t&&t["div.widget_shopping_cart_content"]&&n==r){e.each(t,function(t,n){e(t).replaceWith(n)});e("body").trigger("wc_fragments_loaded")}else{throw"No fragment"}}catch(i){e.ajax($fragment_refresh)}}else{e.ajax($fragment_refresh)}if(e.cookie("woocommerce_items_in_cart")>0){e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()}else{e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide()}e("body").bind("adding_to_cart",function(){e(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})})
jQuery(function(a){if("undefined"==typeof wc_cart_fragments_params)return!1;if($supports_html5_storage="sessionStorage"in window&&null!==window.sessionStorage,$fragment_refresh={url:wc_cart_fragments_params.ajax_url,type:"POST",data:{action:"woocommerce_get_refreshed_fragments"},success:function(b){b&&b.fragments&&(a.each(b.fragments,function(b,c){a(b).replaceWith(c)}),$supports_html5_storage&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(b.fragments)),sessionStorage.setItem("wc_cart_hash",b.cart_hash)),a("body").trigger("wc_fragments_refreshed"))}},$supports_html5_storage){a("body").bind("added_to_cart",function(a,b,c){sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(b)),sessionStorage.setItem("wc_cart_hash",c)});try{var b=a.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),c=sessionStorage.getItem("wc_cart_hash"),d=a.cookie("woocommerce_cart_hash");if((null===c||void 0===c||""===c)&&(c=""),(null===d||void 0===d||""===d)&&(d=""),!b||!b["div.widget_shopping_cart_content"]||c!=d)throw"No fragment";a.each(b,function(b,c){a(b).replaceWith(c)}),a("body").trigger("wc_fragments_loaded")}catch(e){a.ajax($fragment_refresh)}}else a.ajax($fragment_refresh);a.cookie("woocommerce_items_in_cart")>0?a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),a("body").bind("adding_to_cart",function(){a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});

View File

@ -1 +1 @@
jQuery(function(e){if(typeof wc_cart_params==="undefined"){return false}e(document).on("click",".shipping-calculator-button",function(){e(".shipping-calculator-form").slideToggle("slow");return false}).on("change","select.shipping_method, input[name^=shipping_method]",function(){var t=[];e("select.shipping_method, input[name^=shipping_method][type=radio]:checked, input[name^=shipping_method][type=hidden]").each(function(n,r){t[e(this).data("index")]=e(this).val()});e("div.cart_totals").block({message:null,overlayCSS:{background:"#fff url("+wc_cart_params.ajax_loader_url+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}});var n={action:"woocommerce_update_shipping_method",security:wc_cart_params.update_shipping_method_nonce,shipping_method:t};e.post(wc_cart_params.ajax_url,n,function(t){e("div.cart_totals").replaceWith(t);e("body").trigger("updated_shipping_method")})});e(".shipping-calculator-form").hide()})
jQuery(function(a){return"undefined"==typeof wc_cart_params?!1:(a(document).on("click",".shipping-calculator-button",function(){return a(".shipping-calculator-form").slideToggle("slow"),!1}).on("change","select.shipping_method, input[name^=shipping_method]",function(){var b=[];a("select.shipping_method, input[name^=shipping_method][type=radio]:checked, input[name^=shipping_method][type=hidden]").each(function(){b[a(this).data("index")]=a(this).val()}),a("div.cart_totals").block({message:null,overlayCSS:{background:"#fff url("+wc_cart_params.ajax_loader_url+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}});var c={action:"woocommerce_update_shipping_method",security:wc_cart_params.update_shipping_method_nonce,shipping_method:b};a.post(wc_cart_params.ajax_url,c,function(b){a("div.cart_totals").replaceWith(b),a("body").trigger("updated_shipping_method")})}),void a(".shipping-calculator-form").hide())});

View File

@ -1,80 +1,87 @@
jQuery(function($) {
jQuery( function( $ ) {
$.blockUI.defaults.overlayCSS.cursor = 'default';
// wc_checkout_params is required to continue, ensure the object exists
if (typeof wc_checkout_params === "undefined")
if ( typeof wc_checkout_params === 'undefined' )
return false;
var updateTimer;
var dirtyInput = false;
var xhr;
var updateTimer,
dirtyInput = false,
xhr;
function update_checkout() {
if (xhr) xhr.abort();
if ( xhr ) xhr.abort();
var shipping_methods = [];
$('select.shipping_method, input[name^=shipping_method][type=radio]:checked, input[name^=shipping_method][type=hidden]').each( function( index, input ) {
shipping_methods[ $(this).data( 'index' ) ] = $(this).val();
$( 'select.shipping_method, input[name^=shipping_method][type=radio]:checked, input[name^=shipping_method][type=hidden]' ).each( function( index, input ) {
shipping_methods[ $( this ).data( 'index' ) ] = $( this ).val();
} );
var payment_method = $('#order_review input[name=payment_method]:checked').val();
var country = $('#billing_country').val();
var state = $('#billing_state').val();
var postcode = $('input#billing_postcode').val();
var city = $('#billing_city').val();
var address = $('input#billing_address_1').val();
var address_2 = $('input#billing_address_2').val();
var payment_method = $( '#order_review input[name=payment_method]:checked' ).val(),
country = $( '#billing_country' ).val(),
state = $( '#billing_state' ).val(),
postcode = $( 'input#billing_postcode' ).val(),
city = $( '#billing_city' ).val(),
address = $( 'input#billing_address_1' ).val(),
address_2 = $( 'input#billing_address_2' ).val(),
s_country,
s_state,
s_postcode,
s_city,
s_address,
s_address_2;
if ( $('#ship-to-different-address input').is(':checked') || $('#ship-to-different-address input').size() == 0 ) {
var s_country = $('#shipping_country').val();
var s_state = $('#shipping_state').val();
var s_postcode = $('input#shipping_postcode').val();
var s_city = $('#shipping_city').val();
var s_address = $('input#shipping_address_1').val();
var s_address_2 = $('input#shipping_address_2').val();
if ( $( '#ship-to-different-address input' ).is( ':checked' ) || $( '#ship-to-different-address input' ).size() === 0 ) {
s_country = $( '#shipping_country' ).val();
s_state = $( '#shipping_state' ).val();
s_postcode = $( 'input#shipping_postcode' ).val();
s_city = $( '#shipping_city' ).val();
s_address = $( 'input#shipping_address_1' ).val();
s_address_2 = $( 'input#shipping_address_2' ).val();
} else {
var s_country = country;
var s_state = state;
var s_postcode = postcode;
var s_city = city;
var s_address = address;
var s_address_2 = address_2;
s_country = country;
s_state = state;
s_postcode = postcode;
s_city = city;
s_address = address;
s_address_2 = address_2;
}
$('#order_methods, #order_review').block({message: null, overlayCSS: {background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
$( '#order_methods, #order_review' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
var data = {
action: 'woocommerce_update_order_review',
security: wc_checkout_params.update_order_review_nonce,
shipping_method: shipping_methods,
payment_method: payment_method,
country: country,
state: state,
postcode: postcode,
city: city,
address: address,
address_2: address_2,
s_country: s_country,
s_state: s_state,
s_postcode: s_postcode,
s_city: s_city,
s_address: s_address,
s_address_2: s_address_2,
post_data: $('form.checkout').serialize()
action: 'woocommerce_update_order_review',
security: wc_checkout_params.update_order_review_nonce,
shipping_method: shipping_methods,
payment_method: payment_method,
country: country,
state: state,
postcode: postcode,
city: city,
address: address,
address_2: address_2,
s_country: s_country,
s_state: s_state,
s_postcode: s_postcode,
s_city: s_city,
s_address: s_address,
s_address_2: s_address_2,
post_data: $( 'form.checkout' ).serialize()
};
xhr = $.ajax({
type: 'POST',
url: wc_checkout_params.ajax_url,
data: data,
success: function( response ) {
type: 'POST',
url: wc_checkout_params.ajax_url,
data: data,
success: function( response ) {
if ( response ) {
var order_output = $($.parseHTML($.trim(response)));
$('#order_review').html(order_output.html());
$('body').trigger('updated_checkout');
var order_output = $( $.parseHTML( $.trim( response ) ) );
$( '#order_review' ).html( order_output.html() );
$( '#order_review' ).find( 'input[name=payment_method]:checked' ).click();
$( 'body' ).trigger('updated_checkout' );
}
}
});
@ -82,44 +89,47 @@ jQuery(function($) {
}
// Event for updating the checkout
$('body').bind('update_checkout', function() {
clearTimeout(updateTimer);
$( 'body' ).bind( 'update_checkout', function() {
clearTimeout( updateTimer );
update_checkout();
});
$('p.password, form.login, .checkout_coupon, div.shipping_address').hide();
$( 'p.password, form.login, .checkout_coupon, div.shipping_address' ).hide();
$('input.show_password').change(function(){
$('p.password').slideToggle();
$( 'input.show_password' ).change( function() {
$( 'p.password' ).slideToggle();
});
$('a.showlogin').click(function(){
$('form.login').slideToggle();
$( 'a.showlogin' ).click( function() {
$( 'form.login' ).slideToggle();
return false;
});
$('a.showcoupon').click(function(){
$('.checkout_coupon').slideToggle(400, function() {
$('#coupon_code').focus();
$( 'a.showcoupon' ).click( function() {
$( '.checkout_coupon' ).slideToggle( 400, function() {
$( '#coupon_code' ).focus();
});
return false;
});
$('#ship-to-different-address input').change(function(){
$('div.shipping_address').hide();
if ($(this).is(':checked')) {
$('div.shipping_address').slideDown();
$( '#ship-to-different-address input' ).change( function() {
$( 'div.shipping_address' ).hide();
if ( $( this ).is( ':checked' ) ) {
$( 'div.shipping_address' ).slideDown();
}
}).change();
if ( wc_checkout_params.option_guest_checkout == 'yes' ) {
if ( wc_checkout_params.option_guest_checkout === 'yes' ) {
$('div.create-account').hide();
$( 'div.create-account' ).hide();
$('input#createaccount').change(function(){
$('div.create-account').hide();
if ($(this).is(':checked')) {
$('div.create-account').slideDown();
$( 'input#createaccount' ).change( function() {
$( 'div.create-account' ).hide();
if ( $( this ).is( ':checked' ) ) {
$( 'div.create-account' ).slideDown();
}
}).change();
@ -129,61 +139,64 @@ jQuery(function($) {
function input_changed() {
var update_totals = true;
if ( $(dirtyInput).size() ) {
if ( $( dirtyInput ).size() ) {
$required_siblings = $(dirtyInput).closest('.form-row').siblings('.address-field.validate-required');
$required_siblings = $( dirtyInput ).closest( '.form-row' ).siblings( '.address-field.validate-required' );
if ( $required_siblings.size() ) {
$required_siblings.each(function(){
if ( $(this).find('input.input-text').val() == '' || $(this).find('input.input-text').val() == 'undefined' ) {
$required_siblings.each( function() {
if ( $( this ).find( 'input.input-text' ).val() === '' || $( this ).find( 'input.input-text' ).val() === 'undefined' ) {
update_totals = false;
}
});
});
}
}
if ( update_totals ) {
dirtyInput = false;
$('body').trigger('update_checkout');
$( 'body' ).trigger( 'update_checkout' );
}
}
$('#order_review')
$( '#order_review' )
/* Payment option selection */
.on( 'click', '.payment_methods input.input-radio', function() {
if ( $('.payment_methods input.input-radio').length > 1 ) {
var target_payment_box = $('div.payment_box.' + $(this).attr('ID') );
if ( $(this).is(':checked') && ! target_payment_box.is(':visible') ) {
$('div.payment_box').filter(':visible').slideUp(250);
if ( $(this).is(':checked') ) {
$('div.payment_box.' + $(this).attr('ID') ).slideDown(250);
if ( $( '.payment_methods input.input-radio' ).length > 1 ) {
var target_payment_box = $( 'div.payment_box.' + $( this ).attr( 'ID' ) );
if ( $( this ).is( ':checked' ) && ! target_payment_box.is( ':visible' ) ) {
$( 'div.payment_box' ).filter( ':visible' ).slideUp( 250 );
if ( $( this ).is( ':checked' ) ) {
$( 'div.payment_box.' + $( this ).attr( 'ID' ) ).slideDown( 250 );
}
}
} else {
$('div.payment_box').show();
$( 'div.payment_box' ).show();
}
if ( $(this).data('order_button_text') ) {
$('#place_order').val( $(this).data('order_button_text') );
if ( $( this ).data( 'order_button_text' ) ) {
$( '#place_order' ).val( $( this ).data( 'order_button_text' ) );
} else {
$('#place_order').val( $('#place_order').data( 'value' ) );
$( '#place_order' ).val( $( '#place_order' ).data( 'value' ) );
}
})
// Trigger initial click
.find('input[name=payment_method]:checked').click();
.find( 'input[name=payment_method]:checked' ).click();
$('form.checkout')
$( 'form.checkout' )
/* Update totals/taxes/shipping */
// Inputs/selects which update totals instantly
.on( 'input change', 'select.shipping_method, input[name^=shipping_method], #ship-to-different-address input, .update_totals_on_change select', function(){
.on( 'input change', 'select.shipping_method, input[name^=shipping_method], #ship-to-different-address input, .update_totals_on_change select', function() {
clearTimeout( updateTimer );
dirtyInput = false;
$('body').trigger('update_checkout');
$( 'body' ).trigger( 'update_checkout' );
})
// Address-fields which refresh totals when all required fields are filled
@ -200,8 +213,11 @@ jQuery(function($) {
.on( 'keydown', '.address-field input.input-text, .update_totals_on_change input.input-text', function( e ){
var code = e.keyCode || e.which;
if ( code == '9' )
if ( code === '9' ) {
return;
}
dirtyInput = this;
clearTimeout( updateTimer );
updateTimer = setTimeout( input_changed, '1000' );
@ -210,12 +226,12 @@ jQuery(function($) {
/* Inline validation */
.on( 'blur input change', '.input-text, select', function() {
var $this = $(this);
var $parent = $this.closest('.form-row');
var validated = true;
var $this = $( this ),
$parent = $this.closest( '.form-row' ),
validated = true;
if ( $parent.is( '.validate-required' ) ) {
if ( $this.val() == '' ) {
if ( $this.val() === '' ) {
$parent.removeClass( 'woocommerce-validated' ).addClass( 'woocommerce-invalid woocommerce-invalid-required-field' );
validated = false;
}
@ -244,82 +260,86 @@ jQuery(function($) {
.submit( function() {
clearTimeout( updateTimer );
var $form = $(this);
var $form = $( this );
if ( $form.is('.processing') )
if ( $form.is( '.processing' ) ) {
return false;
}
// Trigger a handler to let gateways manipulate the checkout if needed
if ( $form.triggerHandler('checkout_place_order') !== false && $form.triggerHandler('checkout_place_order_' + $('#order_review input[name=payment_method]:checked').val() ) !== false ) {
if ( $form.triggerHandler( 'checkout_place_order' ) !== false && $form.triggerHandler( 'checkout_place_order_' + $( '#order_review input[name=payment_method]:checked' ).val() ) !== false ) {
$form.addClass('processing');
$form.addClass( 'processing' );
var form_data = $form.data();
if ( form_data["blockUI.isBlocked"] != 1 )
$form.block({message: null, overlayCSS: {background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
if ( form_data["blockUI.isBlocked"] != 1 ) {
$form.block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
}
$.ajax({
type: 'POST',
url: wc_checkout_params.checkout_url,
data: $form.serialize(),
success: function( code ) {
type: 'POST',
url: wc_checkout_params.checkout_url,
data: $form.serialize(),
success: function( code ) {
var result = '';
try {
// Get the valid JSON only from the returned string
if ( code.indexOf("<!--WC_START-->") >= 0 )
code = code.split("<!--WC_START-->")[1]; // Strip off before after WC_START
if ( code.indexOf( '<!--WC_START-->' ) >= 0 )
code = code.split( '<!--WC_START-->' )[1]; // Strip off before after WC_START
if ( code.indexOf("<!--WC_END-->") >= 0 )
code = code.split("<!--WC_END-->")[0]; // Strip off anything after WC_END
if ( code.indexOf( '<!--WC_END-->' ) >= 0 )
code = code.split( '<!--WC_END-->' )[0]; // Strip off anything after WC_END
// Parse
result = $.parseJSON( code );
if ( result.result == 'success' ) {
window.location = decodeURI(result.redirect);
} else if ( result.result == 'failure' ) {
throw "Result failure";
if ( result.result === 'success' ) {
window.location = decodeURI( result.redirect );
} else if ( result.result === 'failure' ) {
throw 'Result failure';
} else {
throw "Invalid response";
throw 'Invalid response';
}
}
catch( err ) {
if ( result.reload == 'true' ) {
if ( result.reload === 'true' ) {
window.location.reload();
return;
}
// Remove old errors
$('.woocommerce-error, .woocommerce-message').remove();
$( '.woocommerce-error, .woocommerce-message' ).remove();
// Add new errors
if ( result.messages )
if ( result.messages ) {
$form.prepend( result.messages );
else
} else {
$form.prepend( code );
}
// Cancel processing
$form.removeClass('processing').unblock();
// Cancel processing
$form.removeClass( 'processing' ).unblock();
// Lose focus for all fields
$form.find( '.input-text, select' ).blur();
// Scroll to top
$('html, body').animate({
scrollTop: ($('form.checkout').offset().top - 100)
}, 1000);
$( 'html, body' ).animate({
scrollTop: ( $( 'form.checkout' ).offset().top - 100 )
}, 1000 );
// Trigger update in case we need a fresh nonce
if ( result.refresh == 'true' )
$('body').trigger('update_checkout');
if ( result.refresh === 'true' )
$( 'body' ).trigger( 'update_checkout' );
$('body').trigger('checkout_error');
$( 'body' ).trigger( 'checkout_error' );
}
},
dataType: "html"
dataType: 'html'
});
}
@ -328,50 +348,51 @@ jQuery(function($) {
});
/* AJAX Coupon Form Submission */
$('form.checkout_coupon').submit( function() {
var $form = $(this);
$( 'form.checkout_coupon' ).submit( function() {
var $form = $( this );
if ( $form.is('.processing') ) return false;
if ( $form.is( '.processing' ) ) return false;
$form.addClass('processing').block({message: null, overlayCSS: {background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
$form.addClass( 'processing' ).block({ message: null, overlayCSS: {background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
var data = {
action: 'woocommerce_apply_coupon',
security: wc_checkout_params.apply_coupon_nonce,
coupon_code: $form.find('input[name=coupon_code]').val()
action: 'woocommerce_apply_coupon',
security: wc_checkout_params.apply_coupon_nonce,
coupon_code: $form.find( 'input[name=coupon_code]' ).val()
};
$.ajax({
type: 'POST',
url: wc_checkout_params.ajax_url,
data: data,
success: function( code ) {
$('.woocommerce-error, .woocommerce-message').remove();
$form.removeClass('processing').unblock();
type: 'POST',
url: wc_checkout_params.ajax_url,
data: data,
success: function( code ) {
$( '.woocommerce-error, .woocommerce-message' ).remove();
$form.removeClass( 'processing' ).unblock();
if ( code ) {
$form.before( code );
$form.slideUp();
$('body').trigger('update_checkout');
$( 'body' ).trigger( 'update_checkout' );
}
},
dataType: "html"
dataType: 'html'
});
return false;
});
$('body')
$( 'body' )
// Init trigger
.bind('init_checkout', function() {
$('#billing_country, #shipping_country, .country_to_state').change();
$('body').trigger('update_checkout');
.bind( 'init_checkout', function() {
$( '#billing_country, #shipping_country, .country_to_state' ).change();
$( 'body' ).trigger( 'update_checkout' );
});
// Update on page load
if ( wc_checkout_params.is_checkout == 1 ) {
$('body').trigger('init_checkout');
if ( wc_checkout_params.is_checkout === 1 ) {
$( 'body' ).trigger( 'init_checkout' );
}
});

File diff suppressed because one or more lines are too long