PageSourceSearch

https://www.karmaandluck.com/cdn/shop/t/430/assets/kl-sticky-atc.js?v=169131113472934981451789131541

js karmaandluck.com collected 2026-09-24 09:24:21 UTC 5,434 bytes, 2 lines download raw bytes

1const KL_STICKY_ATC_SELECTOR="[data-kl-sticky-atc]",KL_STICKY_ATC_ADD_SELECTOR="[data-kl-sticky-atc-add]",KL_STICKY_ATC_LABEL_SELECTOR="[data-kl-sticky-atc-label]",KL_STICKY_ATC_PRICE_SELECTOR="[data-kl-sticky-atc-price]",KL_STICKY_ATC_BUTTON_PRICE_SELECTOR="[data-kl-sticky-atc-button-price]",KL_STICKY_ATC_IMAGE_SELECTOR="[data-kl-sticky-atc-image]",KL_STICKY_ATC_PRICE_VALUE_SELECTOR="[data-kl-price-current]",KL_STICKY_ATC_SELECTED_VARIANT_SELECTOR="[data-selected-variant]",KL_STICKY_ATC_FOOTER_SELECTOR=".kl-footer",KL_STICKY_ATC_VISIBLE_CLASS="is-visible",KL_STICKY_ATC_IMAGE_WIDTH=160,KL_STICKY_ATC_BODY_CLASS="is-sticky-atc-visible";function getResizedImageUrl(source,width){try{const url=new URL(source);return url.searchParams.set("width",String(width)),url.toString()}catch(error){return console.debug("kl-sticky-atc: the image URL could not be resized",{source,error}),source}}function getIsBarVisible({isTriggerVisible,hasScrolledPast,isFooterVisible,requiresScrollPast}){return isTriggerVisible||isFooterVisible?!1:requiresScrollPast?hasScrolledPast:!0}function readDisplayedPrice(priceSource){return priceSource?(priceSource.querySelector(KL_STICKY_ATC_PRICE_VALUE_SELECTOR)?.textContent||"").trim():""}function readSelectedVariant(variantHost){const script=variantHost?.querySelector(KL_STICKY_ATC_SELECTED_VARIANT_SELECTOR);if(!script)return null;try{return JSON.parse(script.textContent)}catch(error){return console.debug("kl-sticky-atc: the selected variant could not be read",{error}),null}}function syncBar(refs){const{root,triggerButton,priceSource,addButton}=refs;try{const variantHost=document.getElementById(root.dataset.klStickyAtcVariants||""),variant=readSelectedVariant(variantHost),isUnavailable=variant===null&&!!variantHost,isSoldOut=!!triggerButton?.disabled||(variant?variant.available===!1:!1),preOrderLabel=root.dataset.klStickyAtcPreOrderLabel,isPreOrder=!isSoldOut&&preOrderLabel&&triggerButton?.textContent.trim()===preOrderLabel;addButton.disabled=!!triggerButton?.disabled||isUnavailable;const label=root.querySelector(KL_STICKY_ATC_LABEL_SELECTOR);label&&(isUnavailable?label.textContent=root.dataset.klStickyAtcUnavailableLabel:isPreOrder?label.textContent=preOrderLabel:isSoldOut?label.textContent=root.dataset.klStickyAtcSoldOutLabel:label.textContent=root.dataset.klStickyAtcLabel);const price=readDisplayedPrice(priceSource);price&&root.querySelectorAll(`${KL_STICKY_ATC_PRICE_SELECTOR}, ${KL_STICKY_ATC_BUTTON_PRICE_SELECTOR}`).forEach(target=>{target.textContent=price});const image=root.querySelector(KL_STICKY_ATC_IMAGE_SELECTOR),variantImageSource=variant?.featured_image?.src;if(image&&variantImageSource){const resized=getResizedImageUrl(variantImageSource,160);image.src!==resized&&(image.src=resized,image.removeAttribute("srcset"))}}catch(error){console.debug("kl-sticky-atc: the bar could not be brought up to date",{error})}}function initStickyAtc(root){if(!root||root.dataset.klStickyAtcReady==="true")return;const triggerButton=document.getElementById(root.dataset.klStickyAtcTrigger||""),productForm=document.getElementById(root.dataset.klStickyAtcForm||""),addButton=root.querySelector(KL_STICKY_ATC_ADD_SELECTOR);if(!triggerButton||!productForm||!addButton){console.debug("kl-sticky-atc: the bar could not find the product form it belongs to",{triggerId:root.dataset.klStickyAtcTrigger,formId:root.dataset.klStickyAtcForm});return}root.dataset.klStickyAtcReady="true";const refs={root,triggerButton,addButton,priceSource:document.getElementById(root.dataset.klStickyAtcPriceSource||"")},state={isTriggerVisible:!0,hasScrolledPast:!1,isFooterVisible:!1,requiresScrollPast:root.dataset.klStickyAtcRequireScrollPast==="true"},applyVisibility=()=>{root.classList.toggle(KL_STICKY_ATC_VISIBLE_CLASS,getIsBarVisible(state)),document.body.classList.toggle(KL_STICKY_ATC_BODY_CLASS,getIsBarVisible(state))};if(new IntersectionObserver(entries=>{entries.forEach(entry=>{state.isTriggerVisible=entry.isIntersecting,entry.isIntersecting||(state.hasScrolledPast=entry.boundingClientRect.top<0)}),applyVisibility()}).observe(triggerButton),root.dataset.klStickyAtcHideAtFooter==="true"){const footer=document.querySelector(KL_STICKY_ATC_FOOTER_SELECTOR);footer?new IntersectionObserver(entries=>
1{entries.forEach(entry=>{state.isFooterVisible=entry.isIntersecting}),applyVisibility()}).observe(footer):console.debug("kl-sticky-atc: no page footer was found, so the bar will not step aside for it")}const productInfo=document.getElementById(root.dataset.klStickyAtcInfo||"");if(productInfo){let pendingFrame=null;new MutationObserver(()=>{pendingFrame===null&&(pendingFrame=requestAnimationFrame(()=>{pendingFrame=null,refs.priceSource=document.getElementById(root.dataset.klStickyAtcPriceSource||""),syncBar(refs)}))}).observe(productInfo,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled"]})}addButton.addEventListener("click",()=>{if(!addButton.disabled)try{productForm.requestSubmit(triggerButton.disabled?void 0:triggerButton)}catch(error){console.debug("kl-sticky-atc: the product form could not be submitted",{error})}}),syncBar(refs),applyVisibility()}document.querySelectorAll(KL_STICKY_ATC_SELECTOR).forEach(initStickyAtc),document.addEventListener("shopify:section:load",event=>{event.target.querySelectorAll(KL_STICKY_ATC_SELECTOR).forEach(initStickyAtc)});
2//# sourceMappingURL=/cdn/shop/t/430/assets/kl-sticky-atc.js.map?v=169131113472934981451789131541

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.