jQuery(document).ready(function(){COLORSWATCHES.init()});var COLORSWATCHES={init:function(){jQuery(document).on("ajaxStop",function(){COLORSWATCHES.callVitrine()}),jQuery(window).load(function(){setTimeout(function(){COLORSWATCHES.callVitrine()},2e3)})},callVitrine:function(){$(".prateleira.vitrine ul li").not(".noStock").not(".swatches-loaded").each(function(){_this=$(this),0!=$(this).find(".similar-colors-vitrine .product-variation li").length||$(this).hasClass("swatches-loaded")||COLORSWATCHES.getProductVariations(".prateleira.vitrine ul",_this),_this.addClass("swatches-loaded")})},getProductVariations:function(vitrine_html_element,html_child_element){$(".prateleira.vitrine ul li.helperComplement").length>0&&$(".helperComplement").remove(),null==vitrine_html_element&&(vitrine_html_element=".vitrine"),null==html_child_element&&(html_child_element=".prateleira.vitrine > ul > li").not(".swatches-loaded"),$(vitrine_html_element).find(html_child_element).each(function(){if($(this).find(".similar-colors-vitrine").length>0)try{var $product_element_object,product_id,product_link;product_id=($product_element_object=$(this)).find("#productID-oculto").text(),product_link=(product_link=$product_element_object.find("#linkID-oculto").text()).replace("https://www.blind.com.co/","").replace("https://www.blind.com.co/","").replace("https://qablind.vtexlocal.com.br/","").replace("https://qablind.myvtex.com/","").replace("https://blind.myvtex.com/","").replace("http://blind.vtexcommercestable.com.br/","").replace("https://qablind.vtexcommercestable.com.br/","").replace("https://blind.vtexlocal.com.br/",""),product_id=parseInt(product_id),product_link&&(developmode=!1,developmode,apiurl="/api/catalog_system/pub/products/search/"+product_link,$.ajax({url:apiurl,error:function(jqXHR,textStatus,errorThrown){},success:function(data,textStatus,jqXHR){var $container_variation,before,sku,skus;if($product_element_object.addClass("swatches-loaded"),data.length>=1)if(null!=data[0].items&&data[0].items.length>0){skus=data[0].items;for(var count=0,i=0;i0&&skus[i].Color[0].length>0&&(0===i||skus[i].Color[0]!==skus[before].Color[0]&&$container_variation.find('li[data-sku-color="'+skus[i].Color[0]+'"]').length<1&&count<6)){if(sku=skus[i].itemId,color=skus[i].Color[0],prodvariation_img=skus[i].images[0].imageUrl,skus[i].images.length>1?prodvariation_img_atras=skus[i].images[1].imageUrl:prodvariation_img_atras="",color_img="/arquivos/"+color.replace(" ","").toLowerCase()+".jpg",""==prodvariation_img)return;$container_variation=$('
'),0==jQuery($product_element_object).find(".product-variation").length&&jQuery($container_variation).appendTo($product_element_object.find(".similar-colors-vitrine")),jQuery($product_element_object).find(".product-variation").append('
  • '),$product_element_object.find(".productImage .imagen-prod > img").attr("src"),$("li#variacao-item-"+sku).click(function(){$(".product-variation li").removeClass("selected"),$(this).addClass("selected");jQuery(this).attr("data-sku-color").replace('"',""),$product_element_object.find("#container-img .productImage").attr("href")})}count>3&&($container_variation=$product_element_object.find(".product-variation"),jQuery($product_element_object).find(".product-variation").append('
  • '))}else console.log("No hay item")}}))}catch(error){console.error(error)}})}};