").html(e).find(t.opts.filter))),t.$slide.one("onReset",function(){n(this).find("video,audio").trigger("pause"),t.$placeholder&&(t.$placeholder.after(e.removeClass("fancybox-content").hide()).remove(),t.$placeholder=null),t.$smallBtn&&(t.$smallBtn.remove(),t.$smallBtn=null),t.hasError||(n(this).empty(),t.isLoaded=!1,t.isRevealed=!1)}),n(e).appendTo(t.$slide),n(e).is("video,audio")&&(n(e).addClass("fancybox-video"),n(e).wrap("
"),t.contentType="video",t.opts.width=t.opts.width||n(e).attr("width"),t.opts.height=t.opts.height||n(e).attr("height")),t.$content=t.$slide.children().filter("div,form,main,video,audio,article,.fancybox-content").first(),t.$content.siblings().hide(),t.$content.length||(t.$content=t.$slide.wrapInner("
").children().first()),t.$content.addClass("fancybox-content"),t.$slide.addClass("fancybox-slide--"+t.contentType),o.afterLoad(t))},setError:function(t){t.hasError=!0,t.$slide.trigger("onReset").removeClass("fancybox-slide--"+t.contentType).addClass("fancybox-slide--error"),t.contentType="html",this.setContent(t,this.translate(t,t.opts.errorTpl)),t.pos===this.currPos&&(this.isAnimating=!1)},showLoading:function(t){var e=this;(t=t||e.current)&&!t.$spinner&&(t.$spinner=n(e.translate(e,e.opts.spinnerTpl)).appendTo(t.$slide).hide().fadeIn("fast"))},hideLoading:function(t){var e=this;(t=t||e.current)&&t.$spinner&&(t.$spinner.stop().remove(),delete t.$spinner)},afterLoad:function(t){var e=this;e.isClosing||(t.isLoading=!1,t.isLoaded=!0,e.trigger("afterLoad",t),e.hideLoading(t),!t.opts.smallBtn||t.$smallBtn&&t.$smallBtn.length||(t.$smallBtn=n(e.translate(t,t.opts.btnTpl.smallBtn)).appendTo(t.$content)),t.opts.protect&&t.$content&&!t.hasError&&(t.$content.on("contextmenu.fb",function(t){return 2==t.button&&t.preventDefault(),!0}),"image"===t.type&&n('
').appendTo(t.$content)),e.adjustCaption(t),e.adjustLayout(t),t.pos===e.currPos&&e.updateCursor(),e.revealContent(t))},adjustCaption:function(t){var e,n=this,o=t||n.current,i=o.opts.caption,a=o.opts.preventCaptionOverlap,s=n.$refs.caption,r=!1;s.toggleClass("fancybox-caption--separate",a),a&&i&&i.length&&(o.pos!==n.currPos?(e=s.clone().appendTo(s.parent()),e.children().eq(0).empty().html(i),r=e.outerHeight(!0),e.empty().remove()):n.$caption&&(r=n.$caption.outerHeight(!0)),o.$slide.css("padding-bottom",r||""))},adjustLayout:function(t){var e,n,o,i,a=this,s=t||a.current;s.isLoaded&&!0!==s.opts.disableLayoutFix&&(s.$content.css("margin-bottom",""),s.$content.outerHeight()>s.$slide.height()+.5&&(o=s.$slide[0].style["padding-bottom"],i=s.$slide.css("padding-bottom"),parseFloat(i)>0&&(e=s.$slide[0].scrollHeight,s.$slide.css("padding-bottom",0),Math.abs(e-s.$slide[0].scrollHeight)<1&&(n=i),s.$slide.css("padding-bottom",o))),s.$content.css("margin-bottom",n))},revealContent:function(t){var e,o,i,a,s=this,r=t.$slide,c=!1,l=!1,d=s.isMoved(t),u=t.isRevealed;return t.isRevealed=!0,e=t.opts[s.firstRun?"animationEffect":"transitionEffect"],i=t.opts[s.firstRun?"animationDuration":"transitionDuration"],i=parseInt(void 0===t.forcedDuration?i:t.forcedDuration,10),!d&&t.pos===s.currPos&&i||(e=!1),"zoom"===e&&(t.pos===s.currPos&&i&&"image"===t.type&&!t.hasError&&(l=s.getThumbPos(t))?c=s.getFitPos(t):e="fade"),"zoom"===e?(s.isAnimating=!0,c.scaleX=c.width/l.width,c.scaleY=c.height/l.height,a=t.opts.zoomOpacity,"auto"==a&&(a=Math.abs(t.width/t.height-l.width/l.height)>.1),a&&(l.opacity=.1,c.opacity=1),n.fancybox.setTranslate(t.$content.removeClass("fancybox-is-hidden"),l),p(t.$content),void n.fancybox.animate(t.$content,c,i,function(){s.isAnimating=!1,s.complete()})):(s.updateSlide(t),e?(n.fancybox.stop(r),o="fancybox-slide--"+(t.pos>=s.prevPos?"next":"previous")+" fancybox-animated fancybox-fx-"+e,r.addClass(o).removeClass("fancybox-slide--current"),t.$content.removeClass("fancybox-is-hidden"),p(r),"image"!==t.type&&t.$content.hide().show(0),void n.fancybox.animate(r,"fancybox-slide--current",i,function(){r.removeClass(o).css({transform:"",opacity:""}),t.pos===s.currPos&&s.complete()},!0)):(t.$content.removeClass("fancybox-is-hidden"),u||!d||"image"!==t.type||t.hasError||t.$content.hide().fadeIn("fast"),void(t.pos===s.currPos&&s.complete())))},getThumbPos:function(t){var e,o,i,a,s,r=!1,c=t.$thumb;return!(!c||!g(c[0]))&&(e=n.fancybox.getTranslate(c),o=parseFloat(c.css("border-top-width")||0),i=parseFloat(c.css("border-right-width")||0),a=parseFloat(c.css("border-bottom-width")||0),s=parseFloat(c.css("border-left-width")||0),r={top:e.top+o,left:e.left+s,width:e.width-i-s,height:e.height-o-a,scaleX:1,scaleY:1},e.width>0&&e.height>0&&r)},complete:function(){var t,e=this,o=e.current,i={};!e.isMoved()&&o.isLoaded&&(o.isComplete||(o.isComplete=!0,o.$slide.siblings().trigger("onReset"),e.preload("inline"),p(o.$slide),o.$slide.addClass("fancybox-slide--complete"),n.each(e.slides,function(t,o){o.pos>=e.currPos-1&&o.pos<=e.currPos+1?i[o.pos]=o:o&&(n.fancybox.stop(o.$slide),o.$slide.off().remove())}),e.slides=i),e.isAnimating=!1,e.updateCursor(),e.trigger("afterShow"),o.opts.video.autoStart&&o.$slide.find("video,audio").filter(":visible:first").trigger("play").one("ended",function(){this.webkitExitFullscreen&&this.webkitExitFullscreen(),e.next()}),o.opts.autoFocus&&"html"===o.contentType&&(t=o.$content.find("input[autofocus]:enabled:visible:first"),t.length?t.trigger("focus"):e.focus(null,!0)),o.$slide.scrollTop(0).scrollLeft(0))},preload:function(t){var e,n,o=this;o.group.length<2||(n=o.slides[o.currPos+1],e=o.slides[o.currPos-1],e&&e.type===t&&o.loadSlide(e),n&&n.type===t&&o.loadSlide(n))},focus:function(t,o){var i,a,s=this,r=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"])'].join(",");s.isClosing||(i=!t&&s.current&&s.current.isComplete?s.current.$slide.find("*:visible"+(o?":not(.fancybox-close-small)":"")):s.$refs.container.find("*:visible"),i=i.filter(r).filter(function(){return"hidden"!==n(this).css("visibility")&&!n(this).hasClass("disabled")}),i.length?(a=i.index(e.activeElement),t&&t.shiftKey?(a<0||0==a)&&(t.preventDefault(),i.eq(i.length-1).trigger("focus")):(a<0||a==i.length-1)&&(t&&t.preventDefault(),i.eq(0).trigger("focus"))):s.$refs.container.trigger("focus"))},activate:function(){var t=this;n(".fancybox-container").each(function(){var e=n(this).data("FancyBox");e&&e.id!==t.id&&!e.isClosing&&(e.trigger("onDeactivate"),e.removeEvents(),e.isVisible=!1)}),t.isVisible=!0,(t.current||t.isIdle)&&(t.update(),t.updateControls()),t.trigger("onActivate"),t.addEvents()},close:function(t,e){var o,i,a,s,r,c,l,u=this,f=u.current,h=function(){u.cleanUp(t)};return!u.isClosing&&(u.isClosing=!0,!1===u.trigger("beforeClose",t)?(u.isClosing=!1,d(function(){u.update()}),!1):(u.removeEvents(),a=f.$content,o=f.opts.animationEffect,i=n.isNumeric(e)?e:o?f.opts.animationDuration:0,f.$slide.removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),!0!==t?n.fancybox.stop(f.$slide):o=!1,f.$slide.siblings().trigger("onReset").remove(),i&&u.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing").css("transition-duration",i+"ms"),u.hideLoading(f),u.hideControls(!0),u.updateCursor(),"zoom"!==o||a&&i&&"image"===f.type&&!u.isMoved()&&!f.hasError&&(l=u.getThumbPos(f))||(o="fade"),"zoom"===o?(n.fancybox.stop(a),s=n.fancybox.getTranslate(a),c={top:s.top,left:s.left,scaleX:s.width/l.width,scaleY:s.height/l.height,width:l.width,height:l.height},r=f.opts.zoomOpacity,"auto"==r&&(r=Math.abs(f.width/f.height-l.width/l.height)>.1),r&&(l.opacity=0),n.fancybox.setTranslate(a,c),p(a),n.fancybox.animate(a,l,i,h),!0):(o&&i?n.fancybox.animate(f.$slide.addClass("fancybox-slide--previous").removeClass("fancybox-slide--current"),"fancybox-animated fancybox-fx-"+o,i,h):!0===t?setTimeout(h,i):h(),!0)))},cleanUp:function(e){var o,i,a,s=this,r=s.current.opts.$orig;s.current.$slide.trigger("onReset"),s.$refs.container.empty().remove(),s.trigger("afterClose",e),s.current.opts.backFocus&&(r&&r.length&&r.is(":visible")||(r=s.$trigger),r&&r.length&&(i=t.scrollX,a=t.scrollY,r.trigger("focus"),n("html, body").scrollTop(a).scrollLeft(i))),s.current=null,o=n.fancybox.getInstance(),o?o.activate():(n("body").removeClass("fancybox-active compensate-for-scrollbar"),n("#fancybox-style-noscroll").remove())},trigger:function(t,e){var o,i=Array.prototype.slice.call(arguments,1),a=this,s=e&&e.opts?e:a.current;if(s?i.unshift(s):s=a,i.unshift(a),n.isFunction(s.opts[t])&&(o=s.opts[t].apply(s,i)),!1===o)return o;"afterClose"!==t&&a.$refs?a.$refs.container.trigger(t+".fb",i):r.trigger(t+".fb",i)},updateControls:function(){var t=this,o=t.current,i=o.index,a=t.$refs.container,s=t.$refs.caption,r=o.opts.caption;o.$slide.trigger("refresh"),r&&r.length?(t.$caption=s,s.children().eq(0).html(r)):t.$caption=null,t.hasHiddenControls||t.isIdle||t.showControls(),a.find("[data-fancybox-count]").html(t.group.length),a.find("[data-fancybox-index]").html(i+1),a.find("[data-fancybox-prev]").prop("disabled",!o.opts.loop&&i<=0),a.find("[data-fancybox-next]").prop("disabled",!o.opts.loop&&i>=t.group.length-1),"image"===o.type?a.find("[data-fancybox-zoom]").show().end().find("[data-fancybox-download]").attr("href",o.opts.image.src||o.src).show():o.opts.toolbar&&a.find("[data-fancybox-download],[data-fancybox-zoom]").hide(),n(e.activeElement).is(":hidden,[disabled]")&&t.$refs.container.trigger("focus")},hideControls:function(t){var e=this,n=["infobar","toolbar","nav"];!t&&e.current.opts.preventCaptionOverlap||n.push("caption"),this.$refs.container.removeClass(n.map(function(t){return"fancybox-show-"+t}).join(" ")),this.hasHiddenControls=!0},showControls:function(){var t=this,e=t.current?t.current.opts:t.opts,n=t.$refs.container;t.hasHiddenControls=!1,t.idleSecondsCounter=0,n.toggleClass("fancybox-show-toolbar",!(!e.toolbar||!e.buttons)).toggleClass("fancybox-show-infobar",!!(e.infobar&&t.group.length>1)).toggleClass("fancybox-show-caption",!!t.$caption).toggleClass("fancybox-show-nav",!!(e.arrows&&t.group.length>1)).toggleClass("fancybox-is-modal",!!e.modal)},toggleControls:function(){this.hasHiddenControls?this.showControls():this.hideControls()}}),n.fancybox={version:"3.5.6",defaults:a,getInstance:function(t){var e=n('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),o=Array.prototype.slice.call(arguments,1);return e instanceof b&&("string"===n.type(t)?e[t].apply(e,o):"function"===n.type(t)&&t.apply(e,o),e)},open:function(t,e,n){return new b(t,e,n)},close:function(t){var e=this.getInstance();e&&(e.close(),!0===t&&this.close(t))},destroy:function(){this.close(!0),r.add("body").off("click.fb-start","**")},isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),use3d:function(){var n=e.createElement("div");return t.getComputedStyle&&t.getComputedStyle(n)&&t.getComputedStyle(n).getPropertyValue("transform")&&!(e.documentMode&&e.documentMode<11)}(),getTranslate:function(t){var e;return!(!t||!t.length)&&(e=t[0].getBoundingClientRect(),{top:e.top||0,left:e.left||0,width:e.width,height:e.height,opacity:parseFloat(t.css("opacity"))})},setTranslate:function(t,e){var n="",o={};if(t&&e)return void 0===e.left&&void 0===e.top||(n=(void 0===e.left?t.position().left:e.left)+"px, "+(void 0===e.top?t.position().top:e.top)+"px",n=this.use3d?"translate3d("+n+", 0px)":"translate("+n+")"),void 0!==e.scaleX&&void 0!==e.scaleY?n+=" scale("+e.scaleX+", "+e.scaleY+")":void 0!==e.scaleX&&(n+=" scaleX("+e.scaleX+")"),n.length&&(o.transform=n),void 0!==e.opacity&&(o.opacity=e.opacity),void 0!==e.width&&(o.width=e.width),void 0!==e.height&&(o.height=e.height),t.css(o)},animate:function(t,e,o,i,a){var s,r=this;n.isFunction(o)&&(i=o,o=null),r.stop(t),s=r.getTranslate(t),t.on(f,function(c){(!c||!c.originalEvent||t.is(c.originalEvent.target)&&"z-index"!=c.originalEvent.propertyName)&&(r.stop(t),n.isNumeric(o)&&t.css("transition-duration",""),n.isPlainObject(e)?void 0!==e.scaleX&&void 0!==e.scaleY&&r.setTranslate(t,{top:e.top,left:e.left,width:s.width*e.scaleX,height:s.height*e.scaleY,scaleX:1,scaleY:1}):!0!==a&&t.removeClass(e),n.isFunction(i)&&i(c))}),n.isNumeric(o)&&t.css("transition-duration",o+"ms"),n.isPlainObject(e)?(void 0!==e.scaleX&&void 0!==e.scaleY&&(delete e.width,delete e.height,t.parent().hasClass("fancybox-slide--image")&&t.parent().addClass("fancybox-is-scaling")),n.fancybox.setTranslate(t,e)):t.addClass(e),t.data("timer",setTimeout(function(){t.trigger(f)},o+33))},stop:function(t,e){t&&t.length&&(clearTimeout(t.data("timer")),e&&t.trigger(f),t.off(f).css("transition-duration",""),t.parent().removeClass("fancybox-is-scaling"))}},n.fn.fancybox=function(t){var e;return t=t||{},e=t.selector||!1,e?n("body").off("click.fb-start",e).on("click.fb-start",e,{options:t},i):this.off("click.fb-start").on("click.fb-start",{items:this,options:t},i),this},r.on("click.fb-start","[data-fancybox]",i),r.on("click.fb-start","[data-fancybox-trigger]",function(t){n('[data-fancybox="'+n(this).attr("data-fancybox-trigger")+'"]').eq(n(this).attr("data-fancybox-index")||0).trigger("click.fb-start",{$trigger:n(this)})}),function(){var t=null;r.on("mousedown mouseup focus blur",".fancybox-button",function(e){switch(e.type){case"mousedown":t=n(this);break;case"mouseup":t=null;break;case"focusin":n(".fancybox-button").removeClass("fancybox-focus"),n(this).is(t)||n(this).is("[disabled]")||n(this).addClass("fancybox-focus");break;case"focusout":n(".fancybox-button").removeClass("fancybox-focus")}})}()}}(window,document,jQuery),function(t){"use strict";var e={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"https://www.youtube-nocookie.com/embed/$4",thumb:"https://img.youtube.com/vi/$4/hqdefault.jpg"},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/?ll="+(t[9]?t[9]+"&z="+Math.floor(t[10])+(t[12]?t[12].replace(/^\//,"&"):""):t[12]+"").replace(/\?/,"&")+"&output="+(t[12]&&t[12].indexOf("layer=c")>0?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/maps?q="+t[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}},n=function(e,n,o){if(e)return o=o||"","object"===t.type(o)&&(o=t.param(o,!0)),t.each(n,function(t,n){e=e.replace("$"+t,n||"")}),o.length&&(e+=(e.indexOf("?")>0?"&":"?")+o),e};t(document).on("objectNeedsType.fb",function(o,i,a){var s,r,c,l,d,u,f,p=a.src||"",h=!1;s=t.extend(!0,{},e,a.opts.media),t.each(s,function(e,o){if(c=p.match(o.matcher)){if(h=o.type,f=e,u={},o.paramPlace&&c[o.paramPlace]){d=c[o.paramPlace],"?"==d[0]&&(d=d.substring(1)),d=d.split("&");for(var i=0;i
1&&("youtube"===n.contentSource||"vimeo"===n.contentSource)&&o.load(n.contentSource)}})}(jQuery),function(t,e,n){"use strict";var o=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),i=function(){return t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.oCancelAnimationFrame||function(e){t.clearTimeout(e)}}(),a=function(e){var n=[];e=e.originalEvent||e||t.e,e=e.touches&&e.touches.length?e.touches:e.changedTouches&&e.changedTouches.length?e.changedTouches:[e];for(var o in e)e[o].pageX?n.push({x:e[o].pageX,y:e[o].pageY}):e[o].clientX&&n.push({x:e[o].clientX,y:e[o].clientY});return n},s=function(t,e,n){return e&&t?"x"===n?t.x-e.x:"y"===n?t.y-e.y:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)):0},r=function(t){if(t.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe')||n.isFunction(t.get(0).onclick)||t.data("selectable"))return!0;for(var e=0,o=t[0].attributes,i=o.length;ee.clientHeight,a=("scroll"===o||"auto"===o)&&e.scrollWidth>e.clientWidth;return i||a},l=function(t){for(var e=!1;;){if(e=c(t.get(0)))break;if(t=t.parent(),!t.length||t.hasClass("fancybox-stage")||t.is("body"))break}return e},d=function(t){var e=this;e.instance=t,e.$bg=t.$refs.bg,e.$stage=t.$refs.stage,e.$container=t.$refs.container,e.destroy(),e.$container.on("touchstart.fb.touch mousedown.fb.touch",n.proxy(e,"ontouchstart"))};d.prototype.destroy=function(){var t=this;t.$container.off(".fb.touch"),n(e).off(".fb.touch"),t.requestId&&(i(t.requestId),t.requestId=null),t.tapped&&(clearTimeout(t.tapped),t.tapped=null)},d.prototype.ontouchstart=function(o){var i=this,c=n(o.target),d=i.instance,u=d.current,f=u.$slide,p=u.$content,h="touchstart"==o.type;if(h&&i.$container.off("mousedown.fb.touch"),(!o.originalEvent||2!=o.originalEvent.button)&&f.length&&c.length&&!r(c)&&!r(c.parent())&&(c.is("img")||!(o.originalEvent.clientX>c[0].clientWidth+c.offset().left))){if(!u||d.isAnimating||u.$slide.hasClass("fancybox-animated"))return o.stopPropagation(),void o.preventDefault();i.realPoints=i.startPoints=a(o),i.startPoints.length&&(u.touch&&o.stopPropagation(),i.startEvent=o,i.canTap=!0,i.$target=c,i.$content=p,i.opts=u.opts.touch,i.isPanning=!1,i.isSwiping=!1,i.isZooming=!1,i.isScrolling=!1,i.canPan=d.canPan(),i.startTime=(new Date).getTime(),i.distanceX=i.distanceY=i.distance=0,i.canvasWidth=Math.round(f[0].clientWidth),i.canvasHeight=Math.round(f[0].clientHeight),i.contentLastPos=null,i.contentStartPos=n.fancybox.getTranslate(i.$content)||{top:0,left:0},i.sliderStartPos=n.fancybox.getTranslate(f),i.stagePos=n.fancybox.getTranslate(d.$refs.stage),i.sliderStartPos.top-=i.stagePos.top,i.sliderStartPos.left-=i.stagePos.left,i.contentStartPos.top-=i.stagePos.top,i.contentStartPos.left-=i.stagePos.left,n(e).off(".fb.touch").on(h?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",n.proxy(i,"ontouchend")).on(h?"touchmove.fb.touch":"mousemove.fb.touch",n.proxy(i,"ontouchmove")),n.fancybox.isMobile&&e.addEventListener("scroll",i.onscroll,!0),((i.opts||i.canPan)&&(c.is(i.$stage)||i.$stage.find(c).length)||(c.is(".fancybox-image")&&o.preventDefault(),n.fancybox.isMobile&&c.parents(".fancybox-caption").length))&&(i.isScrollable=l(c)||l(c.parent()),n.fancybox.isMobile&&i.isScrollable||o.preventDefault(),(1===i.startPoints.length||u.hasError)&&(i.canPan?(n.fancybox.stop(i.$content),i.isPanning=!0):i.isSwiping=!0,i.$container.addClass("fancybox-is-grabbing")),2===i.startPoints.length&&"image"===u.type&&(u.isLoaded||u.$ghost)&&(i.canTap=!1,i.isSwiping=!1,i.isPanning=!1,i.isZooming=!0,n.fancybox.stop(i.$content),i.centerPointStartX=.5*(i.startPoints[0].x+i.startPoints[1].x)-n(t).scrollLeft(),i.centerPointStartY=.5*(i.startPoints[0].y+i.startPoints[1].y)-n(t).scrollTop(),i.percentageOfImageAtPinchPointX=(i.centerPointStartX-i.contentStartPos.left)/i.contentStartPos.width,i.percentageOfImageAtPinchPointY=(i.centerPointStartY-i.contentStartPos.top)/i.contentStartPos.height,i.startDistanceBetweenFingers=s(i.startPoints[0],i.startPoints[1]))))}},d.prototype.onscroll=function(t){var n=this;n.isScrolling=!0,e.removeEventListener("scroll",n.onscroll,!0)},d.prototype.ontouchmove=function(t){var e=this;return void 0!==t.originalEvent.buttons&&0===t.originalEvent.buttons?void e.ontouchend(t):e.isScrolling?void(e.canTap=!1):(e.newPoints=a(t),void((e.opts||e.canPan)&&e.newPoints.length&&e.newPoints.length&&(e.isSwiping&&!0===e.isSwiping||t.preventDefault(),e.distanceX=s(e.newPoints[0],e.startPoints[0],"x"),e.distanceY=s(e.newPoints[0],e.startPoints[0],"y"),e.distance=s(e.newPoints[0],e.startPoints[0]),e.distance>0&&(e.isSwiping?e.onSwipe(t):e.isPanning?e.onPan():e.isZooming&&e.onZoom()))))},d.prototype.onSwipe=function(e){var a,s=this,r=s.instance,c=s.isSwiping,l=s.sliderStartPos.left||0;if(!0!==c)"x"==c&&(s.distanceX>0&&(s.instance.group.length<2||0===s.instance.current.index&&!s.instance.current.opts.loop)?l+=Math.pow(s.distanceX,.8):s.distanceX<0&&(s.instance.group.length<2||s.instance.current.index===s.instance.group.length-1&&!s.instance.current.opts.loop)?l-=Math.pow(-s.distanceX,.8):l+=s.distanceX),s.sliderLastPos={top:"x"==c?0:s.sliderStartPos.top+s.distanceY,left:l},s.requestId&&(i(s.requestId),s.requestId=null),s.requestId=o(function(){s.sliderLastPos&&(n.each(s.instance.slides,function(t,e){var o=e.pos-s.instance.currPos;n.fancybox.setTranslate(e.$slide,{top:s.sliderLastPos.top,left:s.sliderLastPos.left+o*s.canvasWidth+o*e.opts.gutter})}),s.$container.addClass("fancybox-is-sliding"))});else if(Math.abs(s.distance)>10){if(s.canTap=!1,r.group.length<2&&s.opts.vertical?s.isSwiping="y":r.isDragging||!1===s.opts.vertical||"auto"===s.opts.vertical&&n(t).width()>800?s.isSwiping="x":(a=Math.abs(180*Math.atan2(s.distanceY,s.distanceX)/Math.PI),s.isSwiping=a>45&&a<135?"y":"x"),"y"===s.isSwiping&&n.fancybox.isMobile&&s.isScrollable)return void(s.isScrolling=!0);r.isDragging=s.isSwiping,s.startPoints=s.newPoints,n.each(r.slides,function(t,e){var o,i;n.fancybox.stop(e.$slide),o=n.fancybox.getTranslate(e.$slide),i=n.fancybox.getTranslate(r.$refs.stage),e.$slide.css({transform:"",opacity:"","transition-duration":""}).removeClass("fancybox-animated").removeClass(function(t,e){return(e.match(/(^|\s)fancybox-fx-\S+/g)||[]).join(" ")}),e.pos===r.current.pos&&(s.sliderStartPos.top=o.top-i.top,s.sliderStartPos.left=o.left-i.left),n.fancybox.setTranslate(e.$slide,{top:o.top-i.top,left:o.left-i.left})}),r.SlideShow&&r.SlideShow.isActive&&r.SlideShow.stop()}},d.prototype.onPan=function(){var t=this;if(s(t.newPoints[0],t.realPoints[0])<(n.fancybox.isMobile?10:5))return void(t.startPoints=t.newPoints);t.canTap=!1,t.contentLastPos=t.limitMovement(),t.requestId&&i(t.requestId),t.requestId=o(function(){n.fancybox.setTranslate(t.$content,t.contentLastPos)})},d.prototype.limitMovement=function(){var t,e,n,o,i,a,s=this,r=s.canvasWidth,c=s.canvasHeight,l=s.distanceX,d=s.distanceY,u=s.contentStartPos,f=u.left,p=u.top,h=u.width,g=u.height;return i=h>r?f+l:f,a=p+d,t=Math.max(0,.5*r-.5*h),e=Math.max(0,.5*c-.5*g),n=Math.min(r-h,.5*r-.5*h),o=Math.min(c-g,.5*c-.5*g),l>0&&i>t&&(i=t-1+Math.pow(-t+f+l,.8)||0),l<0&&i0&&a>e&&(a=e-1+Math.pow(-e+p+d,.8)||0),d<0&&aa?(t=t>0?0:t,t=ts?(e=e>0?0:e,e=e1&&(o.dMs>130&&s>10||s>50);o.sliderLastPos=null,"y"==t&&!e&&Math.abs(o.distanceY)>50?(n.fancybox.animate(o.instance.current.$slide,{top:o.sliderStartPos.top+o.distanceY+150*o.velocityY,opacity:0},200),i=o.instance.close(!0,250)):r&&o.distanceX>0?i=o.instance.previous(300):r&&o.distanceX<0&&(i=o.instance.next(300)),!1!==i||"x"!=t&&"y"!=t||o.instance.centerSlide(200),o.$container.removeClass("fancybox-is-sliding")},d.prototype.endPanning=function(){var t,e,o,i=this;i.contentLastPos&&(!1===i.opts.momentum||i.dMs>350?(t=i.contentLastPos.left,e=i.contentLastPos.top):(t=i.contentLastPos.left+500*i.velocityX,e=i.contentLastPos.top+500*i.velocityY),o=i.limitPosition(t,e,i.contentStartPos.width,i.contentStartPos.height),o.width=i.contentStartPos.width,o.height=i.contentStartPos.height,n.fancybox.animate(i.$content,o,366))},d.prototype.endZooming=function(){var t,e,o,i,a=this,s=a.instance.current,r=a.newWidth,c=a.newHeight;a.contentLastPos&&(t=a.contentLastPos.left,e=a.contentLastPos.top,i={top:e,left:t,width:r,height:c,scaleX:1,scaleY:1},n.fancybox.setTranslate(a.$content,i),rs.width||c>s.height?a.instance.scaleToActual(a.centerPointStartX,a.centerPointStartY,150):(o=a.limitPosition(t,e,r,c),n.fancybox.animate(a.$content,o,150)))},d.prototype.onTap=function(e){var o,i=this,s=n(e.target),r=i.instance,c=r.current,l=e&&a(e)||i.startPoints,d=l[0]?l[0].x-n(t).scrollLeft()-i.stagePos.left:0,u=l[0]?l[0].y-n(t).scrollTop()-i.stagePos.top:0,f=function(t){var o=c.opts[t];if(n.isFunction(o)&&(o=o.apply(r,[c,e])),o)switch(o){case"close":r.close(i.startEvent);break;case"toggleControls":r.toggleControls();break;case"next":r.next();break;case"nextOrClose":r.group.length>1?r.next():r.close(i.startEvent);break;case"zoom":"image"==c.type&&(c.isLoaded||c.$ghost)&&(r.canPan()?r.scaleToFit():r.isScaledDown()?r.scaleToActual(d,u):r.group.length<2&&r.close(i.startEvent))}};if((!e.originalEvent||2!=e.originalEvent.button)&&(s.is("img")||!(d>s[0].clientWidth+s.offset().left))){if(s.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))o="Outside";else if(s.is(".fancybox-slide"))o="Slide";else{if(!r.current.$content||!r.current.$content.find(s).addBack().filter(s).length)return;o="Content"}if(i.tapped){if(clearTimeout(i.tapped),i.tapped=null,Math.abs(d-i.tapX)>50||Math.abs(u-i.tapY)>50)return this;f("dblclick"+o)}else i.tapX=d,i.tapY=u,c.opts["dblclick"+o]&&c.opts["dblclick"+o]!==c.opts["click"+o]?i.tapped=setTimeout(function(){i.tapped=null,r.isAnimating||f("click"+o)},500):f("click"+o);return this}},n(e).on("onActivate.fb",function(t,e){e&&!e.Guestures&&(e.Guestures=new d(e))}).on("beforeClose.fb",function(t,e){e&&e.Guestures&&e.Guestures.destroy()})}(window,document,jQuery),function(t,e){"use strict";e.extend(!0,e.fancybox.defaults,{btnTpl:{slideShow:''},slideShow:{autoStart:!1,speed:3e3,progress:!0}});var n=function(t){this.instance=t,this.init()};e.extend(n.prototype,{timer:null,isActive:!1,$button:null,init:function(){var t=this,n=t.instance,o=n.group[n.currIndex].opts.slideShow;t.$button=n.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){t.toggle()}),n.group.length<2||!o?t.$button.hide():o.progress&&(t.$progress=e('').appendTo(n.$refs.inner))},set:function(t){var n=this,o=n.instance,i=o.current;i&&(!0===t||i.opts.loop||o.currIndex'},fullScreen:{autoStart:!1}}),e(t).on(n.fullscreenchange,function(){var t=o.isFullscreen(),n=e.fancybox.getInstance();n&&(n.current&&"image"===n.current.type&&n.isAnimating&&(n.isAnimating=!1,n.update(!0,!0,0),n.isComplete||n.complete()),n.trigger("onFullscreenChange",t),n.$refs.container.toggleClass("fancybox-is-fullscreen",t),n.$refs.toolbar.find("[data-fancybox-fullscreen]").toggleClass("fancybox-button--fsenter",!t).toggleClass("fancybox-button--fsexit",t))})}e(t).on({"onInit.fb":function(t,e){var i;if(!n)return void e.$refs.toolbar.find("[data-fancybox-fullscreen]").remove();e&&e.group[e.currIndex].opts.fullScreen?(i=e.$refs.container,i.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(t){t.stopPropagation(),t.preventDefault(),o.toggle()}),e.opts.fullScreen&&!0===e.opts.fullScreen.autoStart&&o.request(),e.FullScreen=o):e&&e.$refs.toolbar.find("[data-fancybox-fullscreen]").hide()},"afterKeydown.fb":function(t,e,n,o,i){e&&e.FullScreen&&70===i&&(o.preventDefault(),e.FullScreen.toggle())},"beforeClose.fb":function(t,e){e&&e.FullScreen&&e.$refs.container.hasClass("fancybox-is-fullscreen")&&o.exit()}})}(document,jQuery),function(t,e){"use strict";var n="fancybox-thumbs";e.fancybox.defaults=e.extend(!0,{btnTpl:{thumbs:''},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"}},e.fancybox.defaults);var o=function(t){this.init(t)};e.extend(o.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,isActive:!1,init:function(t){var e=this,n=t.group,o=0;e.instance=t,e.opts=n[t.currIndex].opts.thumbs,t.Thumbs=e,e.$button=t.$refs.toolbar.find("[data-fancybox-thumbs]");for(var i=0,a=n.length;i1));i++);o>1&&e.opts?(e.$button.removeAttr("style").on("click",function(){e.toggle()}),e.isActive=!0):e.$button.hide()},create:function(){var t,o=this,i=o.instance,a=o.opts.parentEl,s=[];o.$grid||(o.$grid=e('').appendTo(i.$refs.container.find(a).addBack().filter(a)),o.$grid.on("click","a",function(){i.jumpTo(e(this).attr("data-index"))})),o.$list||(o.$list=e('').appendTo(o.$grid)),e.each(i.group,function(e,n){t=n.thumb,t||"image"!==n.type||(t=n.src),s.push('")}),o.$list[0].innerHTML=s.join(""),"x"===o.opts.axis&&o.$list.width(parseInt(o.$grid.css("padding-right"),10)+i.group.length*o.$list.children().eq(0).outerWidth(!0))},focus:function(t){var e,n,o=this,i=o.$list,a=o.$grid;o.instance.current&&(e=i.children().removeClass("fancybox-thumbs-active").filter('[data-index="'+o.instance.current.index+'"]').addClass("fancybox-thumbs-active"),n=e.position(),"y"===o.opts.axis&&(n.top<0||n.top>i.height()-e.outerHeight())?i.stop().animate({scrollTop:i.scrollTop()+n.top},t):"x"===o.opts.axis&&(n.left
a.scrollLeft()+(a.width()-e.outerWidth()))&&i.parent().stop().animate({scrollLeft:n.left},t))},update:function(){var t=this;t.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),t.isVisible?(t.$grid||t.create(),t.instance.trigger("onThumbsShow"),t.focus(0)):t.$grid&&t.instance.trigger("onThumbsHide"),t.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),e(t).on({"onInit.fb":function(t,e){var n;e&&!e.Thumbs&&(n=new o(e),n.isActive&&!0===n.opts.autoStart&&n.show())},"beforeShow.fb":function(t,e,n,o){var i=e&&e.Thumbs;i&&i.isVisible&&i.focus(o?0:250)},"afterKeydown.fb":function(t,e,n,o,i){var a=e&&e.Thumbs;a&&a.isActive&&71===i&&(o.preventDefault(),a.toggle())},"beforeClose.fb":function(t,e){var n=e&&e.Thumbs;n&&n.isVisible&&!1!==n.opts.hideOnClose&&n.$grid.hide()}})}(document,jQuery),function(t,e){"use strict";function n(t){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(t).replace(/[&<>"'`=\/]/g,function(t){return e[t]})}e.extend(!0,e.fancybox.defaults,{btnTpl:{share:''},share:{url:function(t,e){return!t.currentHash&&"inline"!==e.type&&"html"!==e.type&&(e.origSrc||e.src)||window.location},tpl:''}}),e(t).on("click","[data-fancybox-share]",function(){var t,o,i=e.fancybox.getInstance(),a=i.current||null;a&&("function"===e.type(a.opts.share.url)&&(t=a.opts.share.url.apply(a,[i,a])),o=a.opts.share.tpl.replace(/\{\{media\}\}/g,"image"===a.type?encodeURIComponent(a.src):"").replace(/\{\{url\}\}/g,encodeURIComponent(t)).replace(/\{\{url_raw\}\}/g,n(t)).replace(/\{\{descr\}\}/g,i.$caption?encodeURIComponent(i.$caption.text()):""),e.fancybox.open({src:i.translate(i,o),type:"html",opts:{touch:!1,animationEffect:!1,afterLoad:function(t,e){i.$refs.container.one("beforeClose.fb",function(){t.close(null,0)}),e.$content.find(".fancybox-share__button").click(function(){return window.open(this.href,"Share","width=550, height=450"),!1})},mobile:{autoFocus:!1}}}))})}(document,jQuery),function(t,e,n){"use strict";function o(){var e=t.location.hash.substr(1),n=e.split("-"),o=n.length>1&&/^\+?\d+$/.test(n[n.length-1])?parseInt(n.pop(-1),10)||1:1,i=n.join("-");return{hash:e,index:o<1?1:o,gallery:i}}function i(t){""!==t.gallery&&n("[data-fancybox='"+n.escapeSelector(t.gallery)+"']").eq(t.index-1).focus().trigger("click.fb-start")}function a(t){var e,n;return!!t&&(e=t.current?t.current.opts:t.opts,""!==(n=e.hash||(e.$orig?e.$orig.data("fancybox")||e.$orig.data("fancybox-trigger"):""))&&n)}n.escapeSelector||(n.escapeSelector=function(t){return(t+"").replace(/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t})}),n(function(){!1!==n.fancybox.defaults.hash&&(n(e).on({"onInit.fb":function(t,e){var n,i;!1!==e.group[e.currIndex].opts.hash&&(n=o(),(i=a(e))&&n.gallery&&i==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(n,o,i,s){var r;i&&!1!==i.opts.hash&&(r=a(o))&&(o.currentHash=r+(o.group.length>1?"-"+(i.index+1):""),t.location.hash!=="#"+o.currentHash&&(s&&!o.origHash&&(o.origHash=t.location.hash),o.hashTimer&&clearTimeout(o.hashTimer),o.hashTimer=setTimeout(function(){"replaceState"in t.history?(t.history[s?"pushState":"replaceState"]({},e.title,t.location.pathname+t.location.search+"#"+o.currentHash),s&&(o.hasCreatedHistory=!0)):t.location.hash=o.currentHash,o.hashTimer=null},300)))},"beforeClose.fb":function(n,o,i){i&&!1!==i.opts.hash&&(clearTimeout(o.hashTimer),o.currentHash&&o.hasCreatedHistory?t.history.back():o.currentHash&&("replaceState"in t.history?t.history.replaceState({},e.title,t.location.pathname+t.location.search+(o.origHash||"")):t.location.hash=o.origHash),o.currentHash=null)}}),n(t).on("hashchange.fb",function(){var t=o(),e=null;n.each(n(".fancybox-container").get().reverse(),function(t,o){var i=n(o).data("FancyBox");if(i&&i.currentHash)return e=i,!1}),e?e.currentHash===t.gallery+"-"+t.index||1===t.index&&e.currentHash==t.gallery||(e.currentHash=null,e.close()):""!==t.gallery&&i(t)}),setTimeout(function(){n.fancybox.getInstance()||i(o())},50))})}(window,document,jQuery),function(t,e){"use strict";var n=(new Date).getTime();e(t).on({"onInit.fb":function(t,e,o){e.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll",function(t){var o=e.current,i=(new Date).getTime();e.group.length<2||!1===o.opts.wheel||"auto"===o.opts.wheel&&"image"!==o.type||(t.preventDefault(),t.stopPropagation(),o.$slide.hasClass("fancybox-animated")||(t=t.originalEvent||t,i-n<250||(n=i,e[(-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)<0?"next":"previous"]())))})}})}(document,jQuery); // Move to our_contentwindow.urls = { "shippingUrl": "\/frete\/"}document.addEventListener('lazybeforeunveil', function(e){ if ((e.target.parentElement) && (e.target.nextElementSibling)) { var parent = e.target.parentElement; var sibling = e.target.nextElementSibling; if (sibling.classList.contains('js-lazy-loading-preloader')) { sibling.style.display = 'none'; parent.style.display = 'block'; } }});window.lazySizesConfig = window.lazySizesConfig || {};lazySizesConfig.hFac = 0.4;$(document).ready(function(){ $(".js-notification-close, .js-tooltip-close").on( "click", function(e) { e.preventDefault(); $(this).closest(".js-notification, .js-tooltip").hide(); $(".js-quick-login-badge").hide(); }); var $notification_order_cancellation = $(".js-notification-order-cancellation"); var $notification_status_page = $(".js-notification-status-page"); var $quick_login_notification = $(".js-notification-quick-login"); var $fixed_bottom_button = $(".js-btn-fixed-bottom"); if ($notification_status_page.size() > 0){ if (LS.shouldShowOrderStatusNotification($notification_status_page.data('url'))){ $notification_status_page.show(); }; $(".js-notification-status-page-close").on( "click", function(e) { e.preventDefault(); LS.dontShowOrderStatusNotificationAgain($notification_status_page.data('url')); }); } if ($notification_order_cancellation.size() > 0){ if (LS.shouldShowOrderCancellationNotification($notification_order_cancellation.data('url'))){ if (window.cookieNotificationService.isAcknowledged()) { $notification_order_cancellation.show(); } $fixed_bottom_button.css({"margin-bottom": "40px"}); }; $(".js-notification-order-cancellation-close").on( "click", function(e) { e.preventDefault(); LS.dontShowOrderCancellationNotification($notification_order_cancellation.data('url')); $quick_login_notification.css("bottom" , "0"); }); } $(".js-cart-notification-close").click(function(){ $(".js-alert-added-to-cart").removeClass("notification-visible").addClass("notification-hidden"); setTimeout(function(){ $('.js-cart-notification-item-img').attr('src', ''); $(".js-alert-added-to-cart").hide(); },2000); }); var topBarHeight = $(".js-topbar").outerHeight(); var logoBarHeight = $(".js-nav-logo-bar").outerHeight(); var searchBarHeight = $(".js-search-container").outerHeight(); if ($(window).width() > 768) { var fixedNotificationPosition = topBarHeight + logoBarHeight; }else{ var fixedNotificationPosition = logoBarHeight - searchBarHeight; } var $addedToCartNotification = $(".js-alert-added-to-cart"); var $addedToCartNotificationArrow = $addedToCartNotification.find(".js-cart-notification-arrow-up"); $addedToCartNotification.css({"top": fixedNotificationPosition, "margin-top": -10}); $(function () { $(window).scroll(function () { if ($(this).scrollTop() == 0) { $addedToCartNotification.css("top" , fixedNotificationPosition); $addedToCartNotificationArrow.css("visibility" , "visible"); } else { $addedToCartNotification.css("top" , 20); $addedToCartNotificationArrow.css("visibility" , "hidden"); } }); }) $(".js-dismiss-quicklogin").on( "click", function(e) { LS.dontShowQuickLoginNotification(); }); setTimeout(function(){ $(".js-quick-login-success").fadeOut(); },8000); restoreNotifications = function(){ // Whatsapp button position if ($(window).width() < 768) { $fixed_bottom_button.css({"margin-bottom": "10px"}); } var show_order_cancellation = ($notification_order_cancellation.size() > 0) && (LS.shouldShowOrderCancellationNotification($notification_order_cancellation.data('url'))); }; if (!window.cookieNotificationService.isAcknowledged()) { $(".js-notification-cookie-banner").show(); if ($(window).width() < 768) { $fixed_bottom_button.css({"margin-bottom": "120px"}); } } $(".js-acknowledge-cookies").on( "click", function(e) { window.cookieNotificationService.acknowledge(); restoreNotifications(); }); if ($(window).width() < 768) { cleanURLHash = function(){ const uri = window.location.toString(); const clean_uri = uri.substring(0, uri.indexOf("#")); window.history.replaceState({}, document.title, clean_uri); }; goBackBrowser = function(){ cleanURLHash(); history.back(); }; if(window.location.href.indexOf("modal-fullscreen") > -1) { cleanURLHash(); } $(document).on("click", ".js-fullscreen-modal-open", function(e) { e.preventDefault(); var modal_url_hash = $(this).data("modal-url"); window.location.hash = modal_url_hash; }); $(document).on("click", ".js-fullscreen-modal-close", function(e) { e.preventDefault(); goBackBrowser(); }); window.onhashchange = function() { if(window.location.href.indexOf("modal-fullscreen") <= -1) { if($(".js-fullscreen-modal").hasClass("modal-show")){ if($(".js-modal.modal-show").length == 1){ $("body").removeClass("overflow-none"); } var $opened_modal = $(".js-fullscreen-modal.modal-show"); var $opened_modal_overlay = $opened_modal.prev(); $opened_modal.removeClass("modal-show").delay(500).hide(0); $opened_modal_overlay.fadeOut(500); } } } } $(document).on("click", ".js-modal-open", function(e) { e.preventDefault(); var modal_id = $(this).data('toggle'); var $overlay_id = $('.js-modal-overlay[data-modal-id="' + modal_id + '"]'); if ($(modal_id).hasClass("modal-show")) { $(modal_id).removeClass("modal-show").delay(500).hide(0); } else { if(!$(".js-modal.modal-show").length){ $("body").addClass("overflow-none"); } $overlay_id.fadeIn(400); $(modal_id).detach().appendTo("body"); $overlay_id.detach().insertBefore(modal_id); $(modal_id).show(0).addClass("modal-show"); } }); $(document).on("click", ".js-modal-close", function(e) { e.preventDefault(); if($(".js-modal.modal-show").length == 1){ $("body").removeClass("overflow-none"); } var $modal = $(this).closest(".js-modal"); var modal_id = $modal.attr('id'); var $overlay_id = $('.js-modal-overlay[data-modal-id="#' + modal_id + '"]'); $modal.removeClass("modal-show").delay(500).hide(0); $overlay_id.fadeOut(500); if (($(window).width() < 768) && ($(this).hasClass(".js-fullscreen-modal-close"))) { goBackBrowser(); } }); $(document).on("click", ".js-modal-overlay", function(e) { e.preventDefault(); if($(".js-modal.modal-show").length == 1){ $("body").removeClass("overflow-none"); } var modal_id = $(this).data('modal-id'); $(modal_id).removeClass("modal-show").delay(500).hide(0); $(this).fadeOut(500); }); var $tab_open = $('.js-tab'); $tab_open.click(function (e) { e.preventDefault(); var $tab_container = $(this).closest(".js-tab-container"); $tab_container.find(".js-tab, .js-tab-panel").removeClass("active"); $(this).addClass("active"); var tab_to_show = $(this).find(".js-tab-link").attr("href"); $tab_container.find(tab_to_show).addClass("active"); }); $(document).on("click", ".js-card-collapse-toggle", function(e) { e.preventDefault(); $(this).toggleClass('active'); $(this).closest(".js-card-collapse").toggleClass('active'); }); $(document).on("click", ".js-accordion-toggle", function(e) { e.preventDefault(); if($(this).hasClass("js-accordion-show-only")){ $(this).hide(); }else{ $(this).find(".js-accordion-toggle-inactive").toggle(); $(this).find(".js-accordion-toggle-active").toggle(); } $(this).prev(".js-accordion-container").slideToggle(); }); function applyOffset(selector){ // Get nav height on load if ($(window).width() > 768) { var head_height = $(".js-head-main").height(); $(selector).css("padding-top", head_height); }else{ var head_height = 0; } // Apply offset nav height on load $(window).resize(function() { // Get nav height on resize var head_height = $(".js-head-main").height(); // Apply offset on resize if ($(window).width() > 768) { $(selector).css("padding-top", head_height); }else{ $(selector).css("padding-top", 0); } }); } $(".js-utilities-item").hover(function(e) { e.preventDefault(); $(this).toggleClass("active").find(".js-subutility-list").stop(true, true).fadeToggle(300); }); var $top_nav = $(".js-mobile-nav"); var $page_main_content = $(".js-main-content"); var $search_backdrop = $(".js-search-backdrop"); $top_nav.addClass("move-down").removeClass("move-up"); $(".js-toggle-page-accordion").click(function (e) { e.preventDefault(); $(this).toggleClass("active").closest(".js-nav-list-toggle-accordion").next(".js-pages-accordion").slideToggle(300); }); var win_height = window.innerHeight; var head_height = $(".js-head-main").height(); $(".js-desktop-dropdown").css('max-height', win_height - head_height - 50); $(".js-item-subitems-desktop").hover(function (e) { $(this).addClass("active").children(".js-desktop-dropdown").stop(true, true).fadeIn(300); }, function() { $(this).removeClass("active").children(".js-desktop-dropdown").stop(true, true).fadeOut(300); }); $(".js-toggle-search").click(function (e) { e.preventDefault; $(".js-search-input").focus(); }); LS.search($(".js-search-input"), function (html, count) { $search_suggests = $(this).closest(".js-search-container").next(".js-search-suggest"); if (count > 0) { $search_suggests.html(html).show(); } else { $search_suggests.hide(); } if ($(this).val().length == 0) { $search_suggests.hide(); } }, { snipplet: 'header/header-search-results.tpl' }); if ($(window).width() > 768) { $("body").click(function () { $(".js-search-suggest").hide(); }); $(document).on("click", ".js-search-suggest a", function () { $(".js-search-suggest").show(); }); } $(".js-search-suggest").on("click", ".js-search-suggest-all-link", function (e) { e.preventDefault(); $this_closest_form = $(this).closest(".js-search-suggest").prev(".js-search-form"); $this_closest_form.submit(); }); createSwiper('.js-swiper-related', { lazy: true, loop: true, watchOverflow: true, centerInsufficientSlides: true, threshold: 5, watchSlideProgress: true, watchSlidesVisibility: true, slideVisibleClass: 'js-swiper-slide-visible', slidesPerView: 1.5, navigation: { nextEl: '.js-swiper-related-next', prevEl: '.js-swiper-related-prev', }, breakpoints: { 640: { slidesPerView: 4, } } }); $('.form-select').each(function(){ if(this.id == "variation_2" && $(this).is(':visible')){ const my_options = $(this).find('option'); my_options.sort(function(a,b) { if (a.text > b.text) return 1; if (a.text < b.text) return -1; return 0 }) $(this).html(my_options) } }) var width = window.innerWidth; if (width < 767) { createSwiper('.js-informative-banners', { slidesPerView: 1.2, watchOverflow: true, centerInsufficientSlides: true, pagination: { el: '.js-informative-banners-pagination', clickable: true, }, breakpoints: { 640: { slidesPerView: 3, } } }); } var $category_controls = $(".js-category-controls"); var mobile_nav_height = $(".js-head-main").innerHeight(); $(document).on("click", ".js-item-buy-open", function(e) { e.preventDefault(); $(this).toggleClass("btn-primary btn-secondary"); $(this).closest(".js-quickshop-container").find(".js-item-variants").fadeToggle(300); var elementTop = $(this).closest(".js-product-container").offset().top; var viewportTop = $(window).scrollTop(); if(elementTop < viewportTop){ $([document.documentElement, document.body]).animate({ scrollTop: $(this).closest(".js-product-container").offset().top - 180 }, 400); } }); $(document).on("click", ".js-item-buy-close", function(e) { e.preventDefault(); $(this).closest(".js-item-variants").fadeToggle(300); $(this).closest(".js-quickshop-container").find(".js-item-buy-open").toggleClass("btn-primary btn-secondary"); }); LS.registerOnChangeVariant(function(variant){ var current_image = $('.js-item-image', '.js-item-product[data-product-id="'+variant.product_id+'"]'); current_image.attr('srcset', variant.image_url); }); function get_max_installments_without_interests(number_of_installment, installment_data, max_installments_without_interests) { if (parseInt(number_of_installment) > parseInt(max_installments_without_interests[0])) { if (installment_data.without_interests) { return [number_of_installment, installment_data.installment_value.toFixed(2)]; } } return max_installments_without_interests;}function get_max_installments_with_interests(number_of_installment, installment_data, max_installments_with_interests) { if (parseInt(number_of_installment) > parseInt(max_installments_with_interests[0])) { if (installment_data.without_interests == false) { return [number_of_installment, installment_data.installment_value.toFixed(2)]; } } return max_installments_with_interests;}function refreshInstallmentv2(price){ $(".js-modal-installment-price" ).each(function( index ) { const installment = Number($(this).data('installment')); $(this).text(LS.currency.display_short + (price/installment).toLocaleString('de-DE', {maximumFractionDigits: 2, minimumFractionDigits: 2})); });} function refreshPaymentDiscount(price){ $(".js-price-with-discount" ).each(function( index ) { const payment_discount = $(this).data('payment-discount'); $(this).text(LS.formatToCurrency(price - ((price * payment_discount) / 100))) }); }function changeVariant(variant) { $(".js-product-detail .js-shipping-calculator-response").hide(); $("#shipping-variant-id").val(variant.id); var parent = $("body"); if (variant.element) { parent = $(variant.element); } var sku = parent.find('#sku'); if(sku.length) { sku.text(variant.sku).show(); } var installment_helper = function($element, amount, price){ $element.find('.js-installment-amount').text(amount); $element.find('.js-installment-price').attr("data-value", price); $element.find('.js-installment-price').text(LS.currency.display_short + parseFloat(price).toLocaleString('de-DE', { minimumFractionDigits: 2 })); if(variant.price_short && Math.abs(variant.price_number - price * amount) < 1) { $element.find('.js-installment-total-price').text((variant.price_short).toLocaleString('de-DE', { minimumFractionDigits: 2 })); } else { $element.find('.js-installment-total-price').text(LS.currency.display_short + (price * amount).toLocaleString('de-DE', { minimumFractionDigits: 2 })); } }; if (variant.installments_data) { var variant_installments = JSON.parse(variant.installments_data); var max_installments_without_interests = [0,0]; var max_installments_with_interests = [0,0]; $.each(variant_installments, function(payment_method, installments) { $.each(installments, function(number_of_installment, installment_data) { max_installments_without_interests = get_max_installments_without_interests(number_of_installment, installment_data, max_installments_without_interests); max_installments_with_interests = get_max_installments_with_interests(number_of_installment, installment_data, max_installments_with_interests); var installment_container_selector = '#installment_' + payment_method + '_' + number_of_installment; if(!parent.hasClass("js-quickshop-container")){ installment_helper($(installment_container_selector), number_of_installment, installment_data.installment_value.toFixed(2)); } }); }); var $installments_container = $(variant.element + ' .js-max-installments-container .js-max-installments'); var $installments_modal_link = $(variant.element + ' #btn-installments'); var $payments_module = $(variant.element + ' .js-product-payments-container'); var $installmens_card_icon = $(variant.element + ' .js-installments-credit-card-icon'); var installments_to_use = max_installments_without_interests[0] > 1 ? max_installments_without_interests : max_installments_with_interests; if(installments_to_use[0] <= 1 ) { $installments_container.hide(); $installments_modal_link.hide(); $payments_module.hide(); $installmens_card_icon.hide(); } else { $installments_container.show(); $installments_modal_link.show(); $payments_module.show(); $installmens_card_icon.show(); installment_helper($installments_container, installments_to_use[0], installments_to_use[1]); } } if(!parent.hasClass("js-quickshop-container")){ $('#installments-modal .js-installments-one-payment').text(variant.price_short).attr("data-value", variant.price_number);} if (variant.price_short){ var variant_price_clean = variant.price_short.replace('$', '').replace('R', '').replace(',', '').replace('.', ''); var variant_price_raw = parseInt(variant_price_clean, 10); parent.find('.js-price-display').text(variant.price_short).show(); parent.find('.js-price-display').attr("content", variant.price_number).data('product-price', variant_price_raw); } else { parent.find('.js-price-display').hide(); } if ((variant.compare_at_price_short) && !(parent.find(".js-price-display").css("display") == "none")) { parent.find('.js-compare-price-display').text(variant.compare_at_price_short).show(); } else { parent.find('.js-compare-price-display').hide(); } var button = parent.find('.js-addtocart'); button.removeClass('cart').removeClass('contact').removeClass('nostock'); var $product_shipping_calculator = parent.find("#product-shipping-container"); if (!variant.available){ button.val('Esgotado'); button.addClass('nostock'); button.attr('disabled', 'disabled'); $product_shipping_calculator.hide(); } else if (variant.contact) { button.val('Preço sob Consulta'); button.addClass('contact'); button.removeAttr('disabled'); $product_shipping_calculator.hide(); } else { button.val('Comprar'); button.addClass('cart'); button.removeAttr('disabled'); $product_shipping_calculator.show(); } const base_price = Number($("#price_display").attr("content")); refreshInstallmentv2(base_price); refreshPaymentDiscount(variant.price_number); LS.updateShippingProduct(); zipcode_on_changevariant = $("#product-shipping-container .js-shipping-input").val(); $("#product-shipping-container .js-shipping-calculator-current-zip").text(zipcode_on_changevariant); LS.freeShippingProgress(); }$(document).on("change", ".js-variation-option", function(e) { var $parent = $(this).closest(".js-product-variants"); var $variants_group = $(this).closest(".js-product-variants-group"); var quick_id = $(this).closest(".js-quickshop-container").attr("id"); if($parent.hasClass("js-product-quickshop-variants")){ LS.changeVariant(changeVariant, '#' + quick_id); } else { LS.changeVariant(changeVariant, '#single-product'); } var $this_product_container = $(this).closest(".js-product-container"); var $this_compare_price = $this_product_container.find(".js-compare-price-display"); var $this_price = $this_product_container.find(".js-price-display"); var $installment_container = $this_product_container.find(".js-product-payments-container"); var $installment_text = $this_product_container.find(".js-max-installments-container"); var $this_add_to_cart = $this_product_container.find(".js-prod-submit-form"); // Get the current product discount percentage value var current_percentage_value = $this_product_container.find(".js-offer-percentage"); // Get the current product price and promotional price var compare_price_value = $this_compare_price.html(); var price_value = $this_price.html(); // Calculate new discount percentage based on difference between filtered old and new prices const percentageDifference = window.moneyDifferenceCalculator.percentageDifferenceFromString(compare_price_value, price_value); if(percentageDifference){ $this_product_container.find(".js-offer-percentage").text(percentageDifference); $this_product_container.find(".js-offer-label").css("display" , "table"); } if ($this_compare_price.css("display") == "none" || !percentageDifference) { $this_product_container.find(".js-offer-label").hide(); } if ($this_add_to_cart.hasClass("nostock")) { $this_product_container.find(".js-stock-label").show(); } else { $this_product_container.find(".js-stock-label").hide(); } if ($this_price.css('display') == 'none'){ $installment_container.hide(); $installment_text.hide(); }else{ $installment_text.show(); }});$(".js-product-form").submit(function (e) { var button = $(this).find(':submit'); button.attr('disabled', 'disabled'); if ((button.hasClass('contact')) || (button.hasClass('catalog'))) { e.preventDefault(); var product_id = $(this).find("input[name='add_to_cart']").val(); window.location = "\/contato\/?product=" + product_id; } else if (button.hasClass('cart')) { button.val('Incluindo...'); }}); var width = window.innerWidth; if (width > 767) { var speedVal = 0; var spaceBetweenVal = 0; var slidesPerViewVal = 1; } else { var speedVal = 300; var spaceBetweenVal = 10; var slidesPerViewVal = 1.2; } var productSwiper = null; createSwiper( '.js-swiper-product', { lazy: true, speed: speedVal, slidesPerView: slidesPerViewVal, centeredSlides: true, spaceBetween: spaceBetweenVal, pagination: { el: '.js-swiper-product-pagination', type: 'fraction', clickable: true, }, navigation: { nextEl: '.js-swiper-product-next', prevEl: '.js-swiper-product-prev', }, on: { init: function () { $(".js-product-slider-placeholder").hide(); $(".js-swiper-product").css({"visibility" : "visible" , "height" : "auto"}); }, }, }, function(swiperInstance) { productSwiper = swiperInstance; } ); $().fancybox({ selector : '[data-fancybox="product-gallery"]', toolbar : false, smallBtn : true, beforeClose : function(instance) { // Update position of the slider productSwiper.slideTo( instance.currIndex, 0 ); $(".js-product-thumb").removeClass("selected"); var $product_thumbnail = $(".js-product-thumb[data-thumb-loop='"+instance.currIndex+"']").addClass("selected"); if($product_thumbnail.length){ $product_thumbnail.addClass("selected"); }else{ $(".js-product-thumb[data-thumb-loop='4']").addClass("selected"); } }, }); LS.registerOnChangeVariant(function(variant){ var liImage = $('.js-swiper-product').find("[data-image='"+variant.image+"']"); var selectedPosition = liImage.data('image-position'); var slideToGo = parseInt(selectedPosition); productSwiper.slideTo(slideToGo); $(".js-product-slide-img").removeClass("js-active-variant"); liImage.find(".js-product-slide-img").addClass("js-active-variant"); }); $(".js-product-thumb").click(function(e){ e.preventDefault(); $(".js-product-thumb").removeClass("selected"); $(this).addClass("selected"); var thumbLoop = $(this).data("thumb-loop"); var slideToGo = parseInt(thumbLoop); productSwiper.slideTo(slideToGo); if($(this).hasClass("js-product-thumb-modal")){ $('.js-swiper-product').find("[data-image-position='"+slideToGo+"'] .js-product-slide-link").click(); } }); $('.js-pinterest-share').click(function(e){ e.preventDefault(); $(".pinterest-hidden a")[0].click(); }); $("#product-description").show(); $('.js-quantity .js-quantity-up').on('click', function() { $quantity_input = $(this).closest(".js-quantity").find(".js-quantity-input"); $quantity_input.val( parseInt($quantity_input.val(), 10) + 1); }); $('.js-quantity .js-quantity-down').on('click', function() { $quantity_input = $(this).closest(".js-quantity").find(".js-quantity-input"); quantity_input_val = $quantity_input.val(); if (quantity_input_val>1) { $quantity_input.val( parseInt($quantity_input.val(), 10) - 1); } }); LS.freeShippingProgress(true); var head_height = $(".js-head-main").outerHeight(); if ($(window).width() > 768) { $("#cart-sticky-summary").css("top" , 10); } $(document).on("click", ".js-addtocart:not(.js-addtocart-placeholder)", function (e) { var $productContainer = $(this).closest('.js-product-container'); var $productVariants = $productContainer.find(".js-variation-option"); var $productButton = $productContainer.find("input[type='submit'].js-addtocart"); var $productButtonPlaceholder = $productContainer.find(".js-addtocart-placeholder"); var $productButtonText = $productButtonPlaceholder.find(".js-addtocart-text"); var $productButtonAdding = $productButtonPlaceholder.find(".js-addtocart-adding"); var $productButtonSuccess = $productButtonPlaceholder.find(".js-addtocart-success"); var isQuickShop = $productContainer.hasClass('js-quickshop-container'); if (!isQuickShop) { if($(".js-product-slide-img.js-active-variant").length) { var imageSrc = $($productContainer.find('.js-product-slide-img.js-active-variant')[0]).data('srcset').split(' ')[0]; } else { var imageSrc = $($productContainer.find('.js-product-slide-img')[0]).attr('srcset').split(' ')[0]; } var quantity = $productContainer.find('.js-quantity-input').val(); var name = $productContainer.find('.js-product-name').text(); var price = $productContainer.find('.js-price-display').text(); var addedToCartCopy = "Comprar"; } else { var imageSrc = $(this).closest('.js-quickshop-container').find('img').attr('srcset').split(' ')[0]; var quantity = 1; var name = $productContainer.find('.js-item-name').text(); var price = $productContainer.find('.js-price-display').text().trim(); var addedToCartCopy = "Comprar"; if ($productContainer.hasClass("js-quickshop-has-variants")) { var addedToCartCopy = "Comprar"; }else{ var addedToCartCopy = "Comprar"; } } if (!$(this).hasClass('contact')) { $productButton.hide(); $productButtonPlaceholder.css('display' , 'inline-block'); $productButtonText.fadeOut(); $productButtonAdding.addClass("active"); } }); $(document).on("keypress", ".js-cart-quantity-input", function (e) { if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { return false; } }); $(document).on("focusout", ".js-cart-quantity-input", function (e) { var itemID = $(this).attr("data-item-id"); var itemVAL = $(this).val(); if (itemVAL == 0) { var r = confirm("Tem certeza de que deseja excluir este item?"); if (r == true) { LS.removeItem(itemID, true); } else { $(this).val(1); } } else { LS.changeQuantity(itemID, itemVAL, true); } }); $(".js-trigger-empty-cart-alert").click(function (e) { e.preventDefault(); $(".js-mobile-nav-empty-cart-alert").fadeIn(100).delay(1500).fadeOut(500); }); $('form[action="\/comprar\/"]').submit(function() { cookieService.remove('first_product_added_successfully'); }); if ($('.js-selected-shipping-method').length) { var shipping_cost = $('.js-selected-shipping-method').data("cost"); var $shippingCost = $("#shipping-cost"); $shippingCost.text(shipping_cost); $shippingCost.removeClass('opacity-40'); } selectShippingOption = function(elem, save_option) { $(".js-shipping-method, .js-branch-method").removeClass('js-selected-shipping-method'); $(elem).addClass('js-selected-shipping-method'); var shipping_cost = $(elem).data("cost"); var shipping_price_clean = $(elem).data("price"); if(shipping_price_clean = 0.00){ var shipping_cost = '' } // Updates shipping (ship and pickup) cost on cart var $shippingCost = $("#shipping-cost"); $shippingCost.text(shipping_cost); $shippingCost.removeClass('opacity-40'); if (save_option) { LS.saveCalculatedShipping(true); } if ($(elem).hasClass("js-shipping-method-hidden")) { if ($(elem).hasClass("js-pickup-option")) { $(".js-other-pickup-options, .js-show-other-pickup-options .js-shipping-see-less").show(); $(".js-show-other-pickup-options .js-shipping-see-more").hide(); } else { $(".js-other-shipping-options, .js-show-more-shipping-options .js-shipping-see-less").show(); $(".js-show-more-shipping-options .js-shipping-see-more").hide() } } }; if (cookieService.get('calculator_zipcode')) { var zipcode_from_cookie = cookieService.get('calculator_zipcode'); $('.js-shipping-input').val(zipcode_from_cookie); $(".js-shipping-calculator-current-zip").text(zipcode_from_cookie); $(".js-shipping-calculator-head").addClass("with-zip").removeClass("with-form"); $(".js-shipping-calculator-with-zipcode").addClass("transition-up-active"); $(".js-shipping-calculator-spinner").show(); } else { $(".js-shipping-calculator-form").addClass("transition-up-active"); } removeShippingSuboptions = function(){ var shipping_suboptions_id = $(".js-modal-shipping-suboptions").attr("id"); $("#" + shipping_suboptions_id).remove(); $('.js-modal-overlay[data-modal-id="#' + shipping_suboptions_id + '"').remove(); }; $(".js-calculate-shipping").click(function (e) { e.preventDefault(); let shipping_input_val = $(this).closest(".js-shipping-calculator-form").find(".js-shipping-input").val(); $(".js-shipping-input").val(shipping_input_val); if (!vanillaJS) { LS.calculateShippingAjax( $('#product-shipping-container').find(".js-shipping-input").val(), '\/frete\/', $("#product-shipping-container").closest(".js-shipping-calculator-container") ); } if ($(".js-cart-item").length) { LS.calculateShippingAjax( $('#cart-shipping-container').find(".js-shipping-input").val(), '\/frete\/', $("#cart-shipping-container").closest(".js-shipping-calculator-container") ); } $(".js-shipping-calculator-current-zip").html(shipping_input_val); removeShippingSuboptions();});$(".js-shipping-input").keydown(function (e) { var key = e.which ? e.which : e.keyCode; var enterKey = 13; if (key === enterKey) { e.preventDefault(); $(this).closest(".js-shipping-calculator-form").find(".js-calculate-shipping").click(); if ($(window).width() < 768) { $(this).blur(); } }}); $(document).on("change", ".js-shipping-method, .js-branch-method", function () { selectShippingOption(this, true); $(".js-shipping-method-unavailable").hide(); }); $('.js-shipping-method:checked').livequery(function () { let shippingPrice = $(this).attr("data-price"); LS.addToTotal(shippingPrice); let total = (LS.data.cart.total / 100) + parseFloat(shippingPrice); $(".js-cart-widget-total").html(LS.formatToCurrency(total)); selectShippingOption(this, false); }); $(document).on("click", ".js-toggle-branches", function (e) { e.preventDefault(); $(".js-store-branches-container").slideToggle("fast"); $(".js-see-branches, .js-hide-branches").toggle(); }); $(document).on("click", ".js-toggle-more-shipping-options", function(e) { e.preventDefault(); if($(this).hasClass("js-show-other-pickup-options")){ $(".js-other-pickup-options").slideToggle(600); $(".js-show-other-pickup-options .js-shipping-see-less, .js-show-other-pickup-options .js-shipping-see-more").toggle(); }else{ $(".js-other-shipping-options").slideToggle(600); $(".js-show-more-shipping-options .js-shipping-see-less, .js-show-more-shipping-options .js-shipping-see-more").toggle(); }}); calculateCartShippingOnLoad = function() { if ($("#cart-shipping-container .js-shipping-input").val()) { // If user already had calculated shipping: recalculate shipping setTimeout(function() { LS.calculateShippingAjax( $('#cart-shipping-container').find(".js-shipping-input").val(), '\/frete\/', $("#cart-shipping-container").closest(".js-shipping-calculator-container") ); removeShippingSuboptions(); }, 100); } if ($(".js-branch-method").hasClass('js-selected-shipping-method')) { } }; if (!vanillaJS) { if($('#product-shipping-container').find(".js-shipping-input").val()){ setTimeout(function() { LS.calculateShippingAjax( $('#product-shipping-container').find(".js-shipping-input").val(), '\/frete\/', $("#product-shipping-container").closest(".js-shipping-calculator-container") ); removeShippingSuboptions(); }, 100); } } if (cookieService.get('returning_customer')) { $('.js-shipping-zipcode-help').remove(); } else { $('.js-product-quick-login').remove(); } $(document).on("click", ".js-shipping-calculator-change-zipcode", function(e) { e.preventDefault(); $(".js-shipping-calculator-response").fadeOut(100); $(".js-shipping-calculator-head").addClass("with-form").removeClass("with-zip"); $(".js-shipping-calculator-with-zipcode").removeClass("transition-up-active"); $(".js-shipping-calculator-form").addClass("transition-up-active"); }); $(document).on("click", ".js-save-shipping-country", function(e) { e.preventDefault(); var selected_country_url = $(this).closest(".js-modal-shipping-country").find(".js-shipping-country-select option:selected").attr("data-country-url"); location.href = selected_country_url; $(this).text('Aplicando...').addClass("disabled"); }); $(".js-winnie-pooh-form").submit(function (e) { $(this).attr('action', ''); }); $(".js-form").submit(function (e) { $(this).find('.js-form-spinner').show(); }); $('.js-password-view').click(function () { $(this).toggleClass('password-view'); if($(this).hasClass('password-view')){ $(this).parent().find(".js-password-input").attr('type', ''); $(this).find(".js-eye-open, .js-eye-closed").toggle(); } else { $(this).parent().find(".js-password-input").attr('type', 'password'); $(this).find(".js-eye-open, .js-eye-closed").toggle(); } }); }); console.log('custom2 loaded!');window.MVL = {};MVL.paymentTemplate = { i_ticket : ' ', i_card : ' ', styles: '.js-product-container .price-holder{display:none} .mvl-payment-app {margin-top:1rem;} .mvl-payment-item{margin-bottom:1rem} .mvl-payment-item-wrapper { display: flex; align-items: center; } .mvl-payment-item-icon { width: 25px; margin-right: 10px; } .mvl-payment-item-value { font-size: 1.3rem; } .mvl-payment-item-icon svg { display: block; } .mvl-payment-item-text { margin-top: 5px; }', installments: ( $('.js-product-payments-container .js-max-installments-container').length>0 ) ? $('.js-product-payments-container .js-max-installments-container')[0].innerHTML : '' , // el_pix : "#info-payment-method-pix .js-installments-one-payment", // el_ticket : "#installment-credit-card-option-PayPal .js-installments-one-payment", // el_card : "#installment_PayPal_1 .js-installment-price", el_pix : "#info-payment-method-pix .js-installments-one-payment", el_ticket : "#info-payment-method-boleto .js-installments-one-payment", el_card : "#info-payment-method-boleto .js-installments-one-payment", template : function( payments ){ var html =``; payments.forEach(function(v,k){ html += `
`; }); html += `
`; html += ``; return html; }, init: function(){ console.log( "paymentTemplate fired!" ); if( !$(this.el_pix).length || !$(this.el_card).length ) return; var valueTicket = parseInt( $(this.el_pix).attr('data-value') ); var valueCard = parseInt( $(this.el_card).attr('data-value') ); var ticketPrice = $(this.el_pix)[0].innerHTML; if( valueTicket == valueCard ) { var discount = $('#info-payment-method-pix').attr('data-discount'); ticketPrice = LS.currency.display_short + ( (valueTicket * (100-discount) / 100) ).toLocaleString('de-DE', {maximumFractionDigits: 2, minimumFractionDigits: 2}); // console.log( " PIX: ",ticketPrice ); } // console.log(" PREÇOS: ",valueTicket, valueCard ); var cardInstallments = this.installments; if( $('.js-product-payments-container .js-max-installments-container')[0].innerHTML ) { cardInstallments = $('.js-product-payments-container .js-max-installments-container')[0].innerHTML } if( $(this.el_card)[0].innerHTML == '—' ) { ticketPrice = '—'; cardInstallments = '—'; } var obj = [ { icon: this.i_ticket, value: ticketPrice, text: "à vista no PIX" }, { icon: this.i_card, value: $(this.el_card)[0].innerHTML, text: cardInstallments } ]; $('.js-price-pix').text(ticketPrice); $('.section-single-product .price-container').html( this.template( obj ) ); }}if( LS.template == "product" ) { MVL.paymentTemplate.init(); LS.registerOnChangeVariant(function(variant){ console.log(variant); MVL.paymentTemplate.init(); });};window.noStockProducts = { elements: { container: ".js-product-variants", variantsGroup: ".section-single-product .js-product-variants-group", variantsGroupContainerClass : ".product-variations-buttons-container" }, styles: ".product-variations-buttons-item.selected {background-color:#f2c94c;color:#000;border-color:#000;}a.product-variations-buttons-item.no-stock {position: relative;}a.product-variations-buttons-item.no-stock:after {content: \"x\";position: absolute;top: -5px;right: -5px;width: 20px;height: 20px;border-radius: 20px;border: 1px solid red;display: flex;align-items: center;justify-content: center;color: red;background-color: #fff;}", defaultVariants : LS.variants, verifyStock: function(){ var defaultVariants = this.defaultVariants; // Two var variantTwo_OneSelected = jQueryNuvem(this.elements.variantsGroupContainerClass+' .product-variations-buttons-group#variation_1 a.selected').text(); //console.log(variantTwo_OneSelected); var variantsTwo = jQueryNuvem(this.elements.variantsGroupContainerClass+' .product-variations-buttons-group#variation_2').first(); var variantsTwoItems = variantsTwo.find('.product-variations-buttons-items a'); //console.log(variantsTwoItems); jQueryNuvem(this.elements.variantsGroupContainerClass+' .product-variations-buttons-group#variation_2 a').removeClass('no-stock'); jQueryNuvem(this.elements.variantsGroupContainerClass+' .product-variations-buttons-group#variation_2 a').removeAttr('disabled'); variantsTwoItems.each( function(variant) { var $this = jQueryNuvem(variant); var label = $this.text(); var filtered = defaultVariants.filter( (a) => {return a.option0 == variantTwo_OneSelected && a.option1 == label && a.stock != 0} ); console.log( filtered,$this ); if( filtered.length == 0 ) { $this.addClass('no-stock'); $this.attr('disabled',true); } } ); // Three var variantThree_TwoSelected = jQueryNuvem(this.elements.variantsGroupContainerClass+' .product-variations-buttons-group#variation_2 a.selected').text(); //console.log(variantThree_TwoSelected); var variantsThree = jQueryNuvem(this.elements.variantsGroupContainerClass+' .product-variations-buttons-group#variation_3').first(); var variantsThreeItems = variantsThree.find('.product-variations-buttons-items a'); //console.log(variantsThreeItems); jQueryNuvem(this.elements.variantsGroupContainerClass+' .product-variations-buttons-group#variation_3 a').removeClass('no-stock'); jQueryNuvem(this.elements.variantsGroupContainerClass+' .product-variations-buttons-group#variation_3 a').removeAttr('disabled'); variantsThreeItems.each( function(variant) { var $this = jQueryNuvem(variant); var label = $this.text(); var filtered = defaultVariants.filter( (a) => {return a.option0 == variantTwo_OneSelected && a.option1 == variantThree_TwoSelected && a.option2 == label && a.stock != 0} ); console.log( filtered,$this ); if( filtered.length == 0 ) { $this.addClass('no-stock'); $this.attr('disabled',true); } } ); }, verifyAndClick: function(l=1){ console.log('verifyAndClick variation_'+l); for(let i=l;i<=3;i++) { let items = jQueryNuvem('.product-variations-buttons-group#variation_'+i+' .product-variations-buttons-item'); let item_i = items.filter((a)=> { return !jQueryNuvem(a).hasClass('no-stock') }).first(); console.log( 'item_i',item_i ); jQueryNuvem(item_i).click(); } }, init: function(){ // Make object var variants = jQueryNuvem(this.elements.variantsGroup); var variations = []; variants.each( function(variant){ var $var = jQueryNuvem(variant); console.log($var.find('select').attr('id')); var optionsArr = $var.find('select option'); var options = []; optionsArr.each( function(option){ options.push( jQueryNuvem(option).val() ); } ); variations.push( { id: $var.find('select').attr('id'), name: $var.find('select').attr('name'), label:$var.find('label').text(), preselect: $var.find('select').val(), options:options } ); } ); console.log( variations ); // Make buttons if( !jQueryNuvem('.section-single-product '+this.elements.variantsGroupContainerClass).length ) { jQueryNuvem( "#product_form" ).prepend( '' ); } jQueryNuvem('.section-single-product '+this.elements.variantsGroupContainerClass).html(""); variations.map( function(variant){ var options = variant.options; var html = ''; html += ''; let variant_label = variant.label; if( variant.label == "Tamanho" ) { variant_label += " (cada quadro)"; } html += ""+variant_label+" "; html += '
'; options.map( function(option){ var isSelected = ""; if( option == variant.preselect ) { isSelected = "selected"; } html += ""+option+" "; } ); html += '
'; html += '
'; jQueryNuvem('.section-single-product '+noStockProducts.elements.variantsGroupContainerClass).append(jQueryNuvem.parseHTML(html)); } ); // Handle buttons jQueryNuvem('.product-variations-buttons-container .js-product-variations-buttons-item').on('click',function(e){ e.preventDefault(); let $this = jQueryNuvem(this); let selectID = $this.data('for'); let value = $this.text(); let var_id = $this.closest('.product-variations-buttons-group').attr('id').replace('variation_',''); jQueryNuvem('.section-single-product select#'+selectID).val(value); jQueryNuvem('.section-single-product select#'+selectID).trigger('change'); $this.siblings().removeClass('selected'); $this.addClass('selected'); noStockProducts.verifyStock(); noStockProducts.verifyAndClick(parseInt(var_id)+1); }); // NoStock - ONE var defaultVariants = this.defaultVariants; //console.log( defaultVariants ); var variantsOne = jQueryNuvem(this.elements.variantsGroupContainerClass+' .product-variations-buttons-group#variation_1').first(); var variantsOneItems = variantsOne.find('.product-variations-buttons-items a'); variantsOneItems.each( function(variant) { var $this = jQueryNuvem(variant); var label = $this.text(); var filtered = defaultVariants.filter( (a) => {return a.option0 == label && a.stock != 0} ); console.log( filtered ); if( filtered.length == 0 ) { $this.addClass('no-stock'); $this.attr('disabled',true); } } ); jQueryNuvem(this.elements.container).hide(); setTimeout( function(){ noStockProducts.verifyAndClick(); },500 ); }}noStockProducts.init(); function resizeProductInfo() { if( $(window).width() < 767 ) return; var base = $('#product_form'); var base_h = base.height(); var itemImage = $('.js-product-slide > a'); var itemImage_w = itemImage.width(); var pbImage = (base_h * 100) / itemImage_w; pbImage = pbImage<=100?100:pbImage; itemImage.css({"padding-bottom": pbImage+"%"}); var gallery = $('.section-single-product .js-product-thumb'); var galleryWidth = gallery.width(); var galleryCount = gallery.length; var galery_margin = 16 * (galleryCount-1); var gallery_size = (base_h - galery_margin) / galleryCount; var pbGallery = (gallery_size * 100) / galleryWidth; pbGallery = pbGallery<=100?100:pbGallery; gallery.css({"padding-bottom": pbGallery + "%","overflow":"hidden"}); }; resizeProductInfo(); // function selectValidVariant( variant ){ // $('#single-product .js-product-variants').addClass('loading-effect'); // setTimeout( function(){ // var itemInvalid = $('.btn-primary.no-stock'); // var itemInvalidNexts = itemInvalid.parent().find("a:not(.no-stock)"); // console.log('==============#########+==========='); // console.log(itemInvalid); // if( itemInvalidNexts.length>=1 ){ // itemInvalidNexts[0].click(); // } // },500 ); // setTimeout( function(){ // $('#single-product .js-product-variants').removeClass('loading-effect'); // },750 ); // } // LS.registerOnChangeVariant( selectValidVariant );window.activeCampaignCreateContact = ( data ) => { const options = { method: 'POST', headers: { accept: 'application/json', 'content-type': 'application/json' }, body: JSON.stringify({contact: data}) }; fetch('https://bimper.sampisolution.com.br/activecampaign/index.php', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));}$('[data-store="newsletter-form"],[data-store="newsletter-form-popup"]').one('submit',function(e){ let $this = $(this); let form = $this.serializeArray(); let phone = form.filter( a => a.name == 'phone'); let email = form.filter( a => a.name == 'email'); if( !email ) return false; let dataToPush = { phone:phone.length?phone[0].value:null, email:email.length?email[0].value:null }; activeCampaignCreateContact(dataToPush); console.log( dataToPush ); //e.preventDefault();});/* Apply fancybox to multiple items */$("a.youtube-modal").fancybox({ 'transitionIn':'elastic', 'transitionOut':'elastic', 'speedIn':600, 'speedOut':200, 'overlayShow':false}); });