PageSourceSearch

https://www.siku.de/theme/90cb1092fdf35b49884e707d0a60130d/js/stor…/storefront.offcanvas-cart.plugin.17559d.js

js siku.de collected 2026-09-24 11:29:03 UTC 6,464 bytes, 7 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[88155],{1088(e,t,i){i.d(t,{A:()=>s});class s{static serialize(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if("FORM"!==e.nodeName){if(t)throw Error("The passed element is not a form!");return{}}return new FormData(e)}static serializeJson(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=s.serialize(e,t);if(!(i instanceof FormData)&&0===Object.keys(i).length||i instanceof FormData&&0===Array.from(i.entries()).length)return{};let n={};for(let[e,t]of i.entries())n[e]=t;return n}}},3343(e,t,i){i.d(t,{A:()=>r});var s=i(5683);let n="element-loader-backdrop";class r extends s.A{static create(e){e.classList.add("has-element-loader"),r.exists(e)||(r.appendLoader(e),setTimeout(()=>{let t=e.querySelector(`.${n}`);t&&t.classList.add("element-loader-backdrop-open")},1))}static remove(e){e.classList.remove("has-element-loader");let t=e.querySelector(`.${n}`);t&&t.remove()}static exists(e){return e.querySelectorAll(`.${n}`).length>0}static getTemplate(){return`
2        <div class="${n}">
3            <div class="loader" role="status">
4                <span class="visually-hidden">Loading...</span>
5            </div>
6        </div>
7        `}static appendLoader(e){e.insertAdjacentHTML("beforeend",r.getTemplate())}}},8155(e,t,i){i.r(t),i.d(t,{default:()=>l});var s=i(4335),n=i(9068),r=i(8948),o=i(4632),a=i(1088),c=i(6105),d=i(3343),h=i(4059);class l extends s.A{static #e=this.options={removeProductTriggerSelector:".js-offcanvas-cart-remove-product",changeProductQuantityTriggerSelector:".js-offcanvas-cart-change-quantity",changeProductQuantityTriggerNumberSelector:".js-offcanvas-cart-change-quantity-number",changeQuantityInputDelay:800,addPromotionTriggerSelector:".js-offcanvas-cart-add-promotion",cartItemSelector:".js-cart-item",cartPromotionSelector:".js-offcanvas-cart-promotion",offcanvasPosition:"right",shippingContainerSelector:".offcanvas-shipping-preference",shippingToggleSelector:".js-toggle-shipping-selection",additionalOffcanvasClass:"cart-offcanvas",autoFocus:!1,focusHandlerKey:"offcanvas-cart"};init(){this.client=new n.A,this._registerOpenTriggerEvents()}openOffCanvas(e,t,i){r.A.open(e,t,this._onOffCanvasOpened.bind(this,i),this.options.offcanvasPosition,!0),r.A.setAdditionalClassName(this.options.additionalOffcanvasClass)}_registerOpenTriggerEvents(){let e=o.A.isTouchDevice()?"touchstart":"click";this.el.addEventListener(e,this._onOpenOffCanvasCart.bind(this))}_onOpenOffCanvasCart(e){e.preventDefault(),this.openOffCanvas(window.router["frontend.cart.offcanvas"],!1)}_registerRemoveProductTriggerEvents(){let e=document.querySelectorAll(this.options.removeProductTriggerSelector);e&&e.forEach(e=>e.addEventListener("submit",this._onRemoveProductFromCart.bind(this)))}_registerChangeQuantityProductTriggerEvents(){let e=document.querySelectorAll(this.options.changeProductQuantityTriggerSelector),t=document.querySelectorAll(this.options.changeProductQuantityTriggerNumberSelector);e&&e.forEach(e=>e.addEventListener("change",this._onChangeProductQuantity.bind(this))),t&&t.forEach(e=>{e.addEventListener("change",h.A.debounce(this._onChangeProductQuantity.bind(this),this.options.changeQuantityInputDelay))})}_registeraddPromotionTriggerEvents(){let e=document.querySelectorAll(this.options.addPromotionTriggerSelector);e&&e.forEach(e=>e.addEventListener("submit",this._onAddPromotionToCart.bind(this)))}_registerUpdateShippingEvents(){let{shippingContainerSelector:e}=this.options,t=document.querySelector(`${e} select`);t&&t.addEventListener("input",this._onChangeShippingMethod.bind(this))}_registerToggleShippingSelection(){let{shippingToggleSelector:e,shippingContainerSelector:t}=this.options,i=document.querySelector(e);i&&i.addEventListener("click",()=>{let e=document.querySelector(t),i="offcanvas-shipping-preference--hidden";e.classList.contains(i)?e.classList.remove(i):e.classList.add(i)})}_registerEvents(){this._registerRemoveProductTriggerEvents(),this._registerChangeQuantityProductTriggerEvents(),this._registeraddPromotionTriggerEvents(),this._isShippingAvailable()&&(this._registerUpdateShippingEvents(),this._registerToggleShippingSelection()),this.$emitter.publish("registerEvents")}_onOffCanvasOpened(e,t){"function"==typeof e&&e(t),this.$emitter.publish("offCanvasOpened",{response:t}),this._fetchCartWidgets(),this._registerEvents()}_fireRequest(e,t,i){d.A.create(e.closest(t));let s=i?i.bind(this):this._onOffCanvasOpened.bind(this,this._updateOffCanvasContent.bind(this)),n=e.getAttribute("action"),r=a.A.serialize(e);this.$emitter.publish("beforeFireRequest"),fetch(n,{method:"POST",body:r,headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>e.text()).then(e=>s(e))}_onRemoveProductFromCart(e){e.preventDefault();let t=e.target,i=this.options.cartItemSelector;this.$emitter.publish("onRemoveProductFromCart"),this._fireRequest(t,i)}_onChangeProductQuantity(e){let t=e.target,i=t.closest("form"),s=this.options.cartItemSelector;this.$emitter.publish("onChangeProductQuantity"),this._saveFocusState(t),this._fireRequest(i,s)}_onAddPromotionToCart(e){e.preventDefault();let t=e.target,i=this.options.cartPromotionSelector;this.$emitter.publish("onAddPromotionToCart"),this._saveFocusState("#addPromotionOffcanvasCart"),this._fireRequest(t,i)}_fetchCartWidgets(){window.PluginManager.getPluginInstances("CartWidget").forEach(e
7=>e.fetch()),this.$emitter.publish("fetchCartWidgets")}_updateOffCanvasContent(e){c.A.setContent(e,!0,this._registerEvents.bind(this));let t=c.A.getOffCanvas();t.length>0&&window.PluginManager.initializePluginsInParentElement(t[0]),this._resumeFocusState()}_isShippingAvailable(){let{shippingContainerSelector:e}=this.options;return!!document.querySelector(e)}_onChangeShippingMethod(e){e.preventDefault(),this.$emitter.publish("onShippingMethodChange");let t=window.router["frontend.cart.offcanvas"];this._fireRequest(e.target.form,".offcanvas-summary",()=>{fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>e.text()).then(e=>{this._updateOffCanvasContent(e),this._registerEvents()})})}_saveFocusState(e){if(this.options.autoFocus){if("string"==typeof e){window.focusHandler.saveFocusState(this.options.focusHandlerKey,e);return}window.focusHandler.saveFocusState(this.options.focusHandlerKey,`[data-focus-id="${e.dataset.focusId}"]`)}}_resumeFocusState(){this.options.autoFocus&&window.focusHandler.resumeFocusState(this.options.focusHandlerKey)}}}}]);

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.