PageSourceSearch

https://www.skateshop24.de/theme/5649e944d7fd3206bc0154da554a2885/…n-quantity-select-selector.plugin.cd4e87.js

js skateshop24.de collected 2026-10-09 23:03:23 UTC 3,029 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[48242],{8242(e,t,i){i.r(t),i.d(t,{default:()=>a});class a extends window.PluginBaseClass{static #e=this.options={ariaLiveUpdates:!0,ariaLiveUpdateMode:"live",ariaLiveTextValueToken:"%quantity%",ariaLiveTextProductToken:"%product%",purchaseLimitUrl:null,packUnit:"",packUnitPlural:""};init(){this._select=this.el.querySelector("select.js-quantity-selector"),this._purchaseLimitFetched=!1,this.options.ariaLiveUpdates&&this._initAriaLiveUpdates(),this._registerEvents(),this._registerLivePurchaseLimitEvents()}_initAriaLiveUpdates(){this.ariaLiveContainer=this.el.nextElementSibling,this.ariaLiveContainer&&this.ariaLiveContainer.hasAttribute("aria-live")&&(this.ariaLiveText=this.ariaLiveContainer.dataset.ariaLiveText,this.ariaLiveProductName=this.ariaLiveContainer.dataset.ariaLiveProductName,"onload"===this.options.ariaLiveUpdateMode&&window.setTimeout(this._updateAriaLive.bind(this),1e3))}_registerEvents(){this._select.addEventListener("change",()=>{this._triggerChange()})}_triggerChange(){"live"===this.options.ariaLiveUpdateMode&&this._updateAriaLive()}_updateAriaLive(){if(!this.options.ariaLiveUpdates||!this.ariaLiveText||!this.ariaLiveContainer)return;let e=this._select.value,t=this.ariaLiveText.replace(this.options.ariaLiveTextValueToken,e);this.options.ariaLiveTextProductToken&&this.ariaLiveProductName&&(t=t.replace(this.options.ariaLiveTextProductToken,this.ariaLiveProductName)),this.ariaLiveContainer.innerHTML=t}_registerLivePurchaseLimitEvents(){let e=this.options.purchaseLimitUrl;e&&(this._onFirstInteraction=this._fetchLivePurchaseLimit.bind(this,e),this._select.addEventListener("focus",this._onFirstInteraction))}_removeLivePurchaseLimitEvents(){this._select.removeEventListener("focus",this._onFirstInteraction)}_fetchLivePurchaseLimit(e){this._purchaseLimitFetched||(this._purchaseLimitFetched=!0,this._removeLivePurchaseLimitEvents(),fetch(e,{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>e.ok?e.json():null).then(e=>{e&&this._applyPurchaseLimit(e)}).catch(e=>{console.warn("Unable to fetch live quantity limits, keeping rendered values.",e)}))}_applyPurchaseLimit(e){if(!this._select)return;let t=e.maxPurchase;if(t<=0){this._disableControls(),this._dispatchFormEvent("QuantitySelector/OutOfStock");return}let i=e.minPurchase,a=e.purchaseSteps,s=this.options.packUnit,r=this.options.packUnitPlural;this._select.innerHTML="";for(let e=i;e<=t;e+=a){let t=document.createElement("option");t.value=e;let i=`${e}`;1===e?s&&(i+=` ${s}`):r?i+=` ${r}`:s&&(i+=` ${s}`),t.textContent=i,this._select.appendChild(t)}let n=parseInt(this._select.value,10)||i,h=Math.floor((Math.min(Math.max(n,i),t)-i)/a)*a+i;h!==n&&(this._select.value=h,this._triggerChange(),this._dispatchFormEvent("QuantitySelector/StockAdjusted",{quantity:h}))}_disableControls(){this._select.disabled=!0}_dispatchFormEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.el.closest("form")?.dispatchEvent(new CustomEvent(e,{detail:t}))}}}}]);

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.