OwlCyberSecurity - MANAGER
Edit File: product-gallery.min.js
!function(h){"use strict";function t(e,t){var i,o,a;if(this.$target=e,this.$images=h(".woocommerce-product-gallery__image",e),e.parent(".product--large-image").data("old_gallery")||(o=e.find(".woocommerce-product-gallery__wrapper").html(),e.parent(".product--large-image").data("old_gallery",o).data("prev_gallery",o)),e.parent(".product--large-image").data("gallery_action")||((i=e.find(".woocommerce-product-gallery__actions").clone()).find(".woocommerce-product-gallery__trigger").remove(),o='<div class="woocommerce-product-gallery__actions">',o+=i.html(),o+="</div>",e.parent(".product--large-image").data("gallery_action",o)),this.$target.parent().attr("data-totalG",this.$images.length),0===this.$images.length)return this.$target.css("opacity",1),void this.$target.parent().addClass("no-gallery");1===this.$images.length?this.$target.parent().addClass("no-gallery"):this.$target.parent().removeClass("no-gallery"),e.data("product_gallery",this),this.flexslider_enabled=!0,(e.hasClass("no-slider-script")||e.hasClass("force-disable-slider-script"))&&(this.flexslider_enabled=!1),this.zoom_enabled=h.isFunction(h.fn.zoom)&&wc_single_product_params.zoom_enabled,this.photoswipe_enabled="undefined"!=typeof PhotoSwipe&&wc_single_product_params.photoswipe_enabled,t&&(this.flexslider_enabled=!1!==t.flexslider_enabled&&this.flexslider_enabled,this.zoom_enabled=!1!==t.zoom_enabled&&this.zoom_enabled,this.photoswipe_enabled=!1!==t.photoswipe_enabled&&this.photoswipe_enabled),e.hasClass("force-disable-slider-script")&&(this.flexslider_enabled=!1),this.thumb_verital=!1,this.$images.length<2&&(this.flexslider_enabled=!1);try{2==la_theme_config.product_single_design&&(this.thumb_verital=!0)}catch(e){this.thumb_verital=!1}this.parent_is_quickview=!1,e.closest(".featherlight").length&&(this.thumb_verital=!0,this.parent_is_quickview=!0),this.initSlickslider=this.initSlickslider.bind(this),this.initZoom=this.initZoom.bind(this),this.initPhotoswipe=this.initPhotoswipe.bind(this),this.onResetSlidePosition=this.onResetSlidePosition.bind(this),this.getGalleryItems=this.getGalleryItems.bind(this),this.openPhotoswipe=this.openPhotoswipe.bind(this),this.flexslider_enabled?h.isFunction(h.fn.slick)?(this.initSlickslider(),e.on("woocommerce_gallery_reset_slide_position",this.onResetSlidePosition)):(a=this,LaStudio.global.loadDependencies([LaStudio.global.loadJsFile("slick")],function(){a.initSlickslider(),e.on("woocommerce_gallery_reset_slide_position",a.onResetSlidePosition)})):(this.parent_is_quickview?h("body").removeClass("lightcase--pending").addClass("lightcase--completed"):setTimeout(function(){h("body").trigger("la_sticky:recalc")},200),this.$target.css("opacity",1),e.removeClass("la-rebuild-product-gallery").parent().removeClass("swatch-loading")),this.zoom_enabled&&(this.initZoom(),e.on("woocommerce_gallery_init_zoom",this.initZoom)),this.photoswipe_enabled&&this.initPhotoswipe(),this.$images.find("a").attr("href","javascript:;")}t.prototype.initSlickslider=function(){var e=this.$images,t=this.$target,a=t.find(".woocommerce-product-gallery__wrapper"),s=t.parent().find(".la-thumb-inner"),i=Math.floor(100*Math.random()+1),o="la_woo_thumb_"+i,r="la_woo_target_"+i,l=this.parent_is_quickview;a.attr("id",r),s.attr("id",o),e.each(function(){var e=h(this),t=e.find("a[data-videolink]").data("videolink"),i=a.css("height"),o='<div class="la-thumb"><img src="'+e.attr("data-thumb")+'"/></div>';void 0!==t&&t&&(e.unbind("click"),e.find(".zoomImg").css({display:"none!important"}),0==t.indexOf("http://selfhosted/")?(t=t.replace("http://selfhosted/",""),o='<div class="la-thumb has-thumb-video"><div><img src="'+e.attr("data-thumb")+'"/><span class="play-overlay"><i class="fa fa-play-circle-o" aria-hidden="true"></i></span></div></div>',e.append('<video class="selfhostedvid noLightbox" width="460" height="315" controls preload="auto"><source src="'+t+'" /></video>'),e.attr("data-video",'<div class="la-media-wrapper"><video class="selfhostedvid noLightbox" width="460" height="315" controls preload="auto"><source src="'+t+'" /></video></div>')):(o='<div class="la-thumb has-thumb-video"><div><img src="'+e.attr("data-thumb")+'"/><span class="play-overlay"><i class="fa-play-circle-o"></i></span></div></div>',e.append('<iframe src ="'+t+'" width="460" " style="height:'+i+'; z-index:999999;" frameborder="no"></iframe>'),e.attr("data-video",'<div class="la-media-wrapper"><iframe src ="'+t+'" width="980" height="551" frameborder="no" allowfullscreen></iframe></div>')),e.find("img").css({opacity:"0","z-index":"-1"}),e.find("iframe").next().remove()),s.append(o)});var n=h.extend({mobile:3,mobile_landscape:3,tablet:3,laptop:3,desktop:3},JSON.parse(la_theme_config.product_gallery_column)||{}),d={infinite:!1,slidesToShow:parseInt(n.desktop),slidesToScroll:1,asNavFor:"#"+r,dots:!1,arrows:!0,focusOnSelect:!0,prevArrow:'<span class="slick-prev"><i class="lastudioicon-left-arrow"></i></span>',nextArrow:'<span class="slick-next"><i class="lastudioicon-right-arrow"></i></span>',vertical:this.thumb_verital,responsive:[{breakpoint:1500,settings:{vertical:this.thumb_verital,slidesToShow:parseInt(n.laptop)}},{breakpoint:1300,settings:{vertical:this.thumb_verital,slidesToShow:parseInt(n.tablet)}},{breakpoint:800,settings:{vertical:!1,slidesToShow:parseInt(n.mobile_landscape)}},{breakpoint:577,settings:{vertical:!1,slidesToShow:parseInt(n.mobile)}}]};this.thumb_verital||(d.infinite=!1,d.centerMode=!1,d.centerPadding="0px");var c={infinite:!1,swipe:!0,slidesToShow:1,slidesToScroll:1,arrows:!0,asNavFor:"#"+o,prevArrow:'<span class="slick-prev"><i class="lastudioicon-left-arrow"></i></span>',nextArrow:'<span class="slick-next"><i class="lastudioicon-right-arrow"></i></span>',adaptiveHeight:1==la_theme_config.product_single_design};this.thumb_verital||(c.infinite=!1),a.find("a").attr("href","javascript:;"),5!=la_theme_config.product_single_design?s.slick(d):(l&&(n={mobile:1,mobile_landscape:1,tablet:1,laptop:1,desktop:1}),c.slidesToShow=parseInt(n.desktop),c.slidesToScroll=1,c.infinite=!0,c.asNavFor="",c.centerMode=!0,c.centerPadding="0",c.responsive=[{breakpoint:1500,settings:{vertical:this.thumb_verital,slidesToShow:parseInt(n.laptop)}},{breakpoint:1300,settings:{vertical:!1,slidesToShow:parseInt(n.tablet)}},{breakpoint:800,settings:{vertical:!1,slidesToShow:parseInt(n.mobile_landscape)}},{breakpoint:577,settings:{vertical:!1,slidesToShow:parseInt(n.mobile)}}]),a.slick(c),LaStudio.global.LazyLoad(t.parent(),{rootMargin:"100px",load:function(){},complete:function(){LaStudio.global.eventManager.publish("LaStudio:Component:LazyLoadImage",[t.parent()]),t.css("opacity",1),5!=la_theme_config.product_single_design&&s.slick("setPosition"),t.parent().removeClass("swatch-loading"),l?setTimeout(function(){a.resize(),setTimeout(function(){h("body").removeClass("lightcase--pending").addClass("lightcase--completed")},50)},150):setTimeout(function(){h("body").trigger("la_sticky:recalc")},200)}}).observe()},t.prototype.initZoom=function(){this.initZoomForTarget(this.$images)},t.prototype.initZoomForTarget=function(e){if(!this.zoom_enabled)return!1;var t,i=this.$target.width(),o=!1;if(h(e).each(function(e,t){if(h(t).find("img").data("large_image_width")>i)return!(o=!0)}),o){try{t=h.extend({touch:!1},wc_single_product_params.zoom_options)}catch(e){t={touch:!1}}"ontouchstart"in document.documentElement&&(t.on="click"),e.trigger("zoom.destroy"),e.zoom(t)}},t.prototype.initPhotoswipe=function(){this.zoom_enabled&&0<this.$images.length&&(this.$target.find(".woocommerce-product-gallery__actions").prepend('<a href="#" class="woocommerce-product-gallery__trigger"><span><i class="lastudioicon-full-screen"></i></span></a>'),this.$target.on("click",".woocommerce-product-gallery__trigger",this.openPhotoswipe)),this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)},t.prototype.onResetSlidePosition=function(){this.$target.parent().removeClass("swatch-loading"),this.$target.find(".woocommerce-product-gallery__wrapper").slick("slickGoTo",0)},t.prototype.getGalleryItems=function(){var e=this.$images,a=[];return 0<e.length&&e.each(function(e,t){var i=h(t).find("img"),o={src:i.attr("data-large_image"),w:i.attr("data-large_image_width"),h:i.attr("data-large_image_height"),title:i.attr("title")};h(t).attr("data-video")&&(o={html:h(t).attr("data-video")}),a.push(o)}),a},t.prototype.openPhotoswipe=function(e){e.preventDefault();var t,i,o=h(".pswp")[0],a=this.getGalleryItems(),s=h(e.target);s.is(".woocommerce-product-gallery__trigger")?(t=this.$target.find(".slick-current")||this.$target.find(".woocommerce-product-gallery__image").first(),i=h(t).index()):(t=s.closest(".woocommerce-product-gallery__image"),i=h(t).index(),h(".la-p-single-5").length&&(i=parseInt(t.attr("data-slick-index")))<0&&(i=a.length+i)),new PhotoSwipe(o,PhotoSwipeUI_Default,a,{index:i,shareEl:!1,closeOnScroll:!1,history:!1,hideAnimationDuration:0,showAnimationDuration:0}).init()},h.fn.lastudio_product_gallery=function(e){return new t(this,e),this}}(jQuery);