Fix and minify

This commit is contained in:
Mike Jolley 2017-02-21 10:35:11 +00:00
parent ea97b60d49
commit 7f33db5746
4 changed files with 4 additions and 7 deletions

View File

@ -437,7 +437,7 @@ jQuery( function( $ ) {
success: function( response ) {
$( '.woocommerce-error, .woocommerce-message, .woocommerce-info' ).remove();
show_notice( response );
$( document.body ).trigger( 'applied_coupon', [ coupon ] );
$( document.body ).trigger( 'applied_coupon', [ coupon_code ] );
},
complete: function() {
unblock( $form );

File diff suppressed because one or more lines are too long

View File

@ -198,19 +198,16 @@ jQuery( function( $ ) {
var pswpElement = $( '.pswp' )[0],
items = wc_product_gallery.get_gallery_items(),
target = $( e.target ),
index = -1,
clicked;
if ( ! target.is( '.woocommerce-product-gallery__trigger' ) ) {
clicked = e.target.closest( 'figure' );
index = $( clicked ).index();
} else {
clicked = target.parents( '.woocommerce-product-gallery' ).find( '.flex-active-slide' );
index = $( clicked ).index();
}
var options = {
index: index,
index: $( clicked ).index(),
shareEl: false,
closeOnScroll: false,
history: false,

View File

@ -1 +1 @@
jQuery(function(a){if("undefined"==typeof wc_single_product_params)return!1;a("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){a(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var b=window.location.hash,c=window.location.href,d=a(this).find(".wc-tabs, ul.tabs").first();b.toLowerCase().indexOf("comment-")>=0||"#reviews"===b||"#tab-reviews"===b?d.find("li.reviews_tab a").click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?d.find("li.reviews_tab a").click():d.find("li:first a").click()}).on("click",".wc-tabs li a, ul.tabs li a",function(b){b.preventDefault();var c=a(this),d=c.closest(".wc-tabs-wrapper, .woocommerce-tabs"),e=d.find(".wc-tabs, ul.tabs");e.find("li").removeClass("active"),d.find(".wc-tab, .panel:not(.panel .panel)").hide(),c.closest("li").addClass("active"),d.find(c.attr("href")).show()}).on("click","a.woocommerce-review-link",function(){return a(".reviews_tab a").click(),!0}).on("init","#rating",function(){a("#rating").hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>')}).on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating"),d=a(this).closest(".stars");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),d.addClass("selected"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();if(b.length>0&&!c&&"yes"===wc_single_product_params.review_rating_required)return window.alert(wc_single_product_params.i18n_required_rating_text),!1}).on("woocommerce_init_gallery",function(){a.isFunction(a.fn.zoom)&&wc_single_product_params.zoom_enabled&&b.init_zoom()}),a(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init");var b={init:function(){a.isFunction(a.fn.flexslider)&&wc_single_product_params.flexslider_enabled&&this.init_flexslider(),a.isFunction(a.fn.zoom)&&wc_single_product_params.zoom_enabled&&this.init_zoom(),"undefined"!=typeof PhotoSwipe&&wc_single_product_params.photoswipe_enabled&&this.init_photoswipe()},init_flexslider:function(){a(".woocommerce-product-gallery").flexslider({selector:".woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image",animation:wc_single_product_params.flexslider.animation,smoothHeight:wc_single_product_params.flexslider.smoothHeight,directionNav:wc_single_product_params.flexslider.directionNav,controlNav:wc_single_product_params.flexslider.controlNav,slideshow:wc_single_product_params.flexslider.slideshow,animationSpeed:wc_single_product_params.flexslider.animationSpeed,animationLoop:wc_single_product_params.flexslider.animationLoop,start:function(){var b=a(".woocommerce-product-gallery__image"),c=0;b.each(function(){var b=a(this).height();b>c&&(c=b)}),b.each(function(){a(this).css("min-height",c)})}})},init_zoom:function(){var b=a(".woocommerce-product-gallery__image");wc_single_product_params.flexslider_enabled||(b=b.first());var c=b.find("img");c.attr("width")>a(".woocommerce-product-gallery").width()&&(b.trigger("zoom.destroy"),b.zoom({touch:!1}))},get_gallery_items:function(){var b=a(".woocommerce-product-gallery__wrapper").children(),c=[],d=b.filter(".flex-active-slide").index();return b.length>0&&b.each(function(b,d){var e=a(d).find("img"),f=e.attr("data-large-image"),g=e.attr("data-large-image-width"),h=e.attr("data-large-image-height"),i={src:f,w:g,h:h,title:e.attr("title")};c.push(i)}),{index:d,items:c}},init_photoswipe:function(){wc_single_product_params.zoom_enabled&&(a(".woocommerce-product-gallery--with-images").prepend('<a href="#" class="woocommerce-product-gallery__trigger">🔍</a>'),a(document).on("click",".woocommerce-product-gallery__trigger",this.trigger_photoswipe)),a(document).on("click",".woocommerce-product-gallery__image a",this.trigger_photoswipe)},trigger_photoswipe:function(c){c.preventDefault();var d=a(".pswp")[0],e=b.get_gallery_items(),f=a(c.target),g=-1;if(!f.is(".woocommerce-product-gallery__trigger")){var h=c.target.closest("figure");g=a(h).index()}var i={index:g,shareEl:!1,closeOnScroll:!1,history:!1,hideAnimationDuration:0,showAnimationDuration:0},j=new PhotoSwipe(d,PhotoSwipeUI_Default,e.items,i);j.init()}};b.init()});
jQuery(function(a){if("undefined"==typeof wc_single_product_params)return!1;a("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){a(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var b=window.location.hash,c=window.location.href,d=a(this).find(".wc-tabs, ul.tabs").first();b.toLowerCase().indexOf("comment-")>=0||"#reviews"===b||"#tab-reviews"===b?d.find("li.reviews_tab a").click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?d.find("li.reviews_tab a").click():d.find("li:first a").click()}).on("click",".wc-tabs li a, ul.tabs li a",function(b){b.preventDefault();var c=a(this),d=c.closest(".wc-tabs-wrapper, .woocommerce-tabs"),e=d.find(".wc-tabs, ul.tabs");e.find("li").removeClass("active"),d.find(".wc-tab, .panel:not(.panel .panel)").hide(),c.closest("li").addClass("active"),d.find(c.attr("href")).show()}).on("click","a.woocommerce-review-link",function(){return a(".reviews_tab a").click(),!0}).on("init","#rating",function(){a("#rating").hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>')}).on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating"),d=a(this).closest(".stars");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),d.addClass("selected"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();if(b.length>0&&!c&&"yes"===wc_single_product_params.review_rating_required)return window.alert(wc_single_product_params.i18n_required_rating_text),!1}).on("woocommerce_init_gallery",function(){a.isFunction(a.fn.zoom)&&wc_single_product_params.zoom_enabled&&b.init_zoom()}),a(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init");var b={init:function(){a.isFunction(a.fn.flexslider)&&wc_single_product_params.flexslider_enabled&&this.init_flexslider(),a.isFunction(a.fn.zoom)&&wc_single_product_params.zoom_enabled&&this.init_zoom(),"undefined"!=typeof PhotoSwipe&&wc_single_product_params.photoswipe_enabled&&this.init_photoswipe()},init_flexslider:function(){a(".woocommerce-product-gallery").flexslider({selector:".woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image",animation:wc_single_product_params.flexslider.animation,smoothHeight:wc_single_product_params.flexslider.smoothHeight,directionNav:wc_single_product_params.flexslider.directionNav,controlNav:wc_single_product_params.flexslider.controlNav,slideshow:wc_single_product_params.flexslider.slideshow,animationSpeed:wc_single_product_params.flexslider.animationSpeed,animationLoop:wc_single_product_params.flexslider.animationLoop,start:function(){var b=a(".woocommerce-product-gallery__image"),c=0;b.each(function(){var b=a(this).height();b>c&&(c=b)}),b.each(function(){a(this).css("min-height",c)})}})},init_zoom:function(){var b=a(".woocommerce-product-gallery__image");wc_single_product_params.flexslider_enabled||(b=b.first());var c=b.find("img");c.attr("width")>a(".woocommerce-product-gallery").width()&&(b.trigger("zoom.destroy"),b.zoom({touch:!1}))},get_gallery_items:function(){var b=a(".woocommerce-product-gallery__wrapper").children(),c=[],d=b.filter(".flex-active-slide").index();return b.length>0&&b.each(function(b,d){var e=a(d).find("img"),f=e.attr("data-large-image"),g=e.attr("data-large-image-width"),h=e.attr("data-large-image-height"),i={src:f,w:g,h:h,title:e.attr("title")};c.push(i)}),{index:d,items:c}},init_photoswipe:function(){wc_single_product_params.zoom_enabled&&(a(".woocommerce-product-gallery--with-images").prepend('<a href="#" class="woocommerce-product-gallery__trigger">🔍</a>'),a(document).on("click",".woocommerce-product-gallery__trigger",this.trigger_photoswipe)),a(document).on("click",".woocommerce-product-gallery__image a",this.trigger_photoswipe)},trigger_photoswipe:function(c){c.preventDefault();var d,e=a(".pswp")[0],f=b.get_gallery_items(),g=a(c.target);d=g.is(".woocommerce-product-gallery__trigger")?g.parents(".woocommerce-product-gallery").find(".flex-active-slide"):c.target.closest("figure");var h={index:a(d).index(),shareEl:!1,closeOnScroll:!1,history:!1,hideAnimationDuration:0,showAnimationDuration:0},i=new PhotoSwipe(e,PhotoSwipeUI_Default,f.items,h);i.init()}};b.init()});