function initSelect2(){$j(".woocommerce-ordering .orderby, #calc_shipping_country, #dropdown_product_cat").select2({minimumResultsForSearch:-1}),$j(".woocommerce-account .country_select").select2()}function initAddToCartPlusMinus(){$j(document).on("click",".quantity .plus, .quantity .minus",function(){var e=$j(this).closest(".quantity").find(".qty"),t=parseFloat(e.val()),o=parseFloat(e.attr("max")),i=parseFloat(e.attr("min")),a=e.attr("step");t&&""!==t&&"NaN"!==t||(t=0),""!==o&&"NaN"!==o||(o=""),""!==i&&"NaN"!==i||(i=0),"any"!==a&&""!==a&&void 0!==a&&"NaN"!==parseFloat(a)||(a=1),$j(this).is(".plus")?o&&(o==t||o<t)?e.val(o):e.val(t+parseFloat(a)):i&&(i==t||t<i)?e.val(i):0<t&&e.val(t-parseFloat(a)),e.trigger("change")})}function qodeInitSingleProductLightbox(){var e=$j(".woocommerce.single-product .product .images .woocommerce-product-gallery__image");e.length&&e.each(function(){$j(this).children("a").attr("data-rel","prettyPhoto[woo_single_pretty_photo]"),$j("a[data-rel]").each(function(){$j(this).attr("rel",$j(this).data("rel"))}),$j("a[rel^='prettyPhoto']").prettyPhoto({animation_speed:"normal",slideshow:!1,autoplay_slideshow:!1,opacity:.8,show_title:!0,allow_resize:!0,horizontal_padding:0,default_width:650,default_height:400,counter_separator_label:"/",theme:"pp_default",hideflash:!1,wmode:"opaque",autoplay:!0,modal:!1,overlay_gallery:!1,keyboard_shortcuts:!0,deeplinking:!1,social_tools:!1})})}function qodeInitProductListMasonryPinterestShortcode(){var e=$j(".qode_product_list_masonry_holder_inner, .qode_product_list_pinterest_holder_inner");e.length&&e.waitForImages({finished:function(){setTimeout(function(){e.isotope({itemSelector:".qode_product_list_item",resizable:!1,masonry:{columnWidth:".qode_product_list_sizer",gutter:".qode_product_list_gutter"}}),e.css("opacity",1),initParallax()},200)},waitForAll:!0})}function qodeProductPinterestAddedToCartButton(){$j("body").on("added_to_cart",function(e){$j(".qode_product_list_pinterest_holder a.added_to_cart:not(.qbutton)").addClass("qbutton")})}function qodeProductElegantAddedToCartButton(){$j("body").on("added_to_cart",function(e){$j(".qode_product_list_holder .product_button a.added_to_cart:not(.qbutton)").addClass("qbutton")})}function qodeWishlistRefresh(){function e(){$j.ajax({url:QodeAdminAjax.ajaxurl,type:"POST",data:{action:"bridge_qode_product_ajax_wishlist"},success:function(e){$j(".qode-wishlist-widget-holder .qode-wishlist-items-number span").html(e.wishlist_count_products)}})}return{init:function(){qode_body.on("added_to_wishlist",function(){e()}),$j("#yith-wcwl-form").on("click",".product-remove a, .product-add-to-cart a",function(){setTimeout(function(){e()},2e3)})}}}function qodeQuickViewGallery(){return{init:function(){$j(document).on("qv_loader_stop",function(){var e;(e=$j(".qode-quick-view-gallery.qode-owl-slider")).length&&e.each(function(){var e=$j(this);e.owlCarousel({items:1,loop:!0,autoplay:!1,smartSpeed:600,margin:0,center:!1,autoWidth:!1,animateIn:!1,animateOut:!1,dots:!1,nav:!0,navText:['<span class="qode-prev-icon"><span class="fa fa-angle-left"></span></span>','<span class="qode-next-icon"><span class="fa fa-angle-right"></span></span>'],onInitialize:function(){e.css("visibility","visible")}})}),$j(".yith-wcqv-wrapper").css("top",$scroll+20)})}}}function qodeQuickViewSelect2(){$j(document).on("qv_loader_stop",function(){$j("#yith-quick-view-modal select").select2()})}function qodeProductImageSizes(e){var t=e.find(".qode-pl-sizer").width(),o=e.find(".qode-woo-image-normal-width"),i=e.find(".qode-woo-image-large-width"),a=e.find(".qode-woo-image-large-height"),n=e.find(".qode-woo-image-large-width-height");e.find(".qode-landscape-size").length&&(t*=.8),o.css("height",t),(600<$window_width?(n.css("height",Math.round(2*t)),a.css("height",Math.round(2*t)),i):(n.css("height",t),a)).css("height",t)}function qodeInitProductListMasonryShortcode(){var e=$j(".qode-pl-holder.qode-masonry-layout .qode-pl-outer");e.length&&e.each(function(){var e=$j(this);qodeProductImageSizes(e),e.waitForImages(function(){e.isotope({itemSelector:".qode-pli",resizable:!1,layoutMode:"packery",masonry:{columnWidth:".qode-pl-sizer",gutter:".qode-pl-gutter"}}),e.isotope("layout"),e.css("opacity",1)})})}function qodeInitProductListFilter(){function t(t){t.find(".qode-pl-categories a, .qode-pl-ordering a").on("click",function(e){e.preventDefault(),e.stopPropagation();var o,i,a,n,e=$j(this);e.hasClass("active")||(i=e,a=(o=t).find(".qode-pl-outer"),e=qode.modules.common.getLoadMoreData(o),n=o.find(".qode-prl-loading"),c(d,i.data()),e.category=void 0!==d.category?d.category:"",e.metaKey=void 0!==d.metaKey?d.metaKey:"",e.order=void 0!==d.order?d.order:"",e.orderby=void 0!==d.orderby?d.orderby:"",e.minPrice=void 0!==d.minprice?d.minprice:"",e.maxPrice=void 0!==d.maxprice?d.maxprice:"",e.categoryNonce=void 0!==i.parents(".qode-pl-categories-nonce-holder").data("nonce")?i.parents("ul").data("nonce"):"",n.fadeIn(),e=qode.modules.common.setLoadMoreAjaxData(e,"bridge_qode_product_ajax_load_category"),$j.ajax({type:"POST",data:e,url:QodeAdminAjax.ajaxurl,success:function(e){var t=$j.parseJSON(e).html;o.waitForImages(function(){i.parent().siblings().find("a").removeClass("active"),i.addClass("active"),(o.hasClass("qode-masonry-layout")?s:r)(a,n,t),qodeAddingToCart(),qodeAddingToWishlist()})}}))})}function o(e,t){e.on("click",function(){qode.windowWidth<=768&&(e.hasClass("opened")?(e.removeClass("opened"),t.slideUp()):(e.addClass("opened"),t.slideDown()))})}var e=$j(".qode-pl-holder"),d={},r=function(e,t,o){e.html(o),t.fadeOut()},s=function(e,t,o){e.find(".qode-pli").remove(),e.append(o).isotope("reloadItems").isotope({sortBy:"original-order"}),qodeProductImageSizes(e),setTimeout(function(){e.isotope("layout"),t.fadeOut()},400)},c=function(e,t){for(var o in t)e[o]=t[o];switch(e.ordering){case"menu_order":e.metaKey="",e.order="asc",e.orderby="menu_order title";break;case"popularity":e.metaKey="total_sales",e.order="desc",e.orderby="meta_value_num";break;case"rating":e.metaKey="_wc_average_rating",e.order="desc",e.orderby="meta_value_num";break;case"newness":e.metaKey="",e.order="desc",e.orderby="date";break;case"price":e.metaKey="_price",e.order="asc",e.orderby="meta_value_num";break;case"price-desc":e.metaKey="_price",e.order="desc",e.orderby="meta_value_num"}return e};return{init:function(){e.length&&e.each(function(){var e=$j(this);t(e),o(e.find(".qode-pl-ordering-outer h6"),e.find(".qode-pl-ordering")),o(e.find(".qode-pl-categories-label"),e.find(".qode-pl-categories-label").next("ul"))})}}}function qodeAddingToCart(){var e=$j(".qode-pli-add-to-cart .add_to_cart_button");e.length&&e.on("click",function(){$j(this).parents(".product-type-variable").length||$j(this).parents(".product-type-external").length||$j(this).parents(".product-type-grouped").length||$j(this).text(qodeGlobalVars.vars.qodeAddingToCartLabel)})}function qodeAddingToWishlist(){var e=$j(".add_to_wishlist");e.length&&e.on("click",function(){var e,t,o,i=$j(this);i.closest(".qode-pli").length?o=i.closest(".qode-pli"):i.closest(".qode-plc-item").length?o=i.closest(".qode-plc-item"):i.closest(".product").length&&(o=i.closest(".product")),e=o.find("img").offset(),t=o.find("img").height()/2,o=o.find("img").width()/2,$j("#yith-wcwl-popup-message").css({top:e.top+t,left:e.left+o}),i.addClass("qode-adding-to-wishlist"),$j(document).on("added_to_wishlist",function(){i.removeClass("qode-adding-to-wishlist"),setTimeout(function(){var e=$j("#yith-wcwl-popup-message");e.stop().addClass("qode-wishlist-vanish-out"),e.one("webkitAnimationEnd oanimationend msAnimationEnd animationend",function(){e.removeClass("qode-wishlist-vanish-out")})},1e3)})})}function qodeOpenSingleProductReviewsAccordion(){var e,t,o=$j(".qode-single-product-summary");o.length&&(e=o.find(".woocommerce-review-link"),t=o.find(".reviews_tab"),e.length)&&t.length&&e.on("click",function(){t.hasClass("ui-state-active")||t.trigger("click")})}$j(document).ready(function(){$j(".price_slider_wrapper").parents(".widget").addClass("widget_price_filter"),initSelect2(),initAddToCartPlusMinus(),qodeInitProductListMasonryPinterestShortcode(),qodeProductPinterestAddedToCartButton(),qodeProductElegantAddedToCartButton(),qodeInitSingleProductLightbox(),qodeWishlistRefresh().init(),qodeQuickViewGallery().init(),qodeQuickViewSelect2(),qodeInitProductListMasonryShortcode(),qodeInitProductListFilter().init(),qodeAddingToCart(),qodeAddingToWishlist(),$j(document).on("qodeAjaxPageLoad",function(){qodeInitProductListMasonryPinterestShortcode()}),qodeOpenSingleProductReviewsAccordion()});