PageSourceSearch

https://musclerepublic.com/cdn/shop/t/121/assets/arkhi-swym-custom…?v=124449039304718939311774405916

js musclerepublic.com collected 2026-09-26 01:09:23 UTC 8,859 bytes, 22 lines download raw bytes

1window.theme=window.theme||{},theme.delegate={on:function(event,callback,options){return this.namespaces||(this.namespaces={}),this.namespaces[event]=callback,options=options||!1,this.addEventListener(event.split(".")[0],callback,options),this},off:function(event){if(this.namespaces)return this.removeEventListener(event.split(".")[0],this.namespaces[event]),delete this.namespaces[event],this}},window.on=Element.prototype.on=theme.delegate.on,window.off=Element.prototype.off=theme.delegate.off,theme.a11y={trapFocus:function(options){var eventsName={focusin:options.namespace?"focusin."+options.namespace:"focusin",focusout:options.namespace?"focusout."+options.namespace:"focusout",keydown:options.namespace?"keydown."+options.namespace:"keydown.handleFocus"},focusableEls=options.container.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex^="-"])'),elArray=[].slice.call(focusableEls),focusableElements=elArray.filter(el=>el.offsetParent!==null),firstFocusable=focusableElements[0],lastFocusable=focusableElements[focusableElements.length-1];options.elementToFocus||(options.elementToFocus=options.container),options.container.setAttribute("tabindex","-1"),options.elementToFocus.focus(),document.documentElement.off("focusin"),document.documentElement.on(eventsName.focusout,function(){document.documentElement.off(eventsName.keydown)}),document.documentElement.on(eventsName.focusin,function(evt){evt.target!==lastFocusable&&evt.target!==firstFocusable||document.documentElement.on(eventsName.keydown,function(evt2){_manageFocus(evt2)})});function _manageFocus(evt){evt.keyCode===9&&evt.target===firstFocusable&&evt.shiftKey&&(evt.preventDefault(),lastFocusable.focus())}},removeTrapFocus:function(options){var eventName=options.namespace?"focusin."+options.namespace:"focusin";options.container&&options.container.removeAttribute("tabindex"),document.documentElement.off(eventName)},lockMobileScrolling:function(namespace,element){var el=element||document.documentElement;document.documentElement.classList.add("lock-scroll"),el.on("touchmove"+namespace,function(){return!0})},unlockMobileScrolling:function(namespace,element){document.documentElement.classList.remove("lock-scroll");var el=element||document.documentElement;el.off("touchmove"+namespace)}},theme.Modals=(function(){function Modal(id,name,options){var defaults={close:".js-modal-close",open:".js-modal-open-"+name,openClass:"modal--is-active",closingClass:"modal--is-closing",bodyOpenClass:"modal-open",bodyOpenSolidClass:"modal-open--solid",bodyClosingClass:"modal-closing",closeOffContentClick:!0};if(this.id=id,this.modal=document.getElementById(id),!this.modal)return!1;this.modalContent=this.modal.querySelector(".modal__inner"),this.config=Object.assign(defaults,options),this.modalIsOpen=!1,this.focusOnOpen=this.config.focusIdOnOpen?document.getElementById(this.config.focusIdOnOpen):this.modal,this.isSolid=this.config.solid,this.init()}return Modal.prototype.init=function(){document.querySelectorAll(this.config.open).forEach(btn=>{btn.setAttribute("aria-expanded","false"),btn.addEventListener("click",this.open.bind(this))}),this.modal.querySelectorAll(this.config.close).forEach(btn=>{btn.addEventListener("click",this.close.bind(this))}),document.addEventListener("drawerOpen",function(){this.close()}.bind(this))},Modal.prototype.open=function(evt){var externalCall=!1;this.modalIsOpen||(evt?evt.preventDefault():externalCall=!0,evt&&evt.stopPropagation&&(evt.stopPropagation(),this.activeSource=evt.currentTarget.setAttribute("aria-expanded","true")),this.modalIsOpen&&!externalCall&&this.close(),this.modal.classList.add(this.config.openClass),document.documentElement.classList.add(this.config.bodyOpenClass),this.isSolid&&document.documentElement.classList.add(this.config.bodyOpenSolidClass),this.modalIsOpen=!0,theme.a11y.trapFocus({container:this.modal,elementToFocus:this.focusOnOpen,namespace:"modal_focus"}),document.dispatchEvent(new CustomEvent("modalOpen")),document.dispatchEvent(new CustomEvent("modalOpen."+this.id)),this.bindEvents())},Modal.prototype.close=function(evt){if(this.modalIsOpen){if(evt&&!evt.target.closest(".
1js-modal-close")){if(evt.target.closest(".modal__inner"))return}document.activeElement.blur(),this.modal.classList.remove(this.config.openClass),this.modal.classList.add(this.config.closingClass),document.documentElement.classList.remove(this.config.bodyOpenClass),document.documentElement.classList.add(this.config.bodyClosingClass),window.setTimeout(function(){document.documentElement.classList.remove(this.config.bodyClosingClass),this.modal.classList.remove(this.config.closingClass),this.activeSource&&this.activeSource.getAttribute("aria-expanded")&&this.activeSource.setAttribute("aria-expanded","false").focus()}.bind(this),500),this.isSolid&&document.documentElement.classList.remove(this.config.bodyOpenSolidClass),this.modalIsOpen=!1,theme.a11y.removeTrapFocus({container:this.modal,namespace:"modal_focus"}),document.dispatchEvent(new CustomEvent("modalClose."+this.id)),this.unbindEvents()}},Modal.prototype.bindEvents=function(){window.on("keyup.modal",function(evt){evt.keyCode===27&&this.close()}.bind(this)),this.config.closeOffContentClick&&this.modal.on("click.modal",this.close.bind(this))},Modal.prototype.unbindEvents=function(){document.documentElement.off(".modal"),this.config.closeOffContentClick&&this.modal.off(".modal")},Modal})();const timeout=ms=>new Promise(resolve=>setTimeout(resolve,ms));class WishlistButton extends HTMLElement{constructor(){super(),this.addEventListener("click",e=>{this.init(e)})}async init(e){const modal=new theme.Modals("SWYMCustomModal"),{productHandle}=e.target.dataset;if(productHandle){try{const res=await fetch(`/products/${productHandle}.js`),data=await res.json();res.ok&&this.renderMarkup(data,modal)}catch(error){console.log(error)}modal.open()}}renderMarkup(data,modal){const{available,id,handle,title,price,url,featured_image,variants}=data,container=document.getElementById("SWYMCustomModal-Content"),renderVariants=variants.map(({id:id2,title:title2})=>`<option value="${id2}">${title2}</option>`).join("");container.innerHTML="",available&&variants.length===1?(this.addToWishlist(data,container,modal),container.innerHTML=`
2        <div class="product-content">
3          <a href="${url}">
4            <img src="${featured_image}" alt="${title}" />
5            <span>${title}</span>
6          </a>
7        </div>
8        <div class="message hide">Product added to wishlist!</div>
9      `):container.innerHTML=`
10        <div class="product-content">
11          <a href="${url}">
12            <img src="${featured_image}" alt="${title}" />
13            <span>${title}</span>
14          </a>
15          <div class="variants">
16            <label id="variants">Select an option</label>
17            <select id="variants" name="variants">${renderVariants}</select>
18          </div>
19          <button type="button" class="Button Button--full Button--primary js-add-to-wishlist">Add to wishlist</button>
20        </div>
21      `;const addToWishlistBtn=container.querySelector(".js-add-to-wishlist");addToWishlistBtn&&addToWishlistBtn.addEventListener("click",e=>{this.addToWishlist(data,container,modal)})}async addToWishlist(data,container,modal){if(!data||!container)return;const{title,price,url,featured_image,variants,id:productId}=data,{shopUrl}=window.theme,wishList=await new Promise(resolve=>window._swat.fetch(r=>resolve(r))),message=container.querySelector(".message"),button=container.querySelector(".js-add-to-wishlist");let variantId;if(variants.length===1){const[onlyVariant]=variants;variantId=onlyVariant.id}else{const select=container.querySelector('[name="variants"]');variantId=select?select.options[select.selectedIndex].value:null}if(!variantId){console.log("No variant id found");return}if(wishList.find(item=>item.epi===+variantId)){const select=container.querySelector('[name="variants"]');select&&(select.setCustomValidity("Product already in wishlist"),select.reportValidity()),message&&(message.innerText="Product already in wishlist",message.classList.remove("hide"))}else{button&&button.classList.add("btn--loading");const obj={epi:+variantId,empi:+productId,du:`${shopUrl}${url}`,iu:featured_image,pr:price},callback=async data2=>{button&&(button.innerHTML="Product added!",button.classList.remove("btn--loading")),message&&message.classList.remove("hide"),setTimeout(()=>{document.dispatchEvent(new CustomEvent("updateProductItemWishlistButtons"))},500),setTimeout(()=>{document.dispatchEvent(new CustomEvent("updateProductFormWishlistButton"))},500),modal&&(await timeout(2500),modal.close())};window._swat.addToWishList(obj,callback)}}}customElements.define("wishlist-button",WishlistButton);
22//# sourceMappingURL=/cdn/shop/t/121/assets/arkhi-swym-custom-wishlist.js.map?v=124449039304718939311774405916

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.