PageSourceSearch

https://beltz.de/theme/c5b651ba796b08a3748257755ceba02d/js/storefront/storefront.form-handler.plugin.9dfd0a.js

js beltz.de collected 2026-09-24 08:38:22 UTC 3,999 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[79140],{9140:(t,e,i)=>{i.r(e),i.d(e,{default:()=>r});var o=i(9568),s=i(9610),n=i(5965);class r extends o.Z{init(){if(!1===this._isFormElement(this.el)){console.error("[FormHandler]: Element is not of type <form>",this.el);return}this.form=this.el,this.submitButtons=this._getSubmitButtons(),this.submittButtonLoaders=[],!0===this.options.validation&&this._initFormValidation(),this._initFormEvents()}set formFields(t){this._formFields=t}get formFields(){return this.options.formFieldSelector?this.form.querySelectorAll(this.options.formFieldSelector):[...this.form.elements]}_initFormEvents(){this.form.addEventListener("submit",this._onFormSubmit.bind(this)),this.form.addEventListener("removeLoader",this.removeLoadingIndicator.bind(this))}_initFormValidation(){window.formValidation.setNoValidate(this.form),this.form.checkValidity=this._checkValidity.bind(this),this._initFieldValidationEvents()}_initFieldValidationEvents(){this.formFields.forEach(t=>{this._initFieldValidation(t)})}_initFieldValidation(t){let e=t.tagName.toLowerCase();t.addEventListener("select"===e?"change":"input",s.Z.debounce(window.formValidation.validateField.bind(window.formValidation,t),this.options.debounceTime))}_onFormSubmit(t){if(this.$emitter.publish("beforeSubmit"),!0===this.options.validateOnSubmit){let e=window.formValidation.validateForm(this.form,this.formFields);if(e.length>0){t.preventDefault(),this.$emitter.publish("validationFailed",{invalidFields:e}),!0===this.options.focusInvalidField&&(e[0].scrollIntoView({behavior:"smooth",block:"center"}),e[0].focus());return}}this.$emitter.publish("validSubmit"),!0===this.options.loadingIndicator&&this.addLoadingIndicator()}addLoadingIndicator(){this.submitButtons.forEach(t=>{let e=new n.Z(t,this.options.loadingIndicatorPosition);this.submittButtonLoaders.push(e),e.create()})}removeLoadingIndicator(){this.submittButtonLoaders.forEach(t=>t.remove())}_checkValidity(){return 0===window.formValidation.validateForm(this.form,this.formFields).length}_getSubmitButtons(){let t=Array.from(this.form.querySelectorAll("button[type=submit]")),e=this.form.id;if(e){let i=Array.from(document.querySelectorAll('button[type=submit][form="'.concat(e,'"]')));t.push(...i)}return t}_isFormElement(t){return"form"===t.tagName.toLowerCase()}}r.options={validation:!0,validateOnSubmit:!0,focusInvalidField:!0,debounceTime:"200",formFieldSelector:"input, textarea, select",loadingIndicator:!0,loadingIndicatorPosition:"before"}},5965:(t,e,i)=>{i.d(e,{Z:()=>s});var o=i(2363);class s extends o.Z{create(){super.create(),this._isButtonElement()?this.parent.disabled=!0:this._isAnchorElement()&&this.parent.classList.add("disabled")}remove(){super.remove(),this._isButtonElement()?this.parent.disabled=!1:this._isAnchorElement()&&this.parent.classList.remove("disabled")}_isButtonElement(){return"button"===this.parent.tagName.toLowerCase()}_isAnchorElement(){return"a"===this.parent.tagName.toLowerCase()}constructor(t,e="before"){if(super(t,e),!this._isButtonElement()&&!this._isAnchorElement())throw Error("Parent element is not of type <button> or <a>")}}},2363:(t,e,i)=>{i.d(e,{L:()=>n,Z:()=>r});var o=i(3266);let s="loader",n={BEFORE:"before",AFTER:"after",INNER:"inner"};class r{create(){if(!this.exists()){if(this.position===n.INNER){this.parent.innerHTML=r.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),r.getTemplate())}}remove(){let t=this.parent.querySelectorAll(".".concat(s));o.Z.iterate(t,t=>t.remove())}exists(){return this.parent.querySelectorAll(".".concat(s)).length>0}_getPosition(){return this.position===n.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return'<div class="'.concat(s,'" role="status">\n                    <span class="').concat("visually-hidden",'">Loading...</span>\n                </div>')}static SELECTOR_CLASS(){return s}constructor(t,e=n.BEFORE){this.parent=t instanceof Element?t:document.body.querySelector(t),this.position=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.