From 148e308d3895e7fd9e0348e057d928e46b84abf7 Mon Sep 17 00:00:00 2001 From: Eric Defore Date: Fri, 18 Jan 2019 12:20:13 -0500 Subject: [PATCH] Have ProductGallery object utilize arguments that are passed into it. --- assets/js/frontend/single-product.js | 6 +++--- assets/js/frontend/single-product.min.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/js/frontend/single-product.js b/assets/js/frontend/single-product.js index bbc61dd4012..e80b46711f8 100644 --- a/assets/js/frontend/single-product.js +++ b/assets/js/frontend/single-product.js @@ -115,7 +115,7 @@ jQuery( function( $ ) { this.openPhotoswipe = this.openPhotoswipe.bind( this ); if ( this.flexslider_enabled ) { - this.initFlexslider(); + this.initFlexslider( args.flexslider ); $target.on( 'woocommerce_gallery_reset_slide_position', this.onResetSlidePosition ); } else { this.$target.css( 'opacity', 1 ); @@ -134,7 +134,7 @@ jQuery( function( $ ) { /** * Initialize flexSlider. */ - ProductGallery.prototype.initFlexslider = function() { + ProductGallery.prototype.initFlexslider = function( args ) { var $target = this.$target, gallery = this; @@ -146,7 +146,7 @@ jQuery( function( $ ) { after: function( slider ) { gallery.initZoomForTarget( gallery.$images.eq( slider.currentSlide ) ); } - }, wc_single_product_params.flexslider ); + }, args ); $target.flexslider( options ); diff --git a/assets/js/frontend/single-product.min.js b/assets/js/frontend/single-product.min.js index 0c948d5b403..1ee41e3b7d6 100644 --- a/assets/js/frontend/single-product.min.js +++ b/assets/js/frontend/single-product.min.js @@ -1 +1 @@ -jQuery(function(s){if("undefined"==typeof wc_single_product_params)return!1;s("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){s(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var e=window.location.hash,t=window.location.href,i=s(this).find(".wc-tabs, ul.tabs").first();0<=e.toLowerCase().indexOf("comment-")||"#reviews"===e||"#tab-reviews"===e?i.find("li.reviews_tab a").click():012345

')}).on("click","#respond p.stars a",function(){var e=s(this),t=s(this).closest("#respond").find("#rating"),i=s(this).closest(".stars");return t.val(e.text()),e.siblings("a").removeClass("active"),e.addClass("active"),i.addClass("selected"),!1}).on("click","#respond #submit",function(){var e=s(this).closest("#respond").find("#rating"),t=e.val();if(0 .woocommerce-product-gallery__image",start:function(){e.css("opacity",1)},after:function(e){t.initZoomForTarget(t.$images.eq(e.currentSlide))}},wc_single_product_params.flexslider);e.flexslider(i),s(".woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:eq(0) .wp-post-image").one("load",function(){var i=s(this);i&&setTimeout(function(){var e=i.closest(".woocommerce-product-gallery__image").height(),t=i.closest(".flex-viewport");e&&t&&t.height(e)},100)}).each(function(){this.complete&&s(this).trigger("load")})},t.prototype.initZoom=function(){this.initZoomForTarget(this.$images.first())},t.prototype.initZoomForTarget=function(e){if(!this.zoom_enabled)return!1;var i=this.$target.width(),o=!1;if(s(e).each(function(e,t){if(s(t).find("img").data("large_image_width")>i)return!(o=!0)}),o){var t=s.extend({touch:!1},wc_single_product_params.zoom_options);"ontouchstart"in document.documentElement&&(t.on="click"),e.trigger("zoom.destroy"),e.zoom(t)}},t.prototype.initPhotoswipe=function(){this.zoom_enabled&&0🔍'),this.$target.on("click",".woocommerce-product-gallery__trigger",this.openPhotoswipe),this.$target.on("click",".woocommerce-product-gallery__image a",function(e){e.preventDefault()}),this.flexslider_enabled||this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)):this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)},t.prototype.onResetSlidePosition=function(){this.$target.flexslider(0)},t.prototype.getGalleryItems=function(){var e=this.$images,a=[];return 012345

')}).on("click","#respond p.stars a",function(){var e=s(this),t=s(this).closest("#respond").find("#rating"),i=s(this).closest(".stars");return t.val(e.text()),e.siblings("a").removeClass("active"),e.addClass("active"),i.addClass("selected"),!1}).on("click","#respond #submit",function(){var e=s(this).closest("#respond").find("#rating"),t=e.val();if(0 .woocommerce-product-gallery__image",start:function(){t.css("opacity",1)},after:function(e){i.initZoomForTarget(i.$images.eq(e.currentSlide))}},e);t.flexslider(o),s(".woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:eq(0) .wp-post-image").one("load",function(){var i=s(this);i&&setTimeout(function(){var e=i.closest(".woocommerce-product-gallery__image").height(),t=i.closest(".flex-viewport");e&&t&&t.height(e)},100)}).each(function(){this.complete&&s(this).trigger("load")})},t.prototype.initZoom=function(){this.initZoomForTarget(this.$images.first())},t.prototype.initZoomForTarget=function(e){if(!this.zoom_enabled)return!1;var i=this.$target.width(),o=!1;if(s(e).each(function(e,t){if(s(t).find("img").data("large_image_width")>i)return!(o=!0)}),o){var t=s.extend({touch:!1},wc_single_product_params.zoom_options);"ontouchstart"in document.documentElement&&(t.on="click"),e.trigger("zoom.destroy"),e.zoom(t)}},t.prototype.initPhotoswipe=function(){this.zoom_enabled&&0🔍'),this.$target.on("click",".woocommerce-product-gallery__trigger",this.openPhotoswipe),this.$target.on("click",".woocommerce-product-gallery__image a",function(e){e.preventDefault()}),this.flexslider_enabled||this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)):this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)},t.prototype.onResetSlidePosition=function(){this.$target.flexslider(0)},t.prototype.getGalleryItems=function(){var e=this.$images,a=[];return 0