PageSourceSearch

https://www.beardbrand.com/cdn/shop/t/944/assets/variant-description-short.js?v=20853838656509487321790701937

js beardbrand.com collected 2026-10-02 03:30:35 UTC 3,103 bytes, 2 lines download raw bytes

1(()=>{if(window.__bbVariantDescShortInit)return;window.__bbVariantDescShortInit=!0;function safeJsonParse(str){try{return JSON.parse(str)}catch{return null}}function getDescMap(pv){const el=pv.querySelector("[data-variant-description-short]");if(!el)return null;const raw=String(el.textContent||"").trim();if(!raw)return null;const parsed=safeJsonParse(raw);return parsed&&typeof parsed=="object"?parsed:null}function getOutputEl(pv){return pv.querySelector("[data-variant-description-short-output]")}function getVariantsArray(pv){const scripts=pv.querySelectorAll('script[type="application/json"]');for(const s of scripts){if(s.hasAttribute("data-variant-description-short"))continue;const parsed=safeJsonParse(String(s.textContent||"").trim());if(Array.isArray(parsed))return parsed}return null}function getSelectedOptions(pv){const selects=pv.querySelectorAll("select.product-variant-container");if(selects.length)return Array.from(selects).map(sel=>sel.value);const radios=pv.querySelectorAll('input.product-variant-value[type="radio"]');if(radios.length){const byName=new Map;return radios.forEach(r=>{r.checked&&byName.set(r.name,r.value)}),Array.from(byName.values())}return[]}function resolveVariantId(pv){const cv=pv.currentVariant;if(cv&&cv.id!=null)return String(cv.id);const nearestForm=pv.closest("product-page, product-quick-view, .product-quick-view-container, .site-box-content, body");if(nearestForm){const hiddenId=nearestForm.querySelector('input[name="id"][value]');if(hiddenId&&hiddenId.value)return String(hiddenId.value)}const variants=getVariantsArray(pv),selected=getSelectedOptions(pv);if(!variants||!selected.length)return"";const match=variants.find(v=>{if(!v)return!1;const opts=[v.option1,v.option2,v.option3].filter(Boolean);return opts.length!==selected.length?!1:opts.every((opt,idx)=>String(opt)===String(selected[idx]))});return match&&match.id!=null?String(match.id):""}function update(pv){const out=getOutputEl(pv);if(!out)return;const map=getDescMap(pv);if(!map){out.textContent="";return}const id=resolveVariantId(pv);if(!id){out.textContent="";return}const next=map[id];out.textContent=next==null?"":String(next)}function bindOne(pv){!pv||pv.__bbVariantDescShortBound||(pv.__bbVariantDescShortBound=!0,pv.addEventListener("VARIANT_CHANGE",()=>update(pv)),pv.addEventListener("variant:change",()=>update(pv)),pv.addEventListener("variant-change",()=>update(pv)),pv.addEventListener("change",e=>{const t=e.target;t&&(t.matches("select.product-variant-container")||t.matches("input.product-variant-value"))&&requestAnimationFrame(()=>update(pv))}),update(pv))}function bindAll(root=document){root.querySelectorAll("product-variants").forEach(bindOne)}document.readyState!=="loading"?bindAll(document):document.addEventListener("DOMContentLoaded",()=>bindAll(document)),new MutationObserver(mutations=>{for(const m of mutations)if(m.addedNodes&&m.addedNodes.length){bindAll(document);break}}).observe(document.documentElement,{childList:!0,subtree:!0})})();
2//# sourceMappingURL=/cdn/shop/t/944/assets/variant-description-short.js.map?v=20853838656509487321790701937

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.