PageSourceSearch

https://b2b.sjeb.dk/theme/ec2794265755ca40c9fe04d8f5038ac2/js/temp…/templaid-gls-shop-finder.js?1790673501

js sjeb.dk collected 2026-10-10 02:33:51 UTC 13,260 bytes, 16 lines download raw bytes

1(()=>{"use strict";class e{static ucFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}static lcFirst(e){return e.charAt(0).toLowerCase()+e.slice(1)}static toDashCase(e){return e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(t,n){let i=e.toUpperCamelCase(t,n);return e.lcFirst(i)}static toUpperCamelCase(t,n){return n?t.split(n).map(t=>e.ucFirst(t.toLowerCase())).join(""):e.ucFirst(t.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}class t{static isNode(e){return"object"==typeof e&&null!==e&&(e===document||e===window||e instanceof Node)}static hasAttribute(e,n){if(!t.isNode(e))throw Error("The element must be a valid HTML Node!");return"function"==typeof e.hasAttribute&&e.hasAttribute(n)}static getAttribute(e,n){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(i&&!1===t.hasAttribute(e,n))throw Error(`The required property "${n}" does not exist!`);if("function"!=typeof e.getAttribute){if(i)throw Error("This node doesn't support the getAttribute function!");return}return e.getAttribute(n)}static getDataAttribute(n,i){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],o=i.replace(/^data(|-)/,""),s=e.toLowerCamelCase(o,"-");if(!t.isNode(n)){if(r)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===n.dataset){if(r)throw Error("This node doesn't support the dataset attribute!");return}let a=n.dataset[s];if(void 0===a){if(r)throw Error(`The required data attribute "${i}" does not exist on ${n}!`);return a}return e.parsePrimitive(a)}static querySelector(e,n){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(i&&!t.isNode(e))throw Error("The parent node is not a valid HTML Node!");let r=e.querySelector(n)||!1;if(i&&!1===r)throw Error(`The required element "${n}" does not exist in parent node!`);return r}static querySelectorAll(e,n){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(i&&!t.isNode(e))throw Error("The parent node is not a valid HTML Node!");let r=e.querySelectorAll(n);if(0===r.length&&(r=!1),i&&!1===r)throw Error(`At least one item of "${n}" must exist in parent node!`);return r}static getFocusableElements(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body,t=`
2            input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]),
3            select:not([tabindex^="-"]):not([disabled]),
4            textarea:not([tabindex^="-"]):not([disabled]),
5            button:not([tabindex^="-"]):not([disabled]),
6            a[href]:not([tabindex^="-"]):not([disabled]),
7            [tabindex]:not([tabindex^="-"]):not([disabled])
8        `;return e.querySelectorAll(t)}static getFirstFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(e)[0]}static getLastFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=this.getFocusableElements(e);return t[t.length-1]}}class n{constructor(){this._request=null,this._errorHandlingInternal=!1}get(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",i=this._createPreparedRequest("GET",e,n);return this._sendRequest(i,null,t)}post(e,t,n){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,n)}delete(e,t,n){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,n)}patch(e,t,n){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,n)}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,n){return this._registerOnLoaded(e,n),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,n){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),n&&this._request.setRequestHeader("Content-type",n),this._request}}let i="loader",r={BEFORE:"before",INNER:"inner"};class o{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=o.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),o.getTemplate())}}remove(){if(this.position===r.INNER){this.parent.innerHTML=this._previousHTML;return}this.parent.querySelectorAll(`.${i}
8`).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">
9                    <span class="visually-hidden">Loading...</span>
10                </div>`}static SELECTOR_CLASS(){return i}}let s="element-loader-backdrop";class a extends o{static create(e){e.classList.add("has-element-loader"),a.exists(e)||(a.appendLoader(e),setTimeout(()=>{let t=e.querySelector(`.${s}`);t&&t.classList.add("element-loader-backdrop-open")},1))}static remove(e){e.classList.remove("has-element-loader");let t=e.querySelector(`.${s}`);t&&t.remove()}static exists(e){return e.querySelectorAll(`.${s}`).length>0}static getTemplate(){return`
11        <div class="${s}">
12            <div class="loader" role="status">
13                <span class="visually-hidden">Loading...</span>
14            </div>
15        </div>
16        `}static appendLoader(e){e.insertAdjacentHTML("beforeend",a.getTemplate())}}class l{static iterate(e,t){if(e instanceof Map||Array.isArray(e))return e.forEach(t);if(e instanceof FormData){for(var n of e.entries())t(n[1],n[0]);return}if(e instanceof NodeList)return e.forEach(t);if(e instanceof HTMLCollection)return Array.from(e).forEach(t);if(e instanceof Object)return Object.keys(e).forEach(n=>{t(e[n],n)});throw Error(`The element type ${typeof e} is not iterable!`)}}let{PluginBaseClass:d}=window,{PluginBaseClass:c}=window;window.PluginManager.register("GlsCheckout",class extends d{init(){if(document.getElementById("differentZipcode")&&document.getElementById("differentZipcode").addEventListener("change",(function(){this.changeGlsZipcode()}).bind(this)),document.getElementById("servicePointMap")){let e=t.getDataAttribute(this.el,"googlemapskey"),n=document.createElement("script");n.src="//maps.googleapis.com/maps/api/js?key="+e+"&callback=initServicepointMap",n.defer=!0,window.initServicepointMap=function(){let e,t;let n=new google.maps.LatLngBounds;e=new google.maps.Map(document.getElementById("servicePointMap"),{});let i=document.getElementsByName("glsServicepoint"),r=new google.maps.InfoWindow,o;for(let s=0;s<i.length;s++){let a=new google.maps.LatLng(i[s].dataset.latitude,i[s].dataset.longitude);n.extend(a),o=new google.maps.Marker({position:a,map:e,animation:google.maps.Animation.DROP});let l=i[s].value,d=i[s].parentNode.getElementsByClassName("service-point-description")[0].innerHTML;d+="<br/><br/>",d+=i[s].parentNode.getElementsByClassName("service-point-opening-hours")[0].innerHTML,google.maps.event.addListener(o,"click",function(n){return function(){null!==n.getAnimation()?n.setAnimation(null):(n.setAnimation(google.maps.Animation.BOUNCE),setTimeout(function(){n.setAnimation(null)},700)),r.close(),r.setContent(d),r.open(e,n);let o=document.getElementsByClassName("service-point-opening-hours");for(let e=0;e<o.length;e++)o[e].style.display="none";if(i[s].parentNode.getElementsByClassName("service-point-opening-hours")[0].style.display="block",i[s].checked=!0,!1===t){let e=i[s].parentNode.offsetTop,t=document.getElementById("servicePointForm").offsetTop;document.getElementById("servicePointForm").scrollTop=e-t-50}document.getElementById("servicePointId").value=l,e.setCenter(a),e.setZoom(14),t=!1}}(o)),e.fitBounds(n),i[s].addEventListener("change",function(e){return function(){t=!0,google.maps.event.trigger(e,"click")}}(o))}let s=google.maps.event.addListener(e,"bounds_changed",function(){this.setZoom(13),google.maps.event.removeListener(s)})},document.head.appendChild(n)}}changeGlsZipcode(){this._createLoadingIndicators([".shipping-method-service-point-container"]),this._client=new n;let e=document.getElementById("differentZipcode").value,t=document.getElementById("changeZipcodeFormAction").value,i={_csrf_token:document.getElementById("changeZipcodeFormCsrf").value,differentZipcode:e};this._client.post(t,JSON.stringify(i),function(e){JSON.parse(e).success&&window.location.reload()})}_createLoadingIndicators(e){e&&l.iterate(e,e=>{let n=t.querySelectorAll(document,e);l.iterate(n,a.create)})}},"[gls-checkout-plugin]"),window.PluginManager.register("GlsCheckoutConfirm",class extends c{init(
16){if(this.errorMessages=this.el.dataset.errorMessages,"1"!==document.getElementById("disableGlsConfirmScript").value&&document.getElementById("confirmOrderForm").addEventListener("submit",(function(e){if(e.preventDefault(),!1===this.validateRequiredFields(e.target))return document.getElementById("confirmFormSubmit").disabled=!1,document.getElementById("confirmFormSubmit").getElementsByClassName("loader")[0].remove(),!1;Promise.all([this.saveGlsFields()]).then(()=>{e.target.submit()})}).bind(this)),document.getElementById("servicePointForm")){let e=document.getElementById("servicePointForm").getElementsByClassName("service-point-input");for(let t=0;t<e.length;t++)e[t].addEventListener("change",(function(){this._createLoadingIndicators([".service-point-container"]),Promise.all([this.saveGlsFields()]).then(()=>{this._removeLoadingIndicators([".service-point-container"])})}).bind(this))}}validateRequiredFields(e){let t=document.querySelectorAll('[required][form="confirmOrderForm"]');if(!t)return!0;let n=!0;return l.iterate(t,e=>{!1===this.validateField(e)&&(n=!1)}),n}validateField(e){if(e.parentNode.classList.add("was-validated"),e.classList.remove("is-invalid"),Array.from(e.parentNode.getElementsByClassName("invalid-feedback")).forEach(e=>{e.parentNode.removeChild(e)}),""===e.value)return this.appendValidationError(e,"default"),!1;if("email"===e.name){if(e.value=e.value.trim(),!1===e.validity.valid)return this.appendValidationError(e,"email"),!1}else if("shippingTelephone"===e.name&&!/(^[0-9]*$)/.test(e.value))return this.appendValidationError(e,"phoneNumber"),!1;if(!1===e.validity.valid&&(e.validity.tooLong||e.validity.tooShort)){let t=e.dataset.formValidationLengthMessage;if(t)return this.appendValidationError(e,!1,t),!1}return!0}appendValidationError(e,t,n){if(void 0===n&&!Object.prototype.hasOwnProperty.call(this.errorMessages,t))return!1;n=n||this.errorMessages[t];let i=document.createElement("div");i.classList.add("invalid-feedback");let r=document.createTextNode(n);i.appendChild(r),e.parentNode.appendChild(i),e.classList.add("is-invalid")}async saveGlsFields(){let e=document.getElementById("saveGlsCheckoutExtrasUrl").value,t={};if(document.getElementById("instructionField")){let e=document.getElementById("instructionField").getElementsByTagName("textarea")[0];t.instruction=e.value}if(document.getElementById("shippingContactField")&&(t.shippingContact=document.getElementById("shippingContact").value),document.getElementById("shippingEmailField")&&(t.shippingEmail=document.getElementById("shippingEmail").value),document.getElementById("shippingTelephoneField")&&(t.shippingTelephone=document.getElementById("shippingTelephone").value),document.getElementById("serviceForm")){let e=document.getElementById("serviceForm").getElementsByTagName("input"),n=[];for(let i=0;i<e.length;i++)("radio"!==e[i].type&&"checkbox"!==e[i].type||!1!==e[i].checked)&&("radio"===e[i].type||"checkbox"===e[i].type||"hidden"===e[i].type&&"1"===e[i].value?n.push(e[i].name):t[e[i].name]=e[i].value);n.length>0&&(t.services=n)}if(document.getElementById("servicePointForm")){let e=document.querySelector('input[name="glsServicepoint"]:checked');t.servicePointId=e.value}return t._csrf_token=document.getElementById("glsCsrfToken").value,!(Object.keys(t).length>0)||fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)}).then(function(e){return e.json()}).then(function(){return!0})}_createLoadingIndicators(e){e&&l.iterate(e,e=>{let t=document.querySelectorAll(e);l.iterate(t,a.create)})}_removeLoadingIndicators(e){l.iterate(e,e=>{let t=document.querySelectorAll(e);l.iterate(t,a.remove)})}},"[gls-checkout-confirm-plugin]")})();

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.