1(function($){"use strict";$(document).ready(function(){var drawer=$("#fabric-free-swatch-drawer");drawer.length&&(drawer.on("click",".fabric-free-swatch-mask",function(e){var container=drawer;container.is(e.target)||drawer.find(".fabric-free-swatch-drawer-inner").removeClass("is-enter-done").addClass("is-enter")}),$(document).on("click",".get-fabric-free-swatch-button",function(){drawer.find(".fabric-free-swatch-drawer-inner").removeClass("is-enter").addClass("is-enter-done")}),drawer.on("click",".fabric-free-swatch__drawer-dismiss",function(){drawer.find(".fabric-free-swatch-drawer-inner").removeClass("is-enter-done").addClass("is-enter")}),drawer.on("click",".fabric-free-swatch__list-variant-picture-search",function(){var src=$(this).attr("id"),id=$(this).attr("data-product-id"),title=drawer.find("#fabric-free-swatch-zoom-title-"+id).text(),detail=drawer.find("#fabric-free-swatch-zoom-detail-"+id).html();drawer.find(".fabric-free-swatch-modal").addClass("fabric-free-swatch-fixed-model"),drawer.find(".fabric-free-swatch-drawer-inner").hide(),drawer.find("#fabric-free-swatch-image").attr("src",src),drawer.find("#fabric-free-swatch-zoom-title").text(title),drawer.find("#fabric-free-swatch-zoom-detail").html(detail),drawer.find(".fabric-free-swatch-image-popup").show()}),drawer.on("click",".fabric-free-swatch__zoom-close",function(){drawer.find(".fabric-free-swatch-modal").removeClass("fabric-free-swatch-fixed-model"),drawer.find(".fabric-free-swatch-drawer-inner").show(),drawer.find(".fabric-free-swatch-image-popup").hide()}),setInterval(function(){$(".go-product-price-0").text("Free"),$(".go-product-qty-0").prop("disabled",!0)},10))}),$(document).on("click","#fabric-free-swatch-drawer .fabric-free-swatch__list-variant-option-content",function(event){event.preventDefault();var m=this;if(!$(m).hasClass("fabric-free-swatch-loading")){$(m).addClass("fabric-free-swatch-loading"),$(m).html('<div><div class="fabric-free-swatch__spinner-wrapper"><div class="fabric-free-swatch__spinner"><svg aria-hidden="true" focusable="false" role="presentation" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg"><circle class="path" fill="#fff" stroke-width="6" cx="33" cy="33" r="30"></circle></svg></div></div></div>');var product_id=$(m).data("id");if(console.log("Fabric Free Swatch ID: "+product_id),$(m).hasClass("fabric-free-swatch__remove-option-available")){var data="id="+product_id+"&quantity=0";$.ajax({type:"POST",url:"/cart/change.js",dataType:"json",data:data,success:function(){$.getJSON("/cart.js",function(cart){cart.item_count>0?$(".count-bubble").css({opacity:"1"}).text(cart.item_count):$(".count-bubble").css({opacity:"0"})}),document.documentElement.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})),$(m).html('<div><svg role="img" aria-label="fabric-free-swatch-add-to-cart"><g fill="none" fill-rule="evenodd"><circle fill="#323433" cx="8" cy="8" r="8"></circle><path stroke="#FFF" stroke-width="1.5" d="M5.091 8h5.818M8 5.091v5.818"></path></g></svg><div class="fabric-free-swatch__add-to-cart">Add To Cart</div></div>'),$(m).removeClass("fabric-free-swatch__remove-option-available").removeClass("fabric-free-swatch-loading")},error:function(){alert("Fail to remove Fabric-Free Swatch"),$(m).removeClass("fabric-free-swatch-loading")}})}else{var data="id="+product_id+"&quantity=1";$.ajax({type:"POST",url:"/cart/add.js",dataType:"json",data:data,success:function(){$.getJSON("/cart.js",function(cart){cart.item_count>0?$(".count-bubble").css({opacity:"1"}).text(cart.item_count):$(".count-bubble").css({opacity:"0"})}),document.documentElement.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})),$(m).html('<div class="fabric-free-swatch__swatch-added"><svg role="img" class="fabric-free-swatch__add-to-cart-done"><g fill="none" fill-rule="evenodd"><circle fill="#a45b37" cx="8" cy="8" r="8"></circle><path stroke="#FFF" stroke-width="1.5" d="m4.438 7.95 2.787 2.653 4.486-4.747"></path></g></svg><div class="fabric-free-swatch__list-variant-option-content-tap-to-remove">Tap to Remove</div></div>'),$(m).addClass("fabric-free-swatch__remove-option-available").removeClass("fabric-free-swatch-loading")},error:function(){alert("Unfortunately, this fabric swatch is out of stock."),$(m).html('<div><svg role="img" aria-label="fabric-free-swatch-add-to-cart"><g fill="none" fill-rule="evenodd"><circle fill="#323433" cx="8" cy="8" r="8"></circle><path stroke="#FFF" stroke-width="1.5" d="M5.091 8h5.818M8 5.091v5.818"></path></g></svg><div class="fabric-free-swatch__add-to-cart">Add To Cart</div></div>'),$(m).removeClass("fabric-free-swatch-loading")}})}}}),$(document).ready(function(){var scroll_zoom=new FabricFreeSwatchScrollZoom($("#fabric-free-swatch-drawer .fabric-free-swatch__zoom-wrapper"),5,.5)});function FabricFreeSwatchScrollZoom(container,max_scale,factor){if(!container||!container.length)return;var target=container.children().first();if(!target.length)return;var size={w:target.width(),h:target.height()},pos={x:0,y:0},scale=1,zoom_target={x:0,y:0},zoom_point={x:0,y:0},curr_tranform=target.css("transition"),last_mouse_position={x:0,y:0},drag_started=0;target.css("transform-origin","0 0"),target.on("mousewheel DOMMouseScroll",scrolled),target.on("mousemove",moved),target.on("mousedown",function(event){drag_started=1,target.css({cursor:"move",transition:"transform 0s"}),last_mouse_position={x:event.pageX,y:event.pageY}}),target.on("mouseup mouseout",function(){drag_started=0,target.css({cursor:"default",transition:curr_tranform})});function scrolled(e){var offset=container.offset();zoom_point.x=e.pageX-offset.left,zoom_point.y=e.pageY-offset.top,e.preventDefault();var delta=e.delta||e.originalEvent.wheelDelta;delta===void 0&&(delta=e.originalEvent.detail),delta=Math.max(-1,Math.min(1,delta)),zoom_target.x=(zoom_point.x-pos.x)/scale,zoom_target.y=(zoom_point.y-pos.y)/scale,scale+=delta*factor*scale,scale=Math.max(1,Math.min(max_scale,scale)),pos.x=-zoom_target.x*scale+zoom_point.x,pos.y=-zoom_target.y*scale+zoom_point.y,update()}function moved(event){if(drag_started==1){var current_mouse_position={x:event.pageX,y:event.pageY},change_x=current_mouse_position.x-last_mouse_position.x,change_y=current_mouse_position.y-last_mouse_position.y;last_mouse_position=current_mouse_position,pos.x+=change_x,pos.y+=change_y,update()}}
1function update(){pos.x>0&&(pos.x=0),pos.x+size.w*scale<size.w&&(pos.x=-size.w*(scale-1)),pos.y>0&&(pos.y=0),pos.y+size.h*scale<size.h&&(pos.y=-size.h*(scale-1)),target.css("transform","translate("+pos.x+"px,"+pos.y+"px) scale("+scale+")")}}})(jQuery); 2//# sourceMappingURL=/cdn/shop/t/71/assets/fabric-free-swatch.js.map?v=180967635771327748161788459560
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.