PageSourceSearch

https://www.vivat-shop.at/theme/3ec2f43d0eef9c03cce76a6273ece731/j…/storefront.variant-switch.plugin.097b6c.js

js vivat-shop.at collected 2026-09-26 11:22:40 UTC 7,374 bytes, 3 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[21847],{1847:(e,t,s)=>{s.r(t),s.d(t,{default:()=>o});var i=s(4335),r=s(3121),n=s(9068);class o extends i.A{static #e=this.options={url:"",elementId:"",pageType:"",radioFieldSelector:".product-detail-configurator-option-input",selectFieldSelector:".product-detail-configurator-select-input",focusHandlerKey:"variant-switch"};init(){this._httpClient=new n.A,this._radioFields=this.el.querySelectorAll(this.options.radioFieldSelector),this._selectFields=this.el.querySelectorAll(this.options.selectFieldSelector),this._elementId=this.options.elementId,this._pageType=this.options.pageType,this._ensureFormElement(),this._preserveCurrentValues(),this._registerEvents(),this._resumeFocusState()}_ensureFormElement(){if("form"!==this.el.nodeName.toLowerCase())throw Error("This plugin can only be applied on a form element!")}_preserveCurrentValues(){this._radioFields&&this._radioFields.forEach(e=>{o._isFieldSerializable(e)&&e.dataset&&(e.dataset.variantSwitchValue=e.value)})}_registerEvents(){this.el.addEventListener("change",e=>this._onChange(e))}_onChange(e){let t=this._getSwitchedOptionId(e.target),s=this._getFormValue();this._preserveCurrentValues(),this.$emitter.publish("onChange");let i={switched:t,options:JSON.stringify(s)};if(this._elementId&&"product_detail"!==this._pageType){let e=`${this.options.url}?${new URLSearchParams({...i,elementId:this._elementId}).toString()}`;document.$emitter.publish("updateBuyWidget",{url:e,elementId:this._elementId});return}this._saveFocusState(e.target),this._redirectToVariant(i)}_getSwitchedOptionId(e){return!!o._isFieldSerializable(e)&&e.name}_getFormValue(){let e={};return this._radioFields&&this._radioFields.forEach(t=>{o._isFieldSerializable(t)&&t.checked&&(e[t.name]=t.value)}),this._selectFields&&this._selectFields.forEach(t=>{if(o._isFieldSerializable(t)){let s=[...t.options].find(e=>e.selected);e[t.name]=s.value}}),e}static _isFieldSerializable(e){return!e.name||e.disabled||-1===["file","reset","submit","button"].indexOf(e.type)}_disableFields(){this._radioFields.forEach(e=>{e.classList&&e.classList.add("disabled","disabled")})}_redirectToVariant(e){r.A.create(),fetch(`${this.options.url}?${new URLSearchParams(e).toString()}`,{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>e.json()).then(e=>window.location.replace(e.url))}_saveFocusState(e){window.focusHandler.saveFocusStatePersistent(this.options.focusHandlerKey,`[id="${e.id}"]`)}_resumeFocusState(){window.focusHandler.resumeFocusStatePersistent(this.options.focusHandlerKey)}}},9068:(e,t,s)=>{s.d(t,{A:()=>i});class i{constructor(){this._request=null,this._errorHandlingInternal=!1}get(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",i=this._createPreparedRequest("GET",e,s);return this._sendRequest(i,null,t)}post(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let r=this._createPreparedRequest("POST",e,i);return this._sendRequest(r,t,s)}delete(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let r=this._createPreparedRequest("DELETE",e,i);return this._sendRequest(r,t,s)}patch(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let r=this._createPreparedRequest("PATCH",e,i);return this._sendRequest(r,t,s)}abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(e){this._errorHandlingInternal=e}_registerOnLoaded(e,t){t&&(!0===this._errorHandlingInternal?(e.addEventListener("load",()=>{t(e.responseText,e)}),e.addEventListener("abort",()=>{console.warn(`the request to ${e.responseURL} was aborted`)}),e.addEventListener("error",()=>{console.warn(`the request to ${e.responseURL} failed with status ${e.status}`)}),e.addEventListener("timeout",()=>{console.warn(`the request to ${e.responseURL} timed out`)})):e.addEventListener("loadend",()=>{t(e.responseText,e)}))}_sendRequest(e,t,s){return this._registerOnLoaded(e,s),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,s){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),s&&this._request.setRequestHeader("Content-type",s),this._request}}},77:(e,t,s)=>{s.d(t,{Ay:()=>u,Kq:()=>a});var i=s(4632);let r="modal-backdrop",n="modal-backdrop-open",o="no-scroll",a=350,l={ON_CLICK:"backdrop/onclick"};class d{constructor(){return d.instance||(d.instance=this),d.instance}create(e){this._removeExistingBackdrops(),document.body.insertAdjacentHTML("beforeend",this._getTemplate());let t=document.body.lastChild;document.documentElement.classList.add(o),setTimeout(function(){t.classList.add(n),"function"==typeof e&&e()},75),this._dispatchEvents()}remove(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;
1this._getBackdrops().forEach(e=>e.classList.remove(n)),setTimeout(this._removeExistingBackdrops.bind(this),e),document.documentElement.classList.remove(o)}_dispatchEvents(){let e=i.A.isTouchDevice()?"touchstart":"click";document.addEventListener(e,function(e){e.target.classList.contains(r)&&document.dispatchEvent(new CustomEvent(l.ON_CLICK))})}_getBackdrops(){return document.querySelectorAll(`.${r}`)}_removeExistingBackdrops(){!1!==this._exists()&&this._getBackdrops().forEach(e=>e.remove())}_exists(){return document.querySelectorAll(`.${r}`).length>0}_getTemplate(){return`<div class="${r}"></div>`}}let c=Object.freeze(new d);class u{static create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;c.create(e)}static remove(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;c.remove(e)}static SELECTOR_CLASS(){return r}}},5683:(e,t,s)=>{s.d(t,{A:()=>n,c:()=>r});let i="loader",r={BEFORE:"before",AFTER:"after",INNER:"inner"};class n{constructor(e,t=r.BEFORE){this.parent=e instanceof Element?e:document.body.querySelector(e),this.position=t}create(){if(!this.exists()){if(this.position===r.INNER){this._previousHTML=this.parent.innerHTML,this.parent.innerHTML=n.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),n.getTemplate())}}remove(){if(this.position===r.INNER){this.parent.innerHTML=this._previousHTML;return}this.parent.querySelectorAll(`.${i}`).forEach(e=>e.remove())}exists(){return this.parent.querySelectorAll(`.${i}`).length>0}_getPosition(){return this.position===r.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return`<div class="${i}" role="status">
2                    <span class="visually-hidden">Loading...</span>
3                </div>`}static SELECTOR_CLASS(){return i}}},3121:(e,t,s)=>{s.d(t,{A:()=>a});var i=s(5683),r=s(77);class n extends i.A{constructor(){super(document.body)}create(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];!this.exists()&&e&&(r.Ay.create(),document.querySelector(`.${r.Ay.SELECTOR_CLASS()}`).insertAdjacentHTML("beforeend",i.A.getTemplate()))}remove(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];super.remove(),e&&r.Ay.remove()}}let o=Object.freeze(new n);class a{static create(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];o.create(e)}static remove(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];o.remove(e)}}}}]);

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.