/** * @collection Convert * @version 1.1.2 * @author Netzee * @site https://www.netzee.com.br */ (function(e){let t={galleries:{thumbs:null,main:null,fixed:null},createSlide:function(){this.galleries.thumbs=new Swiper(".nav-swiper",{direction:"vertical",slidesPerView:4,updateOnWindowResize:!0,watchSlidesProgress:!0,watchSlidesVisibility:!0,lazy:{loadPrevNext:!0},navigation:{nextEl:".product-next",prevEl:".product-prev"}}),this.galleries.main=new Swiper(".featured-swiper",{slidesPerView:1,keyboard:!0,lazy:{loadPrevNext:!0},pagination:{clickable:!0,el:document.querySelector(".featured-swiper .swiper-pagination")},navigation:{nextEl:".product-mob-next",prevEl:".product-mob-prev"},thumbs:{autoScrollOffset:3,multipleActiveThumbs:!1,swiper:this.galleries.thumbs}}),this.galleries.fixed=new Swiper(".slide-fixed",{speed:0,loopedSlides:1,lazy:{loadPrevNext:!0},navigation:{nextEl:".fixed-next",prevEl:".fixed-prev"}}),e(".featured-swiper .click-to-zoom").on("click",function(){let r=e(".featured-swiper .swiper-slide.swiper-slide-active").data("index");e(".fixed-modal").addClass("active"),t.galleries.fixed.slideTo(r,0,!1)}),e(".nav-swiper .swiper-slide").on("focusin",function(){t.galleries.thumbs.slideTo(e(this).data("index")),t.galleries.main.slideTo(e(this).data("index"))})},variantImage:function(e){jQuery.ajax({method:"get",url:e,success:function(e){if(e.Variant.VariantImage&&e.Variant.VariantImage.length){if(-1===e.Variant.VariantImage[0].https.indexOf("variacao_"))return;t.resetSlider(e.Variant.VariantImage)}}})},resetSlider:function(t){if(void 0!==this.galleries.thumbs){this.galleries.thumbs.destroy(),this.galleries.main.destroy(),this.galleries.fixed.destroy(),jQuery(".gallery .swiper-slide, .fixed-modal .swiper-slide").each(function(){jQuery(this).remove()});let r="",a="";e.each(t,function(){r+=`\n
\n image\n
\n `,a+=`\n
\n image\n
\n `}),jQuery(".gallery .featured-swiper .swiper-wrapper,.fixed-modal .swiper-wrapper").html(r),jQuery(".gallery .nav-swiper .swiper-wrapper").html(a),this.createSlide()}},fixedModal:function(){e(".fixed-modal .exit, .fixed-modal .shad").on("click",function(){e(".fixed-modal").removeClass("active")})},forVisited:function(e){var r=[],a=0;e.forEach(function(i){jQuery.ajax({method:"GET",url:"/web_api/products/"+i.id,success:function(i){if(i.Product&&r.push(i),a++,e.length==a)return t.appendVisited(r)},error:function(i){var o=JSON.parse(i.responseText);if("Nenhum registro encontrado"==o.name){var s=o.url.replace(/\D/g,""),n=e.filter(function(e){if(e.id!=Number(s))return e});localStorage.setItem("visited",JSON.stringify(n))}if(a++,e.length==a)return t.appendVisited(r)}})})},appendVisited:function(e){var t='
{name}
{boxPrice}
',r='
{price}
',a='
{before} {price}
{payment}
',i=jQuery(".visited-section .list-append"),o="";e.forEach(function(e){var i=e.Product,s=t.replace(/{link}/g,i.url.https).replace(/{image}/g,i.ProductImage[0].https).replace(/{name}/g,i.name),n=Number(i.promotional_price);s=i.available&&Number(i.price)?s.replace("{boxPrice}",a.replace("{before}",n?r.replace("{price}",toReal(Number(i.price),"R$")):"").replace("{price}",n?toReal(n,"R$"):toReal(Number(i.price),"R$"))).replace("{payment}",i.payment_option_html):s.replace("{boxPrice}",i.available?'

Sob Consulta

':'

Indisponível

'),o+='
'+s+"
"});var s='
'+o+"
";i.append(s);new LazyLoad({elements_selector:".list-append",threshold:300,callback_enter:function(e){var t=e.querySelectorAll(".item").length;new Swiper(e.querySelector(".swiper-container"),{slidesPerView:4,lazy:{loadPrevNext:!1},navigation:{nextEl:e.querySelector(".next"),prevEl:e.querySelector(".prev")},loop:t>4,breakpoints:{0:{slidesPerView:1,loop:t>1},320:{slidesPerView:2,loop:t>2},640:{slidesPerView:3,loop:t>3},1024:{slidesPerView:4,loop:t>4}}})}})},productVisitedNew:function(){var e=jQuery("#form_comprar").data("id"),r=localStorage.getItem("visited"),a=[];r&&(a=JSON.parse(r).reverse()),setTimeout(function(){a.length?t.forVisited(a):jQuery(".visited-section").remove()},500),10==a.length&&(a.pop(),a.reverse());var i=!0;if(a.forEach(function(t){t.id==e&&(i=!1)}),i&&!jQuery("#form_comprar").hasClass("unavailable")){a.push({id:e});var o=JSON.stringify(a);localStorage.setItem("visited",o)}},shipping:function(){jQuery(".crazy_cep").mask("00000-000");var e=1;jQuery(".new-frete").on("submit",function(t){t.preventDefault(),jQuery("#quant:visible").is(":visible")&&(e=jQuery("#quant:visible").val());var r=jQuery("#shippingSimulatorButton").attr("data-url"),a=jQuery(this).find("input").val().split("-"),i=jQuery("#product-container").find("#selectedVariant").val()?jQuery("#product-container").find("#selectedVariant").val():0;r=r.replace("cep1=%s","cep1="+a[0]).replace("cep2=%s","cep2="+a[1]).replace("acao=%s","acao="+i).replace("dade=%s","dade="+e),""!==jQuery("#selectedVariant").val()?(jQuery(".box-frete .result").html('
'),jQuery.ajax({method:"GET",url:r,success:function(e){jQuery(".box-frete .result").html(e),jQuery(".box-frete .result").find("table:first, p").remove(),jQuery(".box-frete .result").find("img").parent().remove(),jQuery(".box-frete .result").find("th:last").text("Prazo:"),jQuery(".box-frete .result").find('th[colspan="2"]').removeAttr("colspan"),jQuery(".box-frete .result").find("[width]").removeAttr("width"),1==jQuery(".box-frete .result").find("tr").length&&(jQuery(".box-frete .result").find("tr").after('Não foi encontrado formas de envio para o CEP'),jQuery(".box-frete .result").find("tr:first").remove())}})):jQuery(".box-frete .result").html("Escolha uma variação")})},productVariant:function(){this.tabs(),jQuery(".compreJunto form .fotosCompreJunto").append('
=
'),jQuery(".box-variants").on("click",".lista_cor_variacao li[data-id]",function(){var e="/web_api/variants/"+jQuery(this).data("id");t.variantImage(e)}),jQuery(".box-variants").on("click",".lista-radios-input",function(){var e="/web_api/variants/"+jQuery(this).find("input").val();t.variantImage(e)}),jQuery(".box-variants").on("change","select",function(){var e="/web_api/variants/"+jQuery(this).val();t.variantImage(e)}),jQuery(".produto img").each(function(){jQuery(this).attr("src",jQuery(this).attr("src").replace("/90_","/"));var e="";""!==jQuery(this).parent().attr("href")&&(e='href="'+jQuery(this).parent().attr("href")+'"'),jQuery(this).parents("span").after("'+jQuery(this).attr("alt")+"")}),jQuery(".page-product").on("click","#detalhes_formas",function(){var e=jQuery("#form_comprar").data("id"),t=jQuery("#preco_atual").val(),r="/mvc/store/product/payment_options_details?loja="+theme.storeId()+"&IdProd="+e+"&preco="+t;jQuery(".payment-modal").addClass("active"),jQuery(".payment-modal .append").html('
'),jQuery.ajax({method:"GET",url:r,success:function(e){jQuery(".payment-modal .append").html(e).find(".tablePage").wrap('
')}})}),jQuery("#form_comprar").on("submit",function(){if(!jQuery(".labelMultiVariacao").length&&jQuery("#selectedVariant").length&&!jQuery("#selectedVariant").val())return jQuery("#span_erro_carrinho").css("display","block"),!1;if(jQuery(this).hasClass("is-kit")){let e=!1;if(jQuery(this).find('input[type="hidden"][name="variants_kit[]"]').each(function(t,r){if(""===jQuery(r).val())return jQuery("#span_erro_carrinho").css("display","block"),e=!0,!1}),e)return!1}jQuery("#loading-product-container").show(),jQuery("body").removeClass("modal-open").removeAttr("style"),jQuery("body").find(".modal-backdrop").remove();var e=setInterval(function(){jQuery("body").find(".modal-backdrop").remove(),jQuery(".cart-preview-loading-modal").hasClass("tray-hide")&&(cart.showCart(),jQuery("#loading-product-container").hide(),jQuery("body").find(".botao-continuar-comprando .botao-commerce-img").trigger("click"),clearInterval(e))},50)}),jQuery(".compreJunto").on("submit",function(){var e=jQuery(this);if(!e.find(".blocoAlerta").is(":visible")){jQuery("#loading-product-comprejunto").show(),jQuery("body").removeClass("modal-open").removeAttr("style"),jQuery("body").find(".modal-backdrop").remove();var t=setInterval(function(){jQuery(".cart-preview-loading-modal").hasClass("tray-hide")&&(jQuery("#loading-product-comprejunto").hide(),jQuery("body").find(".botao-continuar-comprando .botao-commerce-img").trigger("click"),clearInterval(t))},50)}});var e=jQuery("#variation_second_select").prev(),r=jQuery('[data-tray-tst="variation_first_select"]');e.is(":visible")&&!r.val()&&e.hide(),r.on("change",function(){e.show()})},tabs:function(){if(jQuery('[data-id*="AbaPersonalizada"]').each(function(){var e=jQuery(this).data("id");jQuery(e).removeAttr("style").appendTo(jQuery(this))}),jQuery(".section-box.comments").length){jQuery(".section-box.comments").appendTo(".comments-modal .append"),jQuery(".section-box.comments #comentario_cliente").wrap('
');let e=jQuery(".section-box.comments .comments-form").detach();jQuery(".section-box.comments").wrapInner('
'),jQuery(".section-box.comments").append(e),jQuery(".section-box.comments .customer-comments .tray-hide").remove(),jQuery(".section-box.comments .customer-comments br").remove(),jQuery(".section-box.comments .customer-comments .line").remove(),jQuery(".section-box.comments .customer-comments .title-section").removeClass("title-section").addClass("title-section-comments"),jQuery(".section-box.comments .customer-comments .title-section-comments + h2.color").detach().prependTo(".section-box.comments .comments-form"),jQuery(".section-box.comments .customer-comments h2.color").remove(),jQuery(".section-box.comments .customer-comments .blocoSucesso").detach().appendTo(".section-box.comments .comments-form"),jQuery(".section-box.comments .customer-comments .title-section-comments").detach().prependTo(".section-box.comments"),jQuery(".section-box.comments .comments-form br").remove();let t=jQuery(".section-box.comments .comments-form #form-comments h5").html().replace("- Máximo","Máximo");jQuery(".section-box.comments .comments-form #form-comments h5").html(t),jQuery(".section-box.comments .comments-form h2").html("Deixe sua avaliação sobre esse produto"),0===jQuery(".section-box.comments .customer-comments").children().length&&jQuery(".section-box.comments .customer-comments").html('Nenhuma avaliação disponível. Seja o primeiro a avaliar.')}jQuery(".list-star.cursor").on("click",function(){jQuery(".comments-modal").addClass("active")}),jQuery(".ranking .rating").each(function(){var e=Number(jQuery(this).attr("class").replace(/[^0-9]/g,""));for(i=1;i<=5;i++)i<=e?jQuery(this).append('
'):jQuery(this).append('
')}),jQuery("#downloads").length&&jQuery.get(jQuery("#downloads").data("url"),function(e){jQuery("#downloads").html(e)})},incrementPage:function(){this.templateIncrement(),jQuery(".increment-page").on("click",".low",function(){var e=jQuery(".page-product").find("#quantidade #quant");e.val(1==parseInt(e.val())?1:parseInt(e.val())-1)});var e=jQuery(".value-max-stock").attr("data-variant");if(0==e){var t=jQuery(".page-product").find("#quantidade #quant"),r=parseInt(jQuery(".value-max-stock").text());jQuery(".increment-page").on("click",".add",function(){var e=parseInt(t.val());e\t\t\t\t\t\t\t\t\t\t \t\t\t\t')},validEvaluation:function(){jQuery(".comments-form .botao-commerce").on("click",function(){if(!jQuery(".stars .starn.star-on").length){var e="Avaliação do produto obrigatória, dê sua avaliação por favor";jQuery(".comments-form .blocoAlerta").text(e).addClass("show-message"),setTimeout(()=>{jQuery(".blocoAlerta.show-message").removeClass("show-message")},5e3)}})}};t.productVisitedNew(),t.shipping(),t.createSlide(),t.productVariant(),t.fixedModal(),t.incrementPage(),t.validEvaluation()})(jQuery);