File: /var/www/sites/1250.info/wp-content/themes/savoy/assets/js/nm-shop-single-product.min.js
/* NM: Single product script */
(function(c){c.extend(c.nmTheme,{singleProduct_init:function(){var a=this;a.$productWrap=c(".nm-single-product");a.$galleryContainer=c(".woocommerce-product-gallery");a.$galleryWrap=a.$galleryContainer.find(".woocommerce-product-gallery__wrapper");a.$galleryImages=a.$galleryWrap.children(".woocommerce-product-gallery__image");a.galleryThumbnailsSlider="0"!=nm_wp_vars.galleryThumbnailsSlider&&a.$productWrap.hasClass("thumbnails-vertical")?!0:!1;a.zoomEnabled=!a.isTouch&&c(".woocommerce-product-gallery").hasClass("zoom-enabled");
a.singleProductVariations();a.quantityInputsBindButtons(c(".summary"));a.singleProductFeaturedVideoInit();a.$window.on("load",function(){var f=0,d=function(){a.galleryData?(a.$pageIncludes.hasClass("product-layout-scroll")&&a.singleProductPinSummary(),a.singleProductGalleryInit(),a.singleProductGalleryZoomInit()):10>f&&(f++,a.galleryData=a.$galleryContainer.data("flexslider"),setTimeout(function(){d()},100))};a.$galleryContainer.length&&(1<a.$galleryImages.length?(a.galleryData=a.$galleryContainer.data("flexslider"),
d()):a.singleProductGalleryZoomInit())});var b=document.querySelector(".pswp__button--close");b&&b.addEventListener("pswpTap",function(f){f.preventDefault();f.stopPropagation()},!0);a.$productAccordion=c("#nm-product-accordion");a.$productAccordion.length&&a.singleProductAccordionBind();a.singleProductReviewFormButton();var e=c("#nm-comment-form-rating");e.on("click.nmAddParentClass",".stars a",function(){e.children(".stars").addClass("has-active")});"0"!=nm_wp_vars.shopRedirectScroll&&(c("#nm-breadcrumb").find("a").on("click.nmShopRedirect",
function(f){f.preventDefault();a.singleProductRedirectWithHash(this)}),c("#nm-product-meta").find("a").on("click.nmShopRedirect",function(f){f.preventDefault();a.singleProductRedirectWithHash(this)}))},singleProductPinSummary:function(){var a=this;a.singleProductPinSummaryInit();var b=null;a.$window.on("resize.nmProductDetailsPin",function(){b&&clearTimeout(b);b=setTimeout(function(){a.singleProductPinSummaryUpdate()},250)})},singleProductPinSummaryInit:function(){var a=c("#nm-summary-pin");a.pin({minWidth:1080,
containerSelector:".nm-single-product-summary-col",padding:{top:a.offset().top+.1}})},singleProductPinSummaryRemove:function(){c("#nm-summary-pin").attr("style","").removeData("pin")},singleProductPinSummaryUpdate:function(){this.singleProductPinSummaryRemove();this.singleProductPinSummaryInit();this.$window.trigger("scroll")},singleProductGalleryInit:function(){"0"!=nm_wp_vars.galleryZoom&&c(".woocommerce-product-gallery").prepend('<a href="#" class="woocommerce-product-gallery__trigger">\ud83d\udd0d</a>');
var a=this;a.galleryThumbnailsSlider&&(a.$galleryThumbsContainer=a.$galleryContainer.find(".flex-control-thumbs"),a.$galleryThumbsContainer.wrapInner('<ol id="nm-product-gallery-thumbs-inner"></ol>'),a.$galleryThumbsWrap=c("#nm-product-gallery-thumbs-inner"));a.singleProductGallerySetHeight();a.galleryData.vars.before=function(e){a.singleProductGallerySetHeight()};a.singleProductGalleryArrowsOffset();c(".flex-direction-nav").addClass("show");var b=null;a.$window.on("resize.nmProductGallery",function(){b&&
clearTimeout(b);b=setTimeout(function(){a.singleProductGallerySetHeight();a.singleProductGalleryArrowsOffset();c("#nm-variations-form").trigger("click")},250)});if(a.isTouch)a.$document.on("touchstart.nmProductGallery",function(e){c(e.target).closest(".woocommerce-product-gallery").length?a.$galleryContainer.addClass("nm-touch-hover"):a.$galleryContainer.removeClass("nm-touch-hover")})},singleProductGallerySetHeight:function(){var a=this.galleryData.slides.eq(this.galleryData.animatingTo).height();this.$galleryWrap.css("height",
a+"px");this.galleryThumbnailsSlider&&this.singleProductGalleryPositionThumbnail(a)},singleProductGalleryPositionThumbnail:function(a){this.$galleryThumbsContainer.css("height",a+"px");var b=this.$galleryThumbsWrap.children().eq(this.galleryData.animatingTo),e=Math.round(b.position().top),f=Math.round(e+b.height()),d=Math.abs(parseInt(this.$galleryThumbsWrap.css("top"))),g=null;50>=e-d?(a=b.prev(),a.length&&(e=Math.round(a.position().top)),g=e):f-d>=a-50&&(e=b.next(),e.length&&(f=Math.round(e.position().top+
e.height())),g=f-a);null!==g&&this.$galleryThumbsWrap.css("top","-"+g+"px")},singleProductRedirectWithHash:function(a){a=c(a).attr("href");window.location.href=a+"#shop"},singleProductVariations:function(){var a=this,b=c("#nm-variations-form");b=b.length?b:c(".variations_form");a.singleProductVariationsInit(b);b.on("woocommerce_variation_select_change",function(){a.zoomEnabled&&a.singleProductZoomUpdateImage()})},singleProductGalleryArrowsOffset:function(){var a=c(".woocommerce-product-gallery"),
b=a.children(".flex-direction-nav").find("a"),e=Math.ceil(a.outerHeight());a=Math.ceil(a.children(".woocommerce-product-gallery__wrapper").height());var f=b.first().outerHeight()/2;b.css("marginTop","-"+(f+(e>a?(e-a)/2:0))+"px")},singleProductGalleryZoomInit:function(){this.zoomEnabled&&c(".woocommerce-product-gallery__wrapper").children(".woocommerce-product-gallery__image").easyZoom()},singleProductZoomUpdateImage:function(){var a=c(".woocommerce-product-gallery__wrapper").children(".woocommerce-product-gallery__image").first(),
b=a.children("a").attr("href");b&&0<b.length&&(a=a.data("easyZoom"))&&a.swap(b)},singleProductFeaturedVideoInit:function(){var a=this;a.hasFeaturedVideo=!1;a.$featuredVideoBtn=c("#nm-featured-video-link");a.$featuredVideoBtn.length&&(a.hasFeaturedVideo=!0,a.$featuredVideoBtn.on("click",function(b){b.preventDefault();b={mainClass:"nm-featured-video-popup nm-mfp-fade-in",closeMarkup:'<a class="mfp-close nm-font nm-font-close2"></a>',removalDelay:180,type:"iframe",closeOnContentClick:!0,closeBtnInside:!0};
"0"==nm_wp_vars.shopYouTubeRelated&&(b.iframe={patterns:{youtube:{src:"//www.youtube.com/embed/%id%?rel=0&autoplay=1"}}});a.$featuredVideoBtn.magnificPopup(b).magnificPopup("open")}))},singleProductAccordionBind:function(){var a=this,b=function(){a.$pageIncludes.hasClass("product-layout-scroll")&&a.singleProductPinSummaryUpdate()},e=function(d){d=c(d);d.parent(".nm-product-accordion-panel").toggleClass("active");d.next(".nm-product-accordion-content").slideToggle(200,function(){b()})},f=function(d){var g=
c(d);d=g.parent(".nm-product-accordion-panel");g=g.next(".nm-product-accordion-content");if(d.hasClass("open"))d.removeClass("open"),g.slideUp(200,function(){b()});else{var h=a.$productAccordion.children(".open");if(h.length){var k=h.children(".nm-product-accordion-content");d.addClass("open");h.removeClass("open");g.slideDown(200);k.slideUp(200,function(){b()})}else d.addClass("open"),g.slideDown(200,function(){b()})}};a.$productAccordion.children(".nm-product-accordion-panel").children(".nm-product-accordion-heading").on("click",
function(d){d.preventDefault();"0"!=nm_wp_vars.productAccordionCloseOpen?f(this):e(this)})},singleProductReviewFormButton:function(){c("#nm-review-form-btn").magnificPopup({mainClass:"nm-review-form-popup nm-mfp-fade-in",closeMarkup:'<a class="mfp-close nm-font nm-font-close2"></a>',removalDelay:180,closeBtnInside:!0,items:{src:"#review_form",type:"inline"}})}});c.nmThemeExtensions.singleProduct=c.nmTheme.singleProduct_init})(jQuery);