PageSourceSearch

https://thesaltworkscompany.com/cdn/shop/t/43/assets/ds-lp-2026-02-11-v2.js?v=itb-c9fcac310d

js thesaltworkscompany.com collected 2026-09-29 16:22:04 UTC 20,000 bytes, 13 lines download raw bytes

1(function(){"use strict";function throttle(fn,wait){let lastTime=0;return function(...args){const now=Date.now();now-lastTime>=wait&&(lastTime=now,fn.apply(this,args))}}function initReveal(){const elements=document.querySelectorAll("[data-reveal]");if(!elements.length)return;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&(entry.target.classList.add("is-visible"),observer.unobserve(entry.target))})},{threshold:.12});elements.forEach(el=>observer.observe(el))}function initHeroCarousel(){const carousel=document.querySelector("[data-carousel]");if(!carousel)return;const slides=carousel.querySelectorAll("[data-slide]"),dots=document.querySelectorAll("[data-dot]");let current=0,autoplayTimer;function goTo(index){slides.forEach((slide,i)=>{slide.classList.toggle("is-active",i===index)}),dots.forEach((dot,i)=>{dot.classList.toggle("is-active",i===index)}),current=index}function next(){goTo((current+1)%slides.length)}function prev(){goTo((current-1+slides.length)%slides.length)}function startAutoplay(){autoplayTimer=setInterval(next,4e3)}function stopAutoplay(){clearInterval(autoplayTimer)}dots.forEach((dot,i)=>{dot.addEventListener("click",()=>{stopAutoplay(),goTo(i),startAutoplay()})});let touchStartX=0;carousel.addEventListener("touchstart",e=>{touchStartX=e.touches[0].clientX,stopAutoplay()},{passive:!0}),carousel.addEventListener("touchend",e=>{const touchEndX=e.changedTouches[0].clientX,diff=touchStartX-touchEndX;Math.abs(diff)>50&&(diff>0?goTo((current+1)%slides.length):goTo((current-1+slides.length)%slides.length)),startAutoplay()},{passive:!0});let lightbox=null,lightboxCurrent=0;function createLightbox(){if(lightbox)return;lightbox=document.createElement("div"),lightbox.className="ds-lightbox",lightbox.innerHTML=`
2        <div class="ds-lightbox__overlay"></div>
3        <div class="ds-lightbox__content">
4          <button class="ds-lightbox__close" aria-label="Close">&times;</button>
5          <button class="ds-lightbox__prev" aria-label="Previous">&#8249;</button>
6          <button class="ds-lightbox__next" aria-label="Next">&#8250;</button>
7          <div class="ds-lightbox__image-wrap">
8            <img class="ds-lightbox__image" src="" alt="">
9          </div>
10          <div class="ds-lightbox__dots"></div>
11        </div>
12      `,document.body.appendChild(lightbox);const dotsContainer=lightbox.querySelector(".ds-lightbox__dots");slides.forEach((_,i)=>{const dot=document.createElement("button");dot.className="ds-lightbox__dot",dot.addEventListener("click",()=>lightboxGoTo(i)),dotsContainer.appendChild(dot)}),lightbox.querySelector(".ds-lightbox__overlay").addEventListener("click",closeLightbox),lightbox.querySelector(".ds-lightbox__close").addEventListener("click",closeLightbox),lightbox.querySelector(".ds-lightbox__prev").addEventListener("click",()=>{lightboxGoTo((lightboxCurrent-1+slides.length)%slides.length)}),lightbox.querySelector(".ds-lightbox__next").addEventListener("click",()=>{lightboxGoTo((lightboxCurrent+1)%slides.length)});const lightboxImg=lightbox.querySelector(".ds-lightbox__image");lightboxImg.addEventListener("click",()=>{lightboxGoTo((lightboxCurrent+1)%slides.length)}),lightboxImg.style.cursor="pointer",document.addEventListener("keydown",handleLightboxKeydown);const imageWrap=lightbox.querySelector(".ds-lightbox__image-wrap");let touchStartX2=0,mouseStartX=0,isDragging=!1;imageWrap.addEventListener("touchstart",e=>{touchStartX2=e.touches[0].clientX},{passive:!0}),imageWrap.addEventListener("touchend",e=>{const touchEndX=e.changedTouches[0].clientX,diff=touchStartX2-touchEndX;Math.abs(diff)>50&&(diff>0?lightboxGoTo((lightboxCurrent+1)%slides.length):lightboxGoTo((lightboxCurrent-1+slides.length)%slides.length))},{passive:!0}),imageWrap.style.cursor="grab",imageWrap.addEventListener("mousedown",e=>{e.target.closest(".ds-lightbox__prev")||e.target.closest(".ds-lightbox__next")||(isDragging=!0,mouseStartX=e.clientX,imageWrap.style.cursor="grabbing",e.preventDefault())}),imageWrap.addEventListener("mousemove",e=>{isDragging&&e.preventDefault()}),imageWrap.addEventListener("mouseup",e=>{if(!isDragging)return;isDragging=!1,imageWrap.style.cursor="grab";const diff=mouseStartX-e.clientX;Math.abs(diff)>50&&(diff>
120?lightboxGoTo((lightboxCurrent+1)%slides.length):lightboxGoTo((lightboxCurrent-1+slides.length)%slides.length))}),imageWrap.addEventListener("mouseleave",()=>{isDragging&&(isDragging=!1,imageWrap.style.cursor="grab")})}function handleLightboxKeydown(e){!lightbox||!lightbox.classList.contains("is-open")||(e.key==="Escape"&&closeLightbox(),e.key==="ArrowRight"&&lightboxGoTo((lightboxCurrent+1)%slides.length),e.key==="ArrowLeft"&&lightboxGoTo((lightboxCurrent-1+slides.length)%slides.length))}function lightboxGoTo(index){lightboxCurrent=index;const img=slides[index].querySelector("img"),lightboxImg=lightbox.querySelector(".ds-lightbox__image"),src=img.src.replace(/\d+x\d+/,"1200x1200");lightboxImg.src=src,lightboxImg.alt=img.alt,lightbox.querySelectorAll(".ds-lightbox__dot").forEach((dot,i)=>{dot.classList.toggle("is-active",i===index)})}function hideChat(){const chat=document.querySelector("inbox-online-store-chat, #ShopifyChat, #inbox-online-store-chat");chat&&chat.style.setProperty("z-index","0","important")}function showChat(){const chat=document.querySelector("inbox-online-store-chat, #ShopifyChat, #inbox-online-store-chat");chat&&chat.style.setProperty("z-index","2147483647","important")}function openLightbox(index){createLightbox(),lightboxGoTo(index),lightbox.classList.add("is-open"),document.body.classList.add("lightbox-open"),document.body.style.overflow="hidden",hideChat(),stopAutoplay()}function closeLightbox(){lightbox&&(lightbox.classList.remove("is-open"),document.body.classList.remove("lightbox-open"),document.body.style.overflow="",showChat(),startAutoplay())}carousel.addEventListener("click",e=>{e.target.closest("[data-dot]")||openLightbox(current)}),carousel.style.cursor="pointer",carousel.addEventListener("openLightbox",e=>{const index=e.detail?.index||0;openLightbox(index)}),startAutoplay()}function initQuantity(){const minusBtn=document.querySelector("[data-qty-minus]"),plusBtn=document.querySelector("[data-qty-plus]"),valueEl=document.querySelector("[data-qty-value]"),inputEl=document.querySelector("[data-qty-input]"),priceEl=document.querySelector("[data-price]");if(!minusBtn||!plusBtn||!valueEl)return;const basePrice=29;let qty=1;function update(){valueEl.textContent=qty,inputEl&&(inputEl.value=qty),priceEl&&(priceEl.textContent="\xA3"+basePrice*qty)}minusBtn.addEventListener("click",()=>{qty>1&&(qty--,update())}),plusBtn.addEventListener("click",()=>{qty<10&&(qty++,update())})}function initFragrances(){const filters=document.querySelectorAll("[data-filter]"),frags=document.querySelectorAll("[data-frag]");filters.forEach(btn=>{btn.addEventListener("click",()=>
12{const filter=btn.dataset.filter;filters.forEach(f=>f.classList.remove("is-active")),btn.classList.add("is-active"),frags.forEach(frag=>{if(filter==="all")frag.classList.remove("is-hidden");else{const family=frag.dataset.family;frag.classList.toggle("is-hidden",family!==filter)}})})}),frags.forEach(frag=>{const header=frag.querySelector(".ds-frag__header");header&&header.addEventListener("click",e=>{e.stopPropagation();const isExpanded=frag.classList.contains("is-expanded");frags.forEach(f=>f.classList.remove("is-expanded")),isExpanded||(frag.classList.add("is-expanded"),setTimeout(()=>{const headerRect=frag.getBoundingClientRect(),offset=20;(headerRect.top<offset||headerRect.top>window.innerHeight*.4)&&(frag.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout(()=>{window.scrollBy({top:-offset,behavior:"smooth"})},300))},50))})})}function initHighlightCarousel(){const carousel=document.querySelector("[data-highlight-carousel]");if(!carousel)return;const slides=carousel.querySelectorAll(".ds-highlight__slide"),dots=carousel.querySelectorAll("[data-highlight-dot]");let current=0,autoplayTimer,touchStartX=0;function goTo(index){slides.forEach((slide,i)=>{slide.classList.toggle("is-active",i===index)}),dots.forEach((dot,i)=>{dot.classList.toggle("is-active",i===index)}),current=index}function next(){goTo((current+1)%slides.length)}function prev(){goTo((current-1+slides.length)%slides.length)}function startAutoplay(){autoplayTimer=setInterval(next,5e3)}function stopAutoplay(){clearInterval(autoplayTimer)}dots.forEach((dot,i)=>{dot.addEventListener("click",()=>{stopAutoplay(),goTo(i),startAutoplay()})}),carousel.addEventListener("touchstart",e=>{touchStartX=e.touches[0].clientX,stopAutoplay()},{passive:!0}),carousel.addEventListener("touchend",e=>{const touchEndX=e.changedTouches[0].clientX,diff=touchStartX-touchEndX;Math.abs(diff)>50&&(diff>0?next():prev()),startAutoplay()},{passive:!0});let mouseStartX=0,isDragging=!1;carousel.style.cursor="grab",carousel.addEventListener("mousedown",e=>{e.target.closest("[data-highlight-dot]")||(isDragging=!0,mouseStartX=e.clientX,carousel.style.cursor="grabbing",stopAutoplay(),e.preventDefault())}),carousel.addEventListener("mousemove",e=>{isDragging&&e.preventDefault()}),carousel.addEventListener("mouseup",e=>{if(!isDragging)return;isDragging=!1,carousel.style.cursor="grab";const diff=mouseStartX-e.clientX;Math.abs(diff)>50&&(diff>0?next():prev()),startAutoplay()}),carousel.addEventListener("mouseleave",()=>{isDragging&&(isDragging=!1,carousel.style.cursor="grab",startAutoplay())}),startAutoplay()}function initAccordion(){document.querySelectorAll("[data-accordion-toggle]").forEach(toggle=>{toggle.addEventListener("click",()=>{const item=toggle.closest(".ds-accordion__item"),isOpen=item.classList.contains("is-open");document.querySelectorAll(".ds-accordion__item").forEach(i=>{i.classList.remove("is-open")}),isOpen||item.classList.add("is-open")})})}function initStickyBar(){const hero=document.getElementById("ds-hero"),sticky=document.getElementById("ds-sticky");
12if(!hero||!sticky)return;const onScroll=throttle(()=>{const heroBottom=hero.getBoundingClientRect().bottom;sticky.classList.toggle("is-visible",heroBottom<-100)},100);window.addEventListener("scroll",onScroll,{passive:!0});const stickyThumb=sticky.querySelector(".ds-sticky__thumb");stickyThumb&&(stickyThumb.style.cursor="pointer",stickyThumb.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation();const carousel=document.querySelector("[data-carousel]");if(carousel){const event=new CustomEvent("openLightbox",{detail:{index:1}});carousel.dispatchEvent(event)}}))}function initScrollToBuy(){const buttons=document.querySelectorAll("[data-scroll-to-buy]"),buybox=document.querySelector(".ds-buybox");!buttons.length||!buybox||buttons.forEach(btn=>{btn.addEventListener("click",e=>{e.preventDefault(),buybox.scrollIntoView({behavior:"smooth",block:"center"})})})}function initAddToCart(){const form=document.getElementById("ds-add-form");form&&form.addEventListener("submit",async e=>{e.preventDefault();const btn=form.querySelector('button[type="submit"]'),originalText=btn.innerHTML;btn.disabled=!0,btn.innerHTML="<span>Adding...</span>";try{const formData=new FormData(form);const addRes=await fetch(window.theme.routes.cartAdd,{method:"POST",body:formData});if(addRes.ok){const product=await addRes.json().catch(()=>null);if(btn.innerHTML="<span>Added!</span>",typeof window.theme<"u"&&window.theme.cart)document.dispatchEvent(new CustomEvent("ajaxProduct:added",{detail:{product,addToCartBtn:btn}}));else{const cartCountEls=document.querySelectorAll("[data-cart-count]");if(cartCountEls.length){const cart=await(await fetch(window.theme.routes.cart)).json();cartCountEls.forEach(el=>{el.textContent=cart.item_count})}}setTimeout(()=>{btn.disabled=!1,btn.innerHTML=originalText},2e3)}else throw new Error("Add to cart failed")}catch(error){console.error("Add to cart error:",error),btn.innerHTML="<span>Error - Try Again</span>",setTimeout(()=>{btn.disabled=!1,btn.innerHTML=originalText},2e3)}})}function initFinalAddToCart(){const finalBtn=document.querySelector("[data-final-add-to-cart]"),form=document.getElementById("ds-add-form");!finalBtn||!form||finalBtn.addEventListener("click",e=>{e.preventDefault();const scrollY=window.scrollY;form.querySelector('button[type="submit"]')?.click(),requestAnimationFrame(()=>window.scrollTo(0,scrollY))})}function initSmoothScroll(){document.querySelectorAll('a[href^="#"]').forEach(anchor=>{anchor.addEventListener("click",e=>{const targetId=anchor.getAttribute("href");if(targetId==="#")return;const target=document.querySelector(targetId);target&&(e.preventDefault(),target.scrollIntoView({behavior:"smooth"}))})})}function initStickyAddToCart(){const stickyBtn=document.querySelector("[data-sticky-atc]");stickyBtn&&stickyBtn.addEventListener("click",e=>{e.preventDefault();const mainForm=document.getElementById("ds-add-form");if(mainForm){const mainBtn=mainForm.querySelector('button[type="submit"]');if(mainBtn){mainBtn.click();return}}const fallbackBtn=document.querySelector('.ds-buybox form button[type="submit"], .ds-buybox__atc');fallbackBtn&&fallbackBtn.click()})}function initDragScroll(){document.querySelectorAll(".ds-proof__scroll, .ds-hero__carousel").forEach(container=>{let isDown=!1,startX,scrollLeft;container.style.cursor="grab",container.addEventListener("mousedown",e=>{e.target.tagName==="A"||e.target.tagName==="BUTTON"||(isDown=!0,container.style.cursor="grabbing",startX=e.pageX-container.offsetLeft,scrollLeft=container.scrollLeft,e.preventDefault())}),container.addEventListener("mouseleave",()=>{isDown=!1,container.style.cursor="grab"}),container.addEventListener("mouseup",()=>{isDown=!1,container.style.cursor="grab"}),container.addEventListener("mousemove",e=>{if(!isDown)return;e.preventDefault();const walk=(e.pageX-container.offsetLeft-startX)*1.5;container.scrollLeft=scrollLeft-walk})})}function initPinchFontScale(){if(!("ontouchstart"in window))return;const indicator=document.getElementById("ds-font-indicator"),sizeDisplay=indicator?.querySelector("[data-font-size]"),body=document.body;if(!indicator||!sizeDisplay)return;let currentScale=parseFloat(localStorage.getItem("ds-font-scale")||"1");const minScale=.8,maxScale=1.5;currentScale!==1&&applyScale(currentScale,!1);let initialDistance=0,initialScale=currentScale,isPinching=!1,hideTimeout;function getDistance(touches){const dx=touches[0].clientX-touches[1].clientX,dy=touches[0].clientY-touches[1].clientY;return Math.sqrt(dx*dx+dy*dy)}function showIndicator(){clearTimeout(hideTimeout),indicator.classList.add("is-visible")}function hideIndicator(){hideTimeout=setTimeout(()=>{indicator.classList.remove("is-visible")},1e3)}function applyScale(scale,animate=!0){currentScale=Math.min(maxScale,Math.max(minScale,scale));const percent=Math.round(currentScale*100);sizeDisplay.textContent=percent+"%",document.documentElement.style.setProperty("--ds-font-multiplier",currentScale),body.classList.add("ds-font-scaled"),localStorage.setItem("ds-font-scale",currentScale.toString())}document.addEventListener("touchstart",e=>{if(e.touches.length===2){if(document.querySelector(".ds-lightbox.is-open"))return;isPinching=!0,initialDistance=getDistance(e.touches),initialScale=currentScale,showIndicator()}},{passive:!0}),document.addEventListener("touchmove",e=>{if(!isPinching||e.touches.length!==2)return;const scaleFactor=getDistance(e.touches)/initialDistance,newScale=initialScale*scaleFactor;applyScale(newScale)},{passive:!0}),document.addEventListener("touchend",e=>{isPinching&&e.touches.length<2&&(isPinching=!1,hideIndicator())},{passive:!0}),document.addEventListener("touchcancel",()=>{isPinching=!1,hideIndicator()},{passive:!0});let lastTap=0;document.addEventListener("touchend",e=>{if(e.changedTouches.length!==1)return;const now=Date.now(),timeDiff=now-lastTap;if(timeDiff<300&&timeDiff>0){const touch=e.changedTouches[0],rect=indicator.getBoundingClientRect(),centerX=window.innerWidth/2,centerY=window.innerHeight/2;Math.sqrt(Math.pow(touch.clientX-centerX,2)+Math.pow(touch.clientY-centerY,2))<100&&currentScale!==1&&(applyScale(1),showIndicator(),hideIndicator())}lastTap=now},{passive:!0})}
12function init(){initReveal(),initHeroCarousel(),initQuantity(),initFragrances(),initHighlightCarousel(),initAccordion(),initStickyBar(),initScrollToBuy(),initAddToCart(),initFinalAddToCart(),initStickyAddToCart(),initSmoothScroll(),initReviewPhotos(),initFragReviewsCarousel(),initDragScroll(),initPinchFontScale()}function initReviewPhotos(){document.querySelectorAll("[data-review-photo]").forEach(photo=>{photo.addEventListener("click",()=>{photo.classList.toggle("is-expanded")})})}function initFragReviewsCarousel(){document.querySelectorAll("[data-frag-reviews]").forEach(carousel=>{const reviews=carousel.querySelectorAll(".ds-frag__review"),dots=carousel.querySelectorAll("[data-review-dot]");if(reviews.length<=1)return;let current=0,autoplayTimer,touchStartX=0,touchEndX=0;function goTo(index){reviews[current].classList.remove("is-active"),dots[current].classList.remove("is-active"),current=index,reviews[current].classList.add("is-active"),dots[current].classList.add("is-active")}function next(){goTo((current+1)%reviews.length)}function prev(){goTo((current-1+reviews.length)%reviews.length)}function startAutoplay(){autoplayTimer=setInterval(next,4e3)}function stopAutoplay(){clearInterval(autoplayTimer)}dots.forEach((dot,i)=>{dot.addEventListener("click",e=>{e.stopPropagation(),stopAutoplay(),goTo(i),startAutoplay()})}),carousel.addEventListener("touchstart",e=>{touchStartX=e.touches[0].clientX,stopAutoplay()},{passive:!0}),carousel.addEventListener("touchend",e=>{touchEndX=e.changedTouches[0].clientX;const diff=touchStartX-touchEndX;Math.abs(diff)>40&&(e.stopPropagation(),diff>0?next():prev()),startAutoplay()},{passive:!0});let mouseStartX=0,isDragging=!1;carousel.style.cursor="grab",carousel.addEventListener("mousedown",e=>{e.target.closest("[data-review-dot]")||(isDragging=!0,mouseStartX=e.clientX,carousel.style.cursor="grabbing",stopAutoplay(),e.preventDefault())}),carousel.addEventListener("mousemove",e=>{isDragging&&e.preventDefault()}),carousel.addEventListener("mouseup",e=>{if(!isDragging)return;isDragging=!1,carousel.style.cursor="grab";const diff=mouseStartX-e.clientX;Math.abs(diff)>40&&(e.stopPropagation(),diff>0?next():prev()),startAutoplay()}),carousel.addEventListener("mouseleave",()=>{isDragging&&(isDragging=!1,carousel.style.cursor="grab",startAutoplay())}),startAutoplay()})}function fixOudHarmonyImage(){const oudHarmonyImg="https://cdn.shopify.com/s/files/1/0653/7091/5035/files/OUDHARMONY_bd101df8-fc8c-42e4-9067-7e4f1c82f42a.jpg";document.querySelectorAll(".ds-frag").forEach(frag=>{const name=frag.querySelector(".ds-frag__name");if(name&&name.textContent.toLowerCase().includes("oud harmony")){const swatchImg=frag.querySelector(".ds-frag__swatch img");swatchImg&&swatchImg.src.includes("no-image")&&(swatchImg.src=oudHarmonyImg,swatchImg.style.objectFit="cover",swatchImg.style.borderRadius="50%");const detailImg=frag.querySelector(".ds-frag__image img");detailImg&&detailImg.src.includes("no-image")&&(detailImg.src=oudHarmonyImg,detailImg.style.objectFit="cover")}})}function fixLooxIframeHeight(){if(window.innerWidth>480)return;const iframe=document.querySelector("#looxReviewsFrame"),looxWidget=document.querySelector(".loox-widget");if(!iframe)return;const maxHeight=5500,checkHeight=()=>{(parseInt(iframe.style.height)||iframe.offsetHeight)>6e3&&(iframe.style.height=maxHeight+"px",looxWidget&&(looxWidget.style.height=maxHeight+"px"))};checkHeight(),new MutationObserver(checkHeight).observe(iframe,{attributes:!0,attributeFilter:["style","height"]}),iframe.addEventListener("load",checkHeight)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{init(),fixOudHarmonyImage(),setTimeout(fixLooxIframeHeight,3e3)}):(init(),fixOudHarmonyImage(),setTimeout(fixLooxIframeHeight,3e3))})();
13//# sourceMappingURL=/cdn/shop/t/43/assets/ds-lp-2026-02-11-v2.js.map?v=151716223277296969341779094730

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.