PageSourceSearch

https://www.seavees.com/cdn/shop/t/974/assets/custom-quick-add.js?v=131458076826518963521789971751

js seavees.com collected 2026-09-24 18:51:58 UTC 3,624 bytes, 14 lines download raw bytes

1class QuickAddVariants extends HTMLElement{constructor(){super(),this.cart=document.querySelector("cart-notification")||document.querySelector("cart-drawer")}connectedCallback(){const productId=this.getAttribute("data-product-id"),productVariants=JSON.parse(document.getElementById(`QuickAddVariants-${productId}`).textContent);this.renderOptions(productVariants),this.querySelector("#quick-add-variants-open-button").addEventListener("click",()=>{this.classList.toggle("show-quick-add-variants")}),this.addEventListener("click",event=>{const variantButton=event.target.closest(".variant-option");this.addToCart(variantButton.dataset.variantId,variantButton.hasAttribute("data-join-waitlist"))})}renderOptions(variants){const optionsContainer=document.createElement("div");optionsContainer.classList.add("variant-options"),variants.forEach(variant=>{const productUrl=this.getAttribute("data-product-url"),option=document.createElement("button");option.classList.add("variant-option"),option.classList.add(`available-${variant.available}`);const numberMatch=variant.title.match(/(\d+(\.\d+)?)/),optionValue=document.createElement("span");if(optionValue.classList.add("variant-option-value"),optionValue.textContent=numberMatch?numberMatch[0]:variant.title,option.appendChild(optionValue),!variant.available&&(option.insertAdjacentHTML("beforeend",`
2          <svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg" class="icon-mail">
3            <path
4              d="M0.833252 8.33335V1.66669H9.16658V8.33335H0.833252ZM4.99992 5.41669L1.66659 3.33335V7.50002H8.33325V3.33335L4.99992 5.41669ZM4.99992 4.58335L8.33325 2.50002H1.66659L4.99992 4.58335ZM1.66659 3.33335V2.50002V7.50002V3.33335Z"
5              fill="currentColor" />
6          </svg>
7        `),option.setAttribute("data-join-waitlist",""),option.setAttribute("data-klaviyo-bis-open",""),productUrl)){const bisUrl=`${window.location.origin}${productUrl}?variant=${variant.id}`;option.setAttribute("data-klaviyo-bis-url",bisUrl)}option.dataset.variantId=variant.id,optionsContainer.appendChild(option)}),this.innerHTML=`
8      <div class="quick-add-variants-header">
9        <h4 class="body-copy-small" id="quick-add-variants-title">Quick Add +</h4>
10        <button id="quick-add-variants-open-button" class="link"><span class="body-copy-small">Quick Add</span></button>
11      </div>
12      ${optionsContainer.outerHTML}
13    `}addToCart(variantId,isJoinWaitlist){if(isJoinWaitlist)return;const config=fetchConfig("javascript");config.headers["X-Requested-With"]="XMLHttpRequest",delete config.headers["Content-Type"];const formData=new FormData;if(formData.append("id",variantId),formData.append("quantity",1),this.cart&&(formData.append("sections",this.cart.getSectionsToRender().map(section=>section.id)),formData.append("sections_url",window.location.pathname),this.cart.setActiveElement(document.activeElement)),config.body=formData,console.debug("Adding variant:",variantId),!variantId){console.error("No variant selected");return}fetch(`${routes.cart_add_url}`,config).then(response=>response.json()).then(response=>{console.debug("Added to cart:",response),publish(PUB_SUB_EVENTS.cartUpdate,{source:"custom-collection-quick-add",cartData:response}),this.cart.renderContents(response)}).catch(error=>{console.error("Error adding to cart:",error)}).finally(()=>{this.cart&&this.cart.classList.contains("is-empty")&&this.cart.classList.remove("is-empty")})}}customElements.define("quick-add-variants",QuickAddVariants);
14//# sourceMappingURL=/cdn/shop/t/974/assets/custom-quick-add.js.map?v=131458076826518963521789971751

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.