/** Shopify CDN: Minification failed Line 328:5 Transforming const to the configured target environment ("es5") is not supported yet Line 336:6 Transforming const to the configured target environment ("es5") is not supported yet **/ jQuery(document).ready(function(){ var vw = 0; var timervwo = setInterval(function(){ jQuery('body').addClass('chescad'); var ur = window.location.href; if(ur.includes('/collection') && !ur.includes('/product') || jQuery('body').hasClass('template-index')){ var q = 0; var timerq = setInterval(function(){ if(jQuery('.quickview-button').length) { var prod = jQuery('.products-grid .product-item'); for(var i = 0; i < prod.length; i++){ var lnk = prod.eq(i).find('a.product-grid-image').attr('href'); prod.eq(i).find('.product-image').eq(0).after(jQuery('
Learn More
')); jQuery('.chesca-button-cont').eq(i).append(jQuery('.quickview-button').eq(i)); jQuery('.quickview-button a').eq(i).html(''); } clearInterval(timerq); } if(q > 400){ clearInterval(timerq); } q++; }, 50); var timers = setInterval(function(){ if(jQuery('.quickview-button').length) { var prod = jQuery('.products-grid .product-item'); for(var i = 0; i < prod.length; i++){ if(prod.eq(i).find('.chesca-button-cont').length == 0){ var lnk = prod.eq(i).find('a.product-grid-image').attr('href'); prod.eq(i).find('.product-image').eq(0).after(jQuery('
Learn More
')); jQuery('.chesca-button-cont').eq(i).append(jQuery('.quickview-button').eq(i)); jQuery('.quickview-button a').eq(i).html(''); } } } }, 1000); } clearInterval(timervwo); if( vw > 200){ clearInterval(timervwo); } vw++; }, 50); }); jQuery(document).ready(function(){ var ur = window.location.href; if(ur.includes('/product')){ if(jQuery('.chescadirect-button-cont').eq(0).length == 0){ jQuery('#product-add-to-cart').before('
BUY NOW
'); jQuery('.chescadirect-button-cont').eq(0).prepend(jQuery('#product-add-to-cart')); jQuery('.chescadirect-buyNow').click(function(){ checkout(); }); } function checkout() { var timerb = setInterval(function(){ if(jQuery('.shopify-payment-button__more-options').eq(0).length || b > 200) { jQuery('.shopify-payment-button__more-options').eq(0).click();; clearInterval(timerb); } b++; }, 50); } } }); var ur = window.location.href; if(ur.includes('/product')){ var cdont = 0; var timercdont = setInterval(function(){ if(jQuery('.chescadirect-button-cont').length) { Element.prototype.appendAfter = function(element) { element.parentNode.insertBefore(this, element.nextSibling); }; var imgSrcs = ['https://useruploads.visualwebsiteoptimizer.com/useruploads/536592/images/e24c0e258631cd7ec26acfc013171127_chescashippingcopy.png', 'https://useruploads.visualwebsiteoptimizer.com/useruploads/536592/images/0ca83b8da73f0247ea880ff848e39386_chescareturncopy.png', 'https://useruploads.visualwebsiteoptimizer.com/useruploads/536592/images/321409be7e3c1642622604afb8626dbd_chescasecurecopy.png']; var badgeTexts = ["Ships Worldwide","14-Day Return Policy","Secure Payment Options"]; var container = document.createElement('div'); container.className = 'chesca-badges-outer-container'; var imgContainer = document.createElement('div'); imgContainer.innerHTML = ''; imgContainer.className = 'chesca-img-container'; if(document.getElementsByClassName('chesca-img-container').length == 0){ var y = document.querySelectorAll('.chescadirect-button-cont')[0]; container.appendAfter(y); container.appendChild(imgContainer); } for(var i = 0; i < imgSrcs.length; i++){ var img = document.createElement('div'); img.innerHTML = '
'+badgeTexts[i]+'
'; imgContainer.appendChild(img); img.className = "chesca-badges-container"; } clearInterval(timercdont); } if( cdont > 200){ clearInterval(timercdont); } cdont++; }, 50); } var hh = 0; var timerhh = setInterval(function(){ if(jQuery('.header .header-logo img').length) { jQuery('.header .header-logo img').addClass('chesca-logo'); jQuery('.header .header-logo img').eq(0).attr('src', 'https://cdn.shopify.com/s/files/1/0539/3612/8173/files/Chescadirect_logo1_719143d3-1182-4570-a783-12d390322298.png?v=1657022015') clearInterval(timerhh); } if( hh > 200){ clearInterval(timerhh); } hh++; }, 50); var ur = window.location.href; if(ur.includes('/collection') && !ur.includes('product')){ jQuery(document).ready(function(){ $('a#cartToggle').click(function(e){ $('#dropdown-cart').toggleClass('open'); if($('#dropdown-cart').height() > 1000){ $('#dropdown-cart').addClass('h'); } if($('#dropdown-cart').height() > 2000){ $('#dropdown-cart').addClass('hh'); } if($('#dropdown-cart').height() > 3000){ $('#dropdown-cart').addClass('hhh'); } if($('#dropdown-cart').height() > 4000){ $('#dropdown-cart').addClass('hhhh'); } }); }); } var ur = window.location.href; if(ur.includes('/product')){ var ccccc = 0; var timerccccc = setInterval(function(){ if(jQuery('.chesca-mid').length) { jQuery('.product-vendor').before(jQuery(`
`)) if(window.innerWidth < 980){ jQuery('.chesca-mid').eq(0).after(jQuery('h2.product-vendor').eq(0)) } jQuery('.t-reviews-cehsca').click(function(){ window.scrollTo({ top: document.querySelectorAll('.template-product .main-content .trustpilot-widget.vwo')[0].offsetTop, behavior: 'smooth' }); }); clearInterval(timerccccc);}if( ccccc > 200){clearInterval(timerccccc);}ccccc++;}, 50); } var ur = window.location.href; if(ur.includes('/product') && window.innerWidth > 980){ jQuery(document).ready(function(){ jQuery('input#product-add-to-cart').click(function(){ jQuery('body').addClass('redirect') setTimeout(function(){ var lll = 0; var timerlll = setInterval(function(){ if(jQuery('.xsell__modal-overlay').length == 0) { window.location.href = "/cart"; clearInterval(timerlll);}if( lll > 200){clearInterval(timerlll);}lll++;}, 50); }, 500); }); }); } var ur = window.location.href; if(ur.includes('/cart') && jQuery('.secure-checkout').length == 0 && window.innerWidth > 980){ jQuery(document).ready(function(){ jQuery('div#breadcrumbs').after(jQuery(`
Checkout is safe and secure.
Pay in 3 interest-free payments with Klarna on checkout.
14-day free and easy returns.
`)) jQuery('.cart-row input.btn[name="checkout"]').eq(0).before(jQuery(`
SECURE CHECKOUT
`)); jQuery('.secure-checkout').click(function(){ jQuery('.cart-row input.btn[name="checkout"]').eq(0).click() }); }); } var ur = window.location.href; if(jQuery('.logo-mobile').length == 0 && window.innerWidth < 768){ jQuery(document).ready(function(){ setTimeout(function(){ jQuery('.gf-menu-device-wrapper').eq(0).addClass('header') jQuery('.gf-menu-device-wrapper').eq(0).append(jQuery('.nav-search').eq(0)) }, 2000); jQuery('p.short-description').eq(0).before(jQuery('.chesca-mid').eq(0)) jQuery('.t-reviews-cehsca').eq(0).after(jQuery('.product-shop .prices').eq(0)) jQuery('.header-panel .row').eq(0).append(jQuery(`
`)); jQuery('.header-right-side').eq(0).append(jQuery('.col-xs-4.top-header')) jQuery('.cart-mobile').click(function(e){ e.preventDefault(); console.log('here'); document.querySelectorAll('#cartToggle')[0].click(); }); var ur = window.location.href; if(ur.includes('/product')){ jQuery(document).ready(function(){ if(jQuery('.product-img-box .product-photo-thumbs.owl-theme li').length < 0){ jQuery('.product-photo-container').eq(0).append(jQuery(`
`)); jQuery('.product-photo-container').eq(0).append(jQuery(`
`)); } }); jQuery(document).ready(function(){ document.querySelectorAll('ul#more-view-carousel a')[0].click() }); const swipeContainer = document.querySelector('.col-xs-5.product-img-box'); // Add touchstart and touchend event listeners to the swipe container swipeContainer.addEventListener('touchstart', function(e) { touchStartX = e.changedTouches[0].pageX; }); swipeContainer.addEventListener('touchend', function(e) { touchEndX = e.changedTouches[0].pageX; // Calculate the difference between touch start and touch end positions const deltaX = touchEndX - touchStartX; // You can define a threshold for swipe detection, for example, 50 pixels if (Math.abs(deltaX) > 50) { if (deltaX > 0) { prevImage() } else { nextImage() } } }); nextImage(); function nextImage(){ var $activeItem = $('ul#more-view-carousel li a.active'); // Find the next item var $nextItem = $activeItem.closest('.owl-item').next(); // If there is a next item, activate it and deactivate the current one if ($nextItem.length > 0) { console.log('test'); $nextItem.find('a').eq(0).click(); $('.arrow.left').show(); if ($nextItem.is(':last-child')) { $('.arrow.right').hide(); } } } function prevImage(){ // Find the currently active item var $activeItem = $('ul#more-view-carousel li a.active'); // Find the previous item var $prevItem = $activeItem.closest('.owl-item').prev(); // If there is a previous item, activate it and deactivate the current one if ($prevItem.length > 0) { $prevItem.find('a').eq(0).click(); // Hide/show arrows as needed $('.arrow.right').show(); if ($prevItem.is(':first-child')) { $('.arrow.left').hide(); } } } $('.arrow.left').hide(); $('ul#more-view-carousel li a').eq(0).click(); // Click event for the right arrow $('.arrow.right').on('click', function() { nextImage() }); // Click event for the left arrow $('.arrow.left').on('click', function() { prevImage() }); } }); }