PageSourceSearch

https://bembien.com/cdn/shop/t/80/assets/custom.js?v=114459827635466894611789672341

js bembien.com collected 2026-10-03 21:23:50 UTC 11,101 bytes, 2 lines download raw bytes

1window.addEventListener("load",function(){window.location.href.includes("#stockists")&&setTimeout(function(){document.querySelector("html,body").animate({scrollTop:document.querySelector("#stockists").offset().top})},2e3)},!1);const getChangedOptionIndex=(variant,previousVariant)=>{for(let i=0;i<variant.options.length;i++)if(variant.options[i]!==previousVariant.options[i])return i};if(document.querySelector(".ProductForm__Variants")){const findVariantByOptions=(variants,options)=>variants.find(variant=>(!options.option1||variant.option1===options.option1)&&(!options.option2||variant.option2===options.option2)&&(!options.option3||variant.option3===options.option3)),{product}=JSON.parse(document.querySelector("script[data-product-json]").innerHTML);document.addEventListener("variant:changed",event=>{if(!event.detail.variant)return;const{variant,previousVariant}=event.detail,changedOptionIndex=getChangedOptionIndex(variant,previousVariant);if(changedOptionIndex===void 0)return;document.querySelectorAll('input[name^="option-"]').forEach(optionInputEl=>{const optionIndex=Number(optionInputEl.name.split("-")[1]);if(optionIndex!==changedOptionIndex){const optionsToCheck={[`option${changedOptionIndex+1}`]:variant.options[changedOptionIndex],[`option${optionIndex+1}`]:optionInputEl.value},foundVariant=findVariantByOptions(product.variants,optionsToCheck);!foundVariant||!foundVariant.available?optionInputEl.nextElementSibling.classList.add("opt-sold-out"):optionInputEl.nextElementSibling.classList.remove("opt-sold-out")}})})}function updateHasContentClass(container){Array.from(container.children).forEach(el=>{/\S/.test(el.textContent)||el.querySelector(".ProductItem__Label")?(el.classList.add("has-content"),el.classList.remove("no-content")):(el.classList.remove("has-content"),el.classList.add("no-content"))})}function observeLabelContainer(container){new MutationObserver(()=>{updateHasContentClass(container)}).observe(container,{childList:!0,subtree:!0,characterData:!0}),updateHasContentClass(container)}function applyObserverToAllContainers(){document.querySelectorAll(".ProductItems__LabelContainer").forEach(container=>{observeLabelContainer(container)}),new MutationObserver(mutationsList=>{mutationsList.forEach(mutation=>{mutation.type==="childList"&&mutation.addedNodes.forEach(node=>{node.nodeType===1&&node.matches(".ProductItems__LabelContainer")&&observeLabelContainer(node)})})}).observe(document.body,{childList:!0,subtree:!0})}applyObserverToAllContainers(),(function(){const originalPushState=history.pushState,originalReplaceState=history.replaceState;history.pushState=function(state,title,url){const result=originalPushState.apply(history,arguments);return window.dispatchEvent(new Event("urlchange")),result},history.replaceState=function(state,title,url){const result=originalReplaceState.apply(history,arguments);return window.dispatchEvent(new Event("urlchange")),result}})(),window.addEventListener("urlchange",()=>{setTimeout(()=>{applyObserverToAllContainers()},1e3)});function showQBSizeList(selectedColorInput,product){if(selectedColorInput){const selectedColor=selectedColorInput.value;product.querySelectorAll(".quick-buy-simple .HorizontalList__Item").forEach(item=>{item.dataset.color===selectedColor?item.style.display="inline-block":item.style.display="none"})}}function showListButton(listButton){listButton.classList.add("hidden");const quickBuyList=listButton.parentElement.querySelector(".quick-buy-list");quickBuyList.classList.remove("hidden"),quickBuyList.classList.add("is-active")}document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".ProductItem").forEach(product=>{const selectedColorInput=product.querySelector(".ProductItem__ColorSwatchItem input:checked");showQBSizeList(selectedColorInput,product),product.addEventListener("change",event=>{event.target.matches(".ProductItem__ColorSwatchItem input")&&product.querySelectorAll(".quick-buy-simple .HorizontalList__Item").forEach(item=>{item.dataset.color===event.target.value?item.style.display="inline-block":item.style.display="none"})})}),document.querySelectorAll(".list-button").forEach(listButton=>{listButton.addEventListener("click",event=>{showListButton(listButton)})}),document.querySelectorAll(".plusButton").forEach(function(button){button.addEventListener("click",handleQBPlusClick),button.addEventListener("touchend",handleQBPlusClick)});function serialize(form){function stringKey(key,value){var beginBracket=key.lastIndexOf("[");if(beginBracket===-1){var _hash={};return _hash[key]=value,_hash}var newKey=key.substr(0,beginBracket),newValue={};return newValue[key.substring(beginBracket+1,key.length-1)]=value,stringKey(newKey,newValue)}for(var hash={},i=0,len=form.elements.length;i<len;i++){var formElement=form.elements[i];if(!(formElement.name===""||formElement.disabled)&&formElement.name&&!formElement.disabled&&(formElement.checked||/select|textarea/i.test(formElement.nodeName)||/hidden|text|search|tel|url|email|password|datetime|date|month|week|time|datetime-local|number|range|c
1olor/i.test(formElement.type))){var stringKeys=stringKey(formElement.name,formElement.value);hash=extend(hash,stringKeys)}}return hash}function extend(target,source){for(var key in source)source.hasOwnProperty(key)&&(target[key]&&typeof target[key]=="object"&&typeof source[key]=="object"?target[key]=extend(target[key],source[key]):target[key]=source[key]);return target}function handleQBPlusClick(event){event.preventDefault();var targetDiv=document.querySelector(".quick-buy-mobile");if(targetDiv){targetDiv.innerHTML="";var productItem=event.target.closest(".ProductItem");if(productItem){var buttonsInSourceDiv=productItem.querySelectorAll(".Button--light");buttonsInSourceDiv.forEach(function(button){button.classList.remove("Button--light"),button.classList.add("Button--dark"),button.classList.add("qb-mobile-add-button")});var clonedContent=productItem.cloneNode(!0);targetDiv.appendChild(clonedContent),targetDiv.classList.add("is-active");let swatchParent=targetDiv.querySelector(".ProductItem__ColorSwatchList"),swatchTarget=targetDiv.querySelector(".qb-swatches");if(swatchParent){swatchTarget.appendChild(swatchParent);var swatches=targetDiv.querySelectorAll(".ProductItem__ColorSwatchItem");swatches&&swatches.forEach(function(swatch){swatch&&swatch.addEventListener("click",event2=>{swatches.forEach(function(swatch2){swatch2.querySelector("input").checked=!1});var swatchInput=swatch.querySelector("input");swatchInput&&(swatchInput.checked=!0);var swatchValue=swatchInput?.getAttribute("value")||"",swatchVariant=swatchInput?.getAttribute("data-variant-id")||"",variantAvailable=swatchInput?.getAttribute("data-variant-available"),variantInventory=swatchInput?.getAttribute("data-variant-inventory"),variantCompareAtPrice=swatchInput?.getAttribute("data-variant-compare-at-price"),variantPrice=swatchInput?.getAttribute("data-variant-price"),variantPreOrder=swatchInput?.getAttribute("data-variant-preorder"),variantRestock=swatchInput?.getAttribute("data-variant-restock");targetDiv.querySelector(".qb-variant").innerHTML=swatchValue,targetDiv.querySelector(".quick-buy-variant").value=swatchVariant;const quickBuyButton=targetDiv.querySelector(".quick-buy-button");var quickBuyButtonMessage=targetDiv.querySelector(".quick-buy-button > .add-to-cart"),productPreOrder=targetDiv.getAttribute("data-product-preorder"),productRestock=targetDiv.getAttribute("data-product-restock");if(showQBSizeList(swatchInput,targetDiv),variantAvailable=="true"){if(targetDiv.querySelector(".quick-buy-simple").classList.remove("hidden"),quickBuyButton.classList.remove("hidden"),quickBuyButton.classList.remove("disabled"),productPreOrder||variantPreOrder){const preOrderMessage=quickBuyButtonMessage.getAttribute("pre-order-message");preOrderMessage?quickBuyButtonMessage.textContent=preOrderMessage:console.warn("pre-order-message attribute not found.")}else if(quickBuyButtonMessage){const addToCartMessage=quickBuyButtonMessage.getAttribute("add-to-cart-message");quickBuyButtonMessage.textContent=addToCartMessage}else console.warn("add-to-cart-message attribute not found.");var productFormPreOrderProperty=targetDiv.querySelector(".ProductForm__PreOrder textarea");productFormPreOrderProperty&&(productPreOrder||variantPreOrder?(productFormPreOrderProperty.innerHTML=productPreOrder||variantPreOrder,productFormPreOrderProperty.name="properties[Estimated Ship Date]"):(productFormPreOrderProperty.innerHTML="",productFormPreOrderProperty.name=""));var productFormRestockProperty=targetDiv.querySelector(".ProductForm__Restock textarea");productFormRestockProperty&&(productRestock||variantRestock?(productFormRestockProperty.innerHTML=productRestock||variantRestock,productFormRestockProperty.name="properties[Estimated Restock Date]"):(productFormRestockProperty.innerHTML="",productFormRestockProperty.name=""))}else{const soldOutMessage=quickBuyButtonMessage.getAttribute("sold-out-message");soldOutMessage?(quickBuyButton.classList.remove("hidden"),quickBuyButton.classList.add("disabled"),quickBuyButtonMessage.textContent=soldOutMessage):targetDiv.querySelector(".quick-buy-simple").classList.add("hidden")}targetDiv.querySelectorAll(".list-button").forEach(listButton=>{showListButton(listButton)})})})}var buttonstargetDiv=targetDiv.querySelectorAll(".qb-mobile-add-button");buttonstargetDiv.forEach(function(button){button&&button.addEventListener("click",event2=>{event2.preventDefault();var addToCartButton=button;addToCartButton.setAttribute("disabled","disabled"),document.dispatchEvent(new CustomEvent("theme:loading:start"));var formElement=button.closest('form[action*="/cart/add"]');fetch("".concat(window.routes.cartAddUrl,".js"),{body:JSON.stringify(serialize(formElement)),credentials:"same-origin",method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"}}).then(function(response){document.dispatchEvent(new CustomEvent("theme:loading:end"));var quantityElement=formElement.querySelector('[name="quantity"]');response.ok?(addToCartButton.removeAttribute("disabled"),targetDiv.classList.remove("is-active"),_this4.element.dispatchEvent(new CustomEvent("product:added",{bubbles:!0,detail:{variant:_this4.currentVariant,quantity:quantityElement?parseInt(quantityElement.value):1}}))):response.json().then(function(content){var errorMessageElement=document.createElement("span");errorMessageElement.className="ProductForm__Error Alert Alert--error",errorMessageElement.innerHTML=content.description,addToCartButton.removeAttribute("disabled"),addToCartButton.insertAdjacentElement("afterend",errorMessageElement),setTimeout(function(){errorMessageElement.remove()},2500)})}),event2.preventDefault()})});const closeButton=document.querySelector(".quick-buy-mobile .close-quick-buy-mobile-details");closeButton&&closeButton.addEventListener("click",event2=>{const quickBuyMobile=document.querySelector(".quick-buy-mobile");quickBuyMobile&&quickBuyMobile.classList.remove("is-active")})}}}});
2//# sourceMappingURL=/cdn/shop/t/80/assets/custom.js.map?v=114459827635466894611789672341

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.