PageSourceSearch

https://www.goodranchers.com/cdn/shop/t/410/assets/free-gift-drawer.js?v=164919082524768541781790179511

js goodranchers.com collected 2026-09-24 20:03:54 UTC 4,287 bytes, 2 lines download raw bytes

1import{DialogComponent}from"@theme/dialog";const HASH="#free-gift-panel",DISMISS_DISTANCE=80;class FreeGiftDrawer extends DialogComponent{requiredRefs=["dialog","sheet"];#activeFooter="";#dragStartY=0;#dragging=!1;#handle=null;connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#handleDocumentClick),this.#decorateTriggerLinks(),window.Shopify?.designMode&&(document.addEventListener("shopify:section:select",this.#handleSectionSelect),document.addEventListener("shopify:section:deselect",this.#handleSectionDeselect));const handle=this.refs.handle;handle instanceof HTMLElement&&(this.#handle=handle,handle.addEventListener("pointerdown",this.#handlePointerDown),handle.addEventListener("pointermove",this.#handlePointerMove),handle.addEventListener("pointerup",this.#handlePointerUp),handle.addEventListener("pointercancel",this.#handlePointerUp))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.#handleDocumentClick),document.removeEventListener("shopify:section:select",this.#handleSectionSelect),document.removeEventListener("shopify:section:deselect",this.#handleSectionDeselect);const handle=this.#handle;handle&&(handle.removeEventListener("pointerdown",this.#handlePointerDown),handle.removeEventListener("pointermove",this.#handlePointerMove),handle.removeEventListener("pointerup",this.#handlePointerUp),handle.removeEventListener("pointercancel",this.#handlePointerUp),this.#handle=null)}open(footer=""){this.#showFooter(footer),this.showDialog(),this.#track(this.#activeFooter)}#handleSectionSelect=event=>{event.target===this.closest(".shopify-section")&&(this.#showFooter(this.#activeFooter),this.showDialog())};#handleSectionDeselect=event=>{event.target===this.closest(".shopify-section")&&this.closeDialog()};get isOpen(){return this.refs.dialog.open}#decorateTriggerLinks(){for(const anchor of document.querySelectorAll(`a[href*="${HASH}"]`))anchor instanceof HTMLAnchorElement&&this.#footerFromAnchor(anchor)!==null&&anchor.setAttribute("aria-haspopup","dialog")}#footerFromAnchor(anchor){if(anchor.target&&anchor.target!=="_self")return null;let url;try{url=new URL(anchor.href,window.location.href)}catch{return null}if(url.origin!==window.location.origin||url.pathname!==window.location.pathname)return null;const hash=url.hash;return hash===HASH?"":hash.startsWith(`${HASH}-`)?hash.slice(HASH.length+1):null}#handleDocumentClick=event=>{const target=event.target;if(!(target instanceof Element))return;const anchor=target.closest(`a[href*="${HASH}"]`);if(!(anchor instanceof HTMLAnchorElement)||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey||event.button!==0)return;const footer=this.#footerFromAnchor(anchor);footer!==null&&(event.preventDefault(),this.open(footer))};#showFooter(name){const footers=Array.from(this.querySelectorAll("[data-footer]")).filter(footer=>footer instanceof HTMLElement);if(footers.length===0)return;const match=footers.find(footer=>footer.getAttribute("data-footer")===name)??footers[0];if(match){for(const footer of footers)footer.hidden=footer!==match;this.#activeFooter=match.getAttribute("data-footer")??""}}#track(footer){const w=window;Array.isArray(w.ElevarDataLayer)||(w.ElevarDataLayer=[]),w.ElevarDataLayer.push({event:"gr_cta_clicked",element_name:"free_gift_panel_open",panel_footer:footer,hit_timestamp_ms:Date.now()})}#handlePointerDown=event=>{event.pointerType==="mouse"&&event.button!==0||(this.#dragging=!0,this.#dragStartY=event.clientY,this.refs.sheet.classList.add("free-gift-drawer__sheet--dragging"),this.#handle?.setPointerCapture(event.pointerId))};#handlePointerMove=event=>{if(!this.#dragging)return;const delta=Math.max(0,event.clientY-this.#dragStartY);this.refs.sheet.style.setProperty("--free-gift-drag",`${delta}px`)};#handlePointerUp=event=>{if(!this.#dragging)return;this.#dragging=!1;const delta=Math.max(0,event.clientY-this.#dragStartY),{sheet}=this.refs;sheet.classList.remove("free-gift-drawer__sheet--dragging"),sheet.style.removeProperty("--free-gift-drag"),delta>DISMISS_DISTANCE&&this.closeDialog()}}customElements.get("free-gift-drawer")||customElements.define("free-gift-drawer",FreeGiftDrawer);
2//# sourceMappingURL=/cdn/shop/t/410/assets/free-gift-drawer.js.map?v=164919082524768541781790179511

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.