PageSourceSearch

https://webers-world.com/theme/fd7c036558e922757bfb8b0e0f00cb44/js…ebers-world.offcanvas-cart.plugin.3aef85.js

js webers-world.com collected 2026-10-07 03:40:38 UTC 14,660 bytes, 9 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[85539],{539:(e,t,s)=>{s.r(t),s.d(t,{default:()=>m});var i=s(220),n=s(68),r=s(308);let a="js-offcanvas-singleton";class o{constructor(){this.$emitter=new r.A}open(e,t,s,i,n,r,a){this._removeExistingOffCanvas();let o=this._createOffCanvas(s,r,a,i);this.setContent(e,n),this._openOffcanvas(o,t)}setContent(e,t){let s=this.getOffCanvas();s[0]&&(s[0].innerHTML=e,this._registerEvents(t),this._setAriaAttrs())}setAdditionalClassName(e){this.getOffCanvas()[0].classList.add(e)}getOffCanvas(){return document.querySelectorAll(`.${a}`)}close(e){let t=this.getOffCanvas();t.forEach(e=>{bootstrap.Offcanvas.getInstance(e).hide()}),setTimeout(()=>{this.$emitter.publish("onCloseOffcanvas",{offCanvasContent:t})},e)}goBackInHistory(){window.history.back()}exists(){return this.getOffCanvas().length>0}_openOffcanvas(e,t){window.focusHandler.saveFocusState("offcanvas"),o.bsOffcanvas.show(),window.history.pushState("offcanvas-open",""),"function"==typeof t&&t()}_registerEvents(e){let t=this.getOffCanvas();t.forEach(s=>{let i=()=>{setTimeout(()=>{s.remove(),window.focusHandler.resumeFocusState("offcanvas"),this.$emitter.publish("onCloseOffcanvas",{offCanvasContent:t})},e),s.removeEventListener("hide.bs.offcanvas",i)};s.addEventListener("hide.bs.offcanvas",i)}),window.addEventListener("popstate",this.close.bind(this,e),{once:!0}),document.querySelectorAll(".js-offcanvas-close").forEach(t=>t.addEventListener("click",this.close.bind(this,e)))}_setAriaAttrs(){let e=this.getOffCanvas()[0],t="off-canvas-headline",s=e.querySelector(`[data-id="${t}"]`);s&&!e.hasAttribute("aria-labelledby")&&(s.setAttribute("id",t),e.setAttribute("aria-labelledby",t))}_removeExistingOffCanvas(){return o.bsOffcanvas=null,this.getOffCanvas().forEach(e=>e.remove())}_getPositionClass(e){return"left"===e?"offcanvas-start":"right"===e?"offcanvas-end":`offcanvas-${e}`}_createOffCanvas(e,t,s,i){let n=document.createElement("div");if(n.classList.add("offcanvas",a),n.classList.add(this._getPositionClass(e)),n.setAttribute("tabindex","-1"),!0===t&&n.classList.add("is-fullwidth"),s){let e=typeof s;if("string"===e)n.classList.add(s);else if(Array.isArray(s))s.forEach(e=>{n.classList.add(e)});else throw Error(`The type "${e}" is not supported. Please pass an array or a string.`)}return document.body.appendChild(n),o.bsOffcanvas=new bootstrap.Offcanvas(n,{backdrop:!1!==i||"static"}),n}}let c=Object.freeze(new o);class d{static open(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left",i=!(arguments.length>3)||void 0===arguments[3]||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";c.open(e,t,s,i,n,r,a)}static setContent(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:350;c.setContent(e,t,s)}static setAdditionalClassName(e){c.setAdditionalClassName(e)}static close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;c.close(e)}static exists(){return c.exists()}static getOffCanvas(){return c.getOffCanvas()}static REMOVE_OFF_CANVAS_DELAY(){return 350}}var l=s(683);class h extends d{static open(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"left",n=!(arguments.length>4)||void 0===arguments[4]||arguments[4],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:d.REMOVE_OFF_CANVAS_DELAY(),a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"";if(!e)throw Error("A url must be given!");c._removeExistingOffCanvas();let l=c._createOffCanvas(i,a,o,n);this.setContent(e,t,s,n,r),c._openOffcanvas(l)}static setContent(e,t,s,i,n){super.setContent(`<div class="offcanvas-body">${l.A.getTemplate()}</div>`,i,n);let r=e=>{super.setContent(e,i,n),"function"==typeof s&&s(e)};t?fetch(e,{method:"POST",body:t instanceof FormData?t:JSON.stringify(t),headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>e.text()).then(e=>h.executeCallback(r,e)):fetch(e,{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>e.text()).then(e=>h.executeCallback(r,e))}static executeCallback(e,t){"function"==typeof e&&e(t),window.PluginManager.initializePlugins()}}var u=s(632),f=s(88),g=s(724),v=s(59);class p extends i.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"};
1init(){this.client=new n.A,this._registerOpenTriggerEvents()}openOffCanvas(e,t,s){h.open(e,t,this._onOffCanvasOpened.bind(this,s),this.options.offcanvasPosition,!0),h.setAdditionalClassName(this.options.additionalOffcanvasClass)}_registerOpenTriggerEvents(){let e=u.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",v.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,s=document.querySelector(e);s&&s.addEventListener("click",()=>{let e=document.querySelector(t),s="offcanvas-shipping-preference--hidden";e.classList.contains(s)?e.classList.remove(s):e.classList.add(s)})}_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,s){g.A.create(e.closest(t));let i=s?s.bind(this):this._onOffCanvasOpened.bind(this,this._updateOffCanvasContent.bind(this)),n=e.getAttribute("action"),r=f.A.serialize(e);this.$emitter.publish("beforeFireRequest"),fetch(n,{method:"POST",body:r,headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>e.text()).then(e=>i(e))}_onRemoveProductFromCart(e){e.preventDefault();let t=e.target,s=this.options.cartItemSelector;this.$emitter.publish("onRemoveProductFromCart"),this._fireRequest(t,s)}_onChangeProductQuantity(e){let t=e.target,s=t.closest("form"),i=this.options.cartItemSelector;this.$emitter.publish("onChangeProductQuantity"),this._saveFocusState(t),this._fireRequest(s,i)}_onAddPromotionToCart(e){e.preventDefault();let t=e.target,s=this.options.cartPromotionSelector;this.$emitter.publish("onAddPromotionToCart"),this._saveFocusState("#addPromotionOffcanvasCart"),this._fireRequest(t,s)}_fetchCartWidgets(){window.PluginManager.getPluginInstances("CartWidget").forEach(e=>e.fetch()),this.$emitter.publish("fetchCartWidgets")}_updateOffCanvasContent(e){d.setContent(e,!0,this._registerEvents.bind(this)),window.PluginManager.initializePlugins(),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)}}class m extends p{init(){this.client=new n.A}}},59:(e,t,s)=>{s.d(t,{A:()=>i});
1class i{static debounce(e,t){let s,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){for(var n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];i&&!s&&setTimeout(e.bind(e,...r),0),clearTimeout(s),s=setTimeout(e.bind(e,...r),t)}}}},632:(e,t,s)=>{s.d(t,{A:()=>i});class i{static isTouchDevice(){return"ontouchstart"in document.documentElement}static isIOSDevice(){return i.isIPhoneDevice()||i.isIPadDevice()}static isNativeWindowsBrowser(){return i.isIEBrowser()||i.isEdgeBrowser()}static isIPhoneDevice(){return!!navigator.userAgent.match(/iPhone/i)}static isIPadDevice(){return!!navigator.userAgent.match(/iPad/i)}static isIEBrowser(){return -1!==navigator.userAgent.toLowerCase().indexOf("msie")||!!navigator.userAgent.match(/Trident.*rv:\d+\./)}static isEdgeBrowser(){return!!navigator.userAgent.match(/Edge\/\d+/i)}static getList(){return{"is-touch":i.isTouchDevice(),"is-ios":i.isIOSDevice(),"is-native-windows":i.isNativeWindowsBrowser(),"is-iphone":i.isIPhoneDevice(),"is-ipad":i.isIPadDevice(),"is-ie":i.isIEBrowser(),"is-edge":i.isEdgeBrowser()}}}},68:(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 n=this._createPreparedRequest("POST",e,i);return this._sendRequest(n,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 n=this._createPreparedRequest("DELETE",e,i);return this._sendRequest(n,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 n=this._createPreparedRequest("PATCH",e,i);return this._sendRequest(n,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}}},88:(e,t,s)=>{s.d(t,{A:()=>i});class i{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],s=i.serialize(e,t);if(!(s instanceof FormData)&&0===Object.keys(s).length||s instanceof FormData&&0===Array.from(s.entries()).length)return{};let n={};for(let[e,t]of s.entries())n[e]=t;return n}}},724:(e,t,s)=>{s.d(t,{A:()=>r});var i=s(683);let n="element-loader-backdrop";class r extends i.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())}}},683:(e,t,s)=>{s.d(t,{A:()=>r});let i="loader",n={BEFORE:"before",INNER:"inner"};
7class r{constructor(e,t=n.BEFORE){this.parent=e instanceof Element?e:document.body.querySelector(e),this.position=t}create(){if(!this.exists()){if(this.position===n.INNER){this._previousHTML=this.parent.innerHTML,this.parent.innerHTML=r.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),r.getTemplate())}}remove(){if(this.position===n.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===n.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return`<div class="${i}" role="status">
8                    <span class="visually-hidden">Loading...</span>
9                </div>`}static SELECTOR_CLASS(){return i}}}}]);

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.