diff --git a/assets/js/frontend/credit-card-form.js b/assets/js/frontend/credit-card-form.js index 1f8f04843ea..4fc1eb42866 100644 --- a/assets/js/frontend/credit-card-form.js +++ b/assets/js/frontend/credit-card-form.js @@ -1,12 +1,12 @@ -jQuery( function() { - jQuery('.wc-credit-card-form-card-number').payment('formatCardNumber'); - jQuery('.wc-credit-card-form-card-expiry').payment('formatCardExpiry'); - jQuery('.wc-credit-card-form-card-cvc').payment('formatCardCVC'); +jQuery( function( $ ) { + $( '.wc-credit-card-form-card-number' ).payment( 'formatCardNumber' ); + $( '.wc-credit-card-form-card-expiry' ).payment( 'formatCardExpiry' ); + $( '.wc-credit-card-form-card-cvc' ).payment( 'formatCardCVC' ); - jQuery('body') - .on('updated_checkout', function() { - jQuery('.wc-credit-card-form-card-number').payment('formatCardNumber'); - jQuery('.wc-credit-card-form-card-expiry').payment('formatCardExpiry'); - jQuery('.wc-credit-card-form-card-cvc').payment('formatCardCVC'); + $( 'body' ) + .on( 'updated_checkout', function() { + $( '.wc-credit-card-form-card-number' ).payment( 'formatCardNumber' ); + $( '.wc-credit-card-form-card-expiry' ).payment( 'formatCardExpiry' ); + $( '.wc-credit-card-form-card-cvc' ).payment( 'formatCardCVC' ); }); } ); \ No newline at end of file diff --git a/assets/js/frontend/credit-card-form.min.js b/assets/js/frontend/credit-card-form.min.js index 567ed606ea9..55db28aee9f 100644 --- a/assets/js/frontend/credit-card-form.min.js +++ b/assets/js/frontend/credit-card-form.min.js @@ -1 +1 @@ -jQuery(function(){jQuery(".wc-credit-card-form-card-number").payment("formatCardNumber"),jQuery(".wc-credit-card-form-card-expiry").payment("formatCardExpiry"),jQuery(".wc-credit-card-form-card-cvc").payment("formatCardCVC"),jQuery("body").on("updated_checkout",function(){jQuery(".wc-credit-card-form-card-number").payment("formatCardNumber"),jQuery(".wc-credit-card-form-card-expiry").payment("formatCardExpiry"),jQuery(".wc-credit-card-form-card-cvc").payment("formatCardCVC")})}); \ No newline at end of file +jQuery(function(e){e(".wc-credit-card-form-card-number").payment("formatCardNumber");e(".wc-credit-card-form-card-expiry").payment("formatCardExpiry");e(".wc-credit-card-form-card-cvc").payment("formatCardCVC");e("body").on("updated_checkout",function(){e(".wc-credit-card-form-card-number").payment("formatCardNumber");e(".wc-credit-card-form-card-expiry").payment("formatCardExpiry");e(".wc-credit-card-form-card-cvc").payment("formatCardCVC")})}) \ No newline at end of file diff --git a/assets/js/frontend/price-slider.js b/assets/js/frontend/price-slider.js index aca527947bb..1ff7a82f681 100644 --- a/assets/js/frontend/price-slider.js +++ b/assets/js/frontend/price-slider.js @@ -1,72 +1,73 @@ -jQuery(function($) { +jQuery( function( $ ) { // woocommerce_price_slider_params is required to continue, ensure the object exists - if (typeof woocommerce_price_slider_params === "undefined") + if ( typeof woocommerce_price_slider_params === 'undefined' ) { return false; + } // Get markup ready for slider - $('input#min_price, input#max_price').hide(); - $('.price_slider, .price_label').show(); + $( 'input#min_price, input#max_price' ).hide(); + $( '.price_slider, .price_label' ).show(); // Price slider uses jquery ui - var min_price = $('.price_slider_amount #min_price').data('min'); - var max_price = $('.price_slider_amount #max_price').data('max'); + var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ), + max_price = $( '.price_slider_amount #max_price' ).data( 'max' ); - current_min_price = parseInt(min_price); - current_max_price = parseInt(max_price); + current_min_price = parseInt( min_price, 10 ); + current_max_price = parseInt( max_price, 10 ); - if (woocommerce_price_slider_params.min_price) current_min_price = parseInt(woocommerce_price_slider_params.min_price); - if (woocommerce_price_slider_params.max_price) current_max_price = parseInt(woocommerce_price_slider_params.max_price); + if ( woocommerce_price_slider_params.min_price ) current_min_price = parseInt( woocommerce_price_slider_params.min_price, 10 ); + if ( woocommerce_price_slider_params.max_price ) current_max_price = parseInt( woocommerce_price_slider_params.max_price, 10 ); - $('body').bind('price_slider_create price_slider_slide', function( event, min, max ) { - if (woocommerce_price_slider_params.currency_pos == "left") { + $( 'body' ).bind( 'price_slider_create price_slider_slide', function( event, min, max ) { + if ( woocommerce_price_slider_params.currency_pos === 'left' ) { - $( ".price_slider_amount span.from" ).html( woocommerce_price_slider_params.currency_symbol + min ); - $( ".price_slider_amount span.to" ).html( woocommerce_price_slider_params.currency_symbol + max ); + $( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + min ); + $( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + max ); - } else if (woocommerce_price_slider_params.currency_pos == "left_space") { + } else if ( woocommerce_price_slider_params.currency_pos === 'left_space' ) { - $( ".price_slider_amount span.from" ).html( woocommerce_price_slider_params.currency_symbol + " " + min ); - $( ".price_slider_amount span.to" ).html( woocommerce_price_slider_params.currency_symbol + " " + max ); + $( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + " " + min ); + $( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + " " + max ); - } else if (woocommerce_price_slider_params.currency_pos == "right") { + } else if ( woocommerce_price_slider_params.currency_pos === 'right' ) { - $( ".price_slider_amount span.from" ).html( min + woocommerce_price_slider_params.currency_symbol ); - $( ".price_slider_amount span.to" ).html( max + woocommerce_price_slider_params.currency_symbol ); + $( '.price_slider_amount span.from' ).html( min + woocommerce_price_slider_params.currency_symbol ); + $( '.price_slider_amount span.to' ).html( max + woocommerce_price_slider_params.currency_symbol ); - } else if (woocommerce_price_slider_params.currency_pos == "right_space") { + } else if ( woocommerce_price_slider_params.currency_pos === 'right_space' ) { - $( ".price_slider_amount span.from" ).html( min + " " + woocommerce_price_slider_params.currency_symbol ); - $( ".price_slider_amount span.to" ).html( max + " " + woocommerce_price_slider_params.currency_symbol ); + $( '.price_slider_amount span.from' ).html( min + " " + woocommerce_price_slider_params.currency_symbol ); + $( '.price_slider_amount span.to' ).html( max + " " + woocommerce_price_slider_params.currency_symbol ); } - $('body').trigger('price_slider_updated', min, max ); + $( 'body' ).trigger( 'price_slider_updated', min, max ); }); - $('.price_slider').slider({ + $( '.price_slider' ).slider({ range: true, animate: true, min: min_price, max: max_price, - values: [current_min_price,current_max_price], + values: [ current_min_price, current_max_price ], create : function( event, ui ) { - $( ".price_slider_amount #min_price" ).val(current_min_price); - $( ".price_slider_amount #max_price" ).val(current_max_price); + $( '.price_slider_amount #min_price' ).val( current_min_price ); + $( '.price_slider_amount #max_price' ).val( current_max_price ); - $('body').trigger('price_slider_create', [current_min_price, current_max_price]); + $( 'body' ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] ); }, slide: function( event, ui ) { - $( "input#min_price" ).val(ui.values[ 0 ]); - $( "input#max_price" ).val(ui.values[ 1 ]); + $( 'input#min_price' ).val( ui.values[0] ); + $( 'input#max_price' ).val( ui.values[1] ); - $('body').trigger('price_slider_slide', [ui.values[ 0 ], ui.values[ 1 ]] ); + $( 'body' ).trigger( 'price_slider_slide', [ ui.values[0], ui.values[1] ] ); }, change: function( event, ui ) { - $('body').trigger('price_slider_change', [ui.values[ 0 ], ui.values[ 1 ]] ); + $( 'body' ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] ); }, }); diff --git a/assets/js/frontend/price-slider.min.js b/assets/js/frontend/price-slider.min.js index ccb322af787..1ce114816ac 100644 --- a/assets/js/frontend/price-slider.min.js +++ b/assets/js/frontend/price-slider.min.js @@ -1 +1 @@ -jQuery(function(a){if("undefined"==typeof woocommerce_price_slider_params)return!1;a("input#min_price, input#max_price").hide(),a(".price_slider, .price_label").show();var b=a(".price_slider_amount #min_price").data("min"),c=a(".price_slider_amount #max_price").data("max");current_min_price=parseInt(b),current_max_price=parseInt(c),woocommerce_price_slider_params.min_price&&(current_min_price=parseInt(woocommerce_price_slider_params.min_price)),woocommerce_price_slider_params.max_price&&(current_max_price=parseInt(woocommerce_price_slider_params.max_price)),a("body").bind("price_slider_create price_slider_slide",function(b,c,d){"left"==woocommerce_price_slider_params.currency_pos?(a(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+c),a(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+d)):"left_space"==woocommerce_price_slider_params.currency_pos?(a(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+" "+c),a(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+" "+d)):"right"==woocommerce_price_slider_params.currency_pos?(a(".price_slider_amount span.from").html(c+woocommerce_price_slider_params.currency_symbol),a(".price_slider_amount span.to").html(d+woocommerce_price_slider_params.currency_symbol)):"right_space"==woocommerce_price_slider_params.currency_pos&&(a(".price_slider_amount span.from").html(c+" "+woocommerce_price_slider_params.currency_symbol),a(".price_slider_amount span.to").html(d+" "+woocommerce_price_slider_params.currency_symbol)),a("body").trigger("price_slider_updated",c,d)}),a(".price_slider").slider({range:!0,animate:!0,min:b,max:c,values:[current_min_price,current_max_price],create:function(){a(".price_slider_amount #min_price").val(current_min_price),a(".price_slider_amount #max_price").val(current_max_price),a("body").trigger("price_slider_create",[current_min_price,current_max_price])},slide:function(b,c){a("input#min_price").val(c.values[0]),a("input#max_price").val(c.values[1]),a("body").trigger("price_slider_slide",[c.values[0],c.values[1]])},change:function(b,c){a("body").trigger("price_slider_change",[c.values[0],c.values[1]])}})}); \ No newline at end of file +jQuery(function(e){if(typeof woocommerce_price_slider_params==="undefined"){return false}e("input#min_price, input#max_price").hide();e(".price_slider, .price_label").show();var t=e(".price_slider_amount #min_price").data("min"),n=e(".price_slider_amount #max_price").data("max");current_min_price=parseInt(t,10);current_max_price=parseInt(n,10);if(woocommerce_price_slider_params.min_price)current_min_price=parseInt(woocommerce_price_slider_params.min_price,10);if(woocommerce_price_slider_params.max_price)current_max_price=parseInt(woocommerce_price_slider_params.max_price,10);e("body").bind("price_slider_create price_slider_slide",function(t,n,r){if(woocommerce_price_slider_params.currency_pos==="left"){e(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+n);e(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+r)}else if(woocommerce_price_slider_params.currency_pos==="left_space"){e(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+" "+n);e(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+" "+r)}else if(woocommerce_price_slider_params.currency_pos==="right"){e(".price_slider_amount span.from").html(n+woocommerce_price_slider_params.currency_symbol);e(".price_slider_amount span.to").html(r+woocommerce_price_slider_params.currency_symbol)}else if(woocommerce_price_slider_params.currency_pos==="right_space"){e(".price_slider_amount span.from").html(n+" "+woocommerce_price_slider_params.currency_symbol);e(".price_slider_amount span.to").html(r+" "+woocommerce_price_slider_params.currency_symbol)}e("body").trigger("price_slider_updated",n,r)});e(".price_slider").slider({range:true,animate:true,min:t,max:n,values:[current_min_price,current_max_price],create:function(t,n){e(".price_slider_amount #min_price").val(current_min_price);e(".price_slider_amount #max_price").val(current_max_price);e("body").trigger("price_slider_create",[current_min_price,current_max_price])},slide:function(t,n){e("input#min_price").val(n.values[0]);e("input#max_price").val(n.values[1]);e("body").trigger("price_slider_slide",[n.values[0],n.values[1]])},change:function(t,n){e("body").trigger("price_slider_change",[n.values[0],n.values[1]])}})}) \ No newline at end of file diff --git a/assets/js/frontend/single-product.js b/assets/js/frontend/single-product.js index 94a58e7c743..cf002d40fed 100644 --- a/assets/js/frontend/single-product.js +++ b/assets/js/frontend/single-product.js @@ -1,8 +1,9 @@ jQuery( function( $ ) { // wc_single_product_params is required to continue, ensure the object exists - if ( typeof wc_single_product_params === "undefined" ) + if ( typeof wc_single_product_params === 'undefined' ) { return false; + } // Tabs $( '.woocommerce-tabs .panel' ).hide(); diff --git a/assets/js/frontend/single-product.min.js b/assets/js/frontend/single-product.min.js index 84943d380ea..032b5853f85 100644 --- a/assets/js/frontend/single-product.min.js +++ b/assets/js/frontend/single-product.min.js @@ -1 +1 @@ -jQuery(function(a){return"undefined"==typeof wc_single_product_params?!1:(a(".woocommerce-tabs .panel").hide(),a(".woocommerce-tabs ul.tabs li a").click(function(){var b=a(this),c=b.closest(".woocommerce-tabs");return a("ul.tabs li",c).removeClass("active"),a("div.panel",c).hide(),a("div"+b.attr("href"),c).show(),b.parent().addClass("active"),!1}),a(".woocommerce-tabs").each(function(){var b=window.location.hash,c=window.location.href,d=a(this);b.toLowerCase().indexOf("comment-")>=0?a("ul.tabs li.reviews_tab a",d).click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?a("ul.tabs li.reviews_tab a",a(this)).click():a("ul.tabs li:first a",d).click()}),a("a.woocommerce-review-link").click(function(){return a(".reviews_tab a").click(),!0}),a("#rating").hide().before('

12345

'),a("body").on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();return b.size()>0&&!c&&"yes"===wc_single_product_params.review_rating_required?(alert(wc_single_product_params.i18n_required_rating_text),!1):void 0}),void a("form.cart").submit(function(){a(this).find(":submit").attr("disabled","disabled")}))}); \ No newline at end of file +jQuery(function(e){if(typeof wc_single_product_params==="undefined"){return false}e(".woocommerce-tabs .panel").hide();e(".woocommerce-tabs ul.tabs li a").click(function(){var t=e(this),n=t.closest(".woocommerce-tabs");e("ul.tabs li",n).removeClass("active");e("div.panel",n).hide();e("div"+t.attr("href"),n).show();t.parent().addClass("active");return false});e(".woocommerce-tabs").each(function(){var t=window.location.hash,n=window.location.href,r=e(this);if(t.toLowerCase().indexOf("comment-")>=0){e("ul.tabs li.reviews_tab a",r).click()}else if(n.indexOf("comment-page-")>0||n.indexOf("cpage=")>0){e("ul.tabs li.reviews_tab a",e(this)).click()}else{e("ul.tabs li:first a",r).click()}});e("a.woocommerce-review-link").click(function(){e(".reviews_tab a").click();return true});e("#rating").hide().before('

12345

');e("body").on("click","#respond p.stars a",function(){var t=e(this),n=e(this).closest("#respond").find("#rating");n.val(t.text());t.siblings("a").removeClass("active");t.addClass("active");return false}).on("click","#respond #submit",function(){var t=e(this).closest("#respond").find("#rating"),n=t.val();if(t.size()>0&&!n&&wc_single_product_params.review_rating_required==="yes"){alert(wc_single_product_params.i18n_required_rating_text);return false}});e("form.cart").submit(function(){e(this).find(":submit").attr("disabled","disabled")})}) \ No newline at end of file diff --git a/assets/js/frontend/woocommerce.js b/assets/js/frontend/woocommerce.js index 279727bf94d..77f0c4d3f31 100644 --- a/assets/js/frontend/woocommerce.js +++ b/assets/js/frontend/woocommerce.js @@ -1,57 +1,57 @@ -jQuery(function($) { +jQuery( function( $ ) { // Orderby - $('.woocommerce-ordering').on( 'change', 'select.orderby', function() { - $(this).closest('form').submit(); + $( '.woocommerce-ordering' ).on( 'change', 'select.orderby', function() { + $( this ).closest( 'form' ).submit(); }); // Quantity buttons - $("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass('buttons_added').append('').prepend(''); + $( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '' ).prepend( '' ); // Target quantity inputs on product pages - $("input.qty:not(.product-quantity input.qty)").each(function(){ - var min = parseFloat( $(this).attr('min') ); + $( 'input.qty:not(.product-quantity input.qty)' ).each( function() { + var min = parseFloat( $( this ).attr( 'min' ) ); - if ( min && min > 0 && parseFloat( $(this).val() ) < min ) { - $(this).val( min ); + if ( min && min > 0 && parseFloat( $( this ).val() ) < min ) { + $( this ).val( min ); } }); - $(document).on( 'click', '.plus, .minus', function() { + $( document ).on( 'click', '.plus, .minus', function() { // Get values - var $qty = $(this).closest('.quantity').find(".qty"); - var currentVal = parseFloat( $qty.val() ); - var max = parseFloat( $qty.attr('max') ); - var min = parseFloat( $qty.attr('min') ); - var step = $qty.attr('step'); + var $qty = $( this ).closest( '.quantity' ).find( '.qty' ), + currentVal = parseFloat( $qty.val() ), + max = parseFloat( $qty.attr( 'max' ) ), + min = parseFloat( $qty.attr( 'min' ) ), + step = $qty.attr( 'step' ); - // Format values - if ( ! currentVal || currentVal == "" || currentVal == "NaN" ) currentVal = 0; - if ( max == "" || max == "NaN" ) max = ''; - if ( min == "" || min == "NaN" ) min = 0; - if ( step == 'any' || step == "" || step == undefined || parseFloat( step ) == "NaN" ) step = 1; + // Format values + if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0; + if ( max === '' || max === 'NaN' ) max = ''; + if ( min === '' || min === 'NaN' ) min = 0; + if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) === 'NaN' ) step = 1; - // Change the value - if ( $(this).is('.plus') ) { + // Change the value + if ( $( this ).is( '.plus' ) ) { - if ( max && ( max == currentVal || currentVal > max ) ) { - $qty.val( max ); - } else { - $qty.val( currentVal + parseFloat( step ) ); - } + if ( max && ( max == currentVal || currentVal > max ) ) { + $qty.val( max ); + } else { + $qty.val( currentVal + parseFloat( step ) ); + } - } else { + } else { - if ( min && ( min==currentVal || currentVal < min ) ) { - $qty.val( min ); - } else if ( currentVal > 0 ) { - $qty.val( currentVal - parseFloat( step ) ); - } + if ( min && ( min == currentVal || currentVal < min ) ) { + $qty.val( min ); + } else if ( currentVal > 0 ) { + $qty.val( currentVal - parseFloat( step ) ); + } - } + } - // Trigger change event - $qty.trigger('change'); + // Trigger change event + $qty.trigger( 'change' ); }); }); diff --git a/assets/js/frontend/woocommerce.min.js b/assets/js/frontend/woocommerce.min.js index 6469fbad1f1..09b6bae40d7 100644 --- a/assets/js/frontend/woocommerce.min.js +++ b/assets/js/frontend/woocommerce.min.js @@ -1 +1 @@ -jQuery(function(a){a(".woocommerce-ordering").on("change","select.orderby",function(){a(this).closest("form").submit()}),a("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('').prepend(''),a("input.qty:not(.product-quantity input.qty)").each(function(){var b=parseFloat(a(this).attr("min"));b&&b>0&&parseFloat(a(this).val())d)?d:c+parseFloat(f)):e&&(e==c||e>c)?b.val(e):c>0&&b.val(c-parseFloat(f)),b.trigger("change")})}); \ No newline at end of file +jQuery(function(e){e(".woocommerce-ordering").on("change","select.orderby",function(){e(this).closest("form").submit()});e("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('').prepend('');e("input.qty:not(.product-quantity input.qty)").each(function(){var t=parseFloat(e(this).attr("min"));if(t&&t>0&&parseFloat(e(this).val())r)){t.val(r)}else{t.val(n+parseFloat(s))}}else{if(i&&(i==n||n0){t.val(n-parseFloat(s))}}t.trigger("change")})}) \ No newline at end of file