1 2(()=>{var __defProp=Object.defineProperty;var __defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty;var __propIsEnum=Object.prototype.propertyIsEnumerable;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:true,configurable:true,writable:true,value}):obj[key]=value;var __spreadValues=(a,b)=>{for(var prop in b||(b={})) 3if(__hasOwnProp.call(b,prop)) 4__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols) 5for(var prop of __getOwnPropSymbols(b)){if(__propIsEnum.call(b,prop)) 6__defNormalProp(a,prop,b[prop]);} 7return a;};var __spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b));class XtxCoreJs{getElement(selectorOrElement,scope=document){const element=scope.querySelector(selectorOrElement);if(element){return element;} 8throw new Error(`xtxJs.getElement('${selectorOrElement}',${scope}),Element nicht gefunden.`);} 9getElements(selector,scope=document){const elements=scope.querySelectorAll(selector);return this.toArray(elements);} 10eachElement(selector,callback,scope=document){this.getElements(selector,scope).forEach(callback);} 11forEach(arrayLike,callback){const normalizedArray=this.toArray(arrayLike);normalizedArray.forEach(callback);} 12onResize(callback,contextWindow=window){let timeout;let prevWidth=contextWindow.innerWidth;let prevHeight=contextWindow.innerHeight;contextWindow.addEventListener("resize",()=>{clearTimeout(timeout);timeout=contextWindow.setTimeout(()=>{if(prevWidth!==contextWindow.innerWidth||prevHeight!==contextWindow.innerHeight){callback(prevWidth,prevHeight,contextWindow.innerWidth,contextWindow.innerHeight);prevWidth=contextWindow.innerWidth;prevHeight=contextWindow.innerHeight;}},250);});} 13onScroll(element,callback){this.addEventListenerToElement(element,"scroll",callback,{passive:true});} 14onDomReady(callback,scope=document){if(scope.readyState!=="loading"){callback();}else{this.addEventListenerToElement(scope,"readystatechange",(element,event,removeListener)=>{if(scope.readyState!=="loading"){removeListener();callback();}});}} 15onPageLoaded(callback,scope=document){if(scope.readyState==="complete"){callback();}else{this.addEventListenerToElement(scope,"readystatechange",(element,event,removeListener)=>{if(scope.readyState==="complete"){removeListener();callback();}});}} 16addEventListenerToElement(element,events,callback,options){const eventsArray=Array.isArray(events)?events:Array.of(events);this.forEach(eventsArray,(eventName)=>{const handler=(event)=>{callback(element,event,()=>{element.removeEventListener(eventName,handler,options);});};element.addEventListener(eventName,handler,options);});} 17addEventListener(selector,events,callback,options,scope=document){const element=this.getElement(selector,scope);this.addEventListenerToElement(element,events,callback,options);return element;} 18addEventListeners(selector,events,callback,options,scope=document){const elements=this.getElements(selector,scope);this.forEach(elements,(element)=>{this.addEventListenerToElement(element,events,callback,options);});return elements;} 19dispatchEvent(target,name,options={bubbles:true,composed:false,cancelable:true}){const event=new Event(name,options);target.dispatchEvent(event);} 20dispatchEventWithDetails(target,name,detail,options={bubbles:true,composed:false,cancelable:true}){const event=new CustomEvent(name,__spreadProps(__spreadValues({},options),{detail}));target.dispatchEvent(event);} 21getCookie(name){const cookie={};document.cookie.split(";").forEach(function(el){const[key,value]=el.split("=");cookie[key.trim()]=decodeURIComponent(value);});return cookie[name];} 22setCookie(name,value,expireDate=null,path,domain){const regexForCookieName=new RegExp("^[\\d\\w-]+$");if(!regexForCookieName.test(name)){throw new Error(`xtxJs.setCookie(${name}),The cookie name should not contain special characters(except'-'and'_')`);} 23let cookie=name+"="+encodeURIComponent(value);if(expireDate instanceof Date){expireDate=expireDate.toUTCString();}else if(typeof expireDate==="number"&&Number.isInteger(expireDate)){expireDate=new Date(expireDate).toUTCString();} 24if(expireDate){cookie+='; expires="'+expireDate+'"';} 25if(path){cookie+="; path="+path;} 26if(domain){cookie+="; domain="+domain;} 27if(document.location.protocol==="https:"){cookie+="; secure";} 28document.cookie=cookie;} 29isInArray(array,item){if(Array.isArray(array)){return array.indexOf(item)!==-1;}else{for(let i=0;i<array.length;i++){if(array.item(i)===item){return true;}}} 30return false;} 31toArray(arrayLike){if(!Array.isArray(arrayLike)){const normalizedArray=[];for(let i=0;i<arrayLike.length;i++){normalizedArray.push(arrayLike[i]);} 32return normalizedArray;} 33return arrayLike;}} 34if(typeof window!=="undefined"){window.xtxJs=new XtxCoreJs();}})(); 35 36function Redx_Ajax_Logger(){} 37Redx_Ajax_Logger.log=function(message){if(typeof value==='object'||typeof value==='function'){message=JSON.stringify(message);} 38if(document.body&&document.body.hasAttribute('data-redx-error-logger-show-snackbar')){let escaper=document.createElement('div');escaper.textContent=String(message);new RedxSnackbar({message:'<a href="/redx/tools/error-log/" target="_blank">'+'Ajax-Logger: '+escaper.innerHTML+'</a>',status:"error"});} 39try{var data=new FormData();data.append('type','ajaxLogger');data.append('url',window.location.href);data.append('title',document.title);data.append('referrer',document.referrer);data.append('message',message);data.append('stack',new Error().stack);var xhr=new XMLHttpRequest();xhr.open("POST","/api/redx/errorlog/",true);xhr.onload=function(e){};xhr.onerror=function(e){};xhr.send(data);}catch(e){}}; 40 41function RedxSmartLoader(){var loadedFiles=[];this.init=function(){var op=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){var resp=op.apply(this,arguments);this.addEventListener('load',function(){if(this.getAllResponseHeaders().indexOf('x-sl-require-resources')>=0){var requireResourcesStr=this.getResponseHeader('x-sl-require-resources');if(requireResourcesStr){processRequireResources(requireResourcesStr);}}});return resp;};var fetch=window.fetch 42window.fetch=function(){var request=Promise.resolve(fetch.apply(window,arguments));request.then(function(result){if(result.headers.has('x-sl-require-resources')){var requireResourcesStr=result.headers.get('x-sl-require-resources') 43if(requireResourcesStr){processRequireResources(requireResourcesStr);}}});return request;}};function processRequireResources(requireResourcesStr){var resources=requireResourcesStr.replace(/}, {/g,'};{').split(';');var origRequiredResources=getRequiredResourcesFromAttribute();var requiredResources=getRequiredResourcesFromAttribute();var resourcesAdded=false;for(var i=0;i<resources.length;i++){var resource=JSON.parse(resources[i]);if(origRequiredResources.indexOf(resource.identifier)===-1&&loadedFiles.indexOf(resource.path)===-1){loadedFiles.push(resource.path);if(resource.type==='js'){loadScript(resource);}else if(resource.type==='css'){loadStyleSheet(resource);} 44resourcesAdded=true;if(requiredResources.indexOf(resource.identifier)===-1){requiredResources.push(resource.identifier);}}} 45if(resourcesAdded){setRequiredResourcesAttribute(requiredResources);}} 46function loadStyleSheet(resource){var link=document.createElement('link');link.rel='stylesheet';link.type='text/css';link.href=resource.path;if(resource.media){link.media=resource.media;} 47document.head.appendChild(link);} 48function loadScript(resource){var script=document.createElement('script');script.src=resource.path;if(resource.async){script.async=true;} 49if(resource.module){script.type='module';}else if(resource.scriptType==='text/plain'){script.type=resource.scriptType;} 50if(resource.module===false){script.noModule=true;} 51if(resource.cookieCategory){script.setAttribute('data-cookie-category',resource.cookieCategory);} 52if(!document.querySelector('script[src="'+resource.path+'"]')){document.head.appendChild(script);}} 53function setRequiredResourcesAttribute(requiredResources){document.body.setAttribute('data-sl-required-resources',requiredResources.join(';'));} 54function getRequiredResourcesFromAttribute(){var requiredResources=document.body.getAttribute('data-sl-required-resources');if(requiredResources){return requiredResources.split(';');}else{return[];}}} 55(new RedxSmartLoader()).init(); 56 57function Redx_Ajax_Action_Base(){var _id='';var _obj=false;var _value='';this.setId=function(value,showWarningAlert){_id=value;if(_id){this.setObj(Redx_Ajax_Action_Base.getDomElement(_id,showWarningAlert));}};this.getId=function(){return _id;};this.setObj=function(value){_obj=value;};this.getObj=function(){return _obj;};this.setValue=function(value){_value=value;};this.getValue=function(){return _value;};this.getOption=function(optionName,options,defaultValue){var retValue=defaultValue;if(typeof options!='undefined'&&options!=null&&typeof options[optionName]!='undefined'){retValue=options[optionName];} 58return retValue;};this.isInputElement=function(element){return(element.nodeName=="INPUT"||element.nodeName=="BUTTON"||element.nodeName=="TEXTAREA"||element.nodeName=="OPTION");};this.unsetElement=function(){var element=this.getObj();if(element){if(element.type=="checkbox"||element.type=="radio"){element.checked=false;}else if(element.type=="number"){element.value="0";}else if(element.type=="text"){element.value="";}else if(element.type=="select"){element.selected=false;}}};this.execute=function(){alert('Muss überschrieben werden!');};} 59Redx_Ajax_Action_Base.dom_elements_cache={};Redx_Ajax_Action_Base.getDomElement=function(id,showWarningAlerts){var obj=document.getElementById(id);if(!obj){obj=false;if(showWarningAlerts){var message="Redx_Ajax_Action_Base.getDomElement: id "+id+" ist nicht vorhanden!";console.log(message);Redx_Ajax_Logger.log(message);}} 60return obj;}; 61 62function Redx_Ajax_Action_alert(){this.execute=function(){alert(this.getValue());};} 63Redx_Ajax_Action_alert.create=function(){return new Redx_Ajax_Action_alert();};Redx_Ajax_Action_alert.prototype=new Redx_Ajax_Action_Base(); 64 65function Redx_Ajax_Action_show(){this.execute=function(options){var element=this.getObj();if(element.style.display==='none'){element.style.display='';} 66if(this.isInputElement(element)){if(this.getOption('enable',options,true)){element.disabled=false;}} 67if(element.style.opacity){element.style.opacity='';}};} 68Redx_Ajax_Action_show.create=function(){return new Redx_Ajax_Action_show();};Redx_Ajax_Action_show.prototype=new Redx_Ajax_Action_Base(); 69 70Redx_Ajax_Action_LoadingAnimation.idSuffix='_redx_loading_container';function Redx_Ajax_Action_LoadingAnimation(){this.execute=function(options){options=this.initOptionsDefaults(options);if(options.visibility=='show'){this.showLoadingBox(this.getObj(),this.getLoadingId(),options)}else{this.hideLoadingBox(this.getLoadingId());}};this.initOptionsDefaults=function(options){if(options.visibility==null){options.visibility='show'} 71if(options.autoResize==null){options.autoResize=true} 72if(options.autoAlign==null){options.autoAlign=true} 73return options;};this.getLoadingId=function(){return this.getId()+Redx_Ajax_Action_LoadingAnimation.idSuffix;};this.showLoadingBox=function(obj,loading_id,options){if(obj){var loading_obj=document.getElementById(loading_id);if(!loading_obj){jQuery(document.body).append(this.getLoadingHtml(loading_id,options.text));} 74loading_obj=document.getElementById(loading_id);try{if(options.autoResize){this.resizeLoadingBox(loading_obj,obj);}}catch(e){Redx_Ajax_Logger.log('Redx_Ajax_Action_LoadingAnimation: showLoadingBox, Exception: '+e.message);}}};this.clonePosition=function(element,source){var options=jQuery.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});var p=jQuery(source).offset(),delta=[0,0],parent=null;if(jQuery(element).css('position')=='absolute'){parent=jQuery(element).offsetParent()[0];delta=jQuery(parent).offset();} 75if(parent==document.body){delta.left-=document.body.offsetLeft;delta.top-=document.body.offsetTop;} 76if(options.setLeft){element.style.left=(p.left-delta.left+options.offsetLeft)+'px';} 77if(options.setTop){element.style.top=(p.top-delta.top+options.offsetTop)+'px';} 78if(options.setWidth){element.style.width=source.offsetWidth+'px';} 79if(options.setHeight){element.style.height=source.offsetHeight+'px';} 80return element;};this.resizeLoadingBox=function(loading_obj,obj){this.clonePosition(loading_obj,obj);};this.getLoadingHtml=function(loading_id,loading_text){var loading_text_container=null;if(loading_text==null){loading_text_container='';loading_text='loading';}else{loading_text_container="<span>"+loading_text+"</span>";} 81return"<div class=\"redx_loading_wrap\" id=\""+loading_id+"_wrap\" style=\"position:absolute;display:flex;align-items:center;justify-content:center;\"><span id=\""+loading_id+"\" class=\"redx_loading\" style=\"display:flex;align-items:center;justify-content:center;\"><xtx-loading-spinner></xtx-loading-spinner>"+loading_text_container+"</span></div>";};this.hideLoadingBox=function(loading_id){var loading_obj=document.getElementById(loading_id+"_wrap");if(loading_obj){loading_obj.remove();}};} 82Redx_Ajax_Action_LoadingAnimation.create=function(){return new Redx_Ajax_Action_LoadingAnimation();};Redx_Ajax_Action_LoadingAnimation.hide=function(id){var element_id=id+Redx_Ajax_Action_LoadingAnimation.idSuffix;var loading_obj=document.getElementById(element_id);if(loading_obj){loading_obj.remove();}};Redx_Ajax_Action_LoadingAnimation.prototype=new Redx_Ajax_Action_Base(); 83 84function Redx_Ajax_Action_hide(){this.execute=function(options){var element=this.getObj();if(this.isInputElement(element)){if(this.getOption('unset',options,true)){this.unsetElement();} 85if(this.getOption('disable',options,false)){element.disabled=true;}} 86jQuery(element).hide();};} 87Redx_Ajax_Action_hide.create=function(){return new Redx_Ajax_Action_hide();};Redx_Ajax_Action_hide.prototype=new Redx_Ajax_Action_Base(); 88 89function Redx_Ajax_Action_disable(){this.execute=function(options){var element=this.getObj();if(this.isInputElement(element)){if(this.getOption('unset',options,true)){this.unsetElement();} 90if(this.getOption('disable',options,true)){element.disabled=true;}} 91var opacity=this.getOption('opacity',options,'0.7');jQuery(element).css('opacity',opacity);};} 92Redx_Ajax_Action_disable.create=function(){return new Redx_Ajax_Action_disable();};Redx_Ajax_Action_disable.prototype=new Redx_Ajax_Action_Base(); 93 94function Redx_Ajax_Action_remove(){this.execute=function(){var element=document.getElementById(this.getId());if(element!=null){element.remove();}};} 95Redx_Ajax_Action_remove.create=function(){return new Redx_Ajax_Action_remove();};Redx_Ajax_Action_remove.prototype=new Redx_Ajax_Action_Base(); 96 97function Redx_Ajax_Action_addInfoMessage(){this.execute=function(options){const element=this.getObj();const value=this.getValue();const tooltip=document.createElement('xtx-tooltip');
97tooltip.setAttribute('trigger','#'+element.id);const span=document.createElement('span');span.setAttribute('slot','content') 98span.textContent=value;tooltip.appendChild(span);document.querySelector('#'+element.id).appendChild(tooltip);};} 99Redx_Ajax_Action_addInfoMessage.create=function(){return new Redx_Ajax_Action_addInfoMessage();};Redx_Ajax_Action_addInfoMessage.prototype=new Redx_Ajax_Action_Base(); 100 101function Redx_Ajax_Action_delInfoMessage(){this.execute=function(){const element=this.getObj();element.querySelectorAll('xtx-tooltip').forEach(el=>el.remove());};} 102Redx_Ajax_Action_delInfoMessage.create=function(){return new Redx_Ajax_Action_delInfoMessage();};Redx_Ajax_Action_delInfoMessage.prototype=new Redx_Ajax_Action_Base(); 103 104function Redx_Ajax_Action_setValue(){this.execute=function(){var element=this.getObj();element.value=this.getValue();};} 105Redx_Ajax_Action_setValue.create=function(){return new Redx_Ajax_Action_setValue();};Redx_Ajax_Action_setValue.prototype=new Redx_Ajax_Action_Base(); 106 107function Redx_Ajax_Action_setChecked(){this.execute=function(){var element=this.getObj();var value=this.getValue();if(element.type=="checkbox"||element.type=="radio"){if(value=="true"||value=="1"||value=="checked"){element.checked=true;}else{element.checked=false;}}};} 108Redx_Ajax_Action_setChecked.create=function(){return new Redx_Ajax_Action_setChecked();};Redx_Ajax_Action_setChecked.prototype=new Redx_Ajax_Action_Base(); 109 110function Redx_Ajax_Action_setDisabled(){this.execute=function(){var element=this.getObj();var value=this.getValue();if(this.isInputElement(element)){if(value=="true"||value=="1"||value=="checked"){element.disabled=true;}else{element.disabled=false;}}};} 111Redx_Ajax_Action_setDisabled.create=function(){return new Redx_Ajax_Action_setDisabled();};Redx_Ajax_Action_setDisabled.prototype=new Redx_Ajax_Action_Base(); 112 113function Redx_Ajax_Action_setInnerHtml(){this.execute=function(){var element=this.getObj();element.innerHTML=this.getValue();element.ariaLive='polite';element.ariaBusy=true;element.ariaBusy=false;};} 114Redx_Ajax_Action_setInnerHtml.create=function(){return new Redx_Ajax_Action_setInnerHtml();};Redx_Ajax_Action_setInnerHtml.prototype=new Redx_Ajax_Action_Base(); 115 116function Redx_Ajax_Action_setStyle(){this.execute=function(options){var element=jQuery(this.getObj());var value=this.getValue();var valueObj;eval("valueObj="+value);element.css(valueObj);};} 117Redx_Ajax_Action_setStyle.create=function(){return new Redx_Ajax_Action_setStyle();};Redx_Ajax_Action_setStyle.prototype=new Redx_Ajax_Action_Base(); 118 119function Redx_Ajax_Action_addSelectOption(){this.execute=function(options){var element=this.getObj();var value=this.getValue();if(value){var opt=document.createElement('option');var parts=value.split(";");if(parts[0]&&parts[1]){opt.value=parts[0];opt.text=parts[1];}else{opt.value="";opt.text=parts[0];} 120element.options.add(opt);}};} 121Redx_Ajax_Action_addSelectOption.create=function(){return new Redx_Ajax_Action_addSelectOption();};Redx_Ajax_Action_addSelectOption.prototype=new Redx_Ajax_Action_Base(); 122 123function Redx_Ajax_Action_appendInnerHtml(){this.execute=function(){var element=this.getObj();element.insertAdjacentHTML('beforeend',this.getValue());};} 124Redx_Ajax_Action_appendInnerHtml.create=function(){return new Redx_Ajax_Action_appendInnerHtml();};Redx_Ajax_Action_appendInnerHtml.prototype=new Redx_Ajax_Action_Base(); 125 126function Redx_Ajax_Action_append(){this.execute=function(){var element=jQuery(this.getObj());var value=this.getValue();element.after(value);};} 127Redx_Ajax_Action_append.create=function(){return new Redx_Ajax_Action_append();};Redx_Ajax_Action_append.prototype=new Redx_Ajax_Action_Base(); 128 129function Redx_Ajax_Action_insert(){this.execute=function(options){var element=jQuery(this.getObj());var value=this.getValue();if(options.position=='top'){element.prepend(value);}else if(options.position=='bottom'){element.append(value);}else if(options.position=='before'){element.before(value);}else if(options.position=='after'){element.after(value);}else if(!options.position){element.append(value);}else{throw"Position not allowed:"+options.position}};} 130Redx_Ajax_Action_insert.create=function(){return new Redx_Ajax_Action_insert();};Redx_Ajax_Action_insert.prototype=new Redx_Ajax_Action_Base(); 131
132function Redx_Ajax_Action_update(){this.execute=function(){var element=this.getObj();var value=this.getValue();jQuery(element).html(value);};} 133Redx_Ajax_Action_update.create=function(){return new Redx_Ajax_Action_update();};Redx_Ajax_Action_update.prototype=new Redx_Ajax_Action_Base(); 134 135function Redx_Ajax_Action_replace(){this.execute=function(){var element=jQuery(this.getObj());var value=this.getValue();element.replaceWith(value);};} 136Redx_Ajax_Action_replace.create=function(){return new Redx_Ajax_Action_replace();};Redx_Ajax_Action_replace.prototype=new Redx_Ajax_Action_Base(); 137 138function Redx_Ajax_Action_prepend(){this.execute=function(){var element=jQuery(this.getObj());var value=this.getValue();element.prepend(value);};} 139Redx_Ajax_Action_prepend.create=function(){return new Redx_Ajax_Action_prepend();};Redx_Ajax_Action_prepend.prototype=new Redx_Ajax_Action_Base(); 140 141function Redx_Ajax_Action_setSelectedIndex(){this.execute=function(){var element=this.getObj();var value=this.getValue();if(element.type=="select-one"){element.selectedIndex=value;}};} 142Redx_Ajax_Action_setSelectedIndex.create=function(){return new Redx_Ajax_Action_setSelectedIndex();};Redx_Ajax_Action_setSelectedIndex.prototype=new Redx_Ajax_Action_Base(); 143 144function Redx_Ajax_Action_setSelectedValue(){this.execute=function(){var element=this.getObj();var value=this.getValue();setTimeout(function(){if(element.type=="select-one"){for(i=0;i<element.length;i++){if(element.options[i].value==value){element.selectedIndex=i;}}}},0);};} 145Redx_Ajax_Action_setSelectedValue.create=function(){return new Redx_Ajax_Action_setSelectedValue();};Redx_Ajax_Action_setSelectedValue.prototype=new Redx_Ajax_Action_Base(); 146 147function Redx_Ajax_Action_AddClassName(){this.execute=function(){var element=jQuery(this.getObj());var value=this.getValue();if(!element.hasClass(value)){element.addClass(value);}};} 148Redx_Ajax_Action_AddClassName.create=function(){return new Redx_Ajax_Action_AddClassName();};Redx_Ajax_Action_AddClassName.prototype=new Redx_Ajax_Action_Base(); 149 150function Redx_Ajax_Action_setReadonly(){this.execute=function(options){var element=this.getObj();var value=this.getValue();if(this.isInputElement(element)){if(value=="true"||value=="1"||value=="checked"){element.readOnly=true;}else{element.readOnly=false;}}};} 151Redx_Ajax_Action_setReadonly.create=function(){return new Redx_Ajax_Action_setReadonly();};Redx_Ajax_Action_setReadonly.prototype=new Redx_Ajax_Action_Base(); 152 153function Redx_Ajax_Action_removeClassName(){this.execute=function(){var element=jQuery(this.getObj());var value=this.getValue();if(element.hasClass(value)){element.removeClass(value);}};} 154Redx_Ajax_Action_removeClassName.create=function(){return new Redx_Ajax_Action_removeClassName();};Redx_Ajax_Action_removeClassName.prototype=new Redx_Ajax_Action_Base(); 155 156function Redx_Ajax_Action_executescript(){this.execute=function(){eval(this.getValue());};} 157Redx_Ajax_Action_executescript.create=function(){return new Redx_Ajax_Action_executescript();};Redx_Ajax_Action_executescript.prototype=new Redx_Ajax_Action_Base(); 158 159function Redx_Ajax_Action_showOption(){this.execute=function(options){var element=this.getObj();jQuery('#'+element.id).replaceWith(element);};} 160Redx_Ajax_Action_showOption.create=function(){return new Redx_Ajax_Action_showOption();};Redx_Ajax_Action_showOption.prototype=new Redx_Ajax_Action_Base(); 161 162function Redx_Ajax_Action_hideOption(){this.execute=function(options){var element=this.getObj();var span=document.createElement('span');span.innerHTML=element.innerHTML;span.id=element.id;span.setAttribute("data-value",element.value);jQuery(element).replaceWith(span);};} 163Redx_Ajax_Action_hideOption.create=function(){return new Redx_Ajax_Action_hideOption();};Redx_Ajax_Action_hideOption.prototype=new Redx_Ajax_Action_Base(); 164 165function Redx_Ajax_Action_triggerEvent(){this.execute=function(){var event=new Event(this.getValue());this.getObj().dispatchEvent(event);};} 166Redx_Ajax_Action_triggerEvent.create=function(){return new Redx_Ajax_Action_triggerEvent();};Redx_Ajax_Action_triggerEvent.prototype=new Redx_Ajax_Action_Base(); 167 168Redx_Ajax_Connector.instances={};Redx_Ajax_Connector.getInstance=function(ajax_server_script,client_form_id){var id=ajax_server_script+client_form_id;if(Redx_Ajax_Connector.instances[id]==null){Redx_Ajax_Connector.instances[id]=new Redx_Ajax_Connector();Redx_Ajax_Connector.instances[id].setServerScript(ajax_server_script);Redx_Ajax_Connector.instances[id].setFormId(client_form_id);Redx_Ajax_Connector.instances[id].init();} 169return Redx_Ajax_Connector.instances[id];};function Redx_Ajax_Connector(){var self=this;var server_script;var form_id;var _loading_container_id='';var _actions=[];var _show_warnings=true;var _is_asynchron_request=false;var _parameters=null;var _nrOfAllowedParallelRequests=null;var _redxAjaxQueueName;var _requestMethod='POST';this.setAction=function(id,obj){_actions[id]=obj;};this.getAction=function(id){return _actions[id];};this.setServerScript=function(script){server_script=script;};
169this.getServerScript=function(){return server_script;};this.setFormId=function(id){form_id=id;};this.getFormId=function(){return form_id;};this.setRedxAjaxQueueName=function(queueName){_redxAjaxQueueName=queueName;};this.getRedxAjaxQueueName=function(){return _redxAjaxQueueName;};this.setRequestMethod=function(requestMethod){_requestMethod=requestMethod;};this.getRequestMethod=function(){return _requestMethod;};this.executeJSONResponse=function(json){var id,action,value,options,optionsObj;for(var i=0;i<json.length;i++){id=json[i].id;action=json[i].action;value=json[i].value;options=json[i].options;if(options!=null&&options.length){eval("optionsObj="+options);} 170this.executeAction(id,action,value,optionsObj);}};this.executeAction=function(id,action,value,options){if(typeof options==='object'&&options.hasOwnProperty('showWarnings')){this.setShowWarningAlerts(options.showWarnings);} 171var action_obj=this.getAction(action);if(action_obj!==undefined){var objs=[];if(id){objs=document.querySelectorAll('#'+id);} 172if(objs.length<=1){action_obj.setId(id,this.showWarningAlerts());action_obj.setValue(value);action_obj.execute(options);}else{for(var i=0;i<objs.length;i++){action_obj.setId(id,this.showWarningAlerts());action_obj.setObj(objs[i]);action_obj.setValue(value);action_obj.execute(options);}}}else{if(this.showWarningAlerts()){Redx_Ajax_Logger.log("Redx_Ajax_Connector: Action: "+action+" not defined!");}else{throw"Action: "+action+" not defined!";}}};this.getDomElement=function(id){return Redx_Ajax_Action_Base.getDomElement(_id,this.showWarningAlerts());};this.setShowWarningAlerts=function(val){_show_warnings=val;};this.showWarningAlerts=function(){return _show_warnings;};this.setIsAsynchronRequest=function(val){_is_asynchron_request=val;};this.isAsynchronRequest=function(){return _is_asynchron_request;};this.setLoadingContainerId=function(val){_loading_container_id=val;};this.getLoadingContainerId=function(){return _loading_container_id;};this.setParameters=function(paramters){_parameters=paramters;};this.getParameters=function(){return _parameters;};this.setNrOfAllowedParallelRequests=function(nrOfAllowedParallelRequests){_nrOfAllowedParallelRequests=nrOfAllowedParallelRequests;};this.getNrOfAllowedParallelRequests=function(){return _nrOfAllowedParallelRequests;};this.initActions=function(){this.setAction('alert',Redx_Ajax_Action_alert.create());this.setAction('show',Redx_Ajax_Action_show.create());this.setAction('hide',Redx_Ajax_Action_hide.create());this.setAction('showOption',Redx_Ajax_Action_showOption.create());this.setAction('hideOption',Redx_Ajax_Action_hideOption.create());this.setAction('disable',Redx_Ajax_Action_disable.create());this.setAction('remove',Redx_Ajax_Action_remove.create());this.setAction('addInfoMessage',Redx_Ajax_Action_addInfoMessage.create());this.setAction('delInfoMessage',Redx_Ajax_Action_delInfoMessage.create());this.setAction('setValue',Redx_Ajax_Action_setValue.create());this.setAction('setChecked',Redx_Ajax_Action_setChecked.create());this.setAction('setDisabled',Redx_Ajax_Action_setDisabled.create());this.setAction('setInnerHtml',Redx_Ajax_Action_setInnerHtml.create());this.setAction('appendInnerHtml',Redx_Ajax_Action_appendInnerHtml.create());this.setAction('addSelectOption',Redx_Ajax_Action_addSelectOption.create());this.setAction('append',Redx_Ajax_Action_append.create());this.setAction('insert',Redx_Ajax_Action_insert.create());this.setAction('update',Redx_Ajax_Action_update.create());this.setAction('replace',Redx_Ajax_Action_replace.create());this.setAction('prepend',Redx_Ajax_Action_prepend.create());this.setAction('setSelectedIndex',Redx_Ajax_Action_setSelectedIndex.create());this.setAction('setSelectedValue',Redx_Ajax_Action_setSelectedValue.create());this.setAction('setStyle',Redx_Ajax_Action_setStyle.create());this.setAction('addClassName',Redx_Ajax_Action_AddClassName.create());this.setAction('setReadonly',Redx_Ajax_Action_setReadonly.create());this.setAction('removeClassName',Redx_Ajax_Action_removeClassName.create());this.setAction('executeScript',Redx_Ajax_Action_executescript.create());this.setAction('loadingAnimation',Redx_Ajax_Action_LoadingAnimation.create());this.setAction('triggerEvent',Redx_Ajax_Action_triggerEvent.create());};this.init=function(){this.initActions();this.setShowWarningAlerts(true);};this.toggleLoadingContainer=function(){var id=this.getLoadingContainerId();if(id!=''&&id!=null){var obj=document.getElementById(id);if(obj){var action;if(obj.style.display=='none'){action='show';}else{action='hide';} 173this.executeAction(id,action,'');}}};
173this.getSerializedString=function(selector){let ret='';if(document.getElementById(selector)&&document.getElementById(selector).length&&typeof document.getElementById(selector).serialize!=='undefined'){ret=document.getElementById(selector).serialize();}else if(jQuery('#'+selector).length){ret=jQuery('#'+selector).serialize();} 174return ret;};this.isCsrfProtectionError=function(responseObj){var ret=false;if(responseObj&&typeof responseObj.getAllResponseHeaders!=='undefined'){var headerStr=responseObj.getAllResponseHeaders();ret=!!(headerStr.match(/x-csrf-validation:\s*error/gi));} 175return ret;};this.update=function(action_info){var formid=this.getFormId();var serverscript=this.getServerScript();var formParametersSerializedStr=(formid)?this.getSerializedString(formid):false;var asynchronous=this.isAsynchronRequest();var parametersObj={};parametersObj.action_info=action_info;parametersObj.action='ajax_update';if(this.getParameters()!=null){jQuery.extend(parametersObj,this.getParameters());} 176var serializedParametersStr=jQuery.param(parametersObj);if(formParametersSerializedStr){serializedParametersStr=formParametersSerializedStr+"&"+serializedParametersStr;} 177var self=this;self.toggleLoadingContainer();var executeJsonResponse=function(response,responseObj){try{var json={};if(typeof response==='object'){json=response;} 178else{try{if(response&&response.length){if(typeof response==='string'&&response.match(/^\/\*-secure-\n?/gi)){response=response.replace(/^\/\*-secure-\n?/gi,'');response=response.replace(/\n?\s?\*\/$/gi,'');} 179json=JSON.parse(response);}} 180catch(parseError){if(!self.isCsrfProtectionError(responseObj)&&response.indexOf('class="error-content"')===-1){Redx_Ajax_Logger.log('Redx_Ajax_Connector: parseError, Url: '+serverscript+', Exception: '+parseError.message+', Response: '+response);}}} 181try{self.executeJSONResponse(json);} 182catch(execJsonError){Redx_Ajax_Logger.log('Redx_Ajax_Connector: execJsonError, Url: '+serverscript+', Exception: '+execJsonError.message+', Response: '+response);} 183self.toggleLoadingContainer();} 184catch(requestError){Redx_Ajax_Logger.log('Redx_Ajax_Connector liefert Fehler: requestError, Url: '+serverscript+', Parameter: '+serializedParametersStr+', Exception: '+requestError.message);}};jQueryAjaxOptions={url:serverscript,method:this.getRequestMethod(),async:asynchronous,data:serializedParametersStr,success:function(response){executeJsonResponse(response);},error:function(response){executeJsonResponse(response.responseText,response);},complete:function(){window.top?.redxRouter?.stopLoading();}};if(this.getNrOfAllowedParallelRequests()===null){jQuery.ajax(jQueryAjaxOptions);}else{var redxAjaxQueue=getRedxAjaxQueue();redxAjaxQueue.add(jQueryAjaxOptions);}};var getRedxAjaxQueue=function(){var queueName=self.getRedxAjaxQueueName()?self.getRedxAjaxQueueName():('Redx_Ajax_Connector_'+self.getServerScript());var redxAjaxQueue=Redx_Ajax_Queue.getInstance(queueName);redxAjaxQueue.setQueueLength(self.getNrOfAllowedParallelRequests());return redxAjaxQueue;}} 185 186(function(){window.Redx_Ajax_Queue=function(){var _items=[];var _queueLength=10;var _autoStart=true;var _nrRunning=0;var _timeoutAjax=10;this.setQueueLength=function(queueLength){_queueLength=queueLength;};this.setAutoStart=function(autoStart){_autoStart=autoStart;};this.add=function(ajaxOpts){_items.push(ajaxOpts);if(_autoStart){executeQueue();}};this.start=function(){executeQueue();};var executeQueue=function(){if(_nrRunning<_queueLength&&_items.length){var ajaxOpts=_items.shift();_nrRunning++;var origComplete=ajaxOpts.complete;(function(origComplete){ajaxOpts.complete=function(){if(origComplete){origComplete.apply(this,arguments);} 187_nrRunning--;};})(origComplete);jQuery.ajax(ajaxOpts);} 188if(_items.length){window.setTimeout(function(){executeQueue();},_timeoutAjax);}};};var instances={};Redx_Ajax_Queue.getInstance=function(queueName){if(instances[queueName]==null){instances[queueName]=new Redx_Ajax_Queue();} 189return instances[queueName];};})(); 190 191function redx_forms_ajax(){} 192redx_forms_ajax.update=function(form_name,is_asynchron,action,loading_id){var ajax_server_script="/redx/ext/forms/ajax/forms.php";var ajax_connector=Redx_Ajax_Connector.getInstance(ajax_server_script,form_name);if(is_asynchron==1){ajax_connector.setIsAsynchronRequest(true);} 193if(loading_id){redx_forms_ajax.showLoadingBox(loading_id);} 194setTimeout(function(){ajax_connector.update(action);},1);};redx_forms_ajax.showLoadingBox=function(loading_id){try{var loading_obj=new Redx_Ajax_Action_LoadingAnimation();var mapping_obj=document.getElementById(loading_id);var options={};options=loading_obj.initOptionsDefaults(options);loading_obj.showLoadingBox(mapping_obj,loading_id+'_loading_box',options);} 195catch(e){Redx_Ajax_Logger.log('redx_forms_ajax: showLoadingBox, Exception: '+e.message);}};redx_forms_ajax.hideLoadingBox=function(loading_id){try{var loading_obj=new Redx_Ajax_Action_LoadingAnimation();loading_obj.hideLoadingBox(loading_id+'_loading_box');} 196catch(e){Redx_Ajax_Logger.log('redx_forms_ajax: hideLoadingBox, Exception: '+e.message);}};redx_forms_ajax.addObservers=function(eventType){xtxJs.eachElement('[data-form-xtx-on-'+eventType+']',function(elem){var webComponents=elem.parentElement.querySelectorAll('xtx-multi-select, xtx-select, xtx-input');
196if(webComponents&&webComponents.length){xtxJs.forEach(webComponents,function(webComponent){if(!webComponent.hasAttribute('data-observer-added-'+eventType)){webComponent.addEventListener(eventType,function(){redx_forms_ajax.update(elem.getAttribute('data-form-xtx-form-id'),elem.getAttribute('data-form-xtx-asynchron'),elem.getAttribute('data-form-xtx-name'),elem.getAttribute('data-form-xtx-loading-id'));});webComponent.setAttribute('data-observer-added-'+eventType,'1');}});} 197elem.removeAttribute('data-form-xtx-on-'+eventType);});};redx_forms_ajax.addChangeObservers=function(){redx_forms_ajax.addObservers('change');};redx_forms_ajax.addBlurObservers=function(){redx_forms_ajax.addObservers('blur');};(function(){var actualUpdateTimeout={};redx_forms_ajax.redxFormsDelayAjaxUpdate=function(form_id,is_asynchron,date_id,trigger,loading_id){if(date_id){if(actualUpdateTimeout[date_id]!==undefined){window.clearTimeout(actualUpdateTimeout[date_id]);} 198actualUpdateTimeout[date_id]=window.setTimeout('redx_forms_ajax.update("'+form_id+'", "'+is_asynchron+'", "'+trigger+'", "'+loading_id+'")',500);}}})();window.addEventListener('load',function(){redx_forms_ajax.addChangeObservers();redx_forms_ajax.addBlurObservers();});window.addEventListener('xtx.content.changed',function(){redx_forms_ajax.addChangeObservers();redx_forms_ajax.addBlurObservers();}); 199 200function followLink(){var bAgent=window.navigator.userAgent;var bAppName=window.navigator.appName;if((bAppName.indexOf("Explorer")>=0)&&(bAgent.indexOf("Mozilla/3")>=0)&&(bAgent.indexOf("Mac")>=0)) 201return false;else return true;} 202var inQuest=false;function askFollowLink(link,quest_string){inQuest=true;ret=confirm(quest_string);inQuest=false;if(ret){link.href=link.href+"&confirmed=true";return followLink();}else{return!followLink();}} 203function askForDelete(deletelink,Redx_Base){inQuest=true;quest_string='Möchten Sie diesen Eintrag wirklich löschen?';ret=confirm(quest_string);inQuest=false;if(ret){deletelink.href=deletelink.href+"&confirmed=true";return followLink();}else{return!followLink();}} 204function askConfirmQuestion(questString){ret=confirm(questString);if(!ret){event.preventDefault();}} 205function askForDeleteOnFormSubmit(form,questString=''){inQuest=true;if(!questString){questString='Möchten Sie diesen Eintrag wirklich löschen?';} 206ret=confirm(questString);inQuest=false;if(ret){form.submit();return followLink();}else{return!followLink();}} 207function askForCopy(copylink,copybutton,Redx_Base){inQuest=true;copybutton.src=Redx_Base+'/res/pics/copy_over.gif';ret=confirm('Möchten Sie diesen Eintrag wirklich kopieren?');copybutton.src=Redx_Base+'/res/pics/copy.gif';inQuest=false;if(ret){return followLink();}else{return!followLink();}} 208function askForSelectionAction(actionlink,action){inQuest=true;var selected=false;var keys=document.getElementsByName("keys[]");actionlink.href=removeSelectedKeysFromHref(actionlink.href);for(var i=0;i<keys.length;++i){if(keys[i].checked){actionlink.href=actionlink.href+"&keys[]="+keys[i].value;selected=true;}} 209if(!selected){alert("Bitte vorher einen Eintrag auswählen!");inQuest=false;return!followLink();} 210ret=confirm('Möchten Sie diese Einträge wirklich '+action+'?');inQuest=false;if(ret){return followLink();}else{return!followLink();}} 211function askForChangeSequenceSelectionAction(actionlink,action){var inQuest=true;var selected=false;var keys=document.getElementsByName("keys[]");actionlink.href=removeSelectedKeysFromHref(actionlink.href);for(var i=0;i<keys.length;++i){if(keys[i].checked){actionlink.href=actionlink.href+"&keys[]="+keys[i].value;selected=true;}} 212if(!selected){alert("Bitte vorher einen Eintrag auswählen!");inQuest=false;return!followLink();} 213if(updateSequenceByUserInput(actionlink,'')){return followLink();}else{return!followLink();}} 214function removeSelectedKeysFromHref(href){while(href.search(/&keys\[\]=\d+/)>-1){href=href.replace(/&keys\[\]=\d+/,'');} 215return href;} 216function askForSelectionAction_(form,action){inQuest=true;var selected=false;var keys=document.getElementsByName("keys[]");for(var i=0;i<keys.length;++i){if(keys[i].checked){selected=true;i=keys.length;}} 217if(!selected){alert("Bitte vorher einen Eintrag auswählen!");inQuest=false;return!followLink();} 218ret=confirm('Möchten Sie diese Einträge wirklich '+action+'?');inQuest=false;if(ret){return followLink();}else{return!followLink();}} 219function selectAllKeys(value){var keys=document.getElementsByName("keys[]");for(var i=0;i<keys.length;++i){keys[i].checked=value;}} 220function updateSequenceByUserInput(sequenceLink,sequence_value){var value=prompt("Bitte geben Sie die Position für den Eintrag an:",sequence_value);if(!value)return!followLink();isnumeric=/^\d{1,4}$/;while(!isnumeric.exec(value)&&value){value=prompt("Bitte geben Sie die Position für den Eintrag an:",sequence_value);} 221if(!value)return!followLink();sequenceLink.href=sequenceLink.href+"&sequence="+value;return followLink();} 222function listUpdate(target_script,form_element,s_table,key,next_view,optenv){var url=target_script+'?action=update&entity='+s_table+'&key='+key+'&'+form_element.name+'='+form_element.value+'&next_view='+next_view+'&'+optenv;url+=RedxSessionSecurityCsrfProtection.getCsrfQueryString();window.location=url;} 223function showHideStatusSelects(display){} 224function showHideSelects(display){} 225var last_opend_drop_down;last_opend_drop_down=false;var dropdownbtn=false;function showHideButtonsDropdown(id){dropdown=document.getElementById(id);var dropdownDiv=document.getElementById('button_'+id);if(dropdown.style.visibility=='visible'){dropdown.style.visibility='hidden';if(typeof dropdownDiv!=='undefined'&&!dropdownDiv.parentNode.parentNode.parentNode.classList.contains('list_filter_content')){} 226dropdown.style.zIndex=-1;setTimeout(function(){jQuery(dropdownbtn).find(".active").each(function(){jQuery(this).removeClass("active");})},40)}else{closeLastOpenedDropDown();dropdownbtn=dropdownDiv;dropdown.style.visibility='visible';if(typeof dropdownDiv!=='undefined'&&!dropdownDiv.parentNode.parentNode.parentNode.classList.contains('list_filter_content')){} 227dropdown.style.zIndex=110;last_opend_drop_down=dropdown;}} 228function changeButtonsDropdownPic(drop_id,type,redx_base){var new_src=redx_base+"/res/pics/down";if(type==1){new_src+="_over";} 229new_src+=".gif";$('img_drop_down_'+drop_id).src=new_src;} 230function closeLastOpenedDropDown(){if(last_opend_drop_down){if(dropdownbtn&&dropdownbtn.parentNode.parentNode){if(!dropdownbtn.parentNode.parentNode.parentNode.classList.contains('list_filter_content')){} 231jQuery(dropdownbtn).find(".active").each(function(){jQuery(this).removeClass('active');});} 232last_opend_drop_down.style.visibility='hidden';last_opend_drop_down.style.zIndex=-1;}} 233function copy_clip(content) 234{if(window.clipboardData) 235{window.clipboardData.setData("Text",content);} 236else if(window.netscape) 237{netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');var clip=Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);if(!clip)return;var trans=Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);if(!trans)return;trans.addDataFlavor('text/unicode');var str=new Object();var len=new Object();var str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);var copytext=content;str.data=copytext;trans.setTransferData("text/unicode",str,copytext.length*2);var clipid=Components.interfaces.nsIClipboard;if(!clip)return false;clip.setData(trans,null,clipid.kGlobalClipboard);} 238alert("Folgender Text wurde in die Zwischenablage kopiert:\n\n"+content);return false;} 239function copy_clip_html(html,alt) 240{if(window.clipboardData) 241{window.clipboardData.setData("Text",alt);} 242else if(window.netscape) 243{netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');var clip=Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);if(!clip)return;var trans=Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);if(!trans)return;trans.addDataFlavor("text/html");trans.addDataFlavor("text/unicode");var str=new Object();var len=new Object();var mozClass=Components.classes["@mozilla.org/supports-string;1"];var strhtml=mozClass.createInstance(Components.interfaces.nsISupportsString);var strtext=mozClass.createInstance(Components.interfaces.nsISupportsString);var copytext=alt;var copyhtml=html;strhtml.data=copyhtml;strtext.data=copytext;trans.setTransferData("text/html",strhtml,copyhtml.length*2);trans.setTransferData("text/unicode",strtext,copytext.length*2);var clipid=Components.interfaces.nsIClipboard;if(!clip)return false;clip.setData(trans,null,clipid.kGlobalClipboard);} 244return false;} 245function BrowserIsIE(){return navigator.appName=="Microsoft Internet Explorer";} 246function BrowserVersion(){return parseInt(navigator.appVersion);} 247function setCookie(sName,sValue,oExpires,sPath,sDomain,bSecure){var sCookie=sName+"="+encodeURIComponent(sValue);if(oExpires&&oExpires!=="0"){sCookie+="; expires="+(typeof oExpires=="string"?oExpires:oExpires.toGMTString());} 248if(sPath){sCookie+="; path="+sPath;} 249if(sDomain){sCookie+="; domain="+sDomain;} 250if(bSecure){sCookie+="; secure";} 251document.cookie=sCookie;} 252function getCookie(sName){var sRE="(?:; )?"+sName+"=([^;]*);?";var oRE=new RegExp(sRE);if(oRE.test(document.cookie)){return decodeURIComponent(RegExp["$1"]);}else{return null;}} 253function focusFirstFormElement(firstTabIndex){var element=findFirstFormElement(firstTabIndex);if(element){element.focus();}} 254function findFirstFormElement(firstTabIndex){var firstFormElement;var formadmin=document.querySelector('form > table.formadmin');if(formadmin){firstFormElement=getFirstFormElementFromForm(formadmin.parentElement);if(firstFormElement){return firstFormElement;}} 255var forms=document.querySelectorAll('body form');for(var j=0;j<forms.length;j++){firstFormElement=getFirstFormElementFromForm(forms[j]);if(firstFormElement){return firstFormElement;}}} 256function getFirstFormElementFromForm(form){if(form.offsetWidth!==0){var allowedTypes=['text','checkbox','radio','select-one','textarea','file','select-multiple'];for(var i=0;i<form.elements.length;i++){var input_type=form.elements[i].type;if(allowedTypes.indexOf(input_type)>=0){return form.elements[i];}}}} 257function redx_search_util(){} 258redx_search_util.searchSelect=function(obj,search_words){if(typeof redx_search_util.searchSelect.select_values=='undefined'){redx_search_util.searchSelect.select_values=[];} 259if(typeof redx_search_util.searchSelect.select_values[obj.id]=='undefined'){redx_search_util.searchSelect.select_values[obj.id]=[];for(var i=0;i<obj.options.length;i++){redx_search_util.searchSelect.select_values[obj.id].push({text:obj.options[i].text,title:obj.options[i].title,value:obj.options[i].value,selected:obj.options[i].selected});}} 260var options_data=redx_search_util.searchSelect.select_values[obj.id];var selected_values=[];for(var i=0;i<options_data.length;i++){if(options_data[i].selected){selected_values.push(options_data[i].value);}} 261for(var i=0;i<obj.length;i++){if(obj[i].selected){selected_values.push(obj[i].value);}} 262obj.innerHTML='';obj.selectedIndex=-1;var add_option=true;var new_obj_index=0;for(var i=0;i<options_data.length;i++){add_option=true;try{if(search_words){add_option=false;if(options_data[i].text.toLowerCase().indexOf(search_words.toLowerCase())!=-1){add_option=true;}}} 263catch(e){add_option=true;} 264if(add_option){obj.options[new_obj_index]=new Option(options_data[i].text,options_data[i].value);if(options_data[i].title){obj.options[new_obj_index].setAttribute('title',options_data[i].title);} 265if(selected_values.indexOf(options_data[i].value)!=-1){obj.options[new_obj_index].selected=true;} 266new_obj_index++;}}}; 267 268/* 269 * JavaScript re-implementation of jQuery-menu-aim 270 * https://github.com/knee-cola/es6-menu-aim/tree/master 271 * MIT License 272 * by Knee-Cola 273 */ 274 275/* 276 * The readme is a little bit missleading. If you have a look here: 277 * https://github.com/knee-cola/es6-menu-aim/blob/master/lib/es6-menu-aim.ts 278 * rowSelector is never used. 279 * So you have to call the hookUp funktion for all element that should handle the submenu.
280 * Fe.: mainNav.children.forEach((element) => { menuAim.hookUp(element); }) 281 */ 282!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["es6-menu-aim"]=e():t["es6-menu-aim"]=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(o){if(i[o])return i[o].exports;var n=i[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,i){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function s(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}Object.defineProperty(e,"__esModule",{value:!0});var u=i(1),a=[],c=0,l=function(){function t(e,i){o(this,t),this.activeRow=null,this.lastDelayLoc=null,this.timeoutId=null,this.exitTimeoutID=null,this.options=null,this.menu=null,this.attach=function(t){this.menu=t,this.options.isRoot&&this.menu.addEventListener("mouseleave",this.mouseleaveMenu),1==++c&&document.addEventListener("mousemove",r)};var n=function(){};i=i||{},this.options={rowSelector:i.rowSelector||"> li",exitDelay:i.exitDelay||null,submenuSelector:i.submenuSelector||"*",submenuDirection:i.submenuDirection||u.MenuDirection.right,tolerance:i.tolerance||75,isRoot:i.isRoot||!0,enter:i.enter||n,exit:i.exit||n,activate:i.activate||n,deactivate:i.deactivate||n,exitMenu:i.exitMenu||n,clickRow:i.clickRow||n},this.mouseenterRow=this.mouseenterRow.bind(this),this.mouseleaveRow=this.mouseleaveRow.bind(this),this.clickRow=this.clickRow.bind(this),this.mouseleaveMenu=this.mouseleaveMenu.bind(this),this.commitExit=this.commitExit.bind(this),this.attach(e)}return s(t,[{key:"mouseleaveMenu",value:function(t){this.timeoutId&&(window.clearTimeout(this.timeoutId),this.timeoutId=null),this.options.exitDelay?(this.exitTimeoutID&&(window.clearTimeout(this.exitTimeoutID),this.exitTimeoutID=null),this.exitTimeoutID=window.setTimeout(this.commitExit,this.options.exitDelay)):this.commitExit()}},{key:"forceExit",value:function(){this.exitTimeoutID&&window.clearTimeout(this.exitTimeoutID),this.commitExit()}},{key:"commitExit",value:function(){this.timeoutId=this.exitTimeoutID=null,this.options.exitMenu(this)&&(this.activeRow&&this.options.deactivate(this.activeRow),this.activeRow=null)}},{key:"mouseenterRow",value:function(t){this.exitTimeoutID&&(clearTimeout(this.exitTimeoutID),this.exitTimeoutID=null),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.options.enter(t.currentTarget),this.possiblyActivate(t.currentTarget)}},{key:"mouseleaveRow",value:function(t){this.options.exit(t.currentTarget)}},{key:"clickRow",value:function(t){t.currentTarget!==this.activeRow&&this.activate(t.currentTarget),this.options.clickRow(t,t.currentTarget)}},{key:"activate",value:function(t){if(t!=this.activeRow){this.activeRow&&this.options.deactivate(this.activeRow);var e=this.options.activate(t);this.activeRow=e||t}}},{key:"possiblyActivate",value:function(t){var e=this.activationDelay(),i=this;e?this.timeoutId=setTimeout(function(){i.possiblyActivate(t)},e):this.activate(t)}},{key:"activationDelay",value:function(){var t=!1;if(this.activeRow)for(var e=this.activeRow.parentElement.querySelectorAll(this.options.submenuSelector),i=0,o=e.length;i<o;i++)if(e[i]===this.activeRow){t=!0;break}if(!t)return 0;var n=m(this.menu),s={x:n.left,y:n.top-this.options.tolerance},c={x:n.left+this.menu.offsetWidth,y:s.y},l={x:n.left,y:n.top+this.menu.offsetHeight+this.options.tolerance},r={x:n.left+this.menu.offsetWidth,y:l.y},v=a[a.length-1],f=a[0];if(!v)return 0;if(f||(f=v),f.x<n.left||f.x>r.x||f.y<n.top||f.y>r.y)return 0;if(this.lastDelayLoc&&v.x==this.lastDelayLoc.x&&v.y==this.lastDelayLoc.y)return 0;var d=c,p=r;this.options.submenuDirection==u.MenuDirection.left?(d=l,p=s):this.options.submenuDirection==u.MenuDirection.below?(d=r,p=l):this.options.submenuDirection==u.MenuDirection.above&&(d=s,p=c);var y=h(v,d),w=h(v,p),x=h(f,d),R=h(f,p);return y<x&&w>R?(this.lastDelayLoc=v,300):(this.lastDelayLoc=null,0)}},{key:"hookUp",value:function(t){t.addEventListener("mouseenter",this.mouseenterRow),t.addEventListener("mouseleave",this.mouseleaveRow),t.addEventListener("click",this.clickRow)}},{key:"setActiveRow",value:function(t){this.activeRow=t,this.timeoutId&&(window.clearTimeout(this.timeoutId),this.timeoutId=null),this.exitTimeoutID&&(window.clearTimeout(this.exitTimeoutID),this.exitTimeoutID=null)}},{key:"deactivateRow",value:function(){this.activeRow&&this.options.deactivate(this.activeRow),this.activeRow=null}},{key:"detach",value:function(){this.menu&&(this.timeoutId&&clearTimeout(this.timeoutId),0==--c&&document.removeEventListener("mousemove",r),this.options.isRoot&&this.menu.removeEventListener("mouseleave",this.mouseleaveMenu),this.timeoutId=this.lastDelayLoc=this.activeRow=this.menu=null)}}]),t}();e.MenuAim=l;var r=function(t){a.push({x:t.pageX,y:t.pageY}),a.length>3&&a.shift()},h=function(t,e){return(e.y-t.y)/(e.x-t.x)},m=function(t){var e=t.getBoundingClientRect(),i=t.ownerDocument.defaultView;return{top:e.top+i.pageYOffset,left:e.left+i.pageXOffset}}}
282,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o;!function(t){t.left="left",t.right="right",t.below="below",t.above="above"}(o||(o={})),e.MenuDirection=o}])}); 283 284(function($){'use strict';var dw,dh,rw,rh,lx,ly;var defaults={loadingNotice:'Loading image',errorNotice:'The image could not be loaded',errorDuration:2500,linkAttribute:'href',preventClicks:true,beforeShow:$.noop,beforeHide:$.noop,onShow:$.noop,onHide:$.noop,onMove:$.noop};function EasyZoom(target,options){this.$target=$(target);this.opts=$.extend({},defaults,options,this.$target.data());this.isOpen===undefined&&this._init();} 285EasyZoom.prototype._init=function(){this.$link=this.$target.find('a');this.$image=this.$target.find('img');this.$flyout=$('<div class="easyzoom-flyout" />');this.$notice=$('<div class="easyzoom-notice" />');this.$target.on({'mousemove.easyzoom touchmove.easyzoom':$.proxy(this._onMove,this),'mouseleave.easyzoom touchend.easyzoom':$.proxy(this._onLeave,this),'mouseenter.easyzoom touchstart.easyzoom':$.proxy(this._onEnter,this)});this.opts.preventClicks&&this.$target.on('click.easyzoom',function(e){e.preventDefault();});};EasyZoom.prototype.show=function(e,testMouseOver){var w1,h1,w2,h2;var self=this;if(this.opts.beforeShow.call(this)===false)return;if(!this.isReady){return this._loadImage(this.$link.attr(this.opts.linkAttribute),function(){if(self.isMouseOver||!testMouseOver){self.show(e);}});} 286this.$target.append(this.$flyout);w1=this.$target.width();h1=this.$target.height();w2=this.$flyout.width();h2=this.$flyout.height();dw=this.$zoom.width()-w2;dh=this.$zoom.height()-h2;if(dw<0)dw=0;if(dh<0)dh=0;rw=dw/w1;rh=dh/h1;this.isOpen=true;this.opts.onShow.call(this);e&&this._move(e);};EasyZoom.prototype._onEnter=function(e){var touches=e.originalEvent.touches;this.isMouseOver=true;if(!touches||touches.length==1){e.preventDefault();this.show(e,true);}};EasyZoom.prototype._onMove=function(e){if(!this.isOpen)return;e.preventDefault();this._move(e);};EasyZoom.prototype._onLeave=function(){this.isMouseOver=false;this.isOpen&&this.hide();};EasyZoom.prototype._onLoad=function(e){if(!e.currentTarget.width)return;this.isReady=true;this.$notice.detach();this.$flyout.html(this.$zoom);this.$target.removeClass('is-loading').addClass('is-ready');e.data.call&&e.data();};EasyZoom.prototype._onError=function(){var self=this;this.$notice.text(this.opts.errorNotice);this.$target.removeClass('is-loading').addClass('is-error');this.detachNotice=setTimeout(function(){self.$notice.detach();self.detachNotice=null;},this.opts.errorDuration);};EasyZoom.prototype._loadImage=function(href,callback){var zoom=new Image;this.$target.addClass('is-loading').append(this.$notice.text(this.opts.loadingNotice));this.$zoom=$(zoom).on('error',$.proxy(this._onError,this)).on('load',callback,$.proxy(this._onLoad,this));zoom.style.position='absolute';zoom.src=href;};EasyZoom.prototype._move=function(e){if(e.type.indexOf('touch')===0){var touchlist=e.touches||e.originalEvent.touches;lx=touchlist[0].pageX;ly=touchlist[0].pageY;}else{lx=e.pageX||lx;ly=e.pageY||ly;} 287var offset=this.$target.offset();var pt=ly-offset.top;var pl=lx-offset.left;var xt=Math.ceil(pt*rh);var xl=Math.ceil(pl*rw);if(xl<0||xt<0||xl>dw||xt>dh){this.hide();}else{var top=xt*-1;var left=xl*-1;this.$zoom.css({top:top,left:left});this.opts.onMove.call(this,top,left);}};EasyZoom.prototype.hide=function(){if(!this.isOpen)return;if(this.opts.beforeHide.call(this)===false)return;this.$flyout.detach();this.isOpen=false;this.opts.onHide.call(this);};EasyZoom.prototype.swap=function(standardSrc,zoomHref,srcset){this.hide();this.isReady=false;this.detachNotice&&clearTimeout(this.detachNotice);this.$notice.parent().length&&this.$notice.detach();this.$target.removeClass('is-loading is-ready is-error');this.$image.attr({src:standardSrc,srcset:srcset&&Array.isArray(srcset)?srcset.join():srcset});this.$link.attr(this.opts.linkAttribute,zoomHref);};EasyZoom.prototype.teardown=function(){this.hide();this.$target.off('.easyzoom').removeClass('is-loading is-ready is-error');this.detachNotice&&clearTimeout(this.detachNotice);delete this.$link;delete this.$zoom;delete this.$image;delete this.$notice;delete this.$flyout;delete this.isOpen;delete this.isReady;};$.fn.easyZoom=function(options){return this.each(function(){var api=$.data(this,'easyZoom');if(!api){$.data(this,'easyZoom',new EasyZoom(this,options));}
287else if(api.isOpen===undefined){api._init();}});};if(typeof define==='function'&&define.amd){define(function(){return EasyZoom;});}else if(typeof module!=='undefined'&&module.exports){module.exports=EasyZoom;}})(jQuery); 288 289var Shopx=(function(){function e(){}return e.prototype.init=function(){var r=this;this.addClickHandlerToMyOrders(),this.moveBadgesAndStickersInsideGalleryToMainImageContainer(),this.initVariantSelection(),this.initReOrderButtons(),this.initReloadCrossSellingOnVariantSelectionChange(),this.initReloadIngredientsOnVariantSelectionChange(),this.initReloadVariantDetailsOnVariantSelectionChange(),document.addEventListener("xtx.configurator.initialized",(function(){var e=new Event("xtx.content.changed",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(e)})),document.addEventListener("xtx.search.render-template.after",(function(){"undefined"!=typeof RedxShopxPriceManager&&RedxShopxPriceManager.getInstance().observePriceContainer()})),document.addEventListener("xsites.fixedcontent.loaded",(function(){"undefined"!=typeof RedxShopxPriceManager&&RedxShopxPriceManager.getInstance().observePriceContainer()})),document.addEventListener("xtx.shopx.checkout.request.success",(function(e){var i=document.getElementById("redx-shopx-checkout"),a=document.getElementById("redx-shopx-checkout-sidebar"),o=null;if(i){r.updateSidebarHeights(a),r.updateCartTableScrollable(a);if(["init","goto-step","next-step","prev-step"].includes(e.detail.eventName)){var t=i.querySelector('[data-step="'.concat(i.dataset.activeStep,'"]'));t&&(o=t.querySelector('[data-slot-group="navigation"]'),r.updateNavigationContainerHeight(i,o))}"init"===e.detail.eventName&&(r.initStickyNavigation(i),xtxJs.onResize((function(e,t,n){e!==n&&(r.updateNavigationContainerHeight(i,o),r.updateSidebarHeights(a),r.updateCartTableScrollable(a))})),xtxJs.onScroll(window.document,(function(){r.updateCartTableScrollable(a)})))}}))},e.prototype.updateCartTableScrollable=function(e){var t=e.querySelector("#redx_shopx_cart"),n=e.querySelector(".cart-list-items-table-wrapper");n&&t&&(2<n.scrollHeight-n.clientHeight?t.classList.add("is-scrollable"):t.classList.remove("is-scrollable"))},e.prototype.updateSidebarHeights=function(e){if(e){var t=e.querySelector(".redx_shopx_result_rows"),n=e.querySelector(".voucher-box-container"),i=0;xtxJs.eachElement(".redxStatusMessage",(function(e){i+=e.offsetHeight}),e),e.style.setProperty("--xtx-checkout-cart-status-messages-height",i+"px"),t&&e.style.setProperty("--xtx-checkout-cart-result-rows-height",t.offsetHeight+"px"),n&&e.style.setProperty("--xtx-checkout-voucher-box-container-height",n.offsetHeight+"px")}},e.prototype.updateNavigationContainerHeight=function(e,t){t&&e.style.setProperty("--xtx-checkout-navigation-height",t.offsetHeight+"px")},e.prototype.initStickyNavigation=function(e){if(e){var t=document.querySelector(e.getAttribute("data-sidebar-selector-bottom-limit")),n=e.querySelectorAll(':is([data-step="1"], [data-step="2"]) [data-slot-group="navigation"]');if(0<n.length)if(t)new IntersectionObserver(function(e){var t=e[0];xtxJs.forEach(n,(function(e){t.isIntersecting?e.classList.remove("is-sticky"):e.classList.add("is-sticky")}))},{root:null,threshold:0}).observe(t);else xtxJs.forEach(n,(function(e){e.classList.add("is-sticky")}))}},e.prototype.addClickHandlerToMyOrders=function(){xtxJs.eachElement("#list_my_orders .order_entry_tr",(function(i){i.addEventListener("click",(function(e){var t=e.target.parentElement;if(!t.classList.contains("redx-modal-opener")&&!t.classList.contains("btn-shopx-reorder")){var n=i.querySelector(".redx-modal-opener a");n&&n.click()}}))}))},e.prototype.moveBadgesAndStickersInsideGalleryToMainImageContainer=function(){xtxJs.eachElement(".shop-product",(function(e){var t=e.querySelector(".gallery-main-image");t&&xtxJs.eachElement(".shopx-badges-container, .shopx-stickers-container",(function(e){t.prepend(e)}),e)}))},e.prototype.initVariantSelection=function(){function t(){xtxJs.eachElement("[data-shopx-variant-selection]",(function(e){ShopxVariantSelection.addInstance(e.id,e.dataset.shopxVariantSelection),e.removeAttribute("data-shopx-variant-selection")}))}t(),document.addEventListener("xtx-datanavigator-navigated",(function(e){t()}),!1)},e.prototype.initReOrderButtons=function(){var o=this;if("undefined"!=typeof Cart){function e(e){var a=t.item(e);a.addEventListener("click",(function(e){if(e.preventDefault(),a.hasAttribute("data-ajax-endpoint")){r.showSpinnerOnElement(a);var t=a.getAttribute("data-ajax-endpoint"),n=a.getAttribute("data-id"),i=new XMLHttpRequest;i.onreadystatechange=function(){if(i.readyState===XMLHttpRequest.DONE)if(0===i.status||200<=i.status&&i.status<400){var e=JSON.parse(i.responseText);r._setCartHtml(e.data.html,e.data.nrOfCartItems);var t=document.createEvent("Event");t.initEvent("xsites.cart.item.added",!0,!0),document.dispatchEvent(t),r.hideSpinnerOnElement(a),r.openCartOverlay(),a.blur()}else r.hideSpinnerOnElement(a),r.refreshCart(),r.openCartOverlay()}.bind(o),t=t+"?id="+n+"&isOverlay=true&returnCartHtml=true",i.open("post",t,!0),i.setRequestHeader("C
289ache-Control","no-cache"),i.send()}}))}for(var t=document.querySelectorAll(".btn-shopx-reorder a"),r=new Cart,n=0;n<t.length;n++)e(n)}},e.prototype.initReloadCrossSellingOnVariantSelectionChange=function(){document.addEventListener("xsites.variantselection.changed",(function(e){var t,n=(null===(t=e.detail.shopx_products_var)||void 0===t?void 0:t.getKey())||null;if(n)for(var i=document.querySelectorAll('[data-listtype="crossSelling"]'),a=0;a<i.length;a++){var o=i.item(a);o.dataset.ajaxEndpoint&&RedxDataNavigator.getInstance().navigate(o.id,o.dataset.ajaxEndpoint+"&shopx_products_var_key="+n,0,null,null,null,null,!1)}}))},e.prototype.initReloadIngredientsOnVariantSelectionChange=function(){document.addEventListener("xsites.variantselection.changed",(function(e){var t,i=(null===(t=e.detail.shopx_products_var)||void 0===t?void 0:t.getKey())||null;if(i){function n(e){var n=a.item(e);if(n.dataset.ajaxEndpoint){var t=n.dataset.ajaxEndpoint;i&&(t+="?shopx_products_var_key="+i),t&&fetch(t,{method:"GET",headers:{Accept:"application/json"}}).then((function(e){return e.text()})).then((function(e){var t=JSON.parse(e);n.outerHTML=t.data.content}))}}for(var a=document.querySelectorAll(".ingredients-list"),o=0;o<a.length;o++)n(o)}}))},e.prototype.initReloadVariantDetailsOnVariantSelectionChange=function(){document.addEventListener("xsites.variantselection.changed",(function(a){var e,o=(null===(e=a.detail.shopx_products_var)||void 0===e?void 0:e.getKey())||null;if(o){function t(e){var t=r.item(e);if(t.dataset.ajaxEndpoint){var n=t.dataset.ajaxEndpoint+"?shopx_products_var_key="+o;a.detail.additionalEnv&&(n+="&"+new URLSearchParams(a.detail.additionalEnv).toString());var i=new XMLHttpRequest;i.addEventListener("load",(function(){if(4===i.readyState&&200===i.status){var e=JSON.parse(i.response);e&&"success"===e.status&&e.data.content&&(t.outerHTML=e.data.content)}})),i.open("GET",n,!0),i.send()}}for(var r=document.querySelectorAll(".shop-product-var[data-ajax-endpoint]"),n=0;n<r.length;n++)t(n)}}))},e})(),FeatureManager=(function(){function e(){}return e.isFeatureEnabled=function(e){var t=document.body;return"enabledFeatures"in t.dataset&&t.dataset.enabledFeatures.split(",").includes(e)},e})(),ListManager=(function(){function e(){}return e.prototype.init=function(){var a=this;this.updateListManagerEntries(),xtxJs.onResize((function(e,t,n,i){e!==n&&a.updateListManagerEntries()})),document.addEventListener("xtx.infiniteScroller.moreEntries.loaded",this.updateListManagerEntries.bind(this)),document.addEventListener("xtx-datanavigator-navigated",(function(){a.executeIfBrowserNotScrolling(a.updateListManagerEntries.bind(a))}))},e.prototype.executeIfBrowserNotScrolling=function(i){var a=document.documentElement.scrollTop||document.body.scrollTop;window.setTimeout((function(){var e=document.documentElement.scrollTop||document.body.scrollTop;if(e===a)i();else{var t=0,n=function(){a=document.documentElement.scrollTop||document.body.scrollTop,clearTimeout(t),t=window.setTimeout((function(){(e=document.documentElement.scrollTop||document.body.scrollTop)===a&&(i(),window.removeEventListener("scroll",n))}),100)};window.addEventListener("scroll",n,{passive:!0})}}),100)},e.prototype.toggleNotWrappedClass=function(){xtxJs.eachElement(".redxListManagerFlexList",(function(e){var t=e.querySelector(".flexListEntry");if(t){e.classList.remove("wrapped"),e.classList.remove("not-wrapped");var n=t.querySelector(".entryImage"),i=t.querySelector(".entryContent");n&&i&&(i.getBoundingClientRect().top>n.getBoundingClientRect().top?e.classList.add("wrapped"):e.classList.add("not-wrapped"))}}))},e.prototype.updateListManagerEntries=function(){this.toggleNotWrappedClass(),"undefined"!=typeof Redx_Sync_Handler&&(Redx_Sync_Handler.refreshSyncs(),Redx_Sync_Handler.execute(),window.requestAnimationFrame((function(){window.requestAnimationFrame((function(){Redx_Sync_Handler.refreshSyncs()}))}))),"undefined"!=typeof RedxShopxPriceManager&&RedxShopxPriceManager.getInstance().observePriceContainer(),setTimeout(function(){this.toggleNotWrappedClass()}.bind(this),250)},e})(),StoreScrollPosition=(function(){function r(){}return r.prototype.init=function(){this.addListener()},r.prototype.addListener=function(){var o=this;if(window.addEventListener("beforeunload",(function(){var e=null;if(document.activeElement&&(e=o.findActiveListEntry(document.activeElement))&&e.classList.contains("flexListEntry")&&sessionStorage.setItem("xtx_listmanager_active_key",e.dataset.entryKey),!e){var t=document.querySelector(".redxListManagerFlexList");if(t)for(var n=t.querySelectorAll(".flexListEntry"),i=0;i<n.length;i++)if(r.isInViewport(n.item(i))){var a=n.item(i);sessionStorage.setItem("xtx_listmanager_active_key",a.dataset.entryKey),i=n.length}}})),sessionStorage.xtx_listmanager_active_key){var e=sessionStorage.getItem("xtx_listmanager_active_key");document.querySelector(".flexListEntry[data-entry-key='"+e+"']")&&(document.querySelector(".flexListEntry[data-entry-key='"+e+"']").scrollIntoView({behavior:"smooth",block:"nearest"}),r.removeActiveKeyFromSesseion())}},r.removeActiveKeyFromSesseion=function(){sessionStorage.removeItem("xtx_listmanager_active_key")},r.prototype.findActiveListEntry=function(e){return e.dataset.entryKey?e:e.parentElement&&e.parentElement!==document.body?this.findActiveListEntry(e.parentElement):null},r.isInViewport=function(e){var t=e.getBoundingClientRect();return 0<=t.top&&0<=t.left&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},r})(),PrintManager=(function(){function n(){}return n.getInstance=function(){return this.instance||(this.instance=new n),this.instance},n.prototype.init=function(){this.initEvents(),this.initElements()},n.prototype.initEvents=function(){window.addEventListener("load",(function(){n.getInstance().initElements()})),document.addEventListener("xtx-datanavigator-navigated",(function(){n.getInstance().initElements()})),document.addEventListener("xtx.infiniteScroller.moreEntries.loaded",(function(){n.getInstance().initElements()})),document.addEventListener("xsites.fixedcontent.loaded",(function(){n.getInstance().initElements()})),document.addEventListener("xtx.presentation.tabs.show",(function(){n.getInstance().initElements()})),document.addEventListener("xtx.presentation.accordion.open",(function(){n.getInstance().initElements()})),document.addEventListener("xtx.presentation.accordion.loaded",(function(){n.getInstance().initElements()}))},n.prototype.initElements=function(){document.querySelectorAll("[data-print]:not([data-print='initialized'])").forEach((function(e){switch(e.setAttribute("data-print","initialized"),e.dataset.printTrigger){case"click":e.addEventListener("click",(function(e){var t=e.target;n.getInstance().print(t.dataset.printType)}));break;case"load":default:n.getInstance().print(e.dataset.printType)}}))},n.prototype.print=function(e){switch(e){case"url":this.printByUrl();break;case"browser":default:this.printByBrowser()}},n.prototype.printByBrowser=function(){window.print()},n.prototype.printByUrl=function(){var e=window.location.href;window.location.search||(e+="?"),e+="&printAsPdf=1",window.open(e,"_blank")},n})();PrintManager.instance=null;
289var BackgroundImage=(function(){function t(){}return t.getInstance=function(){return this.instance||(this.instance=new t),this.instance},t.prototype.init=function(){this.addEventListener(),this.setBackgroundImages()},t.prototype.setBackgroundImages=function(){if("undefined"!=typeof App){var d=App.getActiveResolutionOnScreen();Array.prototype.forEach.call(document.querySelectorAll(".content-background-image[data-background-image]"),(function(e){var t=e.getAttribute("data-background-image"),n=e.getAttribute("data-background-position"),i=e.getAttribute("data-background-size"),a=e.getAttribute("data-target"),o=e.parentNode,r="area"===a?"RedxGridColumn":"RedxGridThemeContainer";do{if(o.classList.contains(r)){if(void 0===e.dataset.origBackgroundImage){var s=getComputedStyle(o);e.setAttribute("data-orig-background-image",s.getPropertyValue("--redx-background-image"))}e.parentNode.classList.contains(d+"Hidden")?o.style.setProperty("--redx-background-image",e.getAttribute("data-orig-background-image")):o.style.setProperty("--redx-background-image","url(".concat(t,")")),o.style.setProperty("--redx-background-position",n),o.style.setProperty("--redx-background-size",i),o.style.setProperty("--redx-background-repeat","no-repeat");break}o=o.parentNode}while(null!==o)}))}},t.prototype.addEventListener=function(){"undefined"==typeof App&&document.addEventListener("xtx.app.initialized",(function(){t.getInstance().setBackgroundImages()}));var e=this;window.addEventListener("resize",(function(){clearTimeout(e.productImageResizeTimer),e.productImageResizeTimer=setTimeout((function(){t.getInstance().setBackgroundImages()}),250)})),window.addEventListener("orientationchange",(function(){clearTimeout(e.productImageResizeTimer),e.productImageResizeTimer=setTimeout((function(){t.getInstance().setBackgroundImages()}),250)})),document.addEventListener("xsites.fixedcontent.loaded",(function(){t.getInstance().setBackgroundImages()}))},t})();BackgroundImage.instance=null;var EventDelegate=(function(){function e(){}return e.getInstance=function(){return this.instance||(this.instance=new e),this.instance},e.prototype.delegateEvents=function(){document.addEventListener("xsites.fixedcontent.loaded",e.getInstance().dispatchFixedContentLoadedEvents.bind(e.getInstance())),document.addEventListener("xtx.presentation.tabs.show",e.getInstance().dispatchPresentationTabsShowEvents.bind(e.getInstance())),document.addEventListener("xtx.presentation.accordion.open",e.getInstance().dispatchPresentationAccordionShowEvents.bind(e.getInstance())),document.addEventListener("xtx.presentation.toggle.open",e.getInstance().dispatchPresentationToggleShowEvents.bind(e.getInstance()))},e.prototype.dispatchFixedContentLoadedEvents=function(e){document.dispatchEvent(new Event("xtx.animation.countdown.refresh",{bubbles:!0,cancelable:!0})),document.dispatchEvent(new Event("xtx.animation.countup.refresh",{bubbles:!0,cancelable:!0})),document.dispatchEvent(new Event("xtx.animation.init",{bubbles:!0,cancelable:!0})),document.dispatchEvent(new Event("xtx.infiniteScroller.init",{bubbles:!0,cancelable:!0})),e.detail.id&&this.dispatchContentChangedEvent(document.querySelector("#"+e.detail.id+" [data-offcanvas-content] .content_wrapper")),App.prepareContentAreaBorderRadiusThemes()},e.prototype.dispatchPresentationTabsShowEvents=function(e){if(e.detail.tabId){var t=document.getElementById(e.detail.tabId);t&&(this.executeInlineScriptsInsideElement(t),this.updateElementsInsideElement(t))}App.prepareContentAreaBorderRadiusThemes()},e.prototype.dispatchPresentationAccordionShowEvents=function(e){if(e.detail.panelId){var t=document.getElementById(e.detail.panelId);t&&(this.executeInlineScriptsInsideElement(t),this.updateElementsInsideElement(t))}App.prepareContentAreaBorderRadiusThemes()},e.prototype.dispatchPresentationToggleShowEvents=function(e){if(e.detail.toggleId){var t=document.getElementById(e.detail.toggleId);t&&(this.executeInlineScriptsInsideElement(t),this.updateElementsInsideElement(t))}},e.prototype.executeInlineScriptsInsideElement=function(e){for(var t,n=window._inlineScripts||[];t=n.shift();)t()},e.prototype.updateElementsInsideElement=function(e){this.dispatchContentChangedEvent(e),this.dispatchSlideshowReInitEvent(e),this.dispatchSlideshowUpdateEvent(e),this.dispatchSlideshowUpdateEvent(e)},e.prototype.dispatchSlideshowUpdateEvent=function(e){if(e){var t=document.createEvent("Event");t.initEvent("xtx.slideshow.update",!0,!0),e.querySelectorAll(".initialized[data-sli
289deshow]:not([data-autoplay])").forEach((function(e){e.dispatchEvent(t)}))}},e.prototype.dispatchSlideshowReInitEvent=function(e){if(e){var t=document.createEvent("Event");t.initEvent("xtx.slideshow.reinit",!0,!0),e.querySelectorAll(".initialized[data-slideshow][data-autoplay]").forEach((function(e){e.dispatchEvent(t)}))}},e.prototype.dispatchContentChangedEvent=function(e){if(e){var t=document.createEvent("Event");t.initEvent("xtx.content.changed",!0,!0),e.dispatchEvent(t)}},e})();EventDelegate.instance=null,EventDelegate.getInstance().delegateEvents(),(function(){var e;e=function(){(new Shopx).init(),(new ListManager).init(),(new StoreScrollPosition).init(),PrintManager.getInstance().init(),BackgroundImage.getInstance().init()},"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)})(),window.FeatureManager=FeatureManager; 290 291function RedxModal(){let activeButtonWrapper;const getOnClickFunction=function(buttonWrapper){return function(){activeButtonWrapper=buttonWrapper;const modal=document.querySelector('xtx-modal[name="redx-modal-iframe"]');modal.title=buttonWrapper.getAttribute("data-modal-header-text");modal.url=buttonWrapper.getAttribute("data-modal-iframe-src");modal.size=buttonWrapper.getAttribute("data-modal-size");if(buttonWrapper.getAttribute("data-modal-resize-button")==='false'||!buttonWrapper.getAttribute("data-modal-resize-button")){modal.noResize='true'} 292if(!modal.title){modal.noHeader=true;} 293let iframeAllowValues=buttonWrapper.getAttribute("data-modal-iframe-allow-values") 294if(iframeAllowValues){modal.iframeAllow=iframeAllowValues;} 295if(modal&&activeButtonWrapper){modal.addEventListener('xtx.modal.opening',function(event){executeJs(activeButtonWrapper.getAttribute("data-modal-on-open-js"));});modal.addEventListener('xtx.modal.opened',function(event){executeJs(activeButtonWrapper.getAttribute("data-modal-after-opening-js"));});modal.addEventListener('xtx.modal.closing',function(event){executeJs(activeButtonWrapper.getAttribute("data-modal-on-close-js"));});modal.addEventListener('xtx.modal.closed',function(event){executeJs(activeButtonWrapper.getAttribute("data-modal-after-closing-js"));});} 296modal.open();}};const addObserverToButton=function(buttonWrapper){let button=buttonWrapper;if(buttonWrapper.getAttribute('data-modal-button-wrapper')==='true'){button=buttonWrapper.firstChild;} 297button.addEventListener("click",function(event){getOnClickFunction(buttonWrapper)();event.preventDefault();return false;});};this.openIframeModal=function(headerText,iframeSrc){const button=document.createElement("div");button.setAttribute('class','redx-modal-opener');button.setAttribute('data-modal-size','max');button.setAttribute('data-modal-header-text',headerText);button.setAttribute('data-modal-type','iframe');button.setAttribute('data-modal-iframe-src',iframeSrc);getOnClickFunction(button)();};const executeJs=function(script){if(script&&script.trim()!==''&&script!=='undefined'){try{eval(script);}catch(e){}}};this.reInit=function(){this.init();};this.init=function(){let buttons=document.querySelectorAll('.redx-modal-opener:not([data-modal-initialized=true])'),i;for(i=0;i<buttons.length;i++){const buttonWrapper=buttons[i];addObserverToButton(buttonWrapper);buttonWrapper.setAttribute('data-modal-initialized','true');}} 298this.close=function(){document.querySelector('xtx-modal[name="redx-modal-iframe"]').close();}} 299var redxModal=new RedxModal();document.addEventListener("DOMContentLoaded",function(){redxModal.init();});document.addEventListener("xtx.tooltip.ajax.loaded.success",function(){redxModal.init();});document.addEventListener("xtx.shopx.checkout.request.success",function(){redxModal.init();}); 300 301function Redx_Sync_Handler(){var _resize_timeout=250,_ready_timeout=100,_selectors=[],_containerObj=null,_unique_id='',_topContainerSelector=null,_topContainerHeight=null,_lastWindowWidth=0;this.setResizeTimeout=function(resize_timeout){_resize_timeout=resize_timeout;};this.getResizeTimeout=function(){return _resize_timeout;};this.setContainerObj=function(containerObj){_containerObj=containerObj;};this.getContainerObj=function(){return _containerObj;};this.setReadyTimeout=function(ready_timeout){_ready_timeout=ready_timeout;};this.getReadyTimeout=function(){return _ready_timeout;};this.setUniqueId=function(unique_id){_unique_id=unique_id;};this.getUniqueId=function(){return _unique_id;};this.addSelector=function(selector){_selectors.push(selector);};
301this.getSelectors=function(){return _selectors;};this.setTopContainersSelector=function(selector,height){_topContainerSelector=selector;_topContainerHeight=height;};this.setTopContainerHeight=function(selector,height){var obj=jQuery(selector);if(obj){obj.height(height);}};this.executeSync=function(){if(_topContainerSelector&&_topContainerHeight){this.setTopContainerHeight(_topContainerSelector,_topContainerHeight)} 302var selectors=this.getSelectors();var _self=this;jQuery.each(selectors,function(index,selector){var obj=null;if(_self.getContainerObj()){obj=_self.getContainerObj().find(selector);}else{obj=jQuery(selector);} 303_self.resetHeight(obj);_self.syncHeight(obj);});_lastWindowWidth=jQuery(window).width();};this.executeSyncOnWindowSizeChange=function(){if(_lastWindowWidth!=jQuery(window).width()){this.executeSync();}};this.start=function(executeReady,executeOnLoad,executeImmmediately){var _self=this;if(_self.getUniqueId()==''){_self.setUniqueId(Math.random().toString(36).replace(/\./,''));} 304if(executeReady==null&&executeOnLoad==null&&executeImmmediately==null){executeReady=true;executeOnLoad=false;executeImmmediately=false;} 305executeOnLoad=(executeOnLoad==null)?true:executeOnLoad;executeReady=(executeReady==null)?true:executeReady;executeImmmediately=(executeImmmediately==null)?false:executeImmmediately;if(executeImmmediately===true){try{this.executeSync();}catch(e){}} 306if(executeReady){jQuery(window).ready(function(){waitForFinalEvent(function(){_self.executeSync()},_self.getReadyTimeout(),'ready_'+_self.getUniqueId());});} 307else if(executeOnLoad){jQuery(window).on("load",function(){_self.executeSync();});} 308jQuery(window).on('resize',function(){var actualWidth=jQuery(window).width();if(_lastWindowWidth!=actualWidth){waitForFinalEvent(function(){_self.executeSyncOnWindowSizeChange();},_self.getResizeTimeout(),'resize_'+_self.getUniqueId());}});};this.resetHeight=function(elements){xtxJs.forEach(elements,(element)=>{element.style.height="auto";});};this.syncHeight=function(elements){let currentRowStart=0,topPosition=0,rows=[],row={height:0,elements:[]};function doSyncElements(rows){xtxJs.forEach(rows,(row)=>{if(row.elements.length>1){xtxJs.forEach(row.elements,(syncElement)=>{syncElement.style.height=row.height+"px";})}})} 309xtxJs.forEach(elements,(element)=>{let rect=element.getBoundingClientRect();topPosition=parseInt(rect.top+window.scrollY);if(currentRowStart>(topPosition+40)||currentRowStart<(topPosition-40)){if(currentRowStart===0){currentRowStart=topPosition;} 310rows[currentRowStart]=row;row={height:0,elements:[]};currentRowStart=topPosition;rows[currentRowStart]=[];row.height=rect.height;}else{if(row.height<rect.height){row.height=rect.height;}} 311row.elements.push(element);});rows[currentRowStart]=row;doSyncElements(rows);};var waitForFinalEvent=(function(){var timers={};return function(callback,ms,uniqueId){if(!uniqueId){uniqueId="no_unique_id_defined";} 312if(timers[uniqueId]){clearTimeout(timers[uniqueId]);} 313timers[uniqueId]=setTimeout(callback,ms);};})();} 314Redx_Sync_Handler.syncHandlers=[];Redx_Sync_Handler.execute=function(){jQuery("[data-redx-sync-handler][data-redx-sync-handler!='initialized']").each(function(){var container=jQuery(this);var syncHandler=new Redx_Sync_Handler();syncHandler.setContainerObj(container);container.find("[data-redx-sync-handler-row]").each(function(){syncHandler.addSelector('[data-redx-sync-handler-row="'+jQuery(this).attr('data-redx-sync-handler-row')+'"]');});syncHandler.start();container.attr("data-redx-sync-handler","initialized");container.attr("data-redx-sync-handler-id",Redx_Sync_Handler.syncHandlers.length);Redx_Sync_Handler.syncHandlers.push(syncHandler);});};Redx_Sync_Handler.refreshSyncs=function(){clearTimeout(Redx_Sync_Handler.refreshSyncTimeout);Redx_Sync_Handler.refreshSyncTimeout=window.setTimeout(()=>{if(!Redx_Sync_Handler.refreshSyncsInProgress){Redx_Sync_Handler.refreshSyncsInProgress=true;window.requestAnimationFrame(()=>{Redx_Sync_Handler.syncHandlers.forEach(function(entry){entry.executeSync();});window.requestAnimationFrame(()=>{Redx_Sync_Handler.refreshSyncsInProgress=false;});})}},10);} 315Redx_Sync_Handler.refreshSync=function(containerObj){var syncHandlerId=containerObj.attr("data-redx-sync-handler-id");if(syncHandlerId&&typeof syncHandlerId!=='undefined'){try{syncHandlerId=parseInt(syncHandlerId);if(Redx_Sync_Handler.syncHandlers[syncHandlerId]!==undefined){Redx_Sync_Handler.syncHandlers[syncHandlerId].executeSync();return true;}}catch(e){}} 316return false;}; 317 318jQuery(document).ready(function(){Redx_Sync_Handler.execute();document.addEventListener('xtx.presentation.accordion.open',function(e){Redx_Sync_Handler.refreshSyncs();Redx_Sync_Handler.execute();},false);document.addEventListener('xtx.presentation.tabs.show',function(e){Redx_Sync_Handler.refreshSyncs();Redx_Sync_Handler.execute();},false);document.addEventListener('xtx.presentation.toggle.open',function(e){Redx_Sync_Handler.refreshSyncs();Redx_Sync_Handler.execute();},false);}); 319/*! 320 * imagesLoaded PACKAGED v4.1.1 321 * JavaScript is all like "You images are done yet or what?" 322 * MIT License 323 */ 324 325/** 326 * EvEmitter v1.0.3 327 * Lil' event emitter 328 * MIT License 329 */ 330 331/* jshint unused: true, undef: true, strict: true */ 332 333( function( global, factory ) { 334 // universal module definition 335 /* jshint strict: false */ /* globals define, module, window */ 336 if ( typeof define == 'function' && define.amd ) { 337 // AMD - RequireJS 338 define( 'ev-emitter/ev-emitter',factory ); 339 } else if ( typeof module == 'object' && module.exports ) { 340 // CommonJS - Browserify, Webpack 341 module.exports = factory(); 342 } else { 343 // Browser globals 344 global.EvEmitter = factory(); 345 } 346 347}( typeof window != 'undefined' ? window : this, function() { 348 349 350 351 function EvEmitter() {} 352 353 var proto = EvEmitter.prototype; 354 355 proto.on = function( eventName, listener ) { 356 if ( !eventName || !listener ) { 357 return; 358 } 359 // set events hash 360 var events = this._events = this._events || {}; 361 // set listeners array 362 var listeners = events[ eventName ] = events[ eventName ] || []; 363 // only add once 364 if ( listeners.indexOf( listener ) == -1 ) { 365 listeners.push( listener ); 366 } 367 368 return this; 369 }; 370 371 proto.once = function( eventName, listener ) { 372 if ( !eventName || !listener ) { 373 return; 374 } 375 // add event 376 this.on( eventName, listener ); 377 // set once flag 378 // set onceEvents hash 379 var onceEvents = this._onceEvents = this._onceEvents || {}; 380 // set onceListeners object 381 var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; 382 // set flag 383 onceListeners[ listener ] = true; 384 385 return this; 386 }; 387 388 proto.off = function( eventName, listener ) { 389 var listeners = this._events && this._events[ eventName ]; 390 if ( !listeners || !listeners.length ) { 391 return; 392 } 393 var index = listeners.indexOf( listener ); 394 if ( index != -1 ) { 395 listeners.splice( index, 1 ); 396 } 397 398 return this; 399 }; 400 401 proto.emitEvent = function( eventName, args ) { 402 var listeners = this._events && this._events[ eventName ]; 403 if ( !listeners || !listeners.length ) { 404 return; 405 } 406 var i = 0; 407 var listener = listeners[i]; 408 args = args || []; 409 // once stuff 410 var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; 411 412 while ( listener ) { 413 var isOnce = onceListeners && onceListeners[ listener ]; 414 if ( isOnce ) { 415 // remove listener 416 // remove before trigger to prevent recursion 417 this.off( eventName, listener ); 418 // unset once flag 419 delete onceListeners[ listener ]; 420 } 421 // trigger listener 422 listener.apply( this, args ); 423 // get next listener 424 i += isOnce ? 0 : 1; 425 listener = listeners[i]; 426 } 427 428 return this; 429 }; 430 431 return EvEmitter; 432 433})); 434 435/*! 436 * imagesLoaded v4.1.1 437 * JavaScript is all like "You images are done yet or what?" 438 * MIT License 439 */ 440 441( function( window, factory ) { 'use strict'; 442 // universal module definition 443 444 /*global define: false, module: false, require: false */ 445 446 if ( typeof define == 'function' && define.amd ) { 447 // AMD 448 define( [ 449 'ev-emitter/ev-emitter' 450 ], function( EvEmitter ) { 451 return factory( window, EvEmitter ); 452 }); 453 } else if ( typeof module == 'object' && module.exports ) { 454 // CommonJS 455 module.exports = factory( 456 window, 457 require('ev-emitter') 458 ); 459 } else { 460 // browser global 461 window.imagesLoaded = factory( 462 window, 463 window.EvEmitter 464 ); 465 } 466 467})( window, 468 469// -------------------------- factory -------------------------- // 470 471 function factory( window, EvEmitter ) { 472 473 474 475 var $ = window.jQuery; 476 var console = window.console; 477 478// -------------------------- helpers -------------------------- // 479 480// extend objects 481 function extend( a, b ) { 482 for ( var prop in b ) { 483 a[ prop ] = b[ prop ]; 484 } 485 return a; 486 } 487 488// turn element or nodeList into an array 489 function makeArray( obj ) { 490 var ary = []; 491 if ( Array.isArray( obj ) ) { 492 // use object if already an array 493 ary = obj; 494 } else if ( typeof obj.length == 'number' ) { 495 // convert nodeList to array 496 for ( var i=0; i < obj.length; i++ ) { 497 ary.push( obj[i] ); 498 } 499 } else { 500 // array of single index 501 ary.push( obj ); 502 } 503 return ary; 504 } 505 506// -------------------------- imagesLoaded -------------------------- // 507 508 /** 509 * @param {Array, Element, NodeList, String} elem 510 * @param {Object or Function} options - if function, use as callback 511 * @param {Function} onAlways - callback function 512 */ 513 function ImagesLoaded( elem, options, onAlways ) { 514 // coerce ImagesLoaded() without new, to be new ImagesLoaded() 515 if ( !( this instanceof ImagesLoaded ) ) { 516 return new ImagesLoaded( elem, options, onAlways ); 517 } 518 // use elem as selector string 519 if ( typeof elem == 'string' ) { 520 elem = document.querySelectorAll( elem ); 521 } 522 523 this.elements = makeArray( elem ); 524 this.options = extend( {}, this.options ); 525 526 if ( typeof options == 'function' ) { 527 onAlways = options; 528 } else { 529 extend( this.options, options ); 530 } 531 532 if ( onAlways ) { 533 this.on( 'always', onAlways ); 534 } 535 536 this.getImages(); 537 538 if ( $ ) { 539 // add jQuery Deferred object 540 this.jqDeferred = new $.Deferred(); 541 } 542 543 // HACK check async to allow time to bind listeners 544 setTimeout( function() { 545 this.check(); 546 }.bind( this )); 547 } 548 549 ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); 550 551 ImagesLoaded.prototype.options = {}; 552 553 ImagesLoaded.prototype.getImages = function() { 554 this.images = []; 555 556 // filter & find items if we have an item selector
vendor: 4,268 bytes, lines 557-697
557 this.elements.forEach( this.addElementImages, this ); 558 }; 559 560 /** 561 * @param {Node} element 562 */ 563 ImagesLoaded.prototype.addElementImages = function( elem ) { 564 // filter siblings 565 if ( elem.nodeName == 'IMG' ) { 566 this.addImage( elem ); 567 } 568 // get background image on element 569 if ( this.options.background === true ) { 570 this.addElementBackgroundImages( elem ); 571 } 572 573 // find children 574 // no non-element nodes, #143 575 var nodeType = elem.nodeType; 576 if ( !nodeType || !elementNodeTypes[ nodeType ] ) { 577 return; 578 } 579 var childImgs = elem.querySelectorAll('img'); 580 // concat childElems to filterFound array 581 for ( var i=0; i < childImgs.length; i++ ) { 582 var img = childImgs[i]; 583 this.addImage( img ); 584 } 585 586 // get child background images 587 if ( typeof this.options.background == 'string' ) { 588 var children = elem.querySelectorAll( this.options.background ); 589 for ( i=0; i < children.length; i++ ) { 590 var child = children[i]; 591 this.addElementBackgroundImages( child ); 592 } 593 } 594 }; 595 596 var elementNodeTypes = { 597 1: true, 598 9: true, 599 11: true 600 }; 601 602 ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { 603 var style = getComputedStyle( elem ); 604 if ( !style ) { 605 // Firefox returns null if in a hidden iframe https://bugzil.la/548397 606 return; 607 } 608 // get url inside url("...") 609 var reURL = /url\((['"])?(.*?)\1\)/gi; 610 var matches = reURL.exec( style.backgroundImage ); 611 while ( matches !== null ) { 612 var url = matches && matches[2]; 613 if ( url ) { 614 this.addBackground( url, elem ); 615 } 616 matches = reURL.exec( style.backgroundImage ); 617 } 618 }; 619 620 /** 621 * @param {Image} img 622 */ 623 ImagesLoaded.prototype.addImage = function( img ) { 624 var loadingImage = new LoadingImage( img ); 625 this.images.push( loadingImage ); 626 }; 627 628 ImagesLoaded.prototype.addBackground = function( url, elem ) { 629 var background = new Background( url, elem ); 630 this.images.push( background ); 631 }; 632 633 ImagesLoaded.prototype.check = function() { 634 var _this = this; 635 this.progressedCount = 0; 636 this.hasAnyBroken = false; 637 // complete if no images 638 if ( !this.images.length ) { 639 this.complete(); 640 return; 641 } 642 643 function onProgress( image, elem, message ) { 644 // HACK - Chrome triggers event before object properties have changed. #83 645 setTimeout( function() { 646 _this.progress( image, elem, message ); 647 }); 648 } 649 650 this.images.forEach( function( loadingImage ) { 651 loadingImage.once( 'progress', onProgress ); 652 loadingImage.check(); 653 }); 654 }; 655 656 ImagesLoaded.prototype.progress = function( image, elem, message ) { 657 this.progressedCount++; 658 this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; 659 // progress event 660 this.emitEvent( 'progress', [ this, image, elem ] ); 661 if ( this.jqDeferred && this.jqDeferred.notify ) { 662 this.jqDeferred.notify( this, image ); 663 } 664 // check if completed 665 if ( this.progressedCount == this.images.length ) { 666 this.complete(); 667 } 668 669 if ( this.options.debug && console ) { 670 console.log( 'progress: ' + message, image, elem ); 671 } 672 }; 673 674 ImagesLoaded.prototype.complete = function() { 675 var eventName = this.hasAnyBroken ? 'fail' : 'done'; 676 this.isComplete = true; 677 this.emitEvent( eventName, [ this ] ); 678 this.emitEvent( 'always', [ this ] ); 679 if ( this.jqDeferred ) { 680 var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; 681 this.jqDeferred[ jqMethod ]( this ); 682 } 683 }; 684 685// -------------------------- -------------------------- // 686 687 function LoadingImage( img ) { 688 this.img = img; 689 } 690 691 LoadingImage.prototype = Object.create( EvEmitter.prototype ); 692 693 LoadingImage.prototype.check = function() { 694 // If complete is true and browser supports natural sizes, 695 // try to check for image status manually. 696 var isComplete = this.getIsImageComplete(); 697 if ( isComplete ) {
698 // report based on naturalWidth 699 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 700 return; 701 } 702 703 // If none of the checks above matched, simulate loading on detached element. 704 this.proxyImage = new Image(); 705 this.proxyImage.addEventListener( 'load', this ); 706 this.proxyImage.addEventListener( 'error', this ); 707 // bind to image as well for Firefox. #191 708 this.img.addEventListener( 'load', this ); 709 this.img.addEventListener( 'error', this ); 710 this.proxyImage.src = this.img.src; 711 }; 712 713 LoadingImage.prototype.getIsImageComplete = function() { 714 return this.img.complete && this.img.naturalWidth !== undefined; 715 }; 716 717 LoadingImage.prototype.confirm = function( isLoaded, message ) { 718 this.isLoaded = isLoaded; 719 this.emitEvent( 'progress', [ this, this.img, message ] ); 720 }; 721 722// ----- events ----- // 723 724// trigger specified handler for event type 725 LoadingImage.prototype.handleEvent = function( event ) { 726 var method = 'on' + event.type; 727 if ( this[ method ] ) { 728 this[ method ]( event ); 729 } 730 }; 731 732 LoadingImage.prototype.onload = function() { 733 this.confirm( true, 'onload' ); 734 this.unbindEvents(); 735 }; 736 737 LoadingImage.prototype.onerror = function() { 738 this.confirm( false, 'onerror' ); 739 this.unbindEvents(); 740 }; 741 742 LoadingImage.prototype.unbindEvents = function() { 743 this.proxyImage.removeEventListener( 'load', this ); 744 this.proxyImage.removeEventListener( 'error', this ); 745 this.img.removeEventListener( 'load', this ); 746 this.img.removeEventListener( 'error', this ); 747 }; 748 749// -------------------------- Background -------------------------- // 750 751 function Background( url, element ) { 752 this.url = url; 753 this.element = element; 754 this.img = new Image(); 755 } 756 757// inherit LoadingImage prototype 758 Background.prototype = Object.create( LoadingImage.prototype ); 759 760 Background.prototype.check = function() { 761 this.img.addEventListener( 'load', this ); 762 this.img.addEventListener( 'error', this ); 763 this.img.src = this.url; 764 // check if image is already complete 765 var isComplete = this.getIsImageComplete(); 766 if ( isComplete ) { 767 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 768 this.unbindEvents(); 769 } 770 }; 771 772 Background.prototype.unbindEvents = function() { 773 this.img.removeEventListener( 'load', this ); 774 this.img.removeEventListener( 'error', this ); 775 }; 776 777 Background.prototype.confirm = function( isLoaded, message ) { 778 this.isLoaded = isLoaded; 779 this.emitEvent( 'progress', [ this, this.element, message ] ); 780 }; 781 782// -------------------------- jQuery -------------------------- // 783 784 ImagesLoaded.makeJQueryPlugin = function( jQuery ) { 785 jQuery = jQuery || window.jQuery; 786 if ( !jQuery ) { 787 return; 788 } 789 // set local variable 790 $ = jQuery; 791 // $().imagesLoaded() 792 $.fn.imagesLoaded = function( options, callback ) { 793 var instance = new ImagesLoaded( this, options, callback ); 794 return instance.jqDeferred.promise( $(this) ); 795 }; 796 }; 797// try making plugin 798 ImagesLoaded.makeJQueryPlugin(); 799 800// -------------------------- -------------------------- // 801 802 return ImagesLoaded; 803 804 }); 805/*! 806 * Masonry PACKAGED v4.1.1 807 * Cascading grid layout library 808 * http://masonry.desandro.com 809 * MIT License 810 * by David DeSandro 811 */ 812 813/** 814 * Bridget makes jQuery widgets 815 * v2.0.1 816 * MIT license 817 */ 818 819/* jshint browser: true, strict: true, undef: true, unused: true */ 820 821( function( window, factory ) { 822 // universal module definition 823 /*jshint strict: false */ /* globals define, module, require */ 824 if ( typeof define == 'function' && define.amd ) { 825 // AMD 826 define( 'jquery-bridget/jquery-bridget',[ 'jquery' ], function( jQuery ) { 827 return factory( window, jQuery ); 828 }); 829 } else if ( typeof module == 'object' && module.exports ) { 830 // CommonJS 831 module.exports = factory( 832 window, 833 require('jquery') 834 ); 835 } else { 836 // browser global 837 window.jQueryBridget = factory( 838 window, 839 window.jQuery 840 ); 841 } 842 843}( window, function factory( window, jQuery ) { 844 'use strict'; 845 846// ----- utils ----- // 847 848 var arraySlice = Array.prototype.slice; 849 850// helper function for logging errors 851// $.error breaks jQuery chaining 852 var console = window.console; 853 var logError = typeof console == 'undefined' ? function() {} : 854 function( message ) { 855 console.error( message ); 856 }; 857 858// ----- jQueryBridget ----- // 859 860 function jQueryBridget( namespace, PluginClass, $ ) { 861 $ = $ || jQuery || window.jQuery; 862 if ( !$ ) { 863 return; 864 } 865 866 // add option method -> $().plugin('option', {...}) 867 if ( !PluginClass.prototype.option ) { 868 // option setter 869 PluginClass.prototype.option = function( opts ) { 870 // bail out if not an object 871 if ( !$.isPlainObject( opts ) ){ 872 return; 873 } 874 this.options = $.extend( true, this.options, opts ); 875 }; 876 } 877 878 // make jQuery plugin 879 $.fn[ namespace ] = function( arg0 /*, arg1 */ ) { 880 if ( typeof arg0 == 'string' ) { 881 // method call $().plugin( 'methodName', { options } ) 882 // shift arguments by 1 883 var args = arraySlice.call( arguments, 1 ); 884 return methodCall( this, arg0, args ); 885 } 886 // just $().plugin({ options }) 887 plainCall( this, arg0 ); 888 return this; 889 }; 890 891 // $().plugin('methodName') 892 function methodCall( $elems, methodName, args ) { 893 var returnValue; 894 var pluginMethodStr = '$().' + namespace + '("' + methodName + '")'; 895 896 $elems.each( function( i, elem ) { 897 // get instance 898 var instance = $.data( elem, namespace ); 899 if ( !instance ) { 900 logError( namespace + ' not initialized. Cannot call methods, i.e. ' + 901 pluginMethodStr ); 902 return; 903 } 904 905 var method = instance[ methodName ]; 906 if ( !method || methodName.charAt(0) == '_' ) { 907 logError( pluginMethodStr + ' is not a valid method' ); 908 return; 909 } 910 911 // apply method, get return value 912 var value = method.apply( instance, args ); 913 // set return value if value is returned, use only first value 914 returnValue = returnValue === undefined ? value : returnValue; 915 }); 916 917 return returnValue !== undefined ? returnValue : $elems; 918 } 919 920 function plainCall( $elems, options ) { 921 $elems.each( function( i, elem ) { 922 var instance = $.data( elem, namespace ); 923 if ( instance ) { 924 // set options & init 925 instance.option( options ); 926 instance._init(); 927 } else { 928 // initialize new instance 929 instance = new PluginClass( elem, options ); 930 $.data( elem, namespace, instance ); 931 } 932 }); 933 } 934 935 updateJQuery( $ ); 936 937 } 938
vendor: 19,254 bytes, lines 939-1667
939// ----- updateJQuery ----- // 940 941// set $.bridget for v1 backwards compatibility 942 function updateJQuery( $ ) { 943 if ( !$ || ( $ && $.bridget ) ) { 944 return; 945 } 946 $.bridget = jQueryBridget; 947 } 948 949 updateJQuery( jQuery || window.jQuery ); 950 951// ----- ----- // 952 953 return jQueryBridget; 954 955})); 956 957/** 958 * EvEmitter v1.0.3 959 * Lil' event emitter 960 * MIT License 961 */ 962 963/* jshint unused: true, undef: true, strict: true */ 964 965( function( global, factory ) { 966 // universal module definition 967 /* jshint strict: false */ /* globals define, module, window */ 968 if ( typeof define == 'function' && define.amd ) { 969 // AMD - RequireJS 970 define( 'ev-emitter/ev-emitter',factory ); 971 } else if ( typeof module == 'object' && module.exports ) { 972 // CommonJS - Browserify, Webpack 973 module.exports = factory(); 974 } else { 975 // Browser globals 976 global.EvEmitter = factory(); 977 } 978 979}( typeof window != 'undefined' ? window : this, function() { 980 981 982 983 function EvEmitter() {} 984 985 var proto = EvEmitter.prototype; 986 987 proto.on = function( eventName, listener ) { 988 if ( !eventName || !listener ) { 989 return; 990 } 991 // set events hash 992 var events = this._events = this._events || {}; 993 // set listeners array 994 var listeners = events[ eventName ] = events[ eventName ] || []; 995 // only add once 996 if ( listeners.indexOf( listener ) == -1 ) { 997 listeners.push( listener ); 998 } 999 1000 return this; 1001 }; 1002 1003 proto.once = function( eventName, listener ) { 1004 if ( !eventName || !listener ) { 1005 return; 1006 } 1007 // add event 1008 this.on( eventName, listener ); 1009 // set once flag 1010 // set onceEvents hash 1011 var onceEvents = this._onceEvents = this._onceEvents || {}; 1012 // set onceListeners object 1013 var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; 1014 // set flag 1015 onceListeners[ listener ] = true; 1016 1017 return this; 1018 }; 1019 1020 proto.off = function( eventName, listener ) { 1021 var listeners = this._events && this._events[ eventName ]; 1022 if ( !listeners || !listeners.length ) { 1023 return; 1024 } 1025 var index = listeners.indexOf( listener ); 1026 if ( index != -1 ) { 1027 listeners.splice( index, 1 ); 1028 } 1029 1030 return this; 1031 }; 1032 1033 proto.emitEvent = function( eventName, args ) { 1034 var listeners = this._events && this._events[ eventName ]; 1035 if ( !listeners || !listeners.length ) { 1036 return; 1037 } 1038 var i = 0; 1039 var listener = listeners[i]; 1040 args = args || []; 1041 // once stuff 1042 var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; 1043 1044 while ( listener ) { 1045 var isOnce = onceListeners && onceListeners[ listener ]; 1046 if ( isOnce ) { 1047 // remove listener 1048 // remove before trigger to prevent recursion 1049 this.off( eventName, listener ); 1050 // unset once flag 1051 delete onceListeners[ listener ]; 1052 } 1053 // trigger listener 1054 listener.apply( this, args ); 1055 // get next listener 1056 i += isOnce ? 0 : 1; 1057 listener = listeners[i]; 1058 } 1059 1060 return this; 1061 }; 1062 1063 return EvEmitter; 1064 1065})); 1066 1067/*! 1068 * getSize v2.0.2 1069 * measure size of elements 1070 * MIT license 1071 */ 1072 1073/*jshint browser: true, strict: true, undef: true, unused: true */ 1074/*global define: false, module: false, console: false */ 1075 1076( function( window, factory ) { 1077 'use strict'; 1078 1079 if ( typeof define == 'function' && define.amd ) { 1080 // AMD 1081 define( 'get-size/get-size',[],function() { 1082 return factory(); 1083 }); 1084 } else if ( typeof module == 'object' && module.exports ) { 1085 // CommonJS 1086 module.exports = factory(); 1087 } else { 1088 // browser global 1089 window.getSize = factory(); 1090 } 1091 1092})( window, function factory() { 1093 'use strict'; 1094 1095// -------------------------- helpers -------------------------- // 1096 1097// get a number from a string, not a percentage 1098 function getStyleSize( value ) { 1099 var num = parseFloat( value ); 1100 // not a percent like '100%', and a number 1101 var isValid = value.indexOf('%') == -1 && !isNaN( num ); 1102 return isValid && num; 1103 } 1104 1105 function noop() {} 1106 1107 var logError = typeof console == 'undefined' ? noop : 1108 function( message ) { 1109 console.error( message ); 1110 }; 1111 1112// -------------------------- measurements -------------------------- // 1113 1114 var measurements = [ 1115 'paddingLeft', 1116 'paddingRight', 1117 'paddingTop', 1118 'paddingBottom', 1119 'marginLeft', 1120 'marginRight', 1121 'marginTop', 1122 'marginBottom', 1123 'borderLeftWidth', 1124 'borderRightWidth', 1125 'borderTopWidth', 1126 'borderBottomWidth' 1127 ]; 1128 1129 var measurementsLength = measurements.length; 1130 1131 function getZeroSize() { 1132 var size = { 1133 width: 0, 1134 height: 0, 1135 innerWidth: 0, 1136 innerHeight: 0, 1137 outerWidth: 0, 1138 outerHeight: 0 1139 }; 1140 for ( var i=0; i < measurementsLength; i++ ) { 1141 var measurement = measurements[i]; 1142 size[ measurement ] = 0; 1143 } 1144 return size; 1145 } 1146 1147// -------------------------- getStyle -------------------------- // 1148 1149 /** 1150 * getStyle, get style of element, check for Firefox bug 1151 * https://bugzilla.mozilla.org/show_bug.cgi?id=548397 1152 */ 1153 function getStyle( elem ) { 1154 var style = getComputedStyle( elem ); 1155 if ( !style ) { 1156 logError( 'Style returned ' + style + 1157 '. Are you running this code in a hidden iframe on Firefox? ' + 1158 'See http://bit.ly/getsizebug1' ); 1159 } 1160 return style; 1161 } 1162 1163// -------------------------- setup -------------------------- // 1164 1165 var isSetup = false; 1166 1167 var isBoxSizeOuter; 1168 1169 /** 1170 * setup 1171 * check isBoxSizerOuter 1172 * do on first getSize() rather than on page load for Firefox bug 1173 */ 1174 function setup() { 1175 // setup once 1176 if ( isSetup ) { 1177 return; 1178 } 1179 isSetup = true; 1180 1181 // -------------------------- box sizing -------------------------- // 1182 1183 /** 1184 * WebKit measures the outer-width on style.width on border-box elems 1185 * IE & Firefox<29 measures the inner-width 1186 */ 1187 var div = document.createElement('div'); 1188 div.style.width = '200px'; 1189 div.style.padding = '1px 2px 3px 4px'; 1190 div.style.borderStyle = 'solid'; 1191 div.style.borderWidth = '1px 2px 3px 4px'; 1192 div.style.boxSizing = 'border-box'; 1193 1194 var body = document.body || document.documentElement; 1195 body.appendChild( div ); 1196 var style = getStyle( div ); 1197 1198 getSize.isBoxSizeOuter = isBoxSizeOuter = getStyleSize( style.width ) == 200; 1199 body.removeChild( div ); 1200 1201 } 1202 1203// -------------------------- getSize -------------------------- // 1204 1205 function getSize( elem ) { 1206 setup(); 1207 1208 // use querySeletor if elem is string 1209 if ( typeof elem == 'string' ) { 1210 elem = document.querySelector( elem ); 1211 } 1212 1213 // do not proceed on non-objects 1214 if ( !elem || typeof elem != 'object' || !elem.nodeType ) { 1215 return; 1216 } 1217 1218 var style = getStyle( elem ); 1219 1220 // if hidden, everything is 0 1221 if ( style.display == 'none' ) { 1222 return getZeroSize(); 1223 } 1224 1225 var size = {}; 1226 size.width = elem.offsetWidth; 1227 size.height = elem.offsetHeight; 1228 1229 var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box'; 1230 1231 // get all measurements 1232 for ( var i=0; i < measurementsLength; i++ ) { 1233 var measurement = measurements[i]; 1234 var value = style[ measurement ]; 1235 var num = parseFloat( value ); 1236 // any 'auto', 'medium' value will be 0 1237 size[ measurement ] = !isNaN( num ) ? num : 0; 1238 } 1239 1240 var paddingWidth = size.paddingLeft + size.paddingRight; 1241 var paddingHeight = size.paddingTop + size.paddingBottom; 1242 var marginWidth = size.marginLeft + size.marginRight; 1243 var marginHeight = size.marginTop + size.marginBottom; 1244 var borderWidth = size.borderLeftWidth + size.borderRightWidth; 1245 var borderHeight = size.borderTopWidth + size.borderBottomWidth; 1246 1247 var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter; 1248 1249 // overwrite width and height if we can get it from style 1250 var styleWidth = getStyleSize( style.width ); 1251 if ( styleWidth !== false ) { 1252 size.width = styleWidth + 1253 // add padding and border unless it's already including it 1254 ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth ); 1255 } 1256 1257 var styleHeight = getStyleSize( style.height ); 1258 if ( styleHeight !== false ) { 1259 size.height = styleHeight + 1260 // add padding and border unless it's already including it 1261 ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight ); 1262 } 1263 1264 size.innerWidth = size.width - ( paddingWidth + borderWidth ); 1265 size.innerHeight = size.height - ( paddingHeight + borderHeight ); 1266 1267 size.outerWidth = size.width + marginWidth; 1268 size.outerHeight = size.height + marginHeight; 1269 1270 return size; 1271 } 1272 1273 return getSize; 1274 1275}); 1276 1277/** 1278 * matchesSelector v2.0.1 1279 * matchesSelector( element, '.selector' ) 1280 * MIT license 1281 */ 1282 1283/*jshint browser: true, strict: true, undef: true, unused: true */ 1284 1285( function( window, factory ) { 1286 /*global define: false, module: false */ 1287 'use strict'; 1288 // universal module definition 1289 if ( typeof define == 'function' && define.amd ) { 1290 // AMD 1291 define( 'desandro-matches-selector/matches-selector',factory ); 1292 } else if ( typeof module == 'object' && module.exports ) { 1293 // CommonJS 1294 module.exports = factory(); 1295 } else { 1296 // browser global 1297 window.matchesSelector = factory(); 1298 } 1299 1300}( window, function factory() { 1301 'use strict'; 1302 1303 var matchesMethod = ( function() { 1304 var ElemProto = Element.prototype; 1305 // check for the standard method name first 1306 if ( ElemProto.matches ) { 1307 return 'matches'; 1308 } 1309 // check un-prefixed 1310 if ( ElemProto.matchesSelector ) { 1311 return 'matchesSelector'; 1312 } 1313 // check vendor prefixes 1314 var prefixes = [ 'webkit', 'moz', 'ms', 'o' ]; 1315 1316 for ( var i=0; i < prefixes.length; i++ ) { 1317 var prefix = prefixes[i]; 1318 var method = prefix + 'MatchesSelector'; 1319 if ( ElemProto[ method ] ) { 1320 return method; 1321 } 1322 } 1323 })(); 1324 1325 return function matchesSelector( elem, selector ) { 1326 return elem[ matchesMethod ]( selector ); 1327 }; 1328 1329})); 1330 1331/** 1332 * Fizzy UI utils v2.0.2 1333 * MIT license 1334 */ 1335 1336/*jshint browser: true, undef: true, unused: true, strict: true */ 1337 1338( function( window, factory ) { 1339 // universal module definition 1340 /*jshint strict: false */ /*globals define, module, require */ 1341 1342 if ( typeof define == 'function' && define.amd ) { 1343 // AMD 1344 define( 'fizzy-ui-utils/utils',[ 1345 'desandro-matches-selector/matches-selector' 1346 ], function( matchesSelector ) { 1347 return factory( window, matchesSelector ); 1348 }); 1349 } else if ( typeof module == 'object' && module.exports ) { 1350 // CommonJS 1351 module.exports = factory( 1352 window, 1353 require('desandro-matches-selector') 1354 ); 1355 } else { 1356 // browser global 1357 window.fizzyUIUtils = factory( 1358 window, 1359 window.matchesSelector 1360 ); 1361 } 1362 1363}( window, function factory( window, matchesSelector ) { 1364 1365 1366 1367 var utils = {}; 1368 1369// ----- extend ----- // 1370 1371// extends objects 1372 utils.extend = function( a, b ) { 1373 for ( var prop in b ) { 1374 a[ prop ] = b[ prop ]; 1375 } 1376 return a; 1377 }; 1378 1379// ----- modulo ----- // 1380 1381 utils.modulo = function( num, div ) { 1382 return ( ( num % div ) + div ) % div; 1383 }; 1384 1385// ----- makeArray ----- // 1386 1387// turn element or nodeList into an array 1388 utils.makeArray = function( obj ) { 1389 var ary = []; 1390 if ( Array.isArray( obj ) ) { 1391 // use object if already an array 1392 ary = obj; 1393 } else if ( obj && typeof obj.length == 'number' ) { 1394 // convert nodeList to array 1395 for ( var i=0; i < obj.length; i++ ) { 1396 ary.push( obj[i] ); 1397 } 1398 } else { 1399 // array of single index 1400 ary.push( obj ); 1401 } 1402 return ary; 1403 }; 1404 1405// ----- removeFrom ----- // 1406 1407 utils.removeFrom = function( ary, obj ) { 1408 var index = ary.indexOf( obj ); 1409 if ( index != -1 ) { 1410 ary.splice( index, 1 ); 1411 } 1412 }; 1413 1414// ----- getParent ----- // 1415 1416 utils.getParent = function( elem, selector ) { 1417 while ( elem != document.body ) { 1418 elem = elem.parentNode; 1419 if ( matchesSelector( elem, selector ) ) { 1420 return elem; 1421 } 1422 } 1423 }; 1424 1425// ----- getQueryElement ----- // 1426 1427// use element as selector string 1428 utils.getQueryElement = function( elem ) { 1429 if ( typeof elem == 'string' ) { 1430 return document.querySelector( elem ); 1431 } 1432 return elem; 1433 }; 1434 1435// ----- handleEvent ----- // 1436 1437// enable .ontype to trigger from .addEventListener( elem, 'type' ) 1438 utils.handleEvent = function( event ) { 1439 var method = 'on' + event.type; 1440 if ( this[ method ] ) { 1441 this[ method ]( event ); 1442 } 1443 }; 1444 1445// ----- filterFindElements ----- // 1446 1447 utils.filterFindElements = function( elems, selector ) { 1448 // make array of elems 1449 elems = utils.makeArray( elems ); 1450 var ffElems = []; 1451 1452 elems.forEach( function( elem ) { 1453 // check that elem is an actual element 1454 if ( !( elem instanceof HTMLElement ) ) { 1455 return; 1456 } 1457 // add elem if no selector 1458 if ( !selector ) { 1459 ffElems.push( elem ); 1460 return; 1461 } 1462 // filter & find items if we have a selector 1463 // filter 1464 if ( matchesSelector( elem, selector ) ) { 1465 ffElems.push( elem ); 1466 } 1467 // find children 1468 var childElems = elem.querySelectorAll( selector ); 1469 // concat childElems to filterFound array 1470 for ( var i=0; i < childElems.length; i++ ) { 1471 ffElems.push( childElems[i] ); 1472 } 1473 }); 1474 1475 return ffElems; 1476 }; 1477 1478// ----- debounceMethod ----- // 1479 1480 utils.debounceMethod = function( _class, methodName, threshold ) { 1481 // original method 1482 var method = _class.prototype[ methodName ]; 1483 var timeoutName = methodName + 'Timeout'; 1484 1485 _class.prototype[ methodName ] = function() { 1486 var timeout = this[ timeoutName ]; 1487 if ( timeout ) { 1488 clearTimeout( timeout ); 1489 } 1490 var args = arguments; 1491 1492 var _this = this; 1493 this[ timeoutName ] = setTimeout( function() { 1494 method.apply( _this, args ); 1495 delete _this[ timeoutName ]; 1496 }, threshold || 100 ); 1497 }; 1498 }; 1499 1500// ----- docReady ----- // 1501 1502 utils.docReady = function( callback ) { 1503 var readyState = document.readyState; 1504 if ( readyState == 'complete' || readyState == 'interactive' ) { 1505 callback(); 1506 } else { 1507 document.addEventListener( 'DOMContentLoaded', callback ); 1508 } 1509 }; 1510 1511// ----- htmlInit ----- // 1512 1513// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/ 1514 utils.toDashed = function( str ) { 1515 return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) { 1516 return $1 + '-' + $2; 1517 }).toLowerCase(); 1518 }; 1519 1520 var console = window.console; 1521 /** 1522 * allow user to initialize classes via [data-namespace] or .js-namespace class 1523 * htmlInit( Widget, 'widgetName' ) 1524 * options are parsed from data-namespace-options 1525 */ 1526 utils.htmlInit = function( WidgetClass, namespace ) { 1527 utils.docReady( function() { 1528 var dashedNamespace = utils.toDashed( namespace ); 1529 var dataAttr = 'data-' + dashedNamespace; 1530 var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' ); 1531 var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace ); 1532 var elems = utils.makeArray( dataAttrElems ) 1533 .concat( utils.makeArray( jsDashElems ) ); 1534 var dataOptionsAttr = dataAttr + '-options'; 1535 var jQuery = window.jQuery; 1536 1537 elems.forEach( function( elem ) { 1538 var attr = elem.getAttribute( dataAttr ) || 1539 elem.getAttribute( dataOptionsAttr ); 1540 var options; 1541 try { 1542 options = attr && JSON.parse( attr ); 1543 } catch ( error ) { 1544 // log error, do not initialize 1545 if ( console ) { 1546 console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className + 1547 ': ' + error ); 1548 } 1549 return; 1550 } 1551 // initialize 1552 var instance = new WidgetClass( elem, options ); 1553 // make available via $().data('layoutname') 1554 if ( jQuery ) { 1555 jQuery.data( elem, namespace, instance ); 1556 } 1557 }); 1558 1559 }); 1560 }; 1561 1562// ----- ----- // 1563 1564 return utils; 1565 1566})); 1567 1568/** 1569 * Outlayer Item 1570 */ 1571 1572( function( window, factory ) { 1573 // universal module definition 1574 /* jshint strict: false */ /* globals define, module, require */ 1575 if ( typeof define == 'function' && define.amd ) { 1576 // AMD - RequireJS 1577 define( 'outlayer/item',[ 1578 'ev-emitter/ev-emitter', 1579 'get-size/get-size' 1580 ], 1581 factory 1582 ); 1583 } else if ( typeof module == 'object' && module.exports ) { 1584 // CommonJS - Browserify, Webpack 1585 module.exports = factory( 1586 require('ev-emitter'), 1587 require('get-size') 1588 ); 1589 } else { 1590 // browser global 1591 window.Outlayer = {}; 1592 window.Outlayer.Item = factory( 1593 window.EvEmitter, 1594 window.getSize 1595 ); 1596 } 1597 1598}( window, function factory( EvEmitter, getSize ) { 1599 'use strict'; 1600 1601// ----- helpers ----- // 1602 1603 function isEmptyObj( obj ) { 1604 for ( var prop in obj ) { 1605 return false; 1606 } 1607 prop = null; 1608 return true; 1609 } 1610 1611// -------------------------- CSS3 support -------------------------- // 1612 1613 1614 var docElemStyle = document.documentElement.style; 1615 1616 var transitionProperty = typeof docElemStyle.transition == 'string' ? 1617 'transition' : 'WebkitTransition'; 1618 var transformProperty = typeof docElemStyle.transform == 'string' ? 1619 'transform' : 'WebkitTransform'; 1620 1621 var transitionEndEvent = { 1622 WebkitTransition: 'webkitTransitionEnd', 1623 transition: 'transitionend' 1624 }[ transitionProperty ]; 1625 1626// cache all vendor properties that could have vendor prefix 1627 var vendorProperties = { 1628 transform: transformProperty, 1629 transition: transitionProperty, 1630 transitionDuration: transitionProperty + 'Duration', 1631 transitionProperty: transitionProperty + 'Property', 1632 transitionDelay: transitionProperty + 'Delay' 1633 }; 1634 1635// -------------------------- Item -------------------------- // 1636 1637 function Item( element, layout ) { 1638 if ( !element ) { 1639 return; 1640 } 1641 1642 this.element = element; 1643 // parent layout class, i.e. Masonry, Isotope, or Packery 1644 this.layout = layout; 1645 this.position = { 1646 x: 0, 1647 y: 0 1648 }; 1649 1650 this._create(); 1651 } 1652 1653// inherit EvEmitter 1654 var proto = Item.prototype = Object.create( EvEmitter.prototype ); 1655 proto.constructor = Item; 1656 1657 proto._create = function() { 1658 // transition objects 1659 this._transn = { 1660 ingProperties: {}, 1661 clean: {}, 1662 onEnd: {} 1663 }; 1664 1665 this.css({ 1666 position: 'absolute' 1667 });
1668 }; 1669 1670// trigger specified handler for event type 1671 proto.handleEvent = function( event ) { 1672 var method = 'on' + event.type; 1673 if ( this[ method ] ) { 1674 this[ method ]( event ); 1675 } 1676 }; 1677 1678 proto.getSize = function() { 1679 this.size = getSize( this.element ); 1680 }; 1681 1682 /** 1683 * apply CSS styles to element 1684 * @param {Object} style 1685 */ 1686 proto.css = function( style ) { 1687 var elemStyle = this.element.style; 1688 1689 for ( var prop in style ) { 1690 // use vendor property if available 1691 var supportedProp = vendorProperties[ prop ] || prop; 1692 elemStyle[ supportedProp ] = style[ prop ]; 1693 } 1694 }; 1695 1696 // measure position, and sets it 1697 proto.getPosition = function() { 1698 var style = getComputedStyle( this.element ); 1699 var isOriginLeft = this.layout._getOption('originLeft'); 1700 var isOriginTop = this.layout._getOption('originTop'); 1701 var xValue = style[ isOriginLeft ? 'left' : 'right' ]; 1702 var yValue = style[ isOriginTop ? 'top' : 'bottom' ]; 1703 // convert percent to pixels 1704 var layoutSize = this.layout.size; 1705 var x = xValue.indexOf('%') != -1 ? 1706 ( parseFloat( xValue ) / 100 ) * layoutSize.width : parseInt( xValue, 10 ); 1707 var y = yValue.indexOf('%') != -1 ? 1708 ( parseFloat( yValue ) / 100 ) * layoutSize.height : parseInt( yValue, 10 ); 1709 1710 // clean up 'auto' or other non-integer values 1711 x = isNaN( x ) ? 0 : x; 1712 y = isNaN( y ) ? 0 : y; 1713 // remove padding from measurement 1714 x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight; 1715 y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom; 1716 1717 this.position.x = x; 1718 this.position.y = y; 1719 }; 1720 1721// set settled position, apply padding 1722 proto.layoutPosition = function() { 1723 var layoutSize = this.layout.size; 1724 var style = {}; 1725 var isOriginLeft = this.layout._getOption('originLeft'); 1726 var isOriginTop = this.layout._getOption('originTop'); 1727 1728 // x 1729 var xPadding = isOriginLeft ? 'paddingLeft' : 'paddingRight'; 1730 var xProperty = isOriginLeft ? 'left' : 'right'; 1731 var xResetProperty = isOriginLeft ? 'right' : 'left'; 1732 1733 var x = this.position.x + layoutSize[ xPadding ]; 1734 // set in percentage or pixels 1735 style[ xProperty ] = this.getXValue( x ); 1736 // reset other property 1737 style[ xResetProperty ] = ''; 1738 1739 // y 1740 var yPadding = isOriginTop ? 'paddingTop' : 'paddingBottom'; 1741 var yProperty = isOriginTop ? 'top' : 'bottom'; 1742 var yResetProperty = isOriginTop ? 'bottom' : 'top'; 1743 1744 var y = this.position.y + layoutSize[ yPadding ]; 1745 // set in percentage or pixels 1746 style[ yProperty ] = this.getYValue( y ); 1747 // reset other property 1748 style[ yResetProperty ] = ''; 1749 1750 this.css( style ); 1751 this.emitEvent( 'layout', [ this ] ); 1752 }; 1753 1754 proto.getXValue = function( x ) { 1755 var isHorizontal = this.layout._getOption('horizontal'); 1756 return this.layout.options.percentPosition && !isHorizontal ? 1757 ( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px'; 1758 }; 1759 1760 proto.getYValue = function( y ) { 1761 var isHorizontal = this.layout._getOption('horizontal'); 1762 return this.layout.options.percentPosition && isHorizontal ? 1763 ( ( y / this.layout.size.height ) * 100 ) + '%' : y + 'px'; 1764 }; 1765 1766 proto._transitionTo = function( x, y ) { 1767 this.getPosition(); 1768 // get current x & y from top/left 1769 var curX = this.position.x; 1770 var curY = this.position.y; 1771 1772 var compareX = parseInt( x, 10 ); 1773 var compareY = parseInt( y, 10 ); 1774 var didNotMove = compareX === this.position.x && compareY === this.position.y; 1775 1776 // save end position 1777 this.setPosition( x, y ); 1778 1779 // if did not move and not transitioning, just go to layout 1780 if ( didNotMove && !this.isTransitioning ) { 1781 this.layoutPosition(); 1782 return; 1783 } 1784 1785 var transX = x - curX; 1786 var transY = y - curY; 1787 var transitionStyle = {}; 1788 transitionStyle.transform = this.getTranslate( transX, transY ); 1789 1790 this.transition({ 1791 to: transitionStyle, 1792 onTransitionEnd: { 1793 transform: this.layoutPosition 1794 }, 1795 isCleaning: true 1796 });
vendor: 10,849 bytes, lines 1797-2176
1797 }; 1798 1799 proto.getTranslate = function( x, y ) { 1800 // flip cooridinates if origin on right or bottom 1801 var isOriginLeft = this.layout._getOption('originLeft'); 1802 var isOriginTop = this.layout._getOption('originTop'); 1803 x = isOriginLeft ? x : -x; 1804 y = isOriginTop ? y : -y; 1805 return 'translate3d(' + x + 'px, ' + y + 'px, 0)'; 1806 }; 1807 1808// non transition + transform support 1809 proto.goTo = function( x, y ) { 1810 this.setPosition( x, y ); 1811 this.layoutPosition(); 1812 }; 1813 1814 proto.moveTo = proto._transitionTo; 1815 1816 proto.setPosition = function( x, y ) { 1817 this.position.x = parseInt( x, 10 ); 1818 this.position.y = parseInt( y, 10 ); 1819 }; 1820 1821// ----- transition ----- // 1822 1823 /** 1824 * @param {Object} style - CSS 1825 * @param {Function} onTransitionEnd 1826 */ 1827 1828// non transition, just trigger callback 1829 proto._nonTransition = function( args ) { 1830 this.css( args.to ); 1831 if ( args.isCleaning ) { 1832 this._removeStyles( args.to ); 1833 } 1834 for ( var prop in args.onTransitionEnd ) { 1835 args.onTransitionEnd[ prop ].call( this ); 1836 } 1837 }; 1838 1839 /** 1840 * proper transition 1841 * @param {Object} args - arguments 1842 * @param {Object} to - style to transition to 1843 * @param {Object} from - style to start transition from 1844 * @param {Boolean} isCleaning - removes transition styles after transition 1845 * @param {Function} onTransitionEnd - callback 1846 */ 1847 proto.transition = function( args ) { 1848 // redirect to nonTransition if no transition duration 1849 if ( !parseFloat( this.layout.options.transitionDuration ) ) { 1850 this._nonTransition( args ); 1851 return; 1852 } 1853 1854 var _transition = this._transn; 1855 // keep track of onTransitionEnd callback by css property 1856 for ( var prop in args.onTransitionEnd ) { 1857 _transition.onEnd[ prop ] = args.onTransitionEnd[ prop ]; 1858 } 1859 // keep track of properties that are transitioning 1860 for ( prop in args.to ) { 1861 _transition.ingProperties[ prop ] = true; 1862 // keep track of properties to clean up when transition is done 1863 if ( args.isCleaning ) { 1864 _transition.clean[ prop ] = true; 1865 } 1866 } 1867 1868 // set from styles 1869 if ( args.from ) { 1870 this.css( args.from ); 1871 // force redraw. http://blog.alexmaccaw.com/css-transitions 1872 var h = this.element.offsetHeight; 1873 // hack for JSHint to hush about unused var 1874 h = null; 1875 } 1876 // enable transition 1877 this.enableTransition( args.to ); 1878 // set styles that are transitioning 1879 this.css( args.to ); 1880 1881 this.isTransitioning = true; 1882 1883 }; 1884 1885// dash before all cap letters, including first for 1886// WebkitTransform => -webkit-transform 1887 function toDashedAll( str ) { 1888 return str.replace( /([A-Z])/g, function( $1 ) { 1889 return '-' + $1.toLowerCase(); 1890 }); 1891 } 1892 1893 var transitionProps = 'opacity,' + toDashedAll( transformProperty ); 1894 1895 proto.enableTransition = function(/* style */) { 1896 // HACK changing transitionProperty during a transition 1897 // will cause transition to jump 1898 if ( this.isTransitioning ) { 1899 return; 1900 } 1901 1902 // make `transition: foo, bar, baz` from style object 1903 // HACK un-comment this when enableTransition can work 1904 // while a transition is happening 1905 // var transitionValues = []; 1906 // for ( var prop in style ) { 1907 // // dash-ify camelCased properties like WebkitTransition 1908 // prop = vendorProperties[ prop ] || prop; 1909 // transitionValues.push( toDashedAll( prop ) ); 1910 // } 1911 // munge number to millisecond, to match stagger 1912 var duration = this.layout.options.transitionDuration; 1913 duration = typeof duration == 'number' ? duration + 'ms' : duration; 1914 // enable transition styles 1915 this.css({ 1916 transitionProperty: transitionProps, 1917 transitionDuration: duration, 1918 transitionDelay: this.staggerDelay || 0 1919 }); 1920 // listen for transition end event 1921 this.element.addEventListener( transitionEndEvent, this, false ); 1922 }; 1923 1924// ----- events ----- // 1925 1926 proto.onwebkitTransitionEnd = function( event ) { 1927 this.ontransitionend( event ); 1928 }; 1929 1930 proto.onotransitionend = function( event ) { 1931 this.ontransitionend( event ); 1932 }; 1933 1934// properties that I munge to make my life easier 1935 var dashedVendorProperties = { 1936 '-webkit-transform': 'transform' 1937 }; 1938 1939 proto.ontransitionend = function( event ) { 1940 // disregard bubbled events from children 1941 if ( event.target !== this.element ) { 1942 return; 1943 } 1944 var _transition = this._transn; 1945 // get property name of transitioned property, convert to prefix-free 1946 var propertyName = dashedVendorProperties[ event.propertyName ] || event.propertyName; 1947 1948 // remove property that has completed transitioning 1949 delete _transition.ingProperties[ propertyName ]; 1950 // check if any properties are still transitioning 1951 if ( isEmptyObj( _transition.ingProperties ) ) { 1952 // all properties have completed transitioning 1953 this.disableTransition(); 1954 } 1955 // clean style 1956 if ( propertyName in _transition.clean ) { 1957 // clean up style 1958 this.element.style[ event.propertyName ] = ''; 1959 delete _transition.clean[ propertyName ]; 1960 } 1961 // trigger onTransitionEnd callback 1962 if ( propertyName in _transition.onEnd ) { 1963 var onTransitionEnd = _transition.onEnd[ propertyName ]; 1964 onTransitionEnd.call( this ); 1965 delete _transition.onEnd[ propertyName ]; 1966 } 1967 1968 this.emitEvent( 'transitionEnd', [ this ] ); 1969 }; 1970 1971 proto.disableTransition = function() { 1972 this.removeTransitionStyles(); 1973 this.element.removeEventListener( transitionEndEvent, this, false ); 1974 this.isTransitioning = false; 1975 }; 1976 1977 /** 1978 * removes style property from element 1979 * @param {Object} style 1980 **/ 1981 proto._removeStyles = function( style ) { 1982 // clean up transition styles 1983 var cleanStyle = {}; 1984 for ( var prop in style ) { 1985 cleanStyle[ prop ] = ''; 1986 } 1987 this.css( cleanStyle ); 1988 }; 1989 1990 var cleanTransitionStyle = { 1991 transitionProperty: '', 1992 transitionDuration: '', 1993 transitionDelay: '' 1994 }; 1995 1996 proto.removeTransitionStyles = function() { 1997 // remove transition 1998 this.css( cleanTransitionStyle ); 1999 }; 2000 2001// ----- stagger ----- // 2002 2003 proto.stagger = function( delay ) { 2004 delay = isNaN( delay ) ? 0 : delay; 2005 this.staggerDelay = delay + 'ms'; 2006 }; 2007 2008// ----- show/hide/remove ----- // 2009 2010// remove element from DOM 2011 proto.removeElem = function() { 2012 this.element.parentNode.removeChild( this.element ); 2013 // remove display: none 2014 this.css({ display: '' }); 2015 this.emitEvent( 'remove', [ this ] ); 2016 }; 2017 2018 proto.remove = function() { 2019 // just remove element if no transition support or no transition 2020 if ( !transitionProperty || !parseFloat( this.layout.options.transitionDuration ) ) { 2021 this.removeElem(); 2022 return; 2023 } 2024 2025 // start transition 2026 this.once( 'transitionEnd', function() { 2027 this.removeElem(); 2028 }); 2029 this.hide(); 2030 }; 2031 2032 proto.reveal = function() { 2033 delete this.isHidden; 2034 // remove display: none 2035 this.css({ display: '' }); 2036 2037 var options = this.layout.options; 2038 2039 var onTransitionEnd = {}; 2040 var transitionEndProperty = this.getHideRevealTransitionEndProperty('visibleStyle'); 2041 onTransitionEnd[ transitionEndProperty ] = this.onRevealTransitionEnd; 2042 2043 this.transition({ 2044 from: options.hiddenStyle, 2045 to: options.visibleStyle, 2046 isCleaning: true, 2047 onTransitionEnd: onTransitionEnd 2048 }); 2049 }; 2050 2051 proto.onRevealTransitionEnd = function() { 2052 // check if still visible 2053 // during transition, item may have been hidden 2054 if ( !this.isHidden ) { 2055 this.emitEvent('reveal'); 2056 } 2057 }; 2058 2059 /** 2060 * get style property use for hide/reveal transition end 2061 * @param {String} styleProperty - hiddenStyle/visibleStyle 2062 * @returns {String} 2063 */ 2064 proto.getHideRevealTransitionEndProperty = function( styleProperty ) { 2065 var optionStyle = this.layout.options[ styleProperty ]; 2066 // use opacity 2067 if ( optionStyle.opacity ) { 2068 return 'opacity'; 2069 } 2070 // get first property 2071 for ( var prop in optionStyle ) { 2072 return prop; 2073 } 2074 }; 2075 2076 proto.hide = function() { 2077 // set flag 2078 this.isHidden = true; 2079 // remove display: none 2080 this.css({ display: '' }); 2081 2082 var options = this.layout.options; 2083 2084 var onTransitionEnd = {}; 2085 var transitionEndProperty = this.getHideRevealTransitionEndProperty('hiddenStyle'); 2086 onTransitionEnd[ transitionEndProperty ] = this.onHideTransitionEnd; 2087 2088 this.transition({ 2089 from: options.visibleStyle, 2090 to: options.hiddenStyle, 2091 // keep hidden stuff hidden 2092 isCleaning: true, 2093 onTransitionEnd: onTransitionEnd 2094 }); 2095 }; 2096 2097 proto.onHideTransitionEnd = function() { 2098 // check if still hidden 2099 // during transition, item may have been un-hidden 2100 if ( this.isHidden ) { 2101 this.css({ display: 'none' }); 2102 this.emitEvent('hide'); 2103 } 2104 }; 2105 2106 proto.destroy = function() { 2107 this.css({ 2108 position: '', 2109 left: '', 2110 right: '', 2111 top: '', 2112 bottom: '', 2113 transition: '', 2114 transform: '' 2115 }); 2116 }; 2117 2118 return Item; 2119 2120})); 2121 2122/*! 2123 * Outlayer v2.1.0 2124 * the brains and guts of a layout library 2125 * MIT license 2126 */ 2127 2128( function( window, factory ) { 2129 'use strict'; 2130 // universal module definition 2131 /* jshint strict: false */ /* globals define, module, require */ 2132 if ( typeof define == 'function' && define.amd ) { 2133 // AMD - RequireJS 2134 define( 'outlayer/outlayer',[ 2135 'ev-emitter/ev-emitter', 2136 'get-size/get-size', 2137 'fizzy-ui-utils/utils', 2138 './item' 2139 ], 2140 function( EvEmitter, getSize, utils, Item ) { 2141 return factory( window, EvEmitter, getSize, utils, Item); 2142 } 2143 ); 2144 } else if ( typeof module == 'object' && module.exports ) { 2145 // CommonJS - Browserify, Webpack 2146 module.exports = factory( 2147 window, 2148 require('ev-emitter'), 2149 require('get-size'), 2150 require('fizzy-ui-utils'), 2151 require('./item') 2152 ); 2153 } else { 2154 // browser global 2155 window.Outlayer = factory( 2156 window, 2157 window.EvEmitter, 2158 window.getSize, 2159 window.fizzyUIUtils, 2160 window.Outlayer.Item 2161 ); 2162 } 2163 2164}( window, function factory( window, EvEmitter, getSize, utils, Item ) { 2165 'use strict'; 2166 2167// ----- vars ----- // 2168 2169 var console = window.console; 2170 var jQuery = window.jQuery; 2171 var noop = function() {}; 2172 2173// -------------------------- Outlayer -------------------------- // 2174 2175// globally unique identifiers 2176 var GUID = 0;
vendor: 19,588 bytes, lines 2177-2921
2177// internal store of all Outlayer intances 2178 var instances = {}; 2179 2180 2181 /** 2182 * @param {Element, String} element 2183 * @param {Object} options 2184 * @constructor 2185 */ 2186 function Outlayer( element, options ) { 2187 var queryElement = utils.getQueryElement( element ); 2188 if ( !queryElement ) { 2189 if ( console ) { 2190 console.error( 'Bad element for ' + this.constructor.namespace + 2191 ': ' + ( queryElement || element ) ); 2192 } 2193 return; 2194 } 2195 this.element = queryElement; 2196 // add jQuery 2197 if ( jQuery ) { 2198 this.$element = jQuery( this.element ); 2199 } 2200 2201 // options 2202 this.options = utils.extend( {}, this.constructor.defaults ); 2203 this.option( options ); 2204 2205 // add id for Outlayer.getFromElement 2206 var id = ++GUID; 2207 this.element.outlayerGUID = id; // expando 2208 instances[ id ] = this; // associate via id 2209 2210 // kick it off 2211 this._create(); 2212 2213 var isInitLayout = this._getOption('initLayout'); 2214 if ( isInitLayout ) { 2215 this.layout(); 2216 } 2217 } 2218 2219// settings are for internal use only 2220 Outlayer.namespace = 'outlayer'; 2221 Outlayer.Item = Item; 2222 2223// default options 2224 Outlayer.defaults = { 2225 containerStyle: { 2226 position: 'relative' 2227 }, 2228 initLayout: true, 2229 originLeft: true, 2230 originTop: true, 2231 resize: true, 2232 resizeContainer: true, 2233 // item options 2234 transitionDuration: '0.4s', 2235 hiddenStyle: { 2236 opacity: 0, 2237 transform: 'scale(0.001)' 2238 }, 2239 visibleStyle: { 2240 opacity: 1, 2241 transform: 'scale(1)' 2242 } 2243 }; 2244 2245 var proto = Outlayer.prototype; 2246// inherit EvEmitter 2247 utils.extend( proto, EvEmitter.prototype ); 2248 2249 /** 2250 * set options 2251 * @param {Object} opts 2252 */ 2253 proto.option = function( opts ) { 2254 utils.extend( this.options, opts ); 2255 }; 2256 2257 /** 2258 * get backwards compatible option value, check old name 2259 */ 2260 proto._getOption = function( option ) { 2261 var oldOption = this.constructor.compatOptions[ option ]; 2262 return oldOption && this.options[ oldOption ] !== undefined ? 2263 this.options[ oldOption ] : this.options[ option ]; 2264 }; 2265 2266 Outlayer.compatOptions = { 2267 // currentName: oldName 2268 initLayout: 'isInitLayout', 2269 horizontal: 'isHorizontal', 2270 layoutInstant: 'isLayoutInstant', 2271 originLeft: 'isOriginLeft', 2272 originTop: 'isOriginTop', 2273 resize: 'isResizeBound', 2274 resizeContainer: 'isResizingContainer' 2275 }; 2276 2277 proto._create = function() { 2278 // get items from children 2279 this.reloadItems(); 2280 // elements that affect layout, but are not laid out 2281 this.stamps = []; 2282 this.stamp( this.options.stamp ); 2283 // set container style 2284 utils.extend( this.element.style, this.options.containerStyle ); 2285 2286 // bind resize method 2287 var canBindResize = this._getOption('resize'); 2288 if ( canBindResize ) { 2289 this.bindResize(); 2290 } 2291 }; 2292 2293// goes through all children again and gets bricks in proper order 2294 proto.reloadItems = function() { 2295 // collection of item elements 2296 this.items = this._itemize( this.element.children ); 2297 }; 2298 2299 2300 /** 2301 * turn elements into Outlayer.Items to be used in layout 2302 * @param {Array or NodeList or HTMLElement} elems 2303 * @returns {Array} items - collection of new Outlayer Items 2304 */ 2305 proto._itemize = function( elems ) { 2306 2307 var itemElems = this._filterFindItemElements( elems ); 2308 var Item = this.constructor.Item; 2309 2310 // create new Outlayer Items for collection 2311 var items = []; 2312 for ( var i=0; i < itemElems.length; i++ ) { 2313 var elem = itemElems[i]; 2314 var item = new Item( elem, this ); 2315 items.push( item ); 2316 } 2317 2318 return items; 2319 }; 2320 2321 /** 2322 * get item elements to be used in layout 2323 * @param {Array or NodeList or HTMLElement} elems 2324 * @returns {Array} items - item elements 2325 */ 2326 proto._filterFindItemElements = function( elems ) { 2327 return utils.filterFindElements( elems, this.options.itemSelector ); 2328 }; 2329 2330 /** 2331 * getter method for getting item elements 2332 * @returns {Array} elems - collection of item elements 2333 */ 2334 proto.getItemElements = function() { 2335 return this.items.map( function( item ) { 2336 return item.element; 2337 }); 2338 }; 2339 2340// ----- init & layout ----- // 2341 2342 /** 2343 * lays out all items 2344 */ 2345 proto.layout = function() { 2346 this._resetLayout(); 2347 this._manageStamps(); 2348 2349 // don't animate first layout 2350 var layoutInstant = this._getOption('layoutInstant'); 2351 var isInstant = layoutInstant !== undefined ? 2352 layoutInstant : !this._isLayoutInited; 2353 this.layoutItems( this.items, isInstant ); 2354 2355 // flag for initalized 2356 this._isLayoutInited = true; 2357 }; 2358 2359// _init is alias for layout 2360 proto._init = proto.layout; 2361 2362 /** 2363 * logic before any new layout 2364 */ 2365 proto._resetLayout = function() { 2366 this.getSize(); 2367 }; 2368 2369 2370 proto.getSize = function() { 2371 this.size = getSize( this.element ); 2372 }; 2373 2374 /** 2375 * get measurement from option, for columnWidth, rowHeight, gutter 2376 * if option is String -> get element from selector string, & get size of element 2377 * if option is Element -> get size of element 2378 * else use option as a number 2379 * 2380 * @param {String} measurement 2381 * @param {String} size - width or height 2382 * @private 2383 */ 2384 proto._getMeasurement = function( measurement, size ) { 2385 var option = this.options[ measurement ]; 2386 var elem; 2387 if ( !option ) { 2388 // default to 0 2389 this[ measurement ] = 0; 2390 } else { 2391 // use option as an element 2392 if ( typeof option == 'string' ) { 2393 elem = this.element.querySelector( option ); 2394 } else if ( option instanceof HTMLElement ) { 2395 elem = option; 2396 } 2397 // use size of element, if element 2398 this[ measurement ] = elem ? getSize( elem )[ size ] : option; 2399 } 2400 }; 2401 2402 /** 2403 * layout a collection of item elements 2404 * @api public 2405 */ 2406 proto.layoutItems = function( items, isInstant ) { 2407 items = this._getItemsForLayout( items ); 2408 2409 this._layoutItems( items, isInstant ); 2410 2411 this._postLayout(); 2412 }; 2413 2414 /** 2415 * get the items to be laid out 2416 * you may want to skip over some items 2417 * @param {Array} items 2418 * @returns {Array} items 2419 */ 2420 proto._getItemsForLayout = function( items ) { 2421 return items.filter( function( item ) { 2422 return !item.isIgnored; 2423 }); 2424 }; 2425 2426 /** 2427 * layout items 2428 * @param {Array} items 2429 * @param {Boolean} isInstant 2430 */ 2431 proto._layoutItems = function( items, isInstant ) { 2432 this._emitCompleteOnItems( 'layout', items ); 2433 2434 if ( !items || !items.length ) { 2435 // no items, emit event with empty array 2436 return; 2437 } 2438 2439 var queue = []; 2440 2441 items.forEach( function( item ) { 2442 // get x/y object from method 2443 var position = this._getItemLayoutPosition( item ); 2444 // enqueue 2445 position.item = item; 2446 position.isInstant = isInstant || item.isLayoutInstant; 2447 queue.push( position ); 2448 }, this ); 2449 2450 this._processLayoutQueue( queue ); 2451 }; 2452 2453 /** 2454 * get item layout position 2455 * @param {Outlayer.Item} item 2456 * @returns {Object} x and y position 2457 */ 2458 proto._getItemLayoutPosition = function( /* item */ ) { 2459 return { 2460 x: 0, 2461 y: 0 2462 }; 2463 }; 2464 2465 /** 2466 * iterate over array and position each item 2467 * Reason being - separating this logic prevents 'layout invalidation' 2468 * thx @paul_irish 2469 * @param {Array} queue 2470 */ 2471 proto._processLayoutQueue = function( queue ) { 2472 this.updateStagger(); 2473 queue.forEach( function( obj, i ) { 2474 this._positionItem( obj.item, obj.x, obj.y, obj.isInstant, i ); 2475 }, this ); 2476 }; 2477 2478// set stagger from option in milliseconds number 2479 proto.updateStagger = function() { 2480 var stagger = this.options.stagger; 2481 if ( stagger === null || stagger === undefined ) { 2482 this.stagger = 0; 2483 return; 2484 } 2485 this.stagger = getMilliseconds( stagger ); 2486 return this.stagger; 2487 }; 2488 2489 /** 2490 * Sets position of item in DOM 2491 * @param {Outlayer.Item} item 2492 * @param {Number} x - horizontal position 2493 * @param {Number} y - vertical position 2494 * @param {Boolean} isInstant - disables transitions 2495 */ 2496 proto._positionItem = function( item, x, y, isInstant, i ) { 2497 if ( isInstant ) { 2498 // if not transition, just set CSS 2499 item.goTo( x, y ); 2500 } else { 2501 item.stagger( i * this.stagger ); 2502 item.moveTo( x, y ); 2503 } 2504 }; 2505 2506 /** 2507 * Any logic you want to do after each layout, 2508 * i.e. size the container 2509 */ 2510 proto._postLayout = function() { 2511 this.resizeContainer(); 2512 }; 2513 2514 proto.resizeContainer = function() { 2515 var isResizingContainer = this._getOption('resizeContainer'); 2516 if ( !isResizingContainer ) { 2517 return; 2518 } 2519 var size = this._getContainerSize(); 2520 if ( size ) { 2521 this._setContainerMeasure( size.width, true ); 2522 this._setContainerMeasure( size.height, false ); 2523 } 2524 }; 2525 2526 /** 2527 * Sets width or height of container if returned 2528 * @returns {Object} size 2529 * @param {Number} width 2530 * @param {Number} height 2531 */ 2532 proto._getContainerSize = noop; 2533 2534 /** 2535 * @param {Number} measure - size of width or height 2536 * @param {Boolean} isWidth 2537 */ 2538 proto._setContainerMeasure = function( measure, isWidth ) { 2539 if ( measure === undefined ) { 2540 return; 2541 } 2542 2543 var elemSize = this.size; 2544 // add padding and border width if border box 2545 if ( elemSize.isBorderBox ) { 2546 measure += isWidth ? elemSize.paddingLeft + elemSize.paddingRight + 2547 elemSize.borderLeftWidth + elemSize.borderRightWidth : 2548 elemSize.paddingBottom + elemSize.paddingTop + 2549 elemSize.borderTopWidth + elemSize.borderBottomWidth; 2550 } 2551 2552 measure = Math.max( measure, 0 ); 2553 this.element.style[ isWidth ? 'width' : 'height' ] = measure + 'px'; 2554 }; 2555 2556 /** 2557 * emit eventComplete on a collection of items events 2558 * @param {String} eventName 2559 * @param {Array} items - Outlayer.Items 2560 */ 2561 proto._emitCompleteOnItems = function( eventName, items ) { 2562 var _this = this; 2563 function onComplete() { 2564 _this.dispatchEvent( eventName + 'Complete', null, [ items ] ); 2565 } 2566 2567 var count = items.length; 2568 if ( !items || !count ) { 2569 onComplete(); 2570 return; 2571 } 2572 2573 var doneCount = 0; 2574 function tick() { 2575 doneCount++; 2576 if ( doneCount == count ) { 2577 onComplete(); 2578 } 2579 } 2580 2581 // bind callback 2582 items.forEach( function( item ) { 2583 item.once( eventName, tick ); 2584 }); 2585 }; 2586 2587 /** 2588 * emits events via EvEmitter and jQuery events 2589 * @param {String} type - name of event 2590 * @param {Event} event - original event 2591 * @param {Array} args - extra arguments 2592 */ 2593 proto.dispatchEvent = function( type, event, args ) { 2594 // add original event to arguments 2595 var emitArgs = event ? [ event ].concat( args ) : args; 2596 this.emitEvent( type, emitArgs ); 2597 2598 if ( jQuery ) { 2599 // set this.$element 2600 this.$element = this.$element || jQuery( this.element ); 2601 if ( event ) { 2602 // create jQuery event 2603 var $event = jQuery.Event( event ); 2604 $event.type = type; 2605 this.$element.trigger( $event, args ); 2606 } else { 2607 // just trigger with type if no event available 2608 this.$element.trigger( type, args ); 2609 } 2610 } 2611 }; 2612 2613// -------------------------- ignore & stamps -------------------------- // 2614 2615 2616 /** 2617 * keep item in collection, but do not lay it out 2618 * ignored items do not get skipped in layout 2619 * @param {Element} elem 2620 */ 2621 proto.ignore = function( elem ) { 2622 var item = this.getItem( elem ); 2623 if ( item ) { 2624 item.isIgnored = true; 2625 } 2626 }; 2627 2628 /** 2629 * return item to layout collection 2630 * @param {Element} elem 2631 */ 2632 proto.unignore = function( elem ) { 2633 var item = this.getItem( elem ); 2634 if ( item ) { 2635 delete item.isIgnored; 2636 } 2637 }; 2638 2639 /** 2640 * adds elements to stamps 2641 * @param {NodeList, Array, Element, or String} elems 2642 */ 2643 proto.stamp = function( elems ) { 2644 elems = this._find( elems ); 2645 if ( !elems ) { 2646 return; 2647 } 2648 2649 this.stamps = this.stamps.concat( elems ); 2650 // ignore 2651 elems.forEach( this.ignore, this ); 2652 }; 2653 2654 /** 2655 * removes elements to stamps 2656 * @param {NodeList, Array, or Element} elems 2657 */ 2658 proto.unstamp = function( elems ) { 2659 elems = this._find( elems ); 2660 if ( !elems ){ 2661 return; 2662 } 2663 2664 elems.forEach( function( elem ) { 2665 // filter out removed stamp elements 2666 utils.removeFrom( this.stamps, elem ); 2667 this.unignore( elem ); 2668 }, this ); 2669 }; 2670 2671 /** 2672 * finds child elements 2673 * @param {NodeList, Array, Element, or String} elems 2674 * @returns {Array} elems 2675 */ 2676 proto._find = function( elems ) { 2677 if ( !elems ) { 2678 return; 2679 } 2680 // if string, use argument as selector string 2681 if ( typeof elems == 'string' ) { 2682 elems = this.element.querySelectorAll( elems ); 2683 } 2684 elems = utils.makeArray( elems ); 2685 return elems; 2686 }; 2687 2688 proto._manageStamps = function() { 2689 if ( !this.stamps || !this.stamps.length ) { 2690 return; 2691 } 2692 2693 this._getBoundingRect(); 2694 2695 this.stamps.forEach( this._manageStamp, this ); 2696 }; 2697 2698// update boundingLeft / Top 2699 proto._getBoundingRect = function() { 2700 // get bounding rect for container element 2701 var boundingRect = this.element.getBoundingClientRect(); 2702 var size = this.size; 2703 this._boundingRect = { 2704 left: boundingRect.left + size.paddingLeft + size.borderLeftWidth, 2705 top: boundingRect.top + size.paddingTop + size.borderTopWidth, 2706 right: boundingRect.right - ( size.paddingRight + size.borderRightWidth ), 2707 bottom: boundingRect.bottom - ( size.paddingBottom + size.borderBottomWidth ) 2708 }; 2709 }; 2710 2711 /** 2712 * @param {Element} stamp 2713 **/ 2714 proto._manageStamp = noop; 2715 2716 /** 2717 * get x/y position of element relative to container element 2718 * @param {Element} elem 2719 * @returns {Object} offset - has left, top, right, bottom 2720 */ 2721 proto._getElementOffset = function( elem ) { 2722 var boundingRect = elem.getBoundingClientRect(); 2723 var thisRect = this._boundingRect; 2724 var size = getSize( elem ); 2725 var offset = { 2726 left: boundingRect.left - thisRect.left - size.marginLeft, 2727 top: boundingRect.top - thisRect.top - size.marginTop, 2728 right: thisRect.right - boundingRect.right - size.marginRight, 2729 bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom 2730 }; 2731 return offset; 2732 }; 2733 2734// -------------------------- resize -------------------------- // 2735 2736// enable event handlers for listeners 2737// i.e. resize -> onresize 2738 proto.handleEvent = utils.handleEvent; 2739 2740 /** 2741 * Bind layout to window resizing 2742 */ 2743 proto.bindResize = function() { 2744 window.addEventListener( 'resize', this ); 2745 this.isResizeBound = true; 2746 }; 2747 2748 /** 2749 * Unbind layout to window resizing 2750 */ 2751 proto.unbindResize = function() { 2752 window.removeEventListener( 'resize', this ); 2753 this.isResizeBound = false; 2754 }; 2755 2756 proto.onresize = function() { 2757 this.resize(); 2758 }; 2759 2760 utils.debounceMethod( Outlayer, 'onresize', 100 ); 2761 2762 proto.resize = function() { 2763 // don't trigger if size did not change 2764 // or if resize was unbound. See #9 2765 if ( !this.isResizeBound || !this.needsResizeLayout() ) { 2766 return; 2767 } 2768 2769 this.layout(); 2770 }; 2771 2772 /** 2773 * check if layout is needed post layout 2774 * @returns Boolean 2775 */ 2776 proto.needsResizeLayout = function() { 2777 var size = getSize( this.element ); 2778 // check that this.size and size are there 2779 // IE8 triggers resize on body size change, so they might not be 2780 var hasSizes = this.size && size; 2781 return hasSizes && size.innerWidth !== this.size.innerWidth; 2782 }; 2783 2784// -------------------------- methods -------------------------- // 2785 2786 /** 2787 * add items to Outlayer instance 2788 * @param {Array or NodeList or Element} elems 2789 * @returns {Array} items - Outlayer.Items 2790 **/ 2791 proto.addItems = function( elems ) { 2792 var items = this._itemize( elems ); 2793 // add items to collection 2794 if ( items.length ) { 2795 this.items = this.items.concat( items ); 2796 } 2797 return items; 2798 }; 2799 2800 /** 2801 * Layout newly-appended item elements 2802 * @param {Array or NodeList or Element} elems 2803 */ 2804 proto.appended = function( elems ) { 2805 var items = this.addItems( elems ); 2806 if ( !items.length ) { 2807 return; 2808 } 2809 // layout and reveal just the new items 2810 this.layoutItems( items, true ); 2811 this.reveal( items ); 2812 }; 2813 2814 /** 2815 * Layout prepended elements 2816 * @param {Array or NodeList or Element} elems 2817 */ 2818 proto.prepended = function( elems ) { 2819 var items = this._itemize( elems ); 2820 if ( !items.length ) { 2821 return; 2822 } 2823 // add items to beginning of collection 2824 var previousItems = this.items.slice(0); 2825 this.items = items.concat( previousItems ); 2826 // start new layout 2827 this._resetLayout(); 2828 this._manageStamps(); 2829 // layout new stuff without transition 2830 this.layoutItems( items, true ); 2831 this.reveal( items ); 2832 // layout previous items 2833 this.layoutItems( previousItems ); 2834 }; 2835 2836 /** 2837 * reveal a collection of items 2838 * @param {Array of Outlayer.Items} items 2839 */ 2840 proto.reveal = function( items ) { 2841 this._emitCompleteOnItems( 'reveal', items ); 2842 if ( !items || !items.length ) { 2843 return; 2844 } 2845 var stagger = this.updateStagger(); 2846 items.forEach( function( item, i ) { 2847 item.stagger( i * stagger ); 2848 item.reveal(); 2849 }); 2850 }; 2851 2852 /** 2853 * hide a collection of items 2854 * @param {Array of Outlayer.Items} items 2855 */ 2856 proto.hide = function( items ) { 2857 this._emitCompleteOnItems( 'hide', items ); 2858 if ( !items || !items.length ) { 2859 return; 2860 } 2861 var stagger = this.updateStagger(); 2862 items.forEach( function( item, i ) { 2863 item.stagger( i * stagger ); 2864 item.hide(); 2865 }); 2866 }; 2867 2868 /** 2869 * reveal item elements 2870 * @param {Array}, {Element}, {NodeList} items 2871 */ 2872 proto.revealItemElements = function( elems ) { 2873 var items = this.getItems( elems ); 2874 this.reveal( items ); 2875 }; 2876 2877 /** 2878 * hide item elements 2879 * @param {Array}, {Element}, {NodeList} items 2880 */ 2881 proto.hideItemElements = function( elems ) { 2882 var items = this.getItems( elems ); 2883 this.hide( items ); 2884 }; 2885 2886 /** 2887 * get Outlayer.Item, given an Element 2888 * @param {Element} elem 2889 * @param {Function} callback 2890 * @returns {Outlayer.Item} item 2891 */ 2892 proto.getItem = function( elem ) { 2893 // loop through items to get the one that matches 2894 for ( var i=0; i < this.items.length; i++ ) { 2895 var item = this.items[i]; 2896 if ( item.element == elem ) { 2897 // return item 2898 return item; 2899 } 2900 } 2901 }; 2902 2903 /** 2904 * get collection of Outlayer.Items, given Elements 2905 * @param {Array} elems 2906 * @returns {Array} items - Outlayer.Items 2907 */ 2908 proto.getItems = function( elems ) { 2909 elems = utils.makeArray( elems ); 2910 var items = []; 2911 elems.forEach( function( elem ) { 2912 var item = this.getItem( elem ); 2913 if ( item ) { 2914 items.push( item ); 2915 } 2916 }, this ); 2917 2918 return items; 2919 }; 2920 2921 /**
vendor: 4,466 bytes, lines 2922-3102
2922 * remove element(s) from instance and DOM 2923 * @param {Array or NodeList or Element} elems 2924 */ 2925 proto.remove = function( elems ) { 2926 var removeItems = this.getItems( elems ); 2927 2928 this._emitCompleteOnItems( 'remove', removeItems ); 2929 2930 // bail if no items to remove 2931 if ( !removeItems || !removeItems.length ) { 2932 return; 2933 } 2934 2935 removeItems.forEach( function( item ) { 2936 item.remove(); 2937 // remove item from collection 2938 utils.removeFrom( this.items, item ); 2939 }, this ); 2940 }; 2941 2942// ----- destroy ----- // 2943 2944// remove and disable Outlayer instance 2945 proto.destroy = function() { 2946 // clean up dynamic styles 2947 var style = this.element.style; 2948 style.height = ''; 2949 style.position = ''; 2950 style.width = ''; 2951 // destroy items 2952 this.items.forEach( function( item ) { 2953 item.destroy(); 2954 }); 2955 2956 this.unbindResize(); 2957 2958 var id = this.element.outlayerGUID; 2959 delete instances[ id ]; // remove reference to instance by id 2960 delete this.element.outlayerGUID; 2961 // remove data for jQuery 2962 if ( jQuery ) { 2963 jQuery.removeData( this.element, this.constructor.namespace ); 2964 } 2965 2966 }; 2967 2968// -------------------------- data -------------------------- // 2969 2970 /** 2971 * get Outlayer instance from element 2972 * @param {Element} elem 2973 * @returns {Outlayer} 2974 */ 2975 Outlayer.data = function( elem ) { 2976 elem = utils.getQueryElement( elem ); 2977 var id = elem && elem.outlayerGUID; 2978 return id && instances[ id ]; 2979 }; 2980 2981 2982// -------------------------- create Outlayer class -------------------------- // 2983 2984 /** 2985 * create a layout class 2986 * @param {String} namespace 2987 */ 2988 Outlayer.create = function( namespace, options ) { 2989 // sub-class Outlayer 2990 var Layout = subclass( Outlayer ); 2991 // apply new options and compatOptions 2992 Layout.defaults = utils.extend( {}, Outlayer.defaults ); 2993 utils.extend( Layout.defaults, options ); 2994 Layout.compatOptions = utils.extend( {}, Outlayer.compatOptions ); 2995 2996 Layout.namespace = namespace; 2997 2998 Layout.data = Outlayer.data; 2999 3000 // sub-class Item 3001 Layout.Item = subclass( Item ); 3002 3003 // -------------------------- declarative -------------------------- // 3004 3005 utils.htmlInit( Layout, namespace ); 3006 3007 // -------------------------- jQuery bridge -------------------------- // 3008 3009 // make into jQuery plugin 3010 if ( jQuery && jQuery.bridget ) { 3011 jQuery.bridget( namespace, Layout ); 3012 } 3013 3014 return Layout; 3015 }; 3016 3017 function subclass( Parent ) { 3018 function SubClass() { 3019 Parent.apply( this, arguments ); 3020 } 3021 3022 SubClass.prototype = Object.create( Parent.prototype ); 3023 SubClass.prototype.constructor = SubClass; 3024 3025 return SubClass; 3026 } 3027 3028// ----- helpers ----- // 3029 3030// how many milliseconds are in each unit 3031 var msUnits = { 3032 ms: 1, 3033 s: 1000 3034 }; 3035 3036// munge time-like parameter into millisecond number 3037// '0.4s' -> 40 3038 function getMilliseconds( time ) { 3039 if ( typeof time == 'number' ) { 3040 return time; 3041 } 3042 var matches = time.match( /(^\d*\.?\d*)(\w*)/ ); 3043 var num = matches && matches[1]; 3044 var unit = matches && matches[2]; 3045 if ( !num.length ) { 3046 return 0; 3047 } 3048 num = parseFloat( num ); 3049 var mult = msUnits[ unit ] || 1; 3050 return num * mult; 3051 } 3052 3053// ----- fin ----- // 3054 3055// back in global 3056 Outlayer.Item = Item; 3057 3058 return Outlayer; 3059 3060})); 3061 3062/*! 3063 * Masonry v4.1.1 3064 * Cascading grid layout library 3065 * http://masonry.desandro.com 3066 * MIT License 3067 * by David DeSandro 3068 */ 3069 3070( function( window, factory ) { 3071 // universal module definition 3072 /* jshint strict: false */ /*globals define, module, require */ 3073 if ( typeof define == 'function' && define.amd ) { 3074 // AMD 3075 define( [ 3076 'outlayer/outlayer', 3077 'get-size/get-size' 3078 ], 3079 factory ); 3080 } else if ( typeof module == 'object' && module.exports ) { 3081 // CommonJS 3082 module.exports = factory( 3083 require('outlayer'), 3084 require('get-size') 3085 ); 3086 } else { 3087 // browser global 3088 window.Masonry = factory( 3089 window.Outlayer, 3090 window.getSize 3091 ); 3092 } 3093 3094}( window, function factory( Outlayer, getSize ) { 3095 3096 3097 3098// -------------------------- masonryDefinition -------------------------- // 3099 3100 // create an Outlayer layout class 3101 var Masonry = Outlayer.create('masonry'); 3102 // isFitWidth -> fitWidth
3103 Masonry.compatOptions.fitWidth = 'isFitWidth'; 3104 3105 Masonry.prototype._resetLayout = function() { 3106 this.getSize(); 3107 this._getMeasurement( 'columnWidth', 'outerWidth' ); 3108 this._getMeasurement( 'gutter', 'outerWidth' ); 3109 this.measureColumns(); 3110 3111 // reset column Y 3112 this.colYs = []; 3113 for ( var i=0; i < this.cols; i++ ) { 3114 this.colYs.push( 0 ); 3115 } 3116 3117 this.maxY = 0; 3118 }; 3119 3120 Masonry.prototype.measureColumns = function() { 3121 this.getContainerWidth(); 3122 // if columnWidth is 0, default to outerWidth of first item 3123 if ( !this.columnWidth ) { 3124 var firstItem = this.items[0]; 3125 var firstItemElem = firstItem && firstItem.element; 3126 // columnWidth fall back to item of first element 3127 this.columnWidth = firstItemElem && getSize( firstItemElem ).outerWidth || 3128 // if first elem has no width, default to size of container 3129 this.containerWidth; 3130 } 3131 3132 var columnWidth = this.columnWidth += this.gutter; 3133 3134 // calculate columns 3135 var containerWidth = this.containerWidth + this.gutter; 3136 var cols = containerWidth / columnWidth; 3137 // fix rounding errors, typically with gutters 3138 var excess = columnWidth - containerWidth % columnWidth; 3139 // if overshoot is less than a pixel, round up, otherwise floor it 3140 var mathMethod = excess && excess < 1 ? 'round' : 'floor'; 3141 cols = Math[ mathMethod ]( cols ); 3142 this.cols = Math.max( cols, 1 ); 3143 }; 3144 3145 Masonry.prototype.getContainerWidth = function() { 3146 // container is parent if fit width 3147 var isFitWidth = this._getOption('fitWidth'); 3148 var container = isFitWidth ? this.element.parentNode : this.element; 3149 // check that this.size and size are there 3150 // IE8 triggers resize on body size change, so they might not be 3151 var size = getSize( container ); 3152 this.containerWidth = size && size.innerWidth; 3153 }; 3154 3155 Masonry.prototype._getItemLayoutPosition = function( item ) { 3156 item.getSize(); 3157 // how many columns does this brick span 3158 var remainder = item.size.outerWidth % this.columnWidth; 3159 var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil'; 3160 // round if off by 1 pixel, otherwise use ceil 3161 var colSpan = Math[ mathMethod ]( item.size.outerWidth / this.columnWidth ); 3162 colSpan = Math.min( colSpan, this.cols ); 3163 3164 var colGroup = this._getColGroup( colSpan ); 3165 // get the minimum Y value from the columns 3166 var minimumY = Math.min.apply( Math, colGroup ); 3167 var shortColIndex = colGroup.indexOf( minimumY ); 3168 3169 // position the brick 3170 var position = { 3171 x: this.columnWidth * shortColIndex, 3172 y: minimumY 3173 }; 3174 3175 // apply setHeight to necessary columns 3176 var setHeight = minimumY + item.size.outerHeight; 3177 var setSpan = this.cols + 1 - colGroup.length; 3178 for ( var i = 0; i < setSpan; i++ ) { 3179 this.colYs[ shortColIndex + i ] = setHeight; 3180 } 3181 3182 return position; 3183 }; 3184 3185 /** 3186 * @param {Number} colSpan - number of columns the element spans 3187 * @returns {Array} colGroup 3188 */ 3189 Masonry.prototype._getColGroup = function( colSpan ) { 3190 if ( colSpan < 2 ) { 3191 // if brick spans only one column, use all the column Ys 3192 return this.colYs; 3193 } 3194 3195 var colGroup = []; 3196 // how many different places could this brick fit horizontally 3197 var groupCount = this.cols + 1 - colSpan; 3198 // for each group potential horizontal position 3199 for ( var i = 0; i < groupCount; i++ ) { 3200 // make an array of colY values for that one group 3201 var groupColYs = this.colYs.slice( i, i + colSpan ); 3202 // and get the max value of the array 3203 colGroup[i] = Math.max.apply( Math, groupColYs ); 3204 } 3205 return colGroup; 3206 }; 3207 3208 Masonry.prototype._manageStamp = function( stamp ) { 3209 var stampSize = getSize( stamp ); 3210 var offset = this._getElementOffset( stamp ); 3211 // get the columns that this stamp affects 3212 var isOriginLeft = this._getOption('originLeft'); 3213 var firstX = isOriginLeft ? offset.left : offset.right; 3214 var lastX = firstX + stampSize.outerWidth; 3215 var firstCol = Math.floor( firstX / this.columnWidth ); 3216 firstCol = Math.max( 0, firstCol ); 3217 var lastCol = Math.floor( lastX / this.columnWidth ); 3218 // lastCol should not go over if multiple of columnWidth #425 3219 lastCol -= lastX % this.columnWidth ? 0 : 1; 3220 lastCol = Math.min( this.cols - 1, lastCol ); 3221 // set colYs to bottom of the stamp 3222 3223 var isOriginTop = this._getOption('originTop'); 3224 var stampMaxY = ( isOriginTop ? offset.top : offset.bottom ) + 3225 stampSize.outerHeight; 3226 for ( var i = firstCol; i <= lastCol; i++ ) { 3227 this.colYs[i] = Math.max( stampMaxY, this.colYs[i] ); 3228 } 3229 }; 3230 3231 Masonry.prototype._getContainerSize = function() { 3232 this.maxY = Math.max.apply( Math, this.colYs ); 3233 var size = { 3234 height: this.maxY 3235 }; 3236 3237 if ( this._getOption('fitWidth') ) { 3238 size.width = this._getContainerFitWidth(); 3239 } 3240 3241 return size; 3242 }; 3243 3244 Masonry.prototype._getContainerFitWidth = function() { 3245 var unusedCols = 0; 3246 // count unused columns 3247 var i = this.cols; 3248 while ( --i ) { 3249 if ( this.colYs[i] !== 0 ) { 3250 break; 3251 } 3252 unusedCols++; 3253 } 3254 // fit container to columns that have been used 3255 return ( this.cols - unusedCols ) * this.columnWidth - this.gutter; 3256 }; 3257 3258 Masonry.prototype.needsResizeLayout = function() { 3259 var previousWidth = this.containerWidth; 3260 this.getContainerWidth(); 3261 return previousWidth != this.containerWidth; 3262 }; 3263 3264 return Masonry; 3265 3266})); 3267 3268 3269"use strict";var RedxShopxVariantActionFormController=(function(){function RedxShopxVariantActionFormController(formElement){this.formElement=formElement;var configJson=formElement.getAttribute('data-form-config');if(configJson){this.formConfig=JSON.parse(configJson);} 3270try{this.shopxActionInputElement=xtxJs.getElement('input[name="shopx_action"]',formElement);} 3271catch(_a){} 3272try{this.checkoutTypeSelectElement=xtxJs.getElement('[name="checkoutType"]',formElement);} 3273catch(_b){} 3274try{this.subscriptionOptionContainer=xtxJs.getElement('[data-subscribe-container]',formElement);} 3275catch(_c){} 3276this.submitButtonElement=xtxJs.getElement('[data-submit-button]',formElement);} 3277RedxShopxVariantActionFormController.create=function(formElement){return new RedxShopxVariantActionFormController(formElement);};RedxShopxVariantActionFormController.initializeRedxShopxVariantActionFormControllerInElement=function(element){xtxJs.eachElement('form[name="variant-action-form"]:not(.initialized-action-form)',function(formElement){var controller=RedxShopxVariantActionFormController.create(formElement);controller.init();},element);};RedxShopxVariantActionFormController.prototype.init=function(){var _this=this;xtxJs.addEventListeners("[name]",'change',function(){xtxJs.dispatchEventWithDetails(_this.formElement,"xtx.shopx.products.variant.action.form.change",{"formElement":_this.formElement});},null,this.formElement);if(this.checkoutTypeSelectElement){if(this.checkoutTypeSelectElement.type==="hidden"){this.changeCheckoutType(false);} 3278else{xtxWebComponents.ready(this.checkoutTypeSelectElement).then(function(){_this.changeCheckoutType(false);xtxJs.addEventListenerToElement(_this.checkoutTypeSelectElement,'change',function(){_this.changeCheckoutType(true);});});}} 3279xtxWebComponents.deepReady(this.formElement).then(function(){xtxJs.dispatchEventWithDetails(_this.formElement,"xtx.shopx.products.variant.action.form.initialized",{"formElement":_this.formElement});});this.formElement.classList.add('initialized-action-form');};RedxShopxVariantActionFormController.prototype.changeCheckoutType=function(updateSyncHandler){switch(this.getCheckoutType()){case 0:this.formElement.action=this.formConfig.formUrlCart;this.formElement.removeAttribute('data-checkout-type-subscription');this.shopxActionInputElement.value=this.formConfig.shopxActionCart;this.hideSubscribeOptions();this.submitButtonElement.innerHTML=this.formConfig.buttonLabelCart;break;case 1:this.formElement.action=this.formConfig.formUrlSubscription;this.formElement.setAttribute('data-checkout-type-subscription','true');this.shopxActionInputElement.value=this.formConfig.shopxActionSubscription;this.showSubscribeOptions();this.submitButtonElement.innerHTML=this.formConfig.buttonLabelSubscription;break;} 3280if(updateSyncHandler&&this.formElement.closest('[data-redx-sync-handler-id]')){Redx_Sync_Handler.refreshSyncs();}};RedxShopxVariantActionFormController.prototype.getCheckoutType=function(){if(this.checkoutTypeSelectElement){return parseInt(this.checkoutTypeSelectElement.value);} 3281return 0;};RedxShopxVariantActionFormController.prototype.showSubscribeOptions=function(){if(this.subscriptionOptionContainer){this.subscriptionOptionContainer.classList.remove('hidden');}};RedxShopxVariantActionFormController.prototype.hideSubscribeOptions=function(){if(this.subscriptionOptionContainer){this.subscriptionOptionContainer.classList.add('hidden');}};return RedxShopxVariantActionFormController;}());document.addEventListener('xtx-datanavigator-navigated',function(){RedxShopxVariantActionFormController.initializeRedxShopxVariantActionFormControllerInElement(document);}); 3282 3283function VariantSelectionConfig(jsonString,variantSeoIdentifier){let _attributes=[];let _useAdvancedVarSelector=false;let _renderType;let _variantSelectionClear=false;let _clearedAttributeName='';let _disabledAttributes=[];let _selectedAttributeOptions=[];let _loadConfigurator=true;let _variantMapping={};let _selectableVariants=[];let _activeVariant=undefined;let _pageKey=0;let _lastActiveVariant=undefined;let _variantSeoIdentifier=undefined;this.init=function(jsonString,variantSeoIdentifier){_variantSeoIdentifier=variantSeoIdentifier;let json=JSON.parse(jsonString);let me=this;let variantInWishlist=false;let hasSelectedVariant=false;me.setPageKey(json.page);me.setRenderType(json.renderType);if(typeof json.loadConfigurator==="boolean"){me.setLoadConfigurator(json.loadConfigurator);} 3284const priceAndVariantHintsIncluded=json.priceAndVariantHintsIncluded;
3284json.attributes.forEach(function(attributeJson){var attribute=new VariantSelectionAttribute();attribute.setKey(attributeJson.key);attribute.setTitle(attributeJson.title);attribute.setName(attributeJson.name);attribute.setType(attributeJson.type);attributeJson.values.forEach(function(valueJson){var value=new VariantSelectionAttributeValue();value.setValue(valueJson.value);value.setTitle(valueJson.title);value.setColor(valueJson.color);value.setIcon(valueJson.icon);value.setIconRetina(valueJson.iconRetina);valueJson.variants.forEach(function(variantJson){var variant=new VariantSelectionVariant();variant.setKey(variantJson.key);variant.setEncryptedId(variantJson.encryptedId);variant.setTitleInCart(variantJson.titleInCart);variant.setProductTitle(variantJson.productTitle);variant.setVariantSeoAlias(variantJson.variantSeoAlias);variant.setUnit(variantJson.unit);if(priceAndVariantHintsIncluded){variant.setPriceHtml(variantJson.priceHtml,true);}else{variant.setPriceHtml('Get_Ajax_Price');} 3285if(variantJson.actionFormHtml){variant.setActionFormHtml(variantJson.actionFormHtml,true);} 3286variant.setSequence(variantJson.sequence);variant.setArticleNumber(variantJson.articleNumber);variant.setDescription(variantJson.description,true);variant.setMediaboxPic(variantJson.mediabox_pic);variant.setIsConfigurator(variantJson.isConfigurator);variant.setIsSelected(variantJson.isSelected);variant.setIsSubscribable(variantJson.isSubscribable);variant.setIsOnRequest(variantJson.isOnRequest);if(variantJson.scalePriceHint!==undefined){variant.setScalePriceHint(variantJson.scalePriceHint);} 3287if(variantJson.isSelected){hasSelectedVariant=true;} 3288if(variantJson.inWishlist){variantInWishlist=variantJson.key;} 3289variant.setAvailability(variantJson.availability);if(!priceAndVariantHintsIncluded){variant.setAreMessagesIncluded(false);}else if(variantJson.messages){variantJson.messages.forEach(function(messageObj){variant.addMessage(VariantSelectionVariantMessage.create(messageObj.type,messageObj.message));});} 3290value.addVariant(variant);if(typeof _variantMapping[variant.getKey()]==="undefined"){_variantMapping[variant.getKey()]={variant:variant,values:[]};} 3291_variantMapping[variant.getKey()].values[attribute.getName()]=value.getValue();});if(!hasSelectedVariant&&variantInWishlist){let variant=me.getVariant(variantInWishlist);variant.setIsSelected(true);} 3292attribute.addValue(value);});_attributes.push(attribute);});if(_attributes.length>2){this.setUseAdvancedVarSelector();} 3293if(this.useAdvancedVarSelector()){this.updateAdvancedVarSelectorAttributes()}else{this.updateSelectableVariants();}};this.getAttributes=function(){return _attributes;};this.getSelectableVariants=function(){return _selectableVariants;};this.getSelectedVariant=function(){let selectedVariant=undefined;Object.keys(_variantMapping).forEach((key)=>{let variant=this.getVariant(parseInt(key));if(variant.isSelected()){selectedVariant=variant;}});return selectedVariant;};this.updateSelectableVariants=function(){_selectableVariants=[];Object.keys(_variantMapping).forEach(function(key){_selectableVariants.push(_variantMapping[key].variant);});_selectableVariants.sort(function(a,b){return a.getSequence()-b.getSequence();});this.getAttributes().forEach(function(attribute){var selectedValue=attribute.getSelectedValue();if(typeof selectedValue!=="undefined"){_selectableVariants=_selectableVariants.filter(function(selectableVariant){return selectedValue.getVariants().find(function(variant){return selectableVariant.getKey()===variant.getKey();})!==undefined;});}});let activeValuesForAttributes=[] 3294let activeVariant=this.getActiveVariant();if(typeof activeVariant!=="undefined"){let values=this.getVariantValues(activeVariant.getKey());this.getAttributes().forEach(function(attribute){let activeValue=Object.keys(values).indexOf(attribute.getName())>-1?values[attribute.getName()]:"";activeValuesForAttributes.push(activeValue);});} 3295this.setLastActiveVariant(activeVariant);this.setActiveVariant(undefined);if(_selectableVariants.length>0){let selectedVariant=false;
3295_selectableVariants.forEach(function(selectableVariant){if(selectableVariant.isSelected()){selectedVariant=selectableVariant}});_selectableVariants.forEach(function(variant){let allAttributeValuesForVariant=_variantMapping[variant.getKey()].values;let variantIsActive=true;_attributes.forEach(function(attribute){let activeValueForAttribute=Object.keys(allAttributeValuesForVariant).indexOf(attribute.getName())>-1?allAttributeValuesForVariant[attribute.getName()]:"";if(!attribute.getSelected()&&!activeValuesForAttributes.includes(activeValueForAttribute)){variantIsActive=false;}});if(variantIsActive){selectedVariant=variant;}});const attributeAmountTilSelected=_attributes.findIndex(attribute=>attribute.getSelected());_selectableVariants.forEach(function(variant){if(selectedVariant){return;} 3296let allAttributeValuesForVariant=_variantMapping[variant.getKey()].values;allAttributeValuesForVariant=Object.values(allAttributeValuesForVariant).slice(0,attributeAmountTilSelected);activeValuesForAttributes=activeValuesForAttributes.slice(0,attributeAmountTilSelected);if(JSON.stringify(allAttributeValuesForVariant)===JSON.stringify(activeValuesForAttributes)){selectedVariant=variant;}});if(!selectedVariant){selectedVariant=_selectableVariants[0];} 3297this.setActiveVariant(selectedVariant);}};this.updateSelectableVariantsForAdvancedVarSelector=function(){_selectableVariants=[];Object.keys(_variantMapping).forEach(function(key){let selectableVariant=true;let allAttributeValuesForVariant=_variantMapping[key].values;for(const attributeName in _selectedAttributeOptions){const selectedAttributeValue=_selectedAttributeOptions[attributeName];const variantAttributeValue=allAttributeValuesForVariant[attributeName];if(selectedAttributeValue&&variantAttributeValue&&variantAttributeValue.toString()!==selectedAttributeValue.toString()){selectableVariant=false;break;}} 3298if(selectableVariant){_selectableVariants.push(_variantMapping[key].variant);}});};this.updateAdvancedVarSelectorAttributes=function(attributeName){this.updateSelectableVariantsForAdvancedVarSelector();let attributes=this.getAttributes();if(attributes.length===Object.keys(_selectedAttributeOptions).length&&_selectableVariants.length===1){this.setLastActiveVariant(this.getActiveVariant()) 3299this.setActiveVariant(_selectableVariants[0]);} 3300let nextStep=false;attributes.forEach(function(attribute){if(nextStep){_disabledAttributes=_disabledAttributes.filter(item=>item!==attribute.getName());nextStep=false;} 3301if(attribute.getName()===attributeName){nextStep=true;}});};this.selectAttribute=function(attributeName,value){if(value===''){this.setVariantSelectionClear(true) 3302this.setClearedAttributeName(attributeName);if(this.useAdvancedVarSelector()){let clearAndDisable=false;xtxJs.forEach(this.getAttributes(),(attribute)=>{if(attribute.getName()===attributeName){clearAndDisable=true;} 3303if(clearAndDisable){this.removeSelectedAttributeOption(attribute.getName());}});}else{this.removeSelectedAttributeOption(attributeName);}}else{this.addSelectedAttributeOption(attributeName,value);this.setVariantSelectionClear(false);let selectedAttributeIndex=-1;for(let i=0;i<this.getAttributes().length;i++){if(this.getAttributes()[i].getName()===attributeName){selectedAttributeIndex=i;this.getAttributes()[i].selectValue(value);}else{this.getAttributes()[i].setSelected(false);this.getAttributes()[i].selectValue('0');}} 3304if(this.useAdvancedVarSelector()){this.updateAdvancedVarSelectorAttributes(attributeName);}else{this.updateSelectableVariants();}}};this.getAttribute=function(name){return this.getAttributes().find(function(attribute){return attribute.getName()===name;})};this.setActiveVariant=function(variant){if(this.getRenderType()==='detail'){this.addVariantParamToUrl(variant);} 3305_activeVariant=variant;};this.addVariantParamToUrl=function(variant){const url=new URL(window.location.href);const regex=new RegExp('/'+_variantSeoIdentifier+'\\.[^/]+','g');url.pathname=url.pathname.replace(regex,'');if(variant){url.pathname=url.pathname.replace(/\/$/,'')+'/'+_variantSeoIdentifier+'.'+variant.getVariantSeoAlias();} 3306window.history.replaceState({},'',url.toString());window['sstDataLayer']=window['sstDataLayer']||[];window['sstDataLayer'].push({'sstEvent':'pageView',});};this.getActiveVariant=function(){return _activeVariant;};this.setVariantSelectionClear=function(isSelectionClear){_variantSelectionClear=isSelectionClear;};this.getIsVariantSelectionClear=function(){return _variantSelectionClear;};this.getClearedAttributeName=function(){return _clearedAttributeName;};this.setClearedAttributeName=function(clearedAttributeName){_clearedAttributeName=clearedAttributeName;};this.getDisabledAttributes=function(){return _disabledAttributes;};this.setDisabledAttributes=function(disabledAttributes){_disabledAttributes=disabledAttributes;};this.addDisabledAttribute=function(disabledAttributeName){_disabledAttributes.push(disabledAttributeName);};
3306this.getSelectedAttributeOptions=function(){return _selectedAttributeOptions;};this.setSelectedAttributeOptions=function(selectedOptions){_selectedAttributeOptions=selectedOptions;};this.addSelectedAttributeOption=function(attributeName,selectedOptions){_selectedAttributeOptions[attributeName]=selectedOptions;};this.removeSelectedAttributeOption=function(attributeName){if(_selectedAttributeOptions.hasOwnProperty(attributeName)){delete _selectedAttributeOptions[attributeName];}};this.useAdvancedVarSelector=function(){return _useAdvancedVarSelector;};this.setUseAdvancedVarSelector=function(){_useAdvancedVarSelector=true;};this.setLastActiveVariant=function(variant){_lastActiveVariant=variant;};this.getLastActiveVariant=function(){return _lastActiveVariant;};this.getVariantValues=function(variantKey){return _variantMapping[variantKey].values;};this.setPageKey=function(pageKey){_pageKey=pageKey;} 3307this.getPageKey=function(){return _pageKey;} 3308this.getRenderType=function(){return _renderType;} 3309this.setRenderType=function(renderType){_renderType=renderType;} 3310this.getLoadConfigurator=function(){return _loadConfigurator;};this.setLoadConfigurator=function(loadConfigurator){_loadConfigurator=loadConfigurator;};this.getVariant=function(key){if(_variantMapping[key]!==undefined){return _variantMapping[key].variant;} 3311return undefined;};this.init(jsonString,variantSeoIdentifier);} 3312function VariantSelectionAttribute(){var _key;var _title;var _name;var _type;var _selected=false;var _values=[];this.getKey=function(){return _key;};this.setKey=function(key){_key=key;};this.getName=function(){return _name;};this.setName=function(name){_name=name;};this.getTitle=function(){return _title;};this.setTitle=function(title){_title=title;};this.getType=function(){return _type;};this.setType=function(type){_type=type;};this.getSelected=function(){return _selected;};this.setSelected=function(selected){_selected=selected;};this.addValue=function(value){_values.push(value);};this.selectValue=function(value){var me=this;me.setSelected(false);
3312this.getValues().forEach(function(attributeValue){if(attributeValue.getValue()==value){me.setSelected(true);attributeValue.setSelected(true);}else{attributeValue.setSelected(false);}});};this.getSelectedValue=function(){return this.getValues().find(function(attributeValue){return attributeValue.getSelected()===true;});};this.getValues=function(){return _values;};this.getValue=function(value){return this.getValues().find(function(attributeValue){return attributeValue.getValue()===value;});}} 3313function VariantSelectionAttributeValue(){var _value;var _title;var _color;var _icon;var _icon_retina;var _selected=false;var _variants=[];this.getValue=function(){return _value;};this.setValue=function(value){_value=value;};this.getTitle=function(){return _title;};this.setTitle=function(title){_title=title;};this.addVariant=function(variant){_variants.push(variant);};this.getVariants=function(){return _variants;};this.getColor=function(){return _color;};this.setColor=function(color){_color=color;};this.getIcon=function(){return _icon;};this.setIcon=function(icon){_icon=icon;};this.getIconRetina=function(){return _icon_retina;};this.setIconRetina=function(icon){_icon_retina=icon;};this.getSelected=function(){return _selected;};this.setSelected=function(selected){_selected=selected;};} 3314function VariantSelectionVariant(){var _key;var _encryptedId;var _titleInCart;var _productTitle;var _unit;var _priceHtml;var _sequence;var _articleNumber;var _description;var _mediaboxPic;var _isConfigurator;var _isSelected=false;var _availability=null;var _onRequest=false;var _messages=[];var _scalePriceHint;var _messagesAreIncluded=true;var _actionFormHtml;var _isSubscribable=false;let _variantSeoAlias;this.getKey=function(){return _key;};this.setKey=function(key){_key=key;};this.getEncryptedId=function(){return _encryptedId;};this.setEncryptedId=function(encryptedId){_encryptedId=encryptedId;};this.getTitleInCart=function(){return _titleInCart;};this.setTitleInCart=function(title){_titleInCart=title;};this.getProductTitle=function(){return _productTitle;};this.setProductTitle=function(title){_productTitle=title;};this.getVariantSeoAlias=function(){return _variantSeoAlias;};this.setVariantSeoAlias=function(variantSeoAlias){_variantSeoAlias=variantSeoAlias;};this.getUnit=function(){return _unit;};this.setUnit=function(unit){_unit=unit;};this.getArticleNumber=function(){return _articleNumber;};this.setArticleNumber=function(articleNumber){_articleNumber=articleNumber;};this.getPriceHtml=function(){return _priceHtml;} 3315this.setPriceHtml=function(priceHtml,parseHtml=false){if(parseHtml){priceHtml=this.parseHtml(priceHtml);} 3316_priceHtml=priceHtml;} 3317this.getDescription=function(){return _description;};this.setDescription=function(description,parseHtml=false){if(parseHtml){description=this.parseHtml(description);} 3318_description=description;};this.getMediaboxPic=function(){return _mediaboxPic;};this.setMediaboxPic=function(mediaboxPic){_mediaboxPic=mediaboxPic;};this.isConfigurator=function(){return _isConfigurator;};this.setIsConfigurator=function(isConfigurator){_isConfigurator=isConfigurator;};this.isSelected=function(){return _isSelected;};this.setIsSelected=function(isSelected){_isSelected=isSelected;};this.getSequence=function(){return _sequence;};this.setSequence=function(sequence){_sequence=sequence;};this.getAvailability=function(){return _availability;};this.setAvailability=function(availability){_availability=availability;};this.isOnRequest=function(){return _onRequest;};this.setIsOnRequest=function(onRequest){_onRequest=onRequest;};this.isDisabled=function(){return this.getAvailability()!==null&&this.getAvailability()<=0;} 3319this.getMessages=function(){return _messages;};this.addMessage=function(message){_messages.push(message);} 3320this.getScalePriceHint=function(){return _scalePriceHint;} 3321this.setScalePriceHint=function(scalePriceHint){_scalePriceHint=scalePriceHint;} 3322this.getActionFormHtml=function(){return _actionFormHtml;} 3323this.setActionFormHtml=function(actionFormHtml,parseHtml=false){if(parseHtml){actionFormHtml=this.parseHtml(actionFormHtml);} 3324_actionFormHtml=actionFormHtml;} 3325this.isSubscribable=function(){return _isSubscribable;};this.setIsSubscribable=function(isSubscribable){_isSubscribable=isSubscribable;};this.parseHtml=function(html){var parser=new DOMParser();var doc=parser.parseFromString(html,"text/html");return doc.body?doc.body.textContent:"";} 3326this.areMessagesIncluded=function(){return _messagesAreIncluded;} 3327this.setAreMessagesIncluded=function(value){_messagesAreIncluded=value;}} 3328function VariantSelectionVariantMessage(){var _type;var _message;this.getType=function(){return _type} 3329this.setType=function(type){_type=type;} 3330this.getMessage=function(){return _message} 3331this.setMessage=function(message){_message=message;} 3332this.getHtml=function(){return"<div class='redxStatusMessage plain redxStatusMessage"+this.getType()+"'>"+this.getMessage()+"</div>";}} 3333VariantSelectionVariantMessage.create=function(type,messageText){var message=new VariantSelectionVariantMessage();message.setType(type);message.setMessage(messageText);return message} 3334 3335var __awaiter=(this&&this.__awaiter)||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value);});} 3336return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value));}catch(e){reject(e);}} 3337function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}} 3338function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected);} 3339step((generator=generator.apply(thisArg,_arguments||[])).next());});};var __generator=(this&&this.__generator)||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1];},trys:[],ops:[]},f,y,t,g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return g.next=verb(0),g["throw"]=verb(1),g["return"]=verb(2),typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this;}),g;function verb(n){return function(v){return step([n,v]);};} 3340function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue;} 3341if(op[0]===3&&(!t||(op[1]>t[0]&&op[1]<t[3]))){_.label=op[1];break;} 3342if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break;} 3343if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break;} 3344if(t[2])_.ops.pop();_.trys.pop();continue;} 3345op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;} 3346if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true};}};var lastEventDetails='';var ShopxVariantSelection=(function(){function ShopxVariantSelection(elementId,optionsJson){this.elementId=elementId;this.optionsJson=optionsJson;this._config=null;this._attributeInputs=[];this.variantChangedTimeout=null;this.syncHeights=false;this.variantSelection=document.getElementById(elementId);} 3347ShopxVariantSelection.getInstance=function(elementId){return ShopxVariantSelection.instances.objects[elementId];};ShopxVariantSelection.addInstance=function(elementId,optionsJson){if(ShopxVariantSelection.instances.length===0){ShopxVariantSelection.addConfiguratorQuantityChangedEventHandler();}
3348if(ShopxVariantSelection.getInstance(elementId)===undefined){ShopxVariantSelection.instances.objects[elementId]=new ShopxVariantSelection(elementId,optionsJson);ShopxVariantSelection.instances.objects[elementId].init().then();ShopxVariantSelection.instances.length++;}};ShopxVariantSelection.addConfiguratorQuantityChangedEventHandler=function(){document.addEventListener('xtx.configurator.initialized',function(){var changedTimeout=null;xtxJs.eachElement('.quantity_wrapper.configurator xtx-quantity-selector',function(element){element.addEventListener('change',function(){if(changedTimeout){clearTimeout(changedTimeout);} 3349changedTimeout=setTimeout(function(){ajax_connector.update();},100);});});});};ShopxVariantSelection.loadConfiguratorFromBackend=function(loadingContainer,pageKey,shopxProductsVarKey,additionalParams,reloadCurrentConfigurator){var ajaxUrl='/ajaxendpoint/redx/shopx/configurator?shopx_products_var_key='+shopxProductsVarKey+'&page='+pageKey;if(reloadCurrentConfigurator){var configuratorElement=document.querySelector('input[name="configurator_id"]');if(configuratorElement&&configuratorElement.value){ajaxUrl+='&configurator_id='+configuratorElement.value;}} 3350if(additionalParams){var additionalURLSearchParams=new URLSearchParams(additionalParams);ajaxUrl+='&'+additionalURLSearchParams.toString();} 3351if(loadingContainer){ShopxVariantSelection.showSpinnerOnElement(loadingContainer);} 3352fetch(ajaxUrl,{headers:{'Cache-Control':'no-cache'}}).then(function(response){if(!response.ok){throw new Error('Error Load Configurator from BE');} 3353return response.json();}).then(function(data){var kit=document.querySelector('[data-configurator-part="kit"]');if(kit){var _loop_1=function(property){var selector='[data-configurator-part="'+property+'"]';xtxJs.eachElement(selector,function(element){if(data.data.hasOwnProperty(property)){element.outerHTML=data.data[property];}});};for(var property in data.data){_loop_1(property);} 3354initConfigurator();} 3355redxModal.reInit();if(loadingContainer){ShopxVariantSelection.hideSpinnerOnElement(loadingContainer);}}).catch(function(error){console.error('Error Load Configurator from BE',error);if(loadingContainer){ShopxVariantSelection.hideSpinnerOnElement(loadingContainer);}});};ShopxVariantSelection.prototype.init=function(){return __awaiter(this,void 0,void 0,function(){var variantSeoIdentifier;var _this=this;return __generator(this,function(_a){variantSeoIdentifier=this.variantSelection.dataset.variantSeoIdentifier;this._config=new VariantSelectionConfig(this.optionsJson,variantSeoIdentifier);this.performInitialRenderingUpdate();xtxWebComponents.deepReady(this.variantSelection).then(function(){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.performInitialUpdate()];case 1:_a.sent();return[2];}});});});return[2];});});};ShopxVariantSelection.prototype.performInitialRenderingUpdate=function(){var _this=this;xtxJs.forEach(this._config.getAttributes(),function(attribute,index){var name=attribute.getName();var input=undefined;if(attribute.getType()==="dropdown"||attribute.getType()==="dropdown_searchable"){var selector='.attribute_'+index+' .variant_attribute_value xtx-select[name="'+name+'"]';input=_this.variantSelection.querySelectorAll(selector);if(_this._config.getAttributes().length===1){input[0].setAttribute('hide-clear','true');}} 3356else if(attribute.getType()==="radio_squares"){var selector='.attribute_'+index+' .variant_attribute_value input[type="radio"][name="'+name+'"]';input=_this.variantSelection.querySelectorAll(selector);xtxJs.forEach(attribute.getValues(),function(value,index){var element=input[index];var elementValue=_this.getElementValue(element);if(_this.isNumber(elementValue)){elementValue=parseInt(elementValue);} 3357if(elementValue===value.getValue()){var label=element.nextElementSibling;label.title=label.textContent;if(value.getIcon()||value.getColor()){label.textContent='';} 3358if(value.getIcon()||value.getIconRetina()){var pictureTag=document.createElement('picture');pictureTag.insertAdjacentHTML('beforeend',"<source srcset=\"".concat(value.getIconRetina(),"\" media=\"min-resolution: 2dppx\"/>"));pictureTag.insertAdjacentHTML('beforeend',"<img src=\"".concat(value.getIcon(),"\" alt=\"").concat(label.getAttribute('title'),"\" loading=\"lazy\"/>"));label.append(pictureTag);label.classList.add('icon');} 3359if(value.getColor()){label.style.backgroundColor=(!/^#/.test(value.getColor())?'#':'')+value.getColor();}}});} 3360_this._attributeInputs[name]=input;});};ShopxVariantSelection.prototype.performInitialUpdate=function(){return __awaiter(this,void 0,void 0,function(){var activeVariant,activeVariantKey;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:activeVariant=this._config.getActiveVariant();if(this._config.getRenderType()==='detail'&&activeVariant!==undefined&&this.getVariantActionFormElement()){activeVariant.setActionFormHtml(this.getVariantActionFormElement().outerHTML);} 3361if(!this._config.useAdvancedVarSelector())return[3,2];return[4,this.performInitialUpdateForAdvancedVarSelector()];case 1:_a.sent();return[3,4];
3361case 2:return[4,this.updateView(true,false,true)];case 3:_a.sent();_a.label=4;case 4:activeVariantKey=undefined;xtxJs.forEach(this._config.getAttributes(),function(attribute){xtxJs.forEach(_this._attributeInputs[attribute.getName()],function(input){input.addEventListener('change',function(event){return __awaiter(_this,void 0,void 0,function(){var targetElement,activeVariant;return __generator(this,function(_a){switch(_a.label){case 0:targetElement=event.target;this._config.selectAttribute(targetElement.getAttribute('name'),this.getElementValue(targetElement));activeVariant=this._config.getActiveVariant();if(this._config.getIsVariantSelectionClear()||(typeof activeVariant==='undefined'&&typeof activeVariantKey!=='undefined')){activeVariantKey=undefined;} 3362else if(typeof activeVariant!=='undefined'&&activeVariantKey!==activeVariant.getKey()&&(this._config.getLastActiveVariant()&&this._config.getLastActiveVariant().getKey()!==activeVariant.getKey())){activeVariantKey=activeVariant.getKey();} 3363this.syncHeights=true;return[4,this.updateView(true).then()];case 1:_a.sent();this.syncHeights=false;return[2];}});});});});});this.addEventListenerOnDocument();return[2];}});});};ShopxVariantSelection.prototype.performInitialUpdateForAdvancedVarSelector=function(){return __awaiter(this,void 0,void 0,function(){var selectableVariants,selectedVariant,activeVariant;return __generator(this,function(_a){switch(_a.label){case 0:selectableVariants=this._config.getSelectableVariants();selectedVariant=this._config.getSelectedVariant();if(!(selectableVariants.length===1||selectedVariant))return[3,2];activeVariant=selectedVariant;if(!activeVariant){activeVariant=selectableVariants[0];} 3364this._config.setActiveVariant(activeVariant);this.initImageGalleryEventsForDetailView();return[4,this.updateView(true,true,true)];case 1:_a.sent();return[3,4];case 2:this._config.setVariantSelectionClear(true);this._config.setClearedAttributeName(this._config.getAttributes()[0].getName());this.initImageGalleryEventsForDetailView();return[4,this.updateView(true,false,true)];case 3:_a.sent();_a.label=4;case 4:return[2];}});});};ShopxVariantSelection.prototype.addEventListenerOnDocument=function(){var _this=this;document.addEventListener('xtx-configurator-add-to-cart',function(){_this.loadConfigurator(_this._config.getActiveVariant(),true,false);});document.addEventListener('xtx-configurator-error-add-to-cart',function(){_this.loadConfigurator(_this._config.getActiveVariant(),true,true);});document.addEventListener('xsites.cart.item.removed',function(evt){if(evt.detail.removedVariant!==undefined&&evt.detail.removedVariant!==null){_this.updateAvailabilityForVariant(evt.detail.removedVariant,undefined);_this.loadConfigurator(_this._config.getActiveVariant(),true,false);}});document.addEventListener('xsites.cart.item.quantity.updated',function(evt){_this.updateAvailabilitiesOfCartItems(evt);_this.loadConfigurator(_this._config.getActiveVariant(),true,false);});document.addEventListener('xsites.cart.item.added',function(evt){if(JSON.stringify(evt.detail)!==JSON.stringify(lastEventDetails)){lastEventDetails=evt.detail;_this.updateAvailabilitiesOfCartItems(evt);}});document.addEventListener('xsites.cart.item.add.error',function(evt){_this.updateAvailabilityForVariant(evt.detail.variant,undefined);});document.addEventListener('xsites.variantselection.select',function(evt){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){if(evt.detail&&evt.detail.key!==undefined){App.setLoadingSpinnerOnElement(this.variantSelection,'large');this._setActiveVariant(this._config.getVariant(evt.detail.key));App.removeLoadingSpinnerFromElement(this.variantSelection);} 3365return[2];});});});};ShopxVariantSelection.prototype.addVariantActionFormEventListener=function(addToCartFormElement){var _this=this;xtxJs.addEventListenerToElement(addToCartFormElement,'xtx.shopx.products.variant.action.form.change',function(){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.changeVariantActionForm()];case 1:_a.sent();this.disableSubmitButtonIfFormActionEmpty(addToCartFormElement);return[2];}});});});xtxJs.addEventListenerToElement(addToCartFormElement,'xtx.shopx.products.variant.action.form.initialized',function(){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.changeVariantActionForm()];case 1:_a.sent();this.disableSubmitButtonIfFormActionEmpty(addToCartFormElement);return[2];}});});});};ShopxVariantSelection.prototype._setActiveVariant=function(variant){var _this=this;
3365if(variant!==undefined){xtxJs.forEach(this._config.getAttributes(),function(attribute,index){if(index===0){var values=_this._config.getVariantValues(variant.getKey());var activeValue=Object.keys(values).indexOf(attribute.getName())>-1?values[attribute.getName()]:"";attribute.selectValue(activeValue);attribute.setSelected(true);_this.updateInput(attribute.getName(),activeValue);} 3366else{attribute.setSelected(false);}});this._config.setActiveVariant(variant);this._config.setVariantSelectionClear(false);this._config.setDisabledAttributes([]);this.updateView(false,true).then();}};ShopxVariantSelection.prototype.updateAvailabilitiesOfCartItems=function(evt){var _this=this;if(evt.detail!==undefined&&evt.detail.items!==undefined){xtxJs.forEach(evt.detail.items,function(entry){_this.updateAvailabilityForVariant(entry.varKey,entry.availability);});this.updateView(false).then();}};ShopxVariantSelection.prototype.updateAvailabilityForVariant=function(key,availability){var variant=this._config.getVariant(key);if(variant!==undefined){if(availability===undefined){if(window['cart']!==undefined&&(window['FeatureManager']===undefined||window['FeatureManager'].isFeatureEnabled('productcatalog_stock'))){window['cart'].requestAvailability(key,function(xmlHttpRequest){var response=JSON.parse(xmlHttpRequest.response);this.updateAvailabilityForVariant(key,response.data.availability);this.updateView(false).then();}.bind(this),null);}} 3367else{variant.setAvailability(availability);}}};ShopxVariantSelection.prototype.updateAddToCartFormStati=function(disabled){xtxJs.eachElement('.variant_addtocart_container button.add-to-cart',function(item){if(disabled){item.classList.add('disabled');item.setAttribute('disabled','');item.title=item.dataset.titleDisabled;} 3368else{item.classList.remove('disabled');item.removeAttribute('disabled');item.title=item.dataset.title;} 3369item.disabled=disabled;},this.variantSelection);xtxJs.eachElement('xtx-quantity-selector',function(item){item.disabled=disabled;},this.variantSelection);xtxJs.eachElement('.request-button-container .request-product-button',function(requestButton){if(disabled){requestButton.setAttribute('disabled','');} 3370else{requestButton.removeAttribute('disabled');}},this.variantSelection);};ShopxVariantSelection.prototype.showVariantOnRequestData=function(isVariantOnRequest){var requestElement=this.variantSelection.querySelector('.variant-selection-request-element');if(requestElement){var addToCartElement=this.variantSelection.querySelector('.variant_addtocart_container');if(addToCartElement){var hideCartButtonClassName='hide-add-to-cart-container';var showVariantRequestElementClassName='show-variant-selection-request-element';if(isVariantOnRequest){addToCartElement.classList.add(hideCartButtonClassName);requestElement.classList.add(showVariantRequestElementClassName);var requestButton=requestElement.querySelector('.request-product-button');var activeVariant=this._config.getActiveVariant();requestButton.setAttribute('data-variant-key',activeVariant.getKey().toString());requestButton.setAttribute('data-product-variant-article-number',activeVariant.getArticleNumber());requestButton.setAttribute('data-product-title',activeVariant.getProductTitle());} 3371else{addToCartElement.classList.remove(hideCartButtonClassName);requestElement.classList.remove(showVariantRequestElementClassName);}}}};ShopxVariantSelection.prototype.setPriceFromAjax=function(activeVariantConfig){var _this=this;var showUnitPrice=this.getShowUnitPrice();var showTaxInfo=this.getShowTaxInfo();var ajaxEndpoint=new URL('/ajaxendpoint/redx/shopx/variant/'+activeVariantConfig.getKey()+'/price?showUnitPrice='+showUnitPrice+'&showTaxInfo='+showTaxInfo,window.location.origin);var priceElement=this.variantSelection.querySelector('.variant_price_container .variant_price');if(!priceElement.innerHTML){this.setPrice(" ",true);} 3372var spinnerContainer=this.variantSelection.querySelector('.variant_price_container .price-container');if(spinnerContainer){ShopxVariantSelection.showSpinnerOnElement(spinnerContainer);} 3373fetch(ajaxEndpoint).then(function(response){return response.json();}).then(function(responseData){if(responseData.status==='success'&&responseData.data.variant){var priceHtml=responseData.data.variant.html;priceElement.innerHTML=priceHtml;activeVariantConfig.setPriceHtml(priceHtml);} 3374else{var variantPriceContainer=_this.variantSelection.querySelector('.variant_price_container');if(variantPriceContainer){variantPriceContainer.style.display='none';}}});};ShopxVariantSelection.prototype.setPrice=function(price,generatePriceMarkup){if(generatePriceMarkup===void 0){generatePriceMarkup=false;} 3375var variantPriceContainer=this.variantSelection.querySelector('.variant_price_container');if(price){var variantPriceElement=variantPriceContainer.querySelector('.variant_price');if(variantPriceContainer){variantPriceContainer.style.display='';} 3376if(generatePriceMarkup){var priceContainer=document.createElement("div");priceContainer.classList.add('price-container');var priceElement=document.createElement("span");priceElement.classList.add('price');priceElement.innerHTML=price;priceContainer.appendChild(priceElement);var priceInfoContainer=variantPriceElement.querySelector('.price-info-container');if(priceInfoContainer){priceContainer.appendChild(priceInfoContainer);} 3377price=priceContainer.outerHTML;} 3378if(variantPriceElement){variantPriceElement.innerHTML=price;variantPriceElement.ariaLive='polite';variantPriceElement.ariaBusy='true';variantPriceElement.ariaBusy='false';} 3379var activeVariant=this._config.getActiveVariant();if(activeVariant&&activeVariant.isOnRequest()){var priceOnRequestElement=this.variantSelection.querySelector('.price-on-request-element');if(priceOnRequestElement){priceOnRequestElement.style.display='none';}}} 3380else{if(variantPriceContainer){variantPriceContainer.style.display='none';} 3381var activeVariant=this._config.getActiveVariant();if(activeVariant&&activeVariant.isOnRequest()){var priceOnRequestElement=this.variantSelection.querySelector('.price-on-request-element');if(priceOnRequestElement){priceOnRequestElement.style.display='block';}}}};ShopxVariantSelection.prototype.disableAndClearAttributes=function(nextAttribute){var _this=this;var attributes=this._config.getAttributes();var clearedAttributeName=this._config.getClearedAttributeName();this._config.updateSelectableVariantsForAdvancedVarSelector();var clearAndDisable=false;
3381xtxJs.forEach(attributes,function(attribute){var attributeName=attribute.getName();if(clearAndDisable){if(nextAttribute===attributeName){_this.updateInput(attributeName,'',false);_this.updateInputValues(attributeName,false);} 3382else{_this.updateInput(attributeName,'',true);_this._config.addDisabledAttribute(attributeName);}} 3383if(attributeName===clearedAttributeName){clearAndDisable=true;if(!nextAttribute){_this.updateInputValues(attributeName,false);}}});this._config.setActiveVariant(undefined);};ShopxVariantSelection.prototype.updateView=function(triggerSelectionChangedEvents_1){return __awaiter(this,arguments,void 0,function(triggerSelectionChangedEvents,activeVariantSet,isInitialUpdate){var nextAttribute,activeVariant,lastActiveVariant,formElement,isDetailPage,quantitySelector;if(activeVariantSet===void 0){activeVariantSet=false;} 3384if(isInitialUpdate===void 0){isInitialUpdate=false;} 3385return __generator(this,function(_a){switch(_a.label){case 0:nextAttribute='';if(!this._config.getIsVariantSelectionClear()&&this._config.getSelectableVariants().length===0){nextAttribute=this.getNextAttributeWhenOptionChanged();this._config.setVariantSelectionClear(true);} 3386if(!this._config.getIsVariantSelectionClear())return[3,1];this.updateAddToCartFormStati(true);this.setPrice('- â¬',true);if(this._config.useAdvancedVarSelector()){this.disableAndClearAttributes(nextAttribute);} 3387else{this.resetSelection();this._config.setActiveVariant(undefined);} 3388return[3,10];case 1:if(!this._config.useAdvancedVarSelector())return[3,2];this.updateViewForAdvancedVarSelector(activeVariantSet);return[3,10];case 2:activeVariant=this._config.getActiveVariant();if(!(typeof activeVariant!=='undefined'))return[3,7];lastActiveVariant=this._config.getLastActiveVariant();formElement=this.getVariantActionFormElement();isDetailPage=this._config.getRenderType()==='detail';if(!((activeVariant.isSubscribable()||(lastActiveVariant&&(lastActiveVariant.isSubscribable()!==activeVariant.isSubscribable())))&&formElement&&isDetailPage))return[3,3];this.loadVariantActionForm(activeVariant);return[3,6];case 3:if(!(!isInitialUpdate&&!isDetailPage))return[3,4];this.loadVariantActionForm(activeVariant);return[3,6];case 4:return[4,this.changeVariantActionForm()];case 5:_a.sent();if(formElement&&!isDetailPage){this.addVariantActionFormEventListener(formElement);} 3389_a.label=6;case 6:if(triggerSelectionChangedEvents&&this._config.getRenderType()==='detail'){document.addEventListener("xsites.thumbnavPic.initialized",(event)=>{this.dispatchVariantChangedEvent();});clearTimeout(this.variantChangedTimeout);this.variantChangedTimeout=window.setTimeout(function(){this.dispatchVariantChangedEvent();}.bind(this),100);} 3390return[3,9];case 7:return[4,this.resetActiveVariantView()];case 8:_a.sent();_a.label=9;case 9:quantitySelector=this.getQuantitySelectorElement();if(quantitySelector){quantitySelector.value=0;quantitySelector.value=1;} 3391_a.label=10;case 10:if(this.syncHeights){Redx_Sync_Handler.refreshSyncs();} 3392return[2];}});});};ShopxVariantSelection.prototype.getNextAttributeWhenOptionChanged=function(){var _this=this;var changedAttribute='';var nextAttribute='';xtxJs.forEach(this._config.getAttributes(),function(attribute){var attributeName=attribute.getName();if(changedAttribute&&nextAttribute){_this._config.addDisabledAttribute(attributeName);} 3393if(changedAttribute&&!nextAttribute){nextAttribute=attributeName;} 3394if(changedAttribute){_this._config.removeSelectedAttributeOption(attributeName);} 3395if(attribute.getSelected()){changedAttribute=attributeName;}});this._config.setClearedAttributeName(changedAttribute);return nextAttribute;};ShopxVariantSelection.prototype.dispatchVariantChangedEvent=function(){var variantChangedEventData={'shopx_products_var':this._config.getActiveVariant(),'last_shopx_products_var':this._config.getLastActiveVariant()};var variantChangedEvent=new CustomEvent('xsites.variantselection.changed',{bubbles:true,cancelable:true,detail:variantChangedEventData});document.dispatchEvent(variantChangedEvent);};ShopxVariantSelection.prototype.updateViewForAdvancedVarSelector=function(activeVariantSet){if(activeVariantSet===void 0){activeVariantSet=false;} 3396this.updateSelectedAttributesForActiveVariantValues(this._config.getSelectedAttributeOptions());var activeVariant=this._config.getActiveVariant();if(activeVariant){this.updateActiveVariantView(activeVariant,activeVariantSet).then();} 3397if(!activeVariantSet&&this._config.getRenderType()==='detail'){this.dispatchVariantChangedEvent();}};ShopxVariantSelection.prototype.updateActiveVariantView=function(activeVariant_1){return __awaiter(this,arguments,void 0,function(activeVariant,updateSelectedOptionsByVariant){var shopxProductsVarKeyInput,variantAddToCartContainer,quantitySelector,requestVariantButton,unitLabel,addToWishlistButton,variantDescriptionContainer,requestProductInput;if(updateSelectedOptionsByVariant===void 0){updateSelectedOptionsByVariant=true;} 3398return __generator(this,function(_a){switch(_a.label){case 0:shopxProductsVarKeyInput
3398=this.getShopxProductsVarKeyInputElement();variantAddToCartContainer=this.getAddToCartContainerElement();quantitySelector=this.getQuantitySelectorElement();requestVariantButton=this.getRequestVariantButtonElement();unitLabel=this.getUnitElement();addToWishlistButton=this.getAddToWishlistButtonElement();variantDescriptionContainer=this.getVariantDescriptionContainerElement();if(shopxProductsVarKeyInput){shopxProductsVarKeyInput.value=String(activeVariant.getKey());} 3399if(unitLabel){unitLabel.innerHTML=activeVariant.getUnit();} 3400if(variantAddToCartContainer){variantAddToCartContainer.style.display=activeVariant.isConfigurator()?'none':'';} 3401this.loadConfigurator(activeVariant,false,false);if(this.getCheckoutType()===1){this.loadSubscriptionPrice();} 3402else if(activeVariant.getPriceHtml()==='Get_Ajax_Price'){this.setPriceFromAjax(activeVariant);} 3403else{this.setPrice(activeVariant.getPriceHtml());} 3404if(addToWishlistButton){addToWishlistButton.setAttribute('data-variant-key',activeVariant.getKey().toString());} 3405if(variantDescriptionContainer){variantDescriptionContainer.innerHTML=activeVariant.getDescription();} 3406if(requestVariantButton){requestVariantButton.setAttribute('data-article-number',activeVariant.getArticleNumber());requestVariantButton.setAttribute('data-title-in-cart',activeVariant.getTitleInCart());} 3407if(this._config.getRenderType()==='detail'){requestProductInput=document.querySelector('.redx_form.form_product_request input[name="requested_product"]');if(requestProductInput){requestProductInput.value=requestProductInput.dataset.productTitle+' - '+activeVariant.getArticleNumber();}} 3408if(quantitySelector){if(activeVariant.getAvailability()===null){quantitySelector.maxValue=999;} 3409else if(activeVariant.getAvailability()>0){quantitySelector.maxValue=activeVariant.getAvailability();}} 3410this.showVariantOnRequestData(activeVariant.isOnRequest());this.updateAddToCartFormStati(activeVariant.isDisabled());this.showVariantMessages(activeVariant);return[4,this.showScalePriceHint(activeVariant)];case 1:_a.sent();if(updateSelectedOptionsByVariant){this.updateSelectedAttributesForActiveVariantValues(this._config.getVariantValues(activeVariant.getKey()));} 3411return[2];}});});};ShopxVariantSelection.prototype.resetActiveVariantView=function(){return __awaiter(this,void 0,void 0,function(){var shopxProductsVarKeyInput,variantAddToCartContainer,quantitySelector,requestVariantButton,unitLabel;return __generator(this,function(_a){switch(_a.label){case 0:shopxProductsVarKeyInput=this.getShopxProductsVarKeyInputElement();variantAddToCartContainer=this.getAddToCartContainerElement();quantitySelector=this.getQuantitySelectorElement();requestVariantButton=this.getRequestVariantButtonElement();unitLabel=this.getUnitElement();if(shopxProductsVarKeyInput){shopxProductsVarKeyInput.value='0';} 3412if(unitLabel){unitLabel.innerHTML='';} 3413if(variantAddToCartContainer){variantAddToCartContainer.style.display='none';} 3414if(requestVariantButton){requestVariantButton.setAttribute('data-article-number','');requestVariantButton.setAttribute('data-title-in-cart','');} 3415this.setPrice('');if(quantitySelector){quantitySelector.maxValue=999;} 3416this.updateAddToCartFormStati(true);this.showVariantMessages(undefined);return[4,this.showScalePriceHint(undefined)];case 1:_a.sent();this.updateSelectedAttributesForActiveVariantValues([]);return[2];}});});};ShopxVariantSelection.prototype.updateSelectedAttributesForActiveVariantValues=function(values){var _this=this;if(this._config.useAdvancedVarSelector()){this._config.setSelectedAttributeOptions([]);} 3417var disabledAttributes=this._config.getDisabledAttributes();xtxJs.forEach(this._config.getAttributes(),function(attribute,index){var activeValue=Object.keys(values).indexOf(attribute.getName())>-1?values[attribute.getName()]:'';var attributeName=attribute.getName();if(_this._config.useAdvancedVarSelector()){_this._config.updateSelectableVariantsForAdvancedVarSelector();var disabled=false;if(disabledAttributes.indexOf(attributeName)!==-1){disabled=true;} 3418_this.updateInput(attributeName,activeValue,disabled);_this.updateInputValues(attributeName,false,disabled);if(activeValue){_this._config.addSelectedAttributeOption(attributeName,activeValue);}} 3419else{if(attribute.getSelected()===false&&Array.from(_this._attributeInputs[attributeName]).length>0){_this.updateInput(attributeName,activeValue);_this.updateInputValues(attributeName,false);} 3420if(index===0&&_this._config.getActiveVariant()!==undefined){attribute.setSelected(true);}}});};ShopxVariantSelection.prototype.showVariantMessagesFromAjaxRequest=function(variant,messageContainer){var ajaxEndpoint=new URL('/ajaxendpoint/redx/shopx/variant/'+variant.getKey()+'/messages',window.location.origin);
3420if(messageContainer.childElementCount===0){var placeholderElement=document.createElement("div");placeholderElement.classList.add('redxStatusMessage','plain');placeholderElement.style.height='2rem';messageContainer.insertAdjacentElement('beforeend',placeholderElement);} 3421ShopxVariantSelection.showSpinnerOnElement(messageContainer.children[0]);fetch(ajaxEndpoint).then(function(response){return response.json();}).then(function(responseData){messageContainer.innerHTML='';if(responseData.status==='success'&&responseData.data.variant){xtxJs.forEach(responseData.data.variant.messages,function(message){var varMessage=VariantSelectionVariantMessage.create(message.type,message.message);messageContainer.insertAdjacentHTML('afterbegin',varMessage.getHtml());});} 3422Redx_Sync_Handler.refreshSyncs();});};ShopxVariantSelection.prototype.showVariantMessages=function(variant){var messageContainer=this.variantSelection.querySelector('.variant_messages_container');messageContainer.ariaLive='polite';if(variant){if(variant.areMessagesIncluded()){messageContainer.innerHTML='';xtxJs.forEach(variant.getMessages(),function(message){messageContainer.insertAdjacentHTML('beforeend',message.getHtml());});} 3423else{this.showVariantMessagesFromAjaxRequest(variant,messageContainer);} 3424messageContainer.ariaBusy='true';messageContainer.ariaBusy='false';} 3425else{messageContainer.innerHTML='';}};ShopxVariantSelection.prototype.showScalePriceHint=function(variant){return __awaiter(this,void 0,void 0,function(){var scalePriceHint,priceContainer,contentChangedEvent;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:scalePriceHint=this.variantSelection.querySelector('.variant_price_container .scale_price_hint');if(scalePriceHint){scalePriceHint.ariaLive='polite';scalePriceHint.innerHTML='';} 3426if(!(variant===undefined||variant.getScalePriceHint()===""))return[3,1];return[3,4];case 1:if(!(variant.getScalePriceHint()===undefined))return[3,3];return[4,fetch('/ajaxendpoint/shopx/scalepricehint/'+variant.getEncryptedId(),{headers:{'Cache-Control':'no-cache'}}).then(function(response){if(!response.ok){throw new Error('Error Load ScalePriceHint');} 3427return response.json();}).then(function(data){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:variant.setScalePriceHint(data.data.html);return[4,this.showScalePriceHint(variant)];case 1:_a.sent();redxModal.reInit();return[2];}});});}).catch(function(error){console.error('Error Load ScalePriceHint',error);})];case 2:_a.sent();return[3,4];case 3:priceContainer=this.variantSelection.querySelector('.variant_price_container');if(scalePriceHint){scalePriceHint.insertAdjacentHTML('beforeend',variant.getScalePriceHint());scalePriceHint.ariaBusy='true';scalePriceHint.ariaBusy='false';} 3428if(priceContainer){contentChangedEvent=new Event('xtx.content.changed',{bubbles:true,cancelable:true});priceContainer.dispatchEvent(contentChangedEvent);} 3429_a.label=4;case 4:return[2];}});});};ShopxVariantSelection.prototype.loadConfigurator=function(activeVariant,reload,reloadCurrentConfigurator){if(!this._config.getLoadConfigurator()||!activeVariant){return;} 3430var varChooserContainer=document.querySelector('#'+this.elementId);if(activeVariant.isConfigurator()){var configurator=document.querySelector('[data-configurator="'+activeVariant.getKey()+'"]');if(!configurator||reload){ShopxVariantSelection.loadConfiguratorFromBackend(varChooserContainer,this._config.getPageKey(),activeVariant.getKey(),null,reloadCurrentConfigurator);}} 3431else{xtxJs.eachElement('[data-configurator-part]',function(element){element.innerHTML="";element.classList.remove('initialized');element.setAttribute('data-configurator','');element.setAttribute('data-configurator-id','');});}};ShopxVariantSelection.prototype.updateInput=function(name,value,disable){var _this=this;if(disable===void 0){disable=false;} 3432if(this._attributeInputs[name][0].getAttribute('type')==='radio'){this._attributeInputs[name].checked=false;xtxJs.forEach(this._attributeInputs[name],function(input){input.checked=input.value.toString()===value.toString();_this.setDisabled(input,disable);});}
3433else{xtxJs.forEach(this._attributeInputs[name],function(input){input.value=String(value);_this.setDisabled(input,disable);});}};ShopxVariantSelection.prototype.setDisabled=function(input,disable){if(disable){input.setAttribute('disabled',"1");} 3434else if(input.hasAttribute('disabled')){input.removeAttribute('disabled');}};ShopxVariantSelection.prototype.resetSelection=function(){var _this=this;xtxJs.forEach(this._config.getAttributes(),function(attribute){_this.updateInputValues(attribute.getName(),true);});};ShopxVariantSelection.prototype.updateInputValues=function(name,enableAll,elementDisabled){var _this=this;if(elementDisabled===void 0){elementDisabled=false;} 3435var attribute=this._config.getAttribute(name);var availableValues=this.getAvailableValues(name);switch(attribute.getType()){case"dropdown_searchable":case"dropdown":var xtxSelect=this._attributeInputs[name][0];xtxWebComponents.ready(xtxSelect).then(function(xtxSelectElement){xtxSelectElement.options=xtxSelectElement.options.map(function(option){option.disabled=enableAll?false:_this.isOptionValueAvailable(option.value,availableValues);return option;});});break;case"radio_squares":xtxJs.forEach(this._attributeInputs[name],function(option){if(elementDisabled){option.disabled=true;} 3436else{option.disabled=(_this.isOptionValueAvailable(_this.getElementValue(option),availableValues)&&!enableAll);}});break;}};ShopxVariantSelection.prototype.getElementValue=function(element){if(element.options&&element.multiple){return element.options.filter(function(option){return option.selected;}).map(function(option){return option.value;});} 3437else{return element.value;}};ShopxVariantSelection.prototype.isNumber=function(value){return value&&value.match(/^[0-9]+$/)!==null;};ShopxVariantSelection.prototype.isOptionValueAvailable=function(optionValue,availableValues){return optionValue&&availableValues.indexOf(optionValue)===-1;};ShopxVariantSelection.prototype.getAvailableValues=function(attributeName){var _this=this;var availableValues=[];var selectableVariants=this._config.getSelectableVariants();if(selectableVariants.length>0){availableValues=selectableVariants.map(function(variant){var values=_this._config.getVariantValues(variant.getKey());return values[attributeName];}).filter(function(value){return typeof value!=='undefined';}).reduce(function(result,value){if(result.indexOf(value)===-1){result.push(String(value));} 3438return result;},[]);} 3439return availableValues;};ShopxVariantSelection.prototype.loadVariantActionForm=function(activeVariant){var _this=this;if(activeVariant&&activeVariant.getKey()){if(activeVariant.getActionFormHtml()===undefined){var spinnerContainer=this.getAddToCartContainerElement();ShopxVariantSelection.showSpinnerOnElement(spinnerContainer);fetch('/ajaxendpoint/redx/shopx/variant/'+activeVariant.getKey()+'/actionform').then(function(response){if(!response.ok){throw new Error('Error Load Variant-Action-Form');} 3440return response.json();}).then(function(data){activeVariant.setActionFormHtml(data.data.html);_this.updateVariantActionForm(activeVariant);}).catch(function(error){console.error('Error Load VariantActionForm',error);});ShopxVariantSelection.hideSpinnerOnElement(spinnerContainer);} 3441else{this.updateVariantActionForm(activeVariant);}}};ShopxVariantSelection.prototype.updateVariantActionForm=function(activeVariant){var variantAddToCartContainer=this.getAddToCartContainerElement();variantAddToCartContainer.innerHTML=activeVariant.getActionFormHtml();var formElement=this.getVariantActionFormElement();if(formElement&&!formElement.classList.contains('initialized-action-form')){this.addVariantActionFormEventListener(formElement);RedxShopxVariantActionFormController.initializeRedxShopxVariantActionFormControllerInElement(formElement.parentElement);}};ShopxVariantSelection.prototype.changeVariantActionForm=function(){return __awaiter(this,void 0,void 0,function(){var activeVariant;return __generator(this,function(_a){switch(_a.label){case 0:activeVariant=this._config.getActiveVariant();if(!(activeVariant!==undefined))return[3,2];return[4,this.updateActiveVariantView(activeVariant)];case 1:_a.sent();_a.label=2;case 2:return[2];}});});};ShopxVariantSelection.prototype.loadSubscriptionPrice=function(){var _this=this;var formElement=this.getVariantActionFormElement();if(formElement){var formData=new FormData(formElement);var spinnerContainer_1=xtxJs.getElement('.variant_price_container');ShopxVariantSelection.showSpinnerOnElement(spinnerContainer_1);var quantityRaw=formData.get('quantity');var quantity=quantityRaw?parseInt(quantityRaw.toString()):1;var requestData={productsVarKey:parseInt(String(formData.get('shopx_products_var_key'))),quantity:quantity,intervalKey:parseInt(String(formData.get('intervalKey'))),contractTermMonths:parseInt(String(formData.get('contractTermMonths'))),showUnitPrice:this.getShowUnitPrice(),showTaxInfo:this.getShowTaxInfo()};fetch('/ajaxendpoint/redx/shopx/subscription/price',{method:'POST',headers:{'Content-Type':'application/json','Cache-Control':'no-cache'},body:JSON.stringify(requestData)}).then(function(response){if(!response.ok){throw new Error('Error Load Variant-Action-F
3441orm');} 3442return response.json();}).then(function(data){_this.setPrice(data.data.priceHtml);ShopxVariantSelection.hideSpinnerOnElement(spinnerContainer_1);}).catch(function(error){console.error('Error Load Subscription-Price',error);ShopxVariantSelection.hideSpinnerOnElement(spinnerContainer_1);});}};ShopxVariantSelection.prototype.getShowUnitPrice=function(){return parseInt(this.variantSelection.dataset.shopxVariantShowUnitPrice);};ShopxVariantSelection.prototype.getShowTaxInfo=function(){return parseInt(this.variantSelection.dataset.shopxVariantShowTaxInfo);};ShopxVariantSelection.prototype.getCheckoutType=function(){try{var checkoutTypeInput=xtxJs.getElement('[name="checkoutType"]',this.variantSelection);return parseInt(checkoutTypeInput.value);} 3443catch(error){return 0;}};ShopxVariantSelection.prototype.getVariantActionFormElement=function(){try{return xtxJs.getElement('form[name="variant-action-form"]',this.variantSelection);} 3444catch(error){return null;}};ShopxVariantSelection.prototype.getShopxProductsVarKeyInputElement=function(){try{return xtxJs.getElement('input[name="shopx_products_var_key"]',this.variantSelection);} 3445catch(error){return null;}};ShopxVariantSelection.prototype.getAddToCartContainerElement=function(){try{return xtxJs.getElement('.variant_addtocart_container',this.variantSelection);} 3446catch(error){return null;}};ShopxVariantSelection.prototype.getQuantitySelectorElement=function(){try{return xtxJs.getElement('.quantity_wrapper xtx-quantity-selector',this.variantSelection);} 3447catch(error){return null;}};ShopxVariantSelection.prototype.getRequestVariantButtonElement=function(){try{return xtxJs.getElement('.variant_addtocart_container button[name="request_variant"]',this.variantSelection);} 3448catch(error){return null;}};ShopxVariantSelection.prototype.getUnitElement=function(){try{return xtxJs.getElement('.unit',this.variantSelection);} 3449catch(error){return null;}};ShopxVariantSelection.prototype.getAddToWishlistButtonElement=function(){try{return xtxJs.getElement('.addToWishlistButton',this.variantSelection);} 3450catch(error){return null;}};ShopxVariantSelection.prototype.getVariantDescriptionContainerElement=function(){try{return xtxJs.getElement('.variant_description_container',this.variantSelection);} 3451catch(error){return null;}};ShopxVariantSelection.prototype.disableSubmitButtonIfFormActionEmpty=function(addToCartFormElement){if(!addToCartFormElement.getAttribute('action')){this.updateAddToCartFormStati(true);}};ShopxVariantSelection.prototype.initImageGalleryEventsForDetailView=function(){var _this=this;if(this._config.getRenderType()==='detail'){document.addEventListener('xsites.thumbnavPic.initialized',function(event){_this.dispatchVariantChangedEvent();});this.dispatchVariantChangedEvent();}};ShopxVariantSelection.instances={length:0,objects:{}};ShopxVariantSelection.showSpinnerOnElement=function(element){if(window['cart']!==undefined){window['cart'].showSpinnerOnElement(element);}};ShopxVariantSelection.hideSpinnerOnElement=function(element){if(element&&window['cart']!==undefined){window['cart'].hideSpinnerOnElement(element);}};return ShopxVariantSelection;}()); 3452 3453var AnalyticsTracker=function(){function initExternalLinkTracking(){if(isGoogleAnalyticsEnabled()||isGoogleTagmanagerEnabled()){jQuery("a[href^='http']").on("click",function(){AnalyticsTracker.trackEvent(jQuery(this));});}} 3454function getExternalLinkRegExp(){return new RegExp("^[^\/|mailto|tel]","i");} 3455function isGoogleAnalyticsEnabled(){return typeof window.ga!=='undefined';} 3456function isGoogleTagmanagerEnabled(){return typeof window.dataLayer!=='undefined';} 3457return{init:function(){initExternalLinkTracking();},trackEvent:function(linkObj){if(isGoogleAnalyticsEnabled()||isGoogleTagmanagerEnabled()){var eventLabel=linkObj.attr('href').replace(/^mailto:/i,'').replace(/^tel:/,'');var event="other";if(/^mailto:/i.test(linkObj.attr('href'))){event="mailto";}else if(/^tel:/i.test(linkObj.attr('href'))){event="tel";}else if(AnalyticsTracker.isExternalLink(linkObj.attr('href'))){event="extern";} 3458if(isGoogleTagmanagerEnabled()){window.dataLayer.push({'event':'trackEvent','eventCategory':event,'eventAction':'click','eventLabel':eventLabel});}else{window.ga('send',{hitType:'event',eventCategory:event,eventAction:'click',eventLabel:eventLabel});}}},trackAnchorPageView:function(anchorObj){if(isGoogleAnalyticsEnabled()||isGoogleTagmanagerEnabled()){var loc=null;if(/^\/?#/.match(anchorObj.attr("href"))){loc=location.pathname;if(location.pathname=="/"){loc="/de/index.html";}} 3459AnalyticsTracker.trackPageView((loc?loc:'')+anchorObj.attr("href"));}},trackPageView:function(href){if(isGoogleTagmanagerEnabled()){window.dataLayer.push({'event':'trackVirtualPageview','virtualPageViewUrl':href});}else if(isGoogleAnalyticsEnabled()){window.ga('send',{hitType:'pageview',page:href});}},isExternalLink:function(href){return getExternalLinkRegExp().test(href);}}}(); 3460 3461var App=function(){function dispatchAppInitEvent(){let event=new Event('xtx.app.initialized',{bubbles:true,cancelable:true});document.dispatchEvent(event);} 3462function setScrollbarWidth(){let width=window.innerWidth-document.documentElement.clientWidth;document.documentElement.style.setProperty("--scrollbarWidth",width+"px");} 3463function handleFirstAnchorScrollingAfterAnimationInitialisation(){let scrollToAnchorAfterAnimationInitialisation=()=>{window.addEventListener('xtx.scrolling.smooth-anchor.scroll.stop',(event)=>{let timeout=0;let target=event.target;let closestAnimation=target.closest('[data-redx-animation]');if(closestAnimation){let computedStyles=window.getComputedStyle(closestAnimation);let transitionDuration=App.getLargestDuration(computedStyles.transitionDuration);let transitionDelay=App.getLargestDuration(computedStyles.transitionDelay);timeout=transitionDuration+transitionDelay;} 3464window.setTimeout(()=>{target.dispatchEvent(new Event('xtx.scrolling.smooth-anchor.scroll-to',{bubbles:true,cancelable:true}));},timeout*1000);},{once:true});};if(typeof window['RedxAnimationController']!=='undefined'){scrollToAnchorAfterAnimationInitialisation();}else{window.addEventListener('xtx.redx.animation.controller.loaded',()=>{scrollToAnchorAfterAnimationInitialisation();});}}
3465function getBreakPointSmall(){return parseInt(document.body.dataset.breakpointSmall);} 3466function getBreakPointLarge(){return parseInt(document.body.dataset.breakpointLarge);} 3467function getBreakPointXLarge(){return parseInt(document.body.dataset.breakpointXlarge);} 3468function initDataNavSpinner(){let scrollToDataNavigatorAnchor=(event)=>{if(event.detail.anchor){let dataNavigatorList=document.querySelector("a[name='"+event.detail.anchor+"'], #"+event.detail.anchor);if(dataNavigatorList){let dataNavigatorAnchor;let previousElement=dataNavigatorList.previousElementSibling;if(previousElement&&previousElement.classList.contains('dataNavigatorAnchor')){dataNavigatorAnchor=previousElement;}else{dataNavigatorAnchor=document.createElement('div');dataNavigatorAnchor.classList.add('dataNavigatorAnchor');dataNavigatorList.insertAdjacentElement('beforebegin',dataNavigatorAnchor);} 3469App.scrollToElement(dataNavigatorAnchor);}}} 3470document.addEventListener("xtx-datanavigator-navigate",scrollToDataNavigatorAnchor);document.addEventListener("xtx-datanavigator-navigated",scrollToDataNavigatorAnchor);} 3471function scrollToElement(element){if(element instanceof jQuery){element=element[0];} 3472if(element){let event=new Event('xtx.scrolling.smooth-anchor.scroll-to',{bubbles:true,cancelable:true});element.dispatchEvent(event);}} 3473function prepareSquareBoxThemes(){var redxThemeClassName="RedxThemeEqualWidthHeight";Array.prototype.forEach.call(document.querySelectorAll("div[class*='"+redxThemeClassName+"']"),function(themeDiv){var classNames=themeDiv.className.split(" ");var regExp=new RegExp("^[a-z]+"+redxThemeClassName,"i");classNames.forEach(function(className){if(regExp.match(className)){themeDiv.parentNode.classList.add(className+"ParentContainer");}});});} 3474function prepareContentAreaBorderRadiusThemes(){var redxThemeClassName="RedxThemeBorderRadius";Array.prototype.forEach.call(document.querySelectorAll(".RedxGridColumn > div[class*='"+redxThemeClassName+"']"),function(themeDiv){var regExp=new RegExp("^[a-z]+"+redxThemeClassName,"i");themeDiv.classList.forEach(function(className){if(regExp.match(className)){themeDiv.parentNode.classList.add(className);}});});} 3475return{init:function(){initDataNavSpinner();initStickyBottomThemeObserver();initAccordionPresentationContentLinkOpenedEventListener();prepareSquareBoxThemes();prepareContentAreaBorderRadiusThemes();dispatchAppInitEvent();setScrollbarWidth();handleFirstAnchorScrollingAfterAnimationInitialisation();xtxJs.onResize(function(){setScrollbarWidth();});},initAnchorLinks:function(){jQuery("a[href^='#'], a[href^='tel'], a[href^='mailto'], header .nav li a.onepager-link, a[href^='"+window.location.pathname+"#']").on("click",function(event){if(!(jQuery(this).hasClass("presentationAccordionAnchor")||jQuery(this).hasClass("headerLink"))){let anchorId=jQuery(this)[0].hash;if(anchorId){anchorId="a"+anchorId;if(jQuery(anchorId).length>0){event.preventDefault();scrollToAnchor(anchorId);AnalyticsTracker.trackAnchorPageView(jQuery(this));return false;}}else if(!AnalyticsTracker.isExternalLink(jQuery(this).attr("href"))){AnalyticsTracker.trackEvent(jQuery(this));}} 3476return true;});},initDataNavSpinner:function(){initDataNavSpinner();},setLoadingSpinnerOnElement:function(element,size){jQuery(element).prepend("<span class='loading_spinner_wrapper'><span class='loading_spinner "+size+"'><span></span><span></span><span></span></span></span>");},removeLoadingSpinnerFromElement:function(element){jQuery(element).find(".loading_spinner_wrapper").remove();},prepareSquareBoxThemes:function(){prepareSquareBoxThemes();},prepareContentAreaBorderRadiusThemes:function(){prepareContentAreaBorderRadiusThemes();},scrollToElement:function(element){scrollToElement(element);},initRequestProductButtons:function(buttonSelector,formSelector){if(!formSelector){formSelector='.redx_form.form_product_request';} 3477jQuery(buttonSelector).each(function(index,element){if(jQuery(formSelector).length>0){jQuery(element).show();jQuery(element).unbind('click').on('click',function(){var input=jQuery(formSelector+' input[name=\"requested_product\"]');var articleNumber=jQuery(this).attr("data-article-number");var variantTitle=jQuery(this).attr("data-title-in-cart");jQuery(input).val(jQuery(input).data('product-title'));if(variantTitle!==undefined&&variantTitle!==""){jQuery(input).val(jQuery(input).val()+' - '+variantTitle);}else if(articleNumber!==undefined&&articleNumber!==""){jQuery(input).val(jQuery(input).val()+' - '+articleNumber);} 3478jQuery('html, body').animate({scrollTop:jQuery(formSelector).offset().top-150},1000);});}});},pushPagingHistoryState:function(limitStart,optParamString,anchorId){var pageRowElement=optParamString.match(/(page_row_element=[0-9]+)/);window.history.pushState({},null,'?limitstart='+limitStart+(pageRowElement?'&'+pageRowElement[0]:'')+(anchorId?'#'+anchorId:''));},getActiveResolutionOnScreen:function(){var breakpoints={};var activeResolution=null;if(document.body.dataset.resolutions){var resolutions=document.body.dataset.resolutions.split(";");resolutions.forEach(function(resolution){breakpoints[document.body.getAttribute("data-breakpoint-"+resolution.toLowerCase())]=resolution;});var orderedBreakPoints=Object.keys(breakpoints).sort(function(a,b){return parseInt(a)>parseInt(b);});
3478orderedBreakPoints.forEach(function(breakpoint,index,arr){if(window.innerWidth>=parseInt(breakpoint)){activeResolution=breakpoints[breakpoint];}});if(activeResolution===null){activeResolution=breakpoints[orderedBreakPoints.shift()];}} 3479return activeResolution;},initCookieOverlayOpenLinks:()=>{const linkSelector='[data-cookie-overlay-open], .xtxCookieOverlayOpen, [data-cookie-overlay-open-settings], '+'.xtxCookieOverlayOpenSettings, [data-cookie-overlay-open-history], .xtxCookieOverlayOpenHistory, #cookie-disallowed-overlay-template' 3480let eventListener=(event)=>{initCookiePopup(event.target);if(document.body.classList.contains('cookieOverlayLinksInitialized')){window.removeEventListener('xtx.content.changed',eventListener);}};let initCookiePopup=(element)=>{if(!document.body.classList.contains('cookieOverlayLinksInitialized')&&element.querySelector(linkSelector)){new redxCookiePolicy({autoOpen:false});let lang=document.body.dataset.lang;redxCookiePolicy.showPolicy(lang);document.body.classList.add('cookieOverlayLinksInitialized');}};initCookiePopup(document);window.addEventListener('xtx.content.changed',eventListener);},getLargestDuration:(duration)=>{let values=duration.split(', ');let numericValues=values.map(rawValue=>{return parseFloat(rawValue);});return Math.max(...numericValues);}};}();App.resizeTimer=null;App.orientationChangeTimer=null;var initMasonryBlockGrid=function(){jQuery("div[class*='RedxThemeMasonryBlockGrid'] .RedxBlockGrid:not(.initialized), div[class*='RedxThemeMasonryBlockGrid'].RedxBlockGrid:not(.initialized), .flexGrid.masonry:not(.initialized)").each(function(){var grid;if(jQuery(this).hasClass("flexGrid")){grid=jQuery(this).find(".masonryGridContainer").masonry({itemSelector:".flexListEntry",columnWidth:".flexListEntry",transitionDuration:0});}else{grid=jQuery(this).masonry({itemSelector:".RedxBlockGridChild",columnWidth:".RedxBlockGridChild",transitionDuration:0});} 3481grid.on('layoutComplete',function(event,laidOutItems){grid.addClass("initialized");});grid.imagesLoaded().progress(function(){grid.masonry('layout');});document.addEventListener('xtx.infiniteScroller.moreEntries.loaded',function(e){grid.masonry('reloadItems');grid.masonry();},false);});document.addEventListener('xsites.masonry.reload',()=>{window.setTimeout(initMasonryBlockGrid,300);}) 3482document.addEventListener('xsites.fixedcontent.loaded',function(e){window.setTimeout(initMasonryBlockGrid,300);});};let scrollToAnchor=(anchorId)=>{let anchor=null;try{anchor=document.querySelector(anchorId);}catch(e){} 3483if(!anchor){anchor=document.querySelector("a[name='"+anchorId.replace(/^a?#/,'')+"']");} 3484if(anchor){let presentationToggleWrapper=anchor.closest(".content-presentation-toggle");if(presentationToggleWrapper>0&&!presentationToggleWrapper.hasClass("open")){Redx_Presentation_Toggle_Controller.getInstance().togglePresentationToggle(presentationToggleWrapper,presentationToggleWrapper.find('.presentationToggleContent'),500);} 3485if(window.navigation){window.navigation.closeNavigation(false);} 3486anchor.focus({preventScroll:true});if(document.activeElement!==anchor&&!anchor.hasAttribute('tabindex')){anchor.tabIndex=-1;anchor.focus({preventScroll:true});} 3487App.scrollToElement(anchor);let match=anchorId.match("#(.*)");if(match.length>1){if(history&&history.replaceState){history.replaceState(null,null,"#"+match[1]);}else{window.location.hash=match[1];}}}};jQuery(document).ready(function(){App.init();App.initRequestProductButtons('.btn_request_variant');AnalyticsTracker.init();});window.addEventListener('load',()=>{initOverflowedTables();initMasonryBlockGrid();document.addEventListener('xtx-datanavigator-navigated',function(e){initMasonryBlockGrid();},false);initBlogCategoryTabs();});window.addEventListener('orientationchange',()=>{clearTimeout(App.orientationChangeTimer);App.orientationChangeTimer=setTimeout(()=>{window.scrollTo({'left':0});},500);});let initOverflowedTables=()=>{xtxJs.eachElement('table.flexible-table, table.table',(table)=>{let element=document.createElement('xtx-content-scroll');table.insertAdjacentElement('beforebegin',element);element.appendChild(table);});};let initBlogCategoryTabs=()=>{let initCagegoryTabs=(element)=>{if(element.classList.contains('blogCategoryTabsContentScroll')){let activeElement=element.querySelector('.active');if(activeElement){element.scrollToElement(activeElement);}}};xtxJs.eachElement('.blogCategoryTabsContentScroll',function(element){initCagegoryTabs(element);});window.addEventListener('xtx.component.initialized',(event)=>{initCagegoryTabs(event.target);});} 3488let initAccordionPresentationContentLinkOpenedEventListener=()=>{let header=document.querySelector('header');window.addEventListener('xtx.presentation.accordion.scrolled.to.open.from.link',(event)=>{let targetElementTop=parseInt(event.target.getBoundingClientRect().top);let headerHeight=parseInt(header.getBoundingClientRect().height.toString());
3488if(targetElementTop<headerHeight){if(document.documentElement.classList.contains('header-fixed-show')){document.documentElement.classList.add('header-fixed-hide');document.documentElement.classList.remove('header-fixed-show');}}});} 3489let initStickyBottomThemeObserver=()=>{let observer=null;let initThemeObserver=(element)=>{let themeElements=element.querySelectorAll('.RedxThemePositionStickyBottom:not(.observingSticky)');if(themeElements.length>0){if(!observer){observer=new IntersectionObserver(([entry])=>entry.target.classList.toggle('elementSticky',entry.intersectionRatio<1),{threshold:[1]});} 3490themeElements.forEach(element=>{observer.observe(element);element.classList.add('observingSticky');});}};initThemeObserver(document);window.addEventListener('xtx.content.changed',(event)=>{initThemeObserver(event.target);});} 3491(function(){document.addEventListener('click',(event)=>{const openSettingsElement=event.target.closest('[data-cookie-overlay-open-settings], .xtxCookieOverlayOpenSettings');if(openSettingsElement){let cookieCategory=openSettingsElement.dataset.acceptCookieCategory;if(cookieCategory){document.addEventListener('xtx.cookie.policy.link.click',()=>{const categoryCheckbox=document.querySelector(`.xtx-privacy-cookie-settings-category-checkbox input[value="${cookieCategory}"]`);if(categoryCheckbox){categoryCheckbox.checked=true;}},{once:true});}}},{capture:true});document.addEventListener('mousedown',(event)=>{const saveSettingsElement=event.target.closest('[data-cookie-overlay-save]');if(saveSettingsElement){const checkedCategories=xtxJs.getElements(".xtx-privacy-cookie-settings-category-checkbox input:checked");let values=[];xtxJs.forEach(checkedCategories,(element)=>{values.push(element.value);});if(!saveSettingsElement.dataset.title){saveSettingsElement.dataset.title=saveSettingsElement.dataset.sstTitle;} 3492saveSettingsElement.dataset.sstTitle=`${saveSettingsElement.dataset.title}:${values.join(', ')}`;}},{capture:true});window.addEventListener('xtx.cookie.policy.store.success',(event)=>{const acceptedCategories=event.detail.categories;if(typeof gtag==='function'){const allCategories=event.detail.allCategories;let consentLevels={};allCategories.forEach((category)=>{consentLevels[category]=acceptedCategories.includes(category)?'1':'0';});gtag({consentLevels});let marketingCookieAllowed=acceptedCategories.includes('marketing')?'granted':'denied';gtag('consent','update',{'ad_storage':marketingCookieAllowed,'ad_user_data':marketingCookieAllowed,'ad_personalization':marketingCookieAllowed,'analytics_storage':acceptedCategories.includes('statistics')?'granted':'denied','functionality_storage':marketingCookieAllowed,'personalization_storage':marketingCookieAllowed,'security_storage':marketingCookieAllowed});if(acceptedCategories.includes('marketing')){gtag({"cookiePolicy":'accepted'});}else{gtag({"cookiePolicy":'declined'});gtag({"marketingCookiesLifetime":3600});}} 3493acceptedCategories.forEach((category)=>{let codeSnippetElements=document.querySelectorAll(`template[data-cookie-category="${category}"]`);if(codeSnippetElements.length>0){codeSnippetElements.forEach(element=>{if(element.nextElementSibling&&element.nextElementSibling.classList.contains('cookieDisallowedOverlayBackground')){element.nextElementSibling.remove();} 3494let snippetElement=element.content.cloneNode(true);element.after(snippetElement);element.remove();});}});if(acceptedCategories.includes('functional')){let videoElements=document.querySelectorAll('xtx-video[disable-require-external-resources]');videoElements.forEach(element=>{const parentElement=element.parentElement;element.removeAttribute('disable-require-external-resources');if(parentElement.classList.contains('videoOverlayContainer')){parentElement.classList.remove('videoOverlayContainer');parentElement.firstElementChild.remove();}});window.dispatchEvent(new Event('functionalCookieCategoryAllowed',{bubbles:true,cancelable:true}));let galleryVideoElements=document.querySelectorAll('.gallery-item.video-item [data-disable-external-resources]');galleryVideoElements.forEach(element=>{element.removeAttribute('data-disable-external-resources');});let bgVideoElements=document.querySelectorAll('div[disable-require-external-resources]');
3494bgVideoElements.forEach(element=>{element.removeAttribute('disable-require-external-resources');element.setAttribute('data-background-video','');});let instagramFeeds=document.querySelectorAll('.instagramFeed');instagramFeeds.forEach(instagramFeed=>{let instagramFeedGallery=instagramFeed.querySelector('.instagramGallery');instagramFeedGallery.style.display='flex';let imgElements=instagramFeedGallery.querySelectorAll('[img-src]') 3495imgElements.forEach(imgElement=>{let imgSrcValue=imgElement.getAttribute('img-src');imgElement.setAttribute('src',imgSrcValue);imgElement.removeAttribute('img-src');});let cookieOverlayElement=instagramFeed.querySelector('.cookieDisallowedOverlay');if(cookieOverlayElement){cookieOverlayElement.remove();}});}});})();RegExp.prototype.match=function(value){return value.match(this);};Element.prototype.getWidth=function(){return this.offsetWidth;};Element.prototype.getHeight=function(){return this.offsetHeight;}; 3496RedxDataNavigator.instance = undefined; 3497 3498RedxDataNavigator.getInstance = function() { 3499 if (RedxDataNavigator.instance === undefined) { 3500 RedxDataNavigator.instance = new RedxDataNavigator(); 3501 } 3502 return RedxDataNavigator.instance; 3503}; 3504 3505function RedxDataNavigator() { 3506 this.init = function() { 3507 this.initClickEventHandler(); 3508 this.initHistoryPopStateEventHandler(); 3509 this.initFitNavigationButtonsHandler(); 3510 this.fitNavigator(); 3511 }; 3512 3513 this.navigate = function(ajaxContainerId, ajaxEndpoint, limitStart, optEnv, anchor, onSuccess, onError, focusFirstNewElement = true) { 3514 if (typeof fetch !== "undefined" && ajaxEndpoint) { 3515 3516 let loadingObj = new Redx_Ajax_Action_LoadingAnimation(); 3517 let mappingObj = document.getElementById(ajaxContainerId); 3518 let loadingBoxId = ajaxContainerId + '_loading_box'; 3519 loadingObj.showLoadingBox(mappingObj, loadingBoxId, loadingObj.initOptionsDefaults({})); 3520 3521 function addParameterToURL(url, param) { 3522 url += (url.split('?')[1] ? '&' : '?') + param; 3523 return url; 3524 } 3525 3526 let url = ajaxEndpoint; 3527 if (limitStart !== undefined || optEnv !== undefined) { 3528 if (limitStart !== undefined) { 3529 url = addParameterToURL(url, "limitstart=" + limitStart); 3530 } 3531 if (optEnv !== undefined) { 3532 url = addParameterToURL(url, optEnv); 3533 } 3534 } 3535 3536 RedxDataNavigator.getInstance().triggerNavigateEvent(anchor); 3537 3538 response = fetch(new Request(url), { 3539 method: "GET", 3540 headers: { 3541 'Accept': 'application/json', 3542 'Content-Type': 'application/json' 3543 }, 3544 }).then(function(response) { 3545 if (response.ok) { 3546 response.json().then(function(data) { 3547 let containerElement = document.getElementById(ajaxContainerId); 3548 let insertContainer = containerElement.querySelector('[data-datanavigator-insert-container]'); 3549 if (insertContainer) { 3550 insertContainer.innerHTML = data.data.content.trim(); 3551 } else { 3552 insertContainer = document.createElement("div"); 3553 insertContainer.innerHTML = data.data.content.trim(); 3554 insertContainer = insertContainer.firstChild; 3555 containerElement.replaceWith(insertContainer); 3556 } 3557 3558 loadingObj.hideLoadingBox(loadingBoxId); 3559 if (typeof onSuccess === "function") { 3560 onSuccess(); 3561 } 3562 3563 RedxDataNavigator.getInstance().fitNavigator(); 3564 RedxDataNavigator.getInstance().trackPageView(); 3565 RedxDataNavigator.getInstance().triggerNavigatedEvent(anchor); 3566 3567 // Muss am Ende aufgerufen werden, weil sonst Störer-Elemente noch nicht korrekt positioniert sind 3568 RedxDataNavigator.getInstance().handleA11yInContainer(insertContainer, focusFirstNewElement); 3569 }).catch(function(error) { 3570 loadingObj.hideLoadingBox(loadingBoxId); 3571 if (typeof onError === "function") { 3572 onError(); 3573 } else { 3574 console.error(error); 3575 } 3576 }); 3577 } 3578 }); 3579 } 3580 }; 3581 3582 this.handleA11yInContainer = (container, focusFirstNewElement) => { 3583 if (focusFirstNewElement) { 3584 let firstNewElement = container.querySelector('.RedxBlockGridChild, .flexListEntry'); 3585 3586 if (firstNewElement) { 3587 let firstFocusableElement = firstNewElement.querySelector('a, button'); 3588 3589 // Falls erstes neues Element keinen Link oder Button enthällt, dann gesamtes Element fokussieren 3590 if (!firstFocusableElement) { 3591 firstFocusableElement = firstNewElement; 3592 firstFocusableElement.setAttribute('tabindex', '-1'); 3593 } 3594 3595 firstFocusableElement.focus({ preventScroll: true }); 3596 } 3597 } 3598 3599 container.ariaLive = 'polite'; 3600 container.ariaBusy = true; 3601 container.ariaBusy = false;
3602 } 3603 3604 this.trackPageView = function() { 3605 if (typeof Redx_Analytics !== "undefined") { 3606 Redx_Analytics.getInstance().sendVirtualPageView(Redx_Analytics_Event_VirtualPageView.create(window.location.pathname + window.location.search)); 3607 } 3608 }; 3609 3610 this.triggerNavigateEvent = function(anchor) { 3611 let event = new CustomEvent('xtx-datanavigator-navigate', { 3612 bubbles: false, 3613 cancelable: false, 3614 detail: { 3615 anchor: anchor 3616 } 3617 }); 3618 document.dispatchEvent(event); 3619 }; 3620 3621 this.triggerNavigatedEvent = function(anchor) { 3622 let event = new CustomEvent('xtx-datanavigator-navigated', { 3623 bubbles: false, 3624 cancelable: false, 3625 detail: { 3626 anchor: anchor 3627 } 3628 }); 3629 document.dispatchEvent(event); 3630 }; 3631 3632 this.initClickEventHandler = function() { 3633 document.documentElement.addEventListener('click', (function(event) { 3634 if (event.target.parentNode 3635 && event.target.parentNode.classList 3636 && (event.target.parentNode.classList.contains('page-item') 3637 || "limitstart" in event.target.dataset)) { 3638 let limitStart = event.target.dataset.limitstart; 3639 let datanavigator = event.target.parentNode; 3640 let href = event.target.href; 3641 3642 while (!datanavigator.classList.contains('xtx-datanavigator')) { 3643 datanavigator = datanavigator.parentNode; 3644 } 3645 3646 let containerId = datanavigator.dataset.ajaxContainerId; 3647 let optEnv = datanavigator.dataset.optEnv; 3648 3649 if (typeof fetch !== "undefined" && datanavigator.dataset.ajaxEnabled && datanavigator.dataset.ajaxEndpoint) { 3650 let url = datanavigator.dataset.ajaxEndpoint; 3651 let anchor = datanavigator.dataset.anchor; 3652 let historyState = {dataNavigatorContainerId: containerId, ajaxEndpoint: url, optEnv: optEnv, anchor: anchor}; 3653 3654 if (window.history) { 3655 let activePage = datanavigator.querySelector(".page-item.active a"); 3656 window.history.replaceState(Object.assign(historyState, {limitstart: activePage.dataset.limitstart}), ""); 3657 } 3658 3659 RedxDataNavigator.getInstance().navigate(containerId, url, limitStart, optEnv, anchor, function() { 3660 if (href && window.history) { 3661 window.history.pushState(historyState, "", href); 3662 } 3663 }.bind(null, {historyState: Object.assign(historyState, {limitstart: limitStart}), href: href})); 3664 3665 event.preventDefault(); 3666 return false; 3667 } 3668 } 3669 })); 3670 }; 3671 3672 this.initHistoryPopStateEventHandler = function() { 3673 window.addEventListener("popstate", function(event) { 3674 if (event.state && event.state.dataNavigatorContainerId) { 3675 RedxDataNavigator.getInstance().navigate(event.state.dataNavigatorContainerId, event.state.ajaxEndpoint, event.state.limitstart, event.state.optEnv, event.state.anchor); 3676 } 3677 }); 3678 }; 3679 3680 this.initFitNavigationButtonsHandler = function() { 3681 document.addEventListener("DOMContentLoaded", RedxDataNavigator.getInstance().fitNavigator); 3682 3683 xtxJs.onResize((prevWidth, prevHeight, currentWidth, currentHeight) => { 3684 if (prevWidth !== currentWidth) { 3685 window.requestAnimationFrame(() => { 3686 RedxDataNavigator.getInstance().fitNavigator(); 3687 }); 3688 } 3689 }); 3690 } 3691 3692 this.fitNavigator = function() { 3693 document.querySelectorAll(".xtx-datanavigator").forEach(function(dataNavigator) { 3694 let beforeItems = []; 3695 let afterItems = []; 3696 let isBeforeActive = true; 3697 let widthNavButtons = 0; 3698 3699 dataNavigator.querySelectorAll("ul li").forEach(function(listItem) { 3700 listItem.style.display = ""; 3701 3702 if (!listItem.classList.contains("next") 3703 && !listItem.classList.contains("prev") 3704 && !listItem.classList.contains("empty-item") 3705 && !listItem.classList.contains("active") 3706 && !listItem.classList.contains("first") 3707 && !listItem.classList.contains("last")) { 3708 if (isBeforeActive) { 3709 beforeItems.push(listItem); 3710 } else { 3711 afterItems.push(listItem); 3712 } 3713 } 3714 3715 widthNavButtons += listItem.offsetWidth + (parseInt(window.getComputedStyle(listItem).marginRight) || 0); 3716 3717 if (listItem.classList.contains("active")) { 3718 isBeforeActive = false;
3719 } 3720 }); 3721 3722 afterItems = afterItems.reverse(); 3723 3724 while (widthNavButtons >= dataNavigator.offsetWidth) { 3725 beforeItems = beforeItems.filter(function(item) { 3726 return item.style.display === ''; 3727 }); 3728 afterItems = afterItems.filter(function(item) { 3729 return item.style.display === ''; 3730 }); 3731 3732 if (beforeItems.length === 0 && afterItems.length === 0) { 3733 break; 3734 } 3735 3736 if (beforeItems.length > 0 && beforeItems.length > afterItems.length) { 3737 widthNavButtons -= beforeItems[0].offsetWidth; 3738 beforeItems[0].style.display = 'none'; 3739 } else if (afterItems.length > 0) { 3740 widthNavButtons -= afterItems[0].offsetWidth; 3741 afterItems[0].style.display = 'none'; 3742 } 3743 } 3744 }); 3745 } 3746} 3747 3748RedxDataNavigator.getInstance().init(); 3749RedxDataNavigatorResponsive.instance = undefined; 3750 3751RedxDataNavigatorResponsive.getInstance = function() { 3752 if (RedxDataNavigatorResponsive.instance === undefined) { 3753 RedxDataNavigatorResponsive.instance = new RedxDataNavigatorResponsive(); 3754 } 3755 return RedxDataNavigatorResponsive.instance; 3756}; 3757 3758function RedxDataNavigatorResponsive() { 3759 3760 this.init = function() { 3761 this.initVisiblePageItems(); 3762 // Für den Daten Navigator in der Suche 3763 this.initXtxSearchListener(); 3764 }; 3765 3766 /** 3767 * @returns {NodeListOf<HTMLElement>} 3768 */ 3769 this.getPaginations = function() { 3770 return document.querySelectorAll('.xtx-datanavigator nav.pagination, .xtx-search-response nav.pagination'); 3771 }; 3772 3773 /** 3774 * @returns {boolean} 3775 */ 3776 this.hasPaginations = function() { 3777 var paginations = this.getPaginations(); 3778 return !!(paginations && paginations.length); 3779 }; 3780 3781 /** 3782 * @param {HTMLElement} pagination 3783 * @param {HTMLElement} activeLink 3784 * @returns {{}} 3785 */ 3786 this.getVisiblePrevNextItems = function(pagination, activeLink) { 3787 var ret = {}; 3788 ret.prev = []; 3789 ret.next = []; 3790 if (activeLink && activeLink.parentNode) { 3791 var items = pagination.querySelectorAll('.page-item, .empty-item'); 3792 if (items && items.length) { 3793 var activeLinkFound = false; 3794 var hasEmptyBefore = false; 3795 var hasEmptyAfter = false; 3796 for (var i = 0; i < items.length; i++) { 3797 if (items[i].style.display !== 'none' && !items[i].classList.contains('prev') && !items[i].classList.contains('next')) { 3798 if (activeLinkFound) { 3799 if (items[i].classList.contains('empty-item')) { 3800 hasEmptyAfter = true; 3801 } else { 3802 if (!items[i].classList.contains('disabled')) { 3803 ret.next.push(items[i]); 3804 } 3805 } 3806 } 3807 if (items[i] === activeLink) { 3808 activeLinkFound = true; 3809 } 3810 if (!activeLinkFound) { 3811 if (items[i].classList.contains('empty-item')) { 3812 hasEmptyBefore = true; 3813 } else { 3814 if (!items[i].classList.contains('disabled')) { 3815 ret.prev.push(items[i]); 3816 } 3817 } 3818 } 3819 } 3820 } 3821 if (ret.next && hasEmptyAfter) { 3822 ret.next.pop(); 3823 } 3824 if (ret.prev && hasEmptyBefore) { 3825 ret.prev.shift(); 3826 } 3827 } 3828 } 3829 return ret; 3830 }; 3831 3832 /** 3833 * @param {HTMLElement} elem 3834 * @param {string} selector 3835 * @returns {null|HTMLElement} 3836 */ 3837 this.getClosest = function(elem, selector) { 3838 if (!Element.prototype.matches) { 3839 Element.prototype.matches = 3840 Element.prototype.matchesSelector || 3841 Element.prototype.mozMatchesSelector || 3842 Element.prototype.msMatchesSelector || 3843 Element.prototype.oMatchesSelector || 3844 Element.prototype.webkitMatchesSelector || 3845 function(s) { 3846 var matches = (this.document || this.ownerDocument).querySelectorAll(s), 3847 i = matches.length; 3848 while (--i >= 0 && matches.item(i) !== this) { 3849 } 3850 return i > -1; 3851 }; 3852 } 3853 for (; elem && elem !== document; elem = elem.parentNode) { 3854 if (elem.matches(selector)) { 3855 return elem; 3856 } 3857 } 3858 return null; 3859 }; 3860 3861 /** 3862 * @param {HTMLElement} target 3863 * @param {string} eventName 3864 * @param {{}} detail 3865 */ 3866 this.dispatchEvent = function(target, eventName, detail) { 3867 var event = document.createEvent('CustomEvent'); 3868 event.initCustomEvent(eventName, true, true, detail); 3869 target.dispatchEvent(event); 3870 }; 3871 3872 /** 3873 * @param {HTMLElement} pagination 3874 * @returns {number} 3875 */ 3876 this.getClosestContainerWidth = function(pagination) { 3877 var me = this; 3878 var containerWidth = window.innerWidth;
3879 if (pagination.getAttribute('data-closest-container-selector')) { 3880 // Expliziten Container benutzten 3881 var closestContainer = me.getClosest(pagination, pagination.getAttribute('data-closest-container-selector')) 3882 if (closestContainer) { 3883 containerWidth = closestContainer.offsetWidth; 3884 } 3885 } else { 3886 // RedxGridRow finden 3887 var closestRedxGridRow = me.getClosest(pagination, '.RedxGridRowContainer') 3888 if (closestRedxGridRow) { 3889 containerWidth = closestRedxGridRow.offsetWidth; 3890 } 3891 } 3892 return containerWidth; 3893 }; 3894 3895 /** 3896 * Aktualisiert die Anzeige der sichtbaren Datennavigator Links 3897 * - Es wird immer versucht das der Datennavigator immer einzeilig bleibt 3898 * - Der Prev und Next Button + erste und letzte Link sind immer sichtbar 3899 * - Befindet man sich im vorderen Navigationsbereich, werden immer nach hinten hin die Links ausgeblendet befindet man sich im hinteren Bereich genau umgekehrt 3900 * - Befindet man sich in der Mitte so werden immer links und rechts Links ausgeblendet 3901 * - Events: xtx.datanavigator.refresh.before und xtx.datanavigator.refresh.after 3902 */ 3903 this.refreshVisiblePageItems = function(isInit) { 3904 var me = this; 3905 var paginations = me.getPaginations(); 3906 if (paginations && paginations.length) { 3907 for (var pagIndex = 0; pagIndex < paginations.length; pagIndex++) { 3908 var pagination = paginations[pagIndex]; 3909 if (!isInit || (isInit && !pagination.getAttribute('data-initialized'))) { 3910 pagination.setAttribute('data-initialized', '1'); 3911 me.dispatchEvent(pagination, 'xtx.datanavigator.refresh.before', {pagination: pagination}); 3912 var containerWidth = me.getClosestContainerWidth(pagination); 3913 3914 var navLinks = pagination.querySelectorAll('.page-item'); 3915 if (!navLinks || navLinks.length === 0) { 3916 return false; 3917 } 3918 for (var i = 0; i < navLinks.length; i++) { 3919 navLinks[i].style.display = ''; 3920 } 3921 var lastNavLink = navLinks[navLinks.length - 1]; 3922 if ((lastNavLink.offsetLeft + lastNavLink.offsetWidth) < containerWidth) { 3923 return false; 3924 } 3925 var breakNext = false; 3926 while (true) { 3927 var activeLink = pagination.querySelector('.page-item.active'); 3928 var visiblePrevNextItems = me.getVisiblePrevNextItems(pagination, activeLink); 3929 var elementsBefore = visiblePrevNextItems.prev; 3930 var elementsAfter = visiblePrevNextItems.next; 3931 /*
3932 // Wieviel Elemente (mittig) mind. stehen bleiben müssen -> aktuell nur der aktive Eintrag 3933 if (elementsBefore.length + elementsAfter.length <= 3) { 3934 break; 3935 }*/ 3936 if (elementsBefore.length > elementsAfter.length) { 3937 if (elementsBefore[0]) { 3938 elementsBefore[0].style.display = 'none'; 3939 } 3940 } else { 3941 if (elementsAfter[elementsAfter.length - 1]) { 3942 elementsAfter[elementsAfter.length - 1].style.display = 'none'; 3943 } 3944 } 3945 if (breakNext) { 3946 break; 3947 } else if ((lastNavLink.offsetLeft + lastNavLink.offsetWidth) < containerWidth) { 3948 breakNext = true; 3949 } 3950 } 3951 me.dispatchEvent(pagination, 'xtx.datanavigator.refresh.after', {pagination: pagination}); 3952 } 3953 } 3954 } 3955 }; 3956 3957 this.initXtxSearchListener = function() { 3958 var me = this; 3959 document.addEventListener('xtx.search.render-template.after', function(event) { 3960 if (event && event.detail && event.detail.origin && event.detail.origin === 'results') { 3961 if (me.hasPaginations()) { 3962 me.refreshVisiblePageItems(true); 3963 } 3964 } 3965 }); 3966 }; 3967 3968 /** 3969 * Optimiert die sichtbaren Page Items so, dass es auch responsive immer möglichst kompakt ist 3970 */ 3971 this.initVisiblePageItems = function() { 3972 xtxJs.onResize((prevWidth, prevHeight, currentWidth, currentHeight) => { 3973 if (prevWidth !== currentWidth) { 3974 window.requestAnimationFrame(() => { 3975 this.refreshVisiblePageItems.bind(this); 3976 }); 3977 } 3978 }); 3979 }; 3980} 3981 3982window.addEventListener('load', function() { 3983 RedxDataNavigatorResponsive.getInstance().init(); 3984 if (RedxDataNavigatorResponsive.getInstance().hasPaginations()) { 3985 RedxDataNavigatorResponsive.getInstance().refreshVisiblePageItems(true); 3986 } 3987}); 3988 3989function Cart(){let CART_AJAX_ROUTE="/ajaxendpoint/redx/shopx/cart";let PRODUCT_AJAX_ROUTE="/ajaxendpoint/redx/shopx/product";let CART_ACTION_ADD="add";let CART_ACTION_UPDATE_CONFIGURATOR="updateConfigurator";let CART_ACTION_REMOVE="remove";let CART_ACTION_SET_QUANTITY="quantity";let CART_ACTION_ADD_VOUCHER="voucher";let CART_ACTION_REMOVE_PROMOTION="promotion";let CART_ACTION_GET_CART="";let PRODUCT_ACTION_AVAILABILITY="availability";let cartOverlayDivId="shopxCartOverlay";let cartDivId="redx_shopx_cart";let cartWrapperId="redx_shopx_startup";let cartOverlayElement=null;let cartOverlayContentContainer=null;let cartElement=null;let _isCartOverlayOpen=false;let _isCartLoaded=false;let _isSubscription=false;let _isExpressCheckout=false;this._init=function(){window.document.addEventListener("DOMContentLoaded",function(){let cart=this;this.setExpressCheckout(!!document.getElementById('redx-shopx-checkout'));document.dispatchEvent(new Event('xsites.cart.initialize',{bubbles:true,cancelable:true}));cartOverlayElement=document.getElementById(cartOverlayDivId);if(!cartOverlayElement){cartElement=document.getElementById(cartDivId);} 3990if(cartOverlayElement){let quantityCartItemsElement=document.querySelector("[data-quantity-cart-items]");let cartOverlayContentContainer=cartOverlayElement.querySelector('[data-offcanvas-content]');if(quantityCartItemsElement){let quantityCartItems=quantityCartItemsElement.getAttribute('data-quantity-cart-items');if(quantityCartItems!=='0'){cart.refreshCart();}else{cartOverlayElement.setAttribute('data-cart-is-empty','true');}} 3991cart._initActionsForCartSlideout();} 3992if(cartElement){if(cartElement.dataset.isSubscription){_isSubscription=true;} 3993cart._initCartActions();} 3994var closeLink=document.querySelector("#"+cartOverlayDivId+" .close");if(closeLink){closeLink.addEventListener("click",function(event){event.preventDefault();cart.closeCartOverlay();return false;});} 3995document.addEventListener('xsites.cart.updated',(function(e){cart._initCartActions();var event=document.createEvent('Event');event.initEvent('xtx.tracking.ecommerce.cart.updated',true,true);document.dispatchEvent(event);let quantity=cart._getCartQuantity();if(quantity===0){let payPalContainer=document.querySelector('.redx-payment-buttons-container');if(payPalContainer){payPalContainer.classList.add('hidePaypalExpressButton')}}}),false);document.addEventListener('xtx-datanavigator-navigated',(function(e){cart._initAddToCartForms();cart._initAddToCartButtons();}),false);document.addEventListener('xtx.shopx.products.variant.action.form.initialized',(function(e){if(e.detail&&e.detail.formElement!==undefined&&!e.detail.formElement.classList.contains('initialized')){cart._initAddToCartForm(e.detail.formElement);}}),false);document.addEventListener('xtx.infiniteScroller.moreEntries.loaded',(function(e){cart._initAddToCartForms();cart._initAddToCartButtons();}),false);document.addEventListener('xtx.configurator.initialized',(function(e){cart._initAddToCartForms();cart._initAddToCartButtons();}),false);document.addEventListener("xsites.cart.item.removed",function(evt){if(window.FeatureManager!==undefined&&!window.FeatureManager.isFeatureEnabled('productcatalog_stock')){return;} 3996if(evt.detail.removedVariant!==undefined&&evt.detail.removedVariant!==null){var productVarKey=evt.detail.removedVariant;cart.requestAvailability(productVarKey,function(xmlHttpRequest){var response=JSON.parse(xmlHttpRequest.response);cart._updateAvailabilities(productVarKey,response.data.availability);});}});document.addEventListener("xsites.cart.item.quantity.updated",function(evt){if(evt.detail!==undefined&&evt.detail.items!==undefined){evt.detail.items.forEac
3996h(function(entry){cart._updateAvailabilities(entry.varKey,entry.availability);});}});document.addEventListener("xsites.cart.item.added",function(evt){if(evt.detail!==undefined&&evt.detail.items!==undefined){evt.detail.items.forEach(function(entry){cart._updateAvailabilities(entry.varKey,entry.availability);});}});document.addEventListener("xsites.cart.item.add.error",function(evt){cart.requestAvailability(evt.detail.variant,function(xmlHttpRequest){var response=JSON.parse(xmlHttpRequest.response);cart._updateAvailabilities(evt.detail.variant,response.data.availability);});});cart._initAddToCartForms();cart._handleScrollbarOnOpenCloseOverlay();cart._initAddToCartButtons();document.dispatchEvent(new Event('xsites.cart.initialized',{bubbles:true,cancelable:true}));if(document.body.hasAttribute('data-open-cart-overlay')&&document.body.getAttribute('data-open-cart-overlay')==='true'){cart.refreshCart();window.addEventListener('xsites.cart.loaded',function(){cart.openCartOverlay();});}}.bind(this));};this._initActionsForCartSlideout=()=>{if(!this.isExpressCheckout()){this._initCartSlideoutToggleButtons();}} 3997this._initCartSlideoutToggleButtons=()=>{xtxJs.eachElement('a.checkoutBadge, [data-open-cart-slideout]',(element)=>{if(!element.hasAttribute('data-open-cart-slideout-initialized')){element.addEventListener('click',(event)=>{event.preventDefault();this.openCartOverlay();return false;});} 3998element.setAttribute('data-open-cart-slideout-initialized','true');});} 3999this._initCartActions=function(){var cart=this;cart._initQuantityLinksInCart();cart._initRemoveLinksInCart();cart._initAddVoucherFormInCart();cart._initAddToCartButtons();} 4000this._handleScrollbarOnOpenCloseOverlay=function(){document.addEventListener("xtx.navigation.offcanvas.opening",function(){this.setCartOverlayOpen(true);}.bind(this));document.addEventListener("xtx.navigation.offcanvas.closed",function(){this.setCartOverlayOpen(false);}.bind(this));};this._initRemoveLinksInCart=function(){let cart=this;let removeItemSelector='#'+cartDivId+' #cart_list_items > tbody tr > td:last-child > a';let removeVoucherSelector='#'+cartDivId+' .voucher_entry a';if(this.isExpressCheckout()){removeItemSelector='#'+cartOverlayDivId+' '+removeItemSelector;removeVoucherSelector='#'+cartOverlayDivId+' '+removeVoucherSelector;} 4001xtxJs.eachElement(removeItemSelector+', '+removeVoucherSelector,(element)=>{cart._addRemoveItemEventListener(element);});};this._addRemoveItemEventListener=function(element){element.addEventListener("click",function(event){event.preventDefault();cart.showSpinnerOnElement(element);if(this.getAttribute("href").match(/\.removePromotion/)){cart.removePromotion();}else{var itemId=this.getAttribute("href").match(/item_id=([a-z_0-9]+)/)[1];cart.removeProductFromCart(itemId);} 4002return false;});};this._initAddVoucherFormInCart=function(){let cart=this;let selector='#'+cartDivId+' form[name="voucher_form"]';if(this.isExpressCheckout()){selector='#'+cartOverlayDivId+' '+selector;} 4003xtxJs.eachElement(selector,(element)=>{element.addEventListener("submit",function(event){event.preventDefault();let voucher=this.querySelector("input[name=voucher_code]").value;cart.showSpinnerOnElement(element);cart.addVoucherToCart(voucher);return false;});});};this._initQuantityLinksInCart=function(){let cart=this;let selector='#'+cartDivId+' xtx-quantity-selector';if(this.isExpressCheckout()){selector='#'+cartOverlayDivId+' '+selector;} 4004xtxJs.eachElement(selector,(element)=>{let quantityTimeout=null;element.addEventListener('change',function(event){event.preventDefault();if(event.target.hasAttribute('disabled')){return false;} 4005clearTimeout(quantityTimeout);quantityTimeout=setTimeout(function(){let row=event.target.parentElement;while(row&&row.tagName.toLowerCase()!=='tr'){row=row.parentElement;} 4006let productVarKey=row.dataset.itemId;if(productVarKey){cart.showSpinnerOnElement(event.target);cart.setQuantity(productVarKey,event.target.value);}}.bind(this),500);return false;});});};this.openCartOverlay=function(){if(!this.isCartLoaded()){this.refreshCart();} 4007if(this.isCartOverlayOpen()){return;} 4008if(window!==window.parent&&window.parent.redxModal!==undefined){window.parent.redxModal.close();} 4009var mainDocument=this._getMainDocument();var event=mainDocument.createEvent('Event');event.initEvent('xtx.navigation.offcanvas.open',true,true);mainDocument.getElementById(cartOverlayDivId).dispatchEvent(event);if(!this.loadPaypalExpress()){window.addEventListener('xsites.cart.updated',function(e){cart.loadPaypalExpress();},false);}};this.loadPaypalExpress=function(){let quantity=this._getCartQuantity();if(quantity!==0){let payPalContainer=document.querySelector('.redx-payment-buttons-container');if(payPalContainer){payPalContainer.classList.remove('hidePaypalExpressButton')} 4010const loadPaypalExpressEvent=new CustomEvent("xtx.load.paypal.express");document.dispatchEvent(loadPaypalExpressEvent);return true;} 4011return false;} 4012this.closeCartOverlay=function(){var event=document.createEvent('Event');event.initEvent('xtx.navigation.offcanvas.close',true,true);document.getElementById(cartOverlayDivId).dispatchEvent(event);};this.setCartOverlayOpen=function(isOpen){_isCartOverlayOpen=isOpen;} 4013this.isCartOverlayOpen=function(){return _isCartOverlayOpen;} 4014this.setCartLoaded=function(loaded){_isCartLoaded=loaded;} 4015this.isCartLoaded=function(){return _isCartLoaded;} 4016this.setExpressCheckout=(isExpressCheckout)=>{_isExpressCheckout=isExpressCheckout;} 4017this.isExpressCheckout=()=>{return _isExpressCheckout;} 4018this.addProduct2Cart=function(productVarKey,quantity,formData,onSuccess,onError){var event=document.createEvent('Event');event.initEvent('xsites.cart.item.add',true,true);document.dispatchEvent(event);if(formData&&formData instanceof FormData){params=formData;}else{params={"quantity":this._getValidQuantity(quantity)};} 4019this._cartAction(CART_ACTION_ADD,productVarKey,params,function(xmlHttpRequest){var cart=this;var response=JSON.parse(xmlHttpRequest.responseText);cart.processCartActionResult(response);var event=document.createEvent('CustomEvent');event.initCustomEvent('xsites.cart.item.added',true,true,response.data);document.dispatchEvent(event);if(typeof onSuccess==="function"){onSuccess(xmlHttpRequest);}},function(xmlHttpRequest){var response=JSON.parse(xmlHttpRequest.responseText);if(response.data.html){cart.processCartActionResult(response);} 4020var event=document.createEvent("CustomEvent");event.initCustomEvent("xsites.cart.item.add.error",true,true,{variant:productVarKey});document.dispatchEvent(event);if(typeof onError==="function"){onError(xmlHttpRequest);}});};this.updateConfigurator=function(productVarKey,formData){var event=document.createEvent('Event');event.initEvent('xsites.cart.item.quantity.update',true,true);document.dispatchEvent(event);this._cartAction(CART_ACTION_UPDATE_CONFIGURATOR,productVarKey,formData,function(xmlHttpRequest){var cart=this;var response=JSON.parse(xmlHttpRequest.responseText);cart.processCartActionResult(response);var event=document.createEvent('CustomEvent');event.initCustomEvent('xsites.cart.item.quantity.updated',true,true,response.data);document.dispatchEvent(event);},null);};this.setQuantity=function(productVarKey,quantity){var event=document.createEvent('Event');event.initEvent('xsites.cart.item.quantity.update',true,true);document.dispatchEvent(event);this._cartAction(CART_ACTION_SET_QUANTITY,productVarKey,{"quantity":this._getValidQuantity(quantity)},function(xmlHttpRequest){var cart=this;var response=JSON.parse(xmlHttpRequest.responseText);cart.processCartActionResult(response);var event=document.createEvent('CustomEvent');event.initCustomEvent('xsites.cart.item.quantity.updated',true,true,response.data);document.dispatchEvent(event);},null);};this.removeProductFromCart=function(itemId){var event=document.createEvent('Event');event.initEvent('xsites.cart.item.remove',true,true);document.dispatchEvent(event);this._cartAction(CART_ACTION_REMOVE,itemId,{},function(xmlHttpRequest){var cart=this;var response=JSON.parse(xmlHttpRequest.responseText);var event=document.createEvent('CustomEvent');event.initCustomEvent('xsites.cart.item.removed',true,true,response.data);document.dispatchEvent(event);cart.processCartActionResult(response);},null);};this.addVoucherToCart=function(voucherCode){var event=document.createEvent('Event');event.initEvent('xsites.cart.voucher.add',true,true);document.dispatchEvent(event);this._cartAction(CART_ACTION_ADD_VOUCHER,voucherCode,{},function(xmlHttpRequest){var cart=this;var response=JSON.parse(xmlHttpRequest.responseText);var event=document.createEvent('Event');event.initEvent('xsites.cart.voucher.added',true,true);document.dispatchEvent(event);cart.processCartActionResult(response);},null);};this.removePromotion=function(){var event=document.createEvent('Event');event.initEvent('xsites.cart.promotion.remove',true,true);document.dispatchEvent(event);this._cartAction(CART_ACTION_REMOVE_PROMOTION,null,{},function(xmlHttpRequest){var cart=this;var response=JSON.parse(xmlHttpRequest.responseText);var event=document.createEvent('Event');event.initEvent('xsites.cart.promotion.removed',true,true);document.dispatchEvent(event);cart.processCartActionResult(response);},null);};this.refreshCart=function(){cart.setCartLoaded(true);var event=document.createEvent('Event');event.initEvent('xsites.cart.load',true,true);document.dispatchEvent(event);this._cartAction(CART_ACTION_GET_CART,null,{},function(xmlHttpRequest){var cart=this;var response=JSON.parse(xmlHttpRequest.responseText);var event=document.createEvent('CustomEvent');event.initCustomEvent('xsites.cart.loaded',true,true,response.data);document.dispatchEvent(event);cart.processCartActionResult(response);},null);};this.processCartActionResult=function(response){cart._setCartHtml(response.data.html,response.data.nrOfCartItems);if(response&&response.data&&response.data.payPalExpressButtonHtml!==undefined){cart._setPayPalExpressButtonHtml(response.data.payPalExpressButtonHtml);} 4021const mainDocument=this._getMainDocument();const updatedEvent=mainDocument.createEvent('Event');updatedEvent.initEvent('xsites.cart.updated',true,true);mainDocument.dispatchEvent(updatedEvent);};this._setCartHtml=function(html,nrOfCartItems){var mainDocument=this._getMainDocument();var cartOverlayContentDiv=mainDocument.querySelector("#"+cartOverlayDivId+" .content_wrapper");var cartWrapperDiv=mainDocument.getElementById(cartWrapperId);var updateEvent=mainDocument.createEvent('Event');updateEvent.initEvent('xsites.cart.update',true,true);mainDocument.dispatchEvent(updateEvent);if(cartOverlayContentDiv){cartOverlayContentDiv.innerHTML=html;let message=cartOverlayContentDiv.querySelector('#redx_shopx_startup_status_msg, .redxStatusMessage');
4021if(message){message.scrollIntoView({behavior:'smooth'});}}else if(cartWrapperDiv){const parser=new DOMParser();const htmlDoc=parser.parseFromString(html,'text/html');cartWrapperDiv.replaceWith(htmlDoc.body.firstChild);} 4022this._updateCartQuantityBadges(nrOfCartItems);let cartOverlayElement=this._getCartOverlayElement();if(cartOverlayElement){if(nrOfCartItems>0){cartOverlayElement.removeAttribute('data-cart-is-empty');}else{cartOverlayElement.setAttribute('data-cart-is-empty','true');}}};this._updateCartQuantityBadges=(nrOfCartItems)=>{xtxJs.eachElement('[data-idenfitier="quantity_cart_items"]',(element)=>{element.innerText=nrOfCartItems;let elementWithQuantityAttribute=element.closest('[data-quantity-cart-items]');let badgeDescription=element.getAttribute('data-badge-label');element.setAttribute('aria-label',badgeDescription+': '+nrOfCartItems);if(elementWithQuantityAttribute){elementWithQuantityAttribute.setAttribute('data-quantity-cart-items',nrOfCartItems);}},this._getMainDocument());} 4023this._setPayPalExpressButtonHtml=function(html){let element=document.querySelector('[data-paypal-express-button-container]') 4024if(element){element.innerHTML=html;}} 4025this._cartAction=function(action,key,parameters,onSuccess,onError){this.setCartLoaded(true);var method;var body=parameters;if(!onError&&action!==CART_ACTION_GET_CART){onError=function(request){var cart=this;cart.refreshCart();var event=document.createEvent("Event");event.initEvent("xsites.cart.error",true,true);document.dispatchEvent(event);}} 4026var request=this._getAjaxRequestObject(onSuccess,onError) 4027var url=CART_AJAX_ROUTE;let cartOverlayElement=this._getCartOverlayElement();if(cartOverlayElement){let payPalExpressButtonId=this._getPayPalExpressButtonId();if(body instanceof FormData){body.append("isOverlay",true);if(payPalExpressButtonId){body.append("payPalExpressButtonId",payPalExpressButtonId);}}else{body=Object.assign(body,{"isOverlay":true});if(payPalExpressButtonId){body=Object.assign(body,{"payPalExpressButtonId":payPalExpressButtonId});}}} 4028if(!document.querySelector('.checkout_tab_nav')){if(body instanceof FormData){body.append('hide_nav',true)}else{body.hide_nav=true;}} 4029if(document.querySelector('*[name="CheckoutProgressIndicator"]')){if(body instanceof FormData){body.append('checkout_nav',true)}else{body.checkout_nav=true;}} 4030switch(action){case CART_ACTION_ADD:method="post";if(body instanceof FormData){body.append("returnCartHtml",true);body.append("productKey",key);}else{body=Object.assign(body,{"returnCartHtml":true,"productKey":key});} 4031url+="/product";break;case CART_ACTION_ADD_VOUCHER:method="post";body=Object.assign(body,{"returnCartHtml":true,"voucherCode":key});url+="/voucher";break;case CART_ACTION_SET_QUANTITY:method="put";body=Object.assign(body,{"returnCartHtml":true,"productKey":key});url+="/product/"+key+"/quantity";break;case CART_ACTION_REMOVE:method="delete";url+="/product/"+key;body=Object.assign(body,{"returnCartHtml":true});break;case CART_ACTION_REMOVE_PROMOTION:method="delete";url+="/promotion";body=Object.assign(body,{"returnCartHtml":true});break;case CART_ACTION_UPDATE_CONFIGURATOR:method="post";var configuratorId=null;if(body instanceof FormData){body.append("returnCartHtml",true);body.append("productKey",key);configuratorId=body.get("configurator_id");} 4032url+="/product/configurator/"+configuratorId;break;default:method="get";if(body){url+="?"+this._getQueryString(body);body={};}} 4033request.open(method,url,true);if(!(body instanceof FormData)){body=this._getQueryString(body);if(body){request.setRequestHeader('Content-type','application/x-www-form-urlencoded');}} 4034request.send(body);};this._productAction=function(action,key,async,onSuccess,onError){var method;var url=PRODUCT_AJAX_ROUTE;var request=this._getAjaxRequestObject(onSuccess,onError);switch(action){case PRODUCT_ACTION_AVAILABILITY:default:method="get";url+="/"+PRODUCT_ACTION_AVAILABILITY+"/"+key;} 4035request.open(method,url,async);request.send();};this._getAjaxRequestObject=function(onSuccess,onError){var request=new XMLHttpRequest();request.onreadystatechange=function(){if(request.readyState===XMLHttpRequest.DONE){if(request.status===0||(request.status>=200&&request.status<400)){if(typeof onSuccess==="function"){onSuccess.bind(this,request)();}}else{if(typeof onError==="function"){onError.bind(this,request)();}else{console.log(request);}}}}.bind(this);return request};this._getQueryString=function(parameter){return Object.keys(parameter).map(function(key){return encodeURIComponent(key)+'='+encodeURIComponent(parameter[key])}).join('&');};this.showSpinnerOnElement=function(element){var spinner=document.createElement("span");spinner.classList.add("loading_spinner","top","normal");spinner.append(document.createElement("span"));spinner.append(document.createElement("span"));spinner.append(document.createElement("span"));element.parentNode.insertBefore(spinner,element);spinner.style.left="0";spinner.style.right="0";spinner.style.margin="auto";spinner.style.top="0";spinner.style.bottom="0";spinner.style.position="absolute";};this.hideSpinnerOnElement=function(element){if(element){var spinner=element.parentNode.querySelector(".loading_spinner");if(spinner){spinner.remove();}}};this._getValidQuantity=function(quantity){quantity=parseInt(quantity);if(isNaN(quantity)||quantity<=0){quantity=1;} 4036return quantity;};this._initAddToCartButtons=function(){var cart=this;Array.prototype.forEach.call(document.querySelectorAll("[data-add-to-cart]:not(.initialized)"),function(button){button.classList.add("initialized");button.addEventListener("click",function(ev){ev.preventDefault();cart.showSpinnerOnElement(button);var self=this;var onSuccess=function(xmlHttpRequest){button.parentElement.classList.add("product-added-successfully");cart.hideSpinnerOnElement(button);if(button.dataset.openCartOverlay!==undefined&&button.dataset.openCartOverlay.toLowerCase()==="true"){cart.openCartOverlay();} 4037setTimeout(function(){button.parentElement.classList.remove("product-added-successfully");},600);button.blur();};var onError=function(xmlHttpRequest){button.parentElement.classList.add("product-added-error");cart.openCartOverlay();cart.hideSpinnerOnElement(button);setTimeout(function(){button.parentElement.classList.remove("product-added-error");},600);};var quantity=1;if(this.hasAttribute("data-quantity")){quantity=this.getAttribute("data-quantity");} 4038if(this.hasAttribute("data-quantity-element-id")){quantity=document.getElementById(this.getAttribute("data-quantity-element-id")).value;} 4039cart.addProduct2Cart(this.getAttribute("data-product-id"),quantity,null,onSuccess,onError);return false;});if(button.dataset.quantityElementId!==undefined){var quantitySelector=document.getElementById(button.dataset.quantityElementId);if(quantitySelector){var quantityClickTimeout=null;quantitySelector.addEventListener("keypress",function(ev){if(ev.key==="Enter"){if(button.dataset.openCartOverlay!==undefined&&button.dataset.openCartOverlay.toLowerCase()==="true"){clearTimeout(quantityClickTimeout);quantityClickTimeout=window.setTimeout(function(){this.click();}.bind(this),250);}else{this.click();}}}.bind(button));}}});};this._initAddToCartForms=function(){Array.prototype.forEach.call(document.querySelectorAll(".add-to-cart-form:not(.initialized), .shop-product .variant-list form:not(.initialized)"),function(form){cart._initAddToCartForm(form);});};this._initAddToCartForm=function(form){let button=form.querySelector('[type="submit"]');let submitFormTimeout;form.classList.add("initialized");document.addEventListener("xsites.cart.updated",()=>{cart.hideSpinnerOnElement(button);});form.addEventListener("submit",(event)=>{if(!form.hasAttribute('data-checkout-type-subscription')){event.preventDefault();clearTimeout(submitFormTimeout);submitFormTimeout=window.setTimeout(function(){var formData=new FormData(this);var productVarKey=this.querySelector('input[name="shopx_products_var_key"]').value;var quantity=this.querySelector('[name="quantity"]').value;cart.showSpinnerOnElement(button);if(this.querySelector('button[name="bt_configurator_update"]')){cart.updateConfigurator(productVarKey,formData);}else{if(this.querySelector('button[name="bt_configurator_insert"]')){let onSuccess=(request)=>{let event=new Event('xtx-configurator-add-to-cart',{bubbles:true,cancelable:true});document.dispatchEvent(event);};let onError=(request)=>{let response=JSON.parse(request.responseText);if(response&&response.message){document.querySelector("#redx_shopx_cart").prepend(cart.getStatusMessage(response.message));} 4040let event=new Event('xtx-configurator-error-add-to-cart',{bubbles:true,cancelable:true});document.dispatchEvent(event);cart.hideSpinnerOnElement(button);setTimeout(function(){document.querySelector("#redx_shopx_cart .redxStatusMessage").remove();cart.closeCartOverlay();},3000);};cart.addProduct2Cart(productVarKey,quantity,formData,onSuccess,onError);}else{cart.addProduct2Cart(productVarKey,quantity,formData);}} 4041cart.openCartOverlay();}.bind(form),250);return false;}});};
4041this.getStatusMessage=function(message){var element=document.createElement("div");element.classList.add("redxStatusMessage");element.classList.add("redxStatusMessageError");element.innerHTML=message;return element;};this._getMainDocument=function(){var doc=document;if(window!==window.parent&&window.parent.document.getElementById(cartOverlayDivId)){doc=window.parent.document;} 4042return doc;};this.requestAvailability=function(productVarKey,onSuccess,onError){var availability=undefined;if(!onError){onError=function(xmlHttpRequest){console.log(xmlHttpRequest);}} 4043this._productAction(PRODUCT_ACTION_AVAILABILITY,productVarKey,true,onSuccess,onError);};this._updateAvailabilities=function(productVarKey,availability){Array.prototype.forEach.call(document.querySelectorAll(".variantList [data-product-id='"+productVarKey+"']"),function(button){var quantitySelector;if(button.dataset.quantityElementId!==undefined){quantitySelector=document.getElementById(button.dataset.quantityElementId);} 4044this._setAttributesByAvailability(button,quantitySelector,availability);}.bind(this));Array.prototype.forEach.call(document.querySelectorAll("form[name='form_var_"+productVarKey+"']"),function(form){var quantitySelector=form.querySelector("xtx-quantity-selector");var button=form.querySelector("button");this._setAttributesByAvailability(button,quantitySelector,availability);}.bind(this));};this._setAttributesByAvailability=function(addToCartButton,quantitySelector,availability){if(availability!==null&&availability<=0){addToCartButton.setAttribute("disabled","disabled");if(quantitySelector){quantitySelector.setAttribute("max-value",0);quantitySelector.setAttribute("value",0);quantitySelector.setAttribute("disabled","disabled");}}else{addToCartButton.removeAttribute("disabled");if(quantitySelector){quantitySelector.setAttribute("max-value",availability!==null?availability:999);quantitySelector.setAttribute("value",1);quantitySelector.removeAttribute("disabled");}}};this._getCartOverlayElement=function(){return this._getMainDocument().getElementById(cartOverlayDivId);};this._getPayPalExpressButtonContainer=function(){let cartOverlayElement=this._getCartOverlayElement();if(cartOverlayElement){return cartOverlayElement.querySelector('[data-paypal-express-button-container]')} 4045return null;};this._getPayPalExpressButtonId=function(){let payPalExpressButtonContainerElement=this._getPayPalExpressButtonContainer();if(payPalExpressButtonContainerElement&&payPalExpressButtonContainerElement.dataset.paypalExpressButtonContainer&&!document.querySelector('#'+payPalExpressButtonContainerElement.dataset.paypalExpressButtonContainer)){return payPalExpressButtonContainerElement.dataset.paypalExpressButtonContainer;} 4046return'';};this._getCartQuantity=function(){let quantity=document.querySelector("[data-idenfitier='quantity_cart_items']").textContent;if(quantity){return parseInt(quantity);} 4047return 0;};this._init();} 4048window.cart=new Cart(); 4049 4050Blog.instance=null;Blog.getInstance=function(){if(Blog.instance===null){Blog.instance=new Blog();} 4051return Blog.instance;} 4052function Blog(){this.init=function(){this._initCategorySelect();} 4053this._initCategorySelect=function(){let categorySelect=document.querySelector(".redx-blog .blogList .categorynav select");if(categorySelect!==null){categorySelect.addEventListener("change",function(){document.querySelector(".redx-blog .blogList .filter form").submit();});}}} 4054window.addEventListener("DOMContentLoaded",function(){Blog.getInstance().init();}); 4055 4056var Events=function(){var _appointmentSwiper=null;var initDocuments=function(){jQuery(document).on("submit",".event-files-wrapper form",function(e){var form=jQuery(this);var data=form.serialize();form.find(".submit").append("<div class='loading-spinner fa fa-spinner fa-spin'></div>");jQuery.ajax("/redx/modules/events/ajax_front.php?action=get_files",{type:"POST",data:data,error:function(a,b,c){console.log("Fehler beim Laden der Dokumente",a,b,c);},success:function(response){if(response.success===true){form.parent().html(response.data);}else{form.find(".validation_error").html(response.message);form.find(".loading-spinner").remove();}}});e.preventDefault();})};var initRegistrationForm=function(){var nrOfParticipants=parseInt(j
4056Query(".event_registration_form_wrapper form input[name='nr_of_participants']").val());var requiredFields=[];jQuery(".event_registration_form_wrapper form .participant_container").each(function(index){var container=jQuery(this);if(index===0){jQuery(container).find(".required input").each(function(){requiredFields.push(jQuery(this).attr("name"));});}else{requiredFields.forEach(function(name){var componentId=jQuery(container).find("input[name^="+name+"]").attr("id");if(componentId){jQuery(container).find("#"+componentId).closest(".RedxGridRow").prev().find("label").append('<span class="redx_form_required_text">*</span>');}});} 4057if(nrOfParticipants>0&&index<nrOfParticipants){jQuery(container).removeClass("hidden");if(index<nrOfParticipants-1){jQuery(container).find(".form_btn_add_participant").hide();jQuery(container).find(".form_btn_remove_participant").hide();}}});jQuery(document).on("click",".event_registration_form_wrapper form .form_btn_add_participant",function(){var nrParticipant=parseInt(jQuery(this).closest(".participant_container").find("input[name^='nr_of_participant']").val());jQuery(".event_registration_form_wrapper form input[name='nr_of_participants']").val(nrParticipant+1);jQuery(this).closest(".participant_container").parent().next().find(".participant_container").removeClass("hidden");App.scrollToElement(jQuery(this).closest(".participant_container").parent().next().find(".participant_container .form_btn_add_participant"));jQuery(this).hide();jQuery(this).closest(".participant_container").find(".form_btn_remove_participant").hide();});jQuery(document).on("click",".event_registration_form_wrapper form .form_btn_remove_participant",function(){var nrParticipant=parseInt(jQuery(this).closest(".participant_container").find("input[name^='nr_of_participant']").val());jQuery(".event_registration_form_wrapper form input[name='nr_of_participants']").val(nrParticipant-1);jQuery(this).closest(".participant_container").addClass("hidden");jQuery(this).closest(".participant_container").parent().prev().find(".form_btn_add_participant").show();jQuery(this).closest(".participant_container").parent().prev().find(".form_btn_remove_participant").show();jQuery(this).closest(".participant_container").find("input[type=text], input[type=email], select").val("");jQuery(this).closest(".participant_container").find("input[type=checkbox]").prop("checked",false);});jQuery(document).on("click",".event_appointment_modal_content #cancel, .event_appointment_modal_content #close",function(event){event.preventDefault();event.stopImmediatePropagation();window.parent.redxModal.close();return false;});jQuery(document).on("click",".event_appointment_modal_content #submit",function(event){event.preventDefault;event.stopImmediatePropagation();App.setLoadingSpinnerOnElement(jQuery(this).parent(),"normal");jQuery(".event_registration_form_wrapper form").submit();});if(jQuery(".event_registration_form_wrapper.registration .redx_forms_thanx_container").length>0){jQuery(".event_appointment_modal_footer a.btn").hide();jQuery(".event_appointment_modal_footer a.cancel").hide();jQuery(".event_appointment_modal_footer a.close").show();}else{App.scrollToElement(jQuery(".event_registration_form_wrapper.modal form .validation_error:not(:empty)").first().prev());} 4058jQuery(".event_appointment_modal_footer a#submit").text(jQuery(".event_registration_form_wrapper form [name^=absenden]").val());jQuery(".event_registration_form_wrapper.modal form [name^=absenden]").closest(".RedxGridColumn").addClass("hidden");};var initAppointments=function(){jQuery(document).on("click",".eventAppointments .eventAppointmentDate:not(.expired), .eventAppointments .eventAppointmentDate.documents",function(){var key=jQuery(this).data("appointment-key");selectAppointment(key);});};var selectAppointment=function(key){var appointment=jQuery(".eventAppointments .eventAppointmentDate:not(.expired)[data-appointment-key="+key+"]");jQuery(".eventAppointments .eventAppointmentDate").attr("data-selected",fal
4058se).removeClass("active");jQuery(appointment).attr("data-selected",true).addClass("active");if(window.history){var appointmentUrl='?appointment='+key;var currentUrl=new URL(window.location);if(currentUrl.searchParams.has("location")){appointmentUrl+="&location="+currentUrl.searchParams.get("location");} 4059window.history.replaceState({},null,appointmentUrl);} 4060slideToAppointment(key);};var slideToAppointment=function(key){jQuery(".eventAppointments .eventAppointmentDate").each(function(index,element){if(_appointmentSwiper!==null&&parseInt(key)===jQuery(element).data("appointment-key")){_appointmentSwiper.slideTo(index);}});};var slideToFirstActiveAppointment=function(){let appointments=document.querySelectorAll(".eventAppointments .eventAppointmentDate");let i=0;while(i<appointments.length){if(_appointmentSwiper!==null&&!appointments[i].classList.contains("expired")){_appointmentSwiper.slideTo(i);break;} 4061i++;}};const fixSlidesHeight=()=>{const myEvent=new Event('xtx.slideshow.update',{bubbles:true,cancelable:true});window.requestAnimationFrame(()=>{_appointmentSwiper.slides.forEach(function(slide,index){let height=Math.round(slide.getHeight());if(height%2!==0){height++;} 4062if((height/2-16)%2!==0){height+=2;} 4063slide.style.minHeight=height+"px";});_appointmentSwiper.el.dispatchEvent(myEvent);});} 4064var initCarousel=function(){var swiperContainer=document.querySelector(".swiper-container-date");if(swiperContainer){if(swiperContainer.swiper){_appointmentSwiper=swiperContainer.swiper;fixSlidesHeight();window.addEventListener('load',()=>{fixSlidesHeight();});}else{window.addEventListener('xtx.slideshow.init',function(event){if(event.target===swiperContainer){_appointmentSwiper=swiperContainer.swiper;fixSlidesHeight();}});}} 4065var activeKey=activeAppointmentKey();if(!isNaN(activeKey)){slideToAppointment(activeKey);}else{slideToFirstActiveAppointment();}};var activeAppointmentKey=function(){return jQuery(".eventAppointmentDate[data-selected=true]").data("appointment-key");} 4066var openRegistrationModal=function(){if(window.location.search.match(/openModal/)){var activeKey=activeAppointmentKey();jQuery(".redx-modal-opener[data-modal-appointment-key="+activeKey+"]").click();}};return{init:function(){initDocuments();initRegistrationForm();initAppointments();initCarousel();},slideTo:function(key){slideToAppointment(key);},getDateSwiper:function(){return _appointmentSwiper;},initParticipants:function(){initRegistrationForm();},openRegistrationModal:function(){openRegistrationModal();},slideToFirstActiveAppointment:function(){slideToFirstActiveAppointment();}}};Events._instance=null;Events.getInstance=function(){if(Events._instance===null){Events._instance=new Events();} 4067return Events._instance;};jQuery(document).ready(function(){Events.getInstance().init();});jQuery(window).on("load",function(){Events.getInstance().openRegistrationModal();}); 4068 4069var Forms=function(){var initShowHideComponents=function(){Array.prototype.forEach.call(document.querySelectorAll(".redx_form:not(.redx-form-initialized)"),function(form){form.classList.add("redx-form-initialized");Array.prototype.forEach.call(form.querySelectorAll("[data-show-component-on-checkbox-checked]"),function(element){var triggerElementName=form.querySelector("input[type=checkbox][name="+element.dataset.showComponentOnCheckboxChecked+"]");addShowHideCheckedEventListener(triggerElementName,form) 4070if(triggerElementName.checked){showHideComponent(element,true);}else{showHideComponent(element,false);}});Array.prototype.forEach.call(form.querySelectorAll("[data-hide-component-on-checkbox-checked]"),function(element){var triggerElementName=form.querySelector("input[type=checkbox][name="+element.dataset.hideComponentOnCheckboxChecked+"]");addShowHideCheckedEventListener(triggerElementName,form) 4071if(triggerElementName.checked){showHideComponent(element,false);}else{showHideComponent(element,true);}});});};var addShowHideCheckedEventListener=function(formElement,form){formElement.addEventListener("change",function(form,event){var checked=this.checked;Array.prototype.forEach.call(form.querySelectorAll("[data-show-component-on-checkbox-checked='"+this.name+"']"),function(element){console.log(element,checked);if(checked){showHideComponent(element,true);}else{showHideComponent(element,false);}});Array.prototype.forEach.call(form.querySelectorAll("[data-hide-component-on-checkbox-checked='"+this.name+"']"),function(element){if(checked){showHideComponent(element,false);}else{showHideComponent(element,true);}});}.bind(formElement,form));} 4072var showHideComponent=function(formElement,show){var parent=formElement.parentNode;do{if(parent.classList.contains("RedxGridColumn")){if(show){if(parent.classList.contains("hidden")){parent.classList.remove("hidden");}else{parent.style.display="block";}}else{parent.classList.add("hidden");} 4073break;} 4074parent=parent.parentNode;}while(parent!==null);};return{init:function(){initShowHideComponents();},showElement:function(formElement){showHideComponent(formElement,true);},hideElement:function(formElement){showHideComponent(formElement,false);}}};Forms._instance=null;Forms.getInstance=function(){if(Forms._instance===null){Forms._instance=new Forms();} 4075return Forms._instance;};window.addEventListener("load",function(e){Forms.getInstance().init();});window.addEventListener("xtx.content.changed",function(e){Forms.getInstance().init();}); 4076 4077function MapInitializer(){this.init=function(){this._addEventListeners();};this._addEventListeners=function(){window.addEventListener("load",function(){this._createMapControllerInstances();}.bind(this));window.document.addEventListener("xsites.fixedcontent.loaded",function(evt){this._createMapControllerInstances();}.bind(this));window.document.addEventListener("xtx.presentation.tabs.show",function(evt){this._createMapControllerInstances();var map=document.querySelector("#"+evt.detail.tabId+" [data-redx-map]");if(map){var mapId=map.getAttribute("id");
4077this._centerMap(mapId);}}.bind(this));window.document.addEventListener("xtx.presentation.accordion.open",function(evt){this._createMapControllerInstances();var map=document.querySelector("#"+evt.detail.panelId+" [data-redx-map]");if(map){var mapId=map.getAttribute("id");this._centerMap(mapId);}}.bind(this));window.document.addEventListener("xtx.presentation.accordion.loaded",function(evt){this._createMapControllerInstances();var map=document.querySelector("#"+evt.detail.panelId+" [data-redx-map]");if(map){var mapId=map.getAttribute("id");this._centerMap(mapId);}}.bind(this));} 4078this._createMapControllerInstances=function(){if(document.querySelector("[data-redx-map]")){if(typeof Redx_Map_Controller==="undefined"||typeof MarkerManager==="undefined"){this._loadLibraries();}else{Redx_Map_Controller.createInstances();}}} 4079this._loadLibraries=function(){var request=new XMLHttpRequest();request.onreadystatechange=function(){if(request.readyState===XMLHttpRequest.DONE){if(request.status===0||(request.status>=200&&request.status<400)){var libraries=JSON.parse(request.responseText).data.libraries;var head=document.getElementsByTagName('head')[0];var countLoaded=0;var countToLoad=0;this._loadNextLib(libraries);}else{console.log(request);}}}.bind(this);request.open("get","/ajaxendpoint/googlemap/libraries",true);request.send({});} 4080this._loadNextLib=function(libraries){var nextLib=libraries.shift();var script=document.createElement('script');script.onload=function(){if(libraries.length>0){this._loadNextLib(libraries);}else{Redx_Map_Controller.createInstances();}}.bind(this);script.src=nextLib;document.getElementsByTagName('head')[0].appendChild(script);} 4081this._centerMap=function(mapId){var mapController=Redx_Map_Controller.getInstance(mapId);if(mapController){mapController.centerMapToMarkerPositions();}}} 4082(new MapInitializer()).init(); 4083 4084var FocusToElement=(function(){function FocusToElement(){} 4085FocusToElement.prototype.addEventListeners=function(){window.addEventListener('xtx.modal.opened',function(event){focusElement.openElement(event);});window.addEventListener('xtx.modal.url.loaded',function(event){event.target.focus();});window.addEventListener('xtx.modal.closed',function(event){focusElement.closeElement(event);});window.addEventListener("xtx.navigation.offcanvas.opened",function(event){focusElement.openElement(event);});window.addEventListener("xtx.navigation.offcanvas.closed",function(event){focusElement.closeElement(event);});window.addEventListener('xtx.a11y.inert',function(event){focusElement.toggleInertStatus(event.detail.active,event);});};FocusToElement.prototype.openElement=function(event){FocusToElement.lastFocusedElement=document.activeElement;focusElement.toggleInertStatus(true,event);var target=event.target;if(target.hasAttribute('data-offcanvas')){target.inert=false;target.setAttribute('tabindex','-1');} 4086var firstFocusable=target.querySelector('a, button, input, [tabindex]:not([tabindex="-1"])');if(!firstFocusable&&target.shadowRoot){firstFocusable=target.shadowRoot.querySelector('a, button, input, [tabindex]:not([tabindex="-1"])');} 4087if(firstFocusable){firstFocusable.focus();}};FocusToElement.prototype.closeElement=function(event){focusElement.toggleInertStatus(false,event);var lastFocusedElement=FocusToElement.lastFocusedElement;if(lastFocusedElement){lastFocusedElement.focus();}};FocusToElement.prototype.toggleInertStatus=function(inertActive,event){var inactiveElements=focusElement.getInactiveElements(event);inactiveElements.forEach(function(element){element.inert=inertActive;});};FocusToElement.prototype.getInactiveElements=function(event){var elements=[];var selectors=['#fixedContentButtons','.header-element','.copyright','#skip-link-container','.xtxBackToTop'];var target=event.target;var targetElementWrapper=null;if(typeof target.hasAttribute==='function'&&target.hasAttribute('data-offcanvas')){targetElementWrapper=target.closest('.RedxElementWrapper');if(targetElementWrapper){var flexListElement=targetElementWrapper.querySelector('.redxListManagerFlexList');if(flexListElement){elements.push(flexListElement);} 4088var filterElement=targetElementWrapper.querySelector('xtx-filter xtx-container');if(filterElement){elements.push(filterElement);}}} 4089var elementWrappers=document.querySelectorAll('.RedxElementWrapper');
4089elementWrappers.forEach(function(elementWrapper){if(elementWrapper!==targetElementWrapper&&!target.contains(elementWrapper)){elements.push(elementWrapper);}});var linkAreaElements=document.querySelectorAll('.RedxLinkAreaOverlay');linkAreaElements.forEach(function(linkAreaElement){if(!target.contains(linkAreaElement)){elements.push(linkAreaElement);}});selectors.forEach(function(selector){var selectedElements=document.querySelectorAll(selector);selectedElements.forEach(function(element){elements.push(element);});});return elements;};return FocusToElement;}());var focusElement=new FocusToElement();focusElement.addEventListeners(); 4090 4091var RedxShopxPriceManager=(function(){function RedxShopxPriceManager(){this.observer=null;} 4092RedxShopxPriceManager.getInstance=function(){if(!RedxShopxPriceManager.instance){RedxShopxPriceManager.instance=new RedxShopxPriceManager();} 4093return RedxShopxPriceManager.instance;};RedxShopxPriceManager.prototype.observePriceContainer=function(){document.querySelectorAll("[data-product-price='reload']").forEach(function(priceContainer){RedxShopxPriceManager.getInstance().getIntersectionObserver().observe(priceContainer);});};RedxShopxPriceManager.prototype.getIntersectionObserver=function(){var _this=this;if(!this.observer){this.observer=new IntersectionObserver(function(entries){entries.forEach(function(observed){if(observed.isIntersecting){_this.reloadPrice(observed.target);}});},{root:null,rootMargin:'50px',threshold:0});} 4094return this.observer;};RedxShopxPriceManager.prototype.reloadPrice=function(priceContainer){var productKey=priceContainer.getAttribute("data-product");var variantKey=priceContainer.getAttribute("data-variant");var ajaxEndpoint="/ajaxendpoint/redx/shopx/";if(productKey){ajaxEndpoint+="product/"+productKey;} 4095else if(variantKey){ajaxEndpoint+="variant/"+variantKey;} 4096ajaxEndpoint+="/price";var startEvent=document.createEvent("CustomEvent");startEvent.initCustomEvent("xtx.shopx.price.reload",true,true,{"priceContainer":priceContainer});document.dispatchEvent(startEvent);fetch(ajaxEndpoint).then(function(response){return response.json();}).then(function(responseData){if(responseData.status!=="success"){throw new Error(responseData.message);} 4097if(responseData.data.product&&responseData.data.product.minPrice&&responseData.data.product.minPrice.html){priceContainer.outerHTML=responseData.data.product.minPrice.html;} 4098else if(responseData.data.variant){priceContainer.outerHTML=responseData.data.variant.html;} 4099return priceContainer;}).catch(function(error){console.log(error);}).then(function(priceContainer){var finishedEvent=document.createEvent("CustomEvent");finishedEvent.initCustomEvent("xtx.shopx.price.reloaded",true,true,{"priceContainer":priceContainer});document.dispatchEvent(finishedEvent);});};RedxShopxPriceManager.instance=null;return RedxShopxPriceManager;}());window.addEventListener("load",function(){RedxShopxPriceManager.getInstance().observePriceContainer();}); 4100"use strict";(function(){function sendData(data){const layerAttr=document.body?document.body.getAttribute('data-sst-layer'):null;if(layerAttr){data.layer=layerAttr;} 4101data.screenWidth=window.screen.width;data.screenHeight=window.screen.height;data.documentTitle=document.title;data.referrer=document.referrer;data.url=window.location.href;const requestId=document.body?document.body.dataset.requestId:null;if(requestId){data.requestId=requestId;} 4102if(typeof performance.getEntriesByType==='function'){const[nav]=performance.getEntriesByType('navigation');if(nav&&nav.loadEventEnd){data.performanceTimings={'networkTime':nav.connectEnd,'serverTime':nav.responseStart-nav.requestStart,'transferTime':nav.responseEnd-nav.responseStart,'domProcessingTime':nav.domInteractive-nav.responseEnd,'domCompletionTime':nav.domComplete-nav.domInteractive,'onLoadTime':nav.loadEventEnd-nav.loadEventStart,'redirectTime':nav.redirectEnd-nav.redirectStart,'connectTime':nav.connectEnd-nav.connectStart,'durationTime':nav.duration,'transferSize':nav.transferSize};}} 4103const request=new XMLHttpRequest();request.open('POST','/ajaxendpoint/redx/sst');request.send(JSON.stringify(data));} 4104let sstDataLayer=window['sstDataLayer'];window['sstDataLayer']={};window['sstDataLayer'].push=function(data){sendData(data);};if(Array.isArray(sstDataLayer)){sstDataLayer.forEach(function(data){sendData(data);});}})(); 4105 4106(function(){function addEventListeners(){document.addEventListener("mousedown",function(event){if(event&&event.button!==2){var mouseEvent=event.target;addLinkClick(mouseEvent);}},true);document.addEventListener('keydown',function(e){if(e.key==='Enter'){var targetElement=e.target;addLinkClick(targetElement);}},true);} 4107function getCleanText(element){var clone=element.cloneNode(true);clone.querySelectorAll('script, style').forEach(function(el){return el.remove();});return clone.textContent.replace(/\s+/g,' ').trim();} 4108function addLinkClick(element){if(!element.getAttribute('data-sst-title')&&element.tagName.toLowerCase()!=='a'){element=element.closest('a[href]');} 4109if(element){var title=getCleanText(element);if(element.getAttribute('data-sst-title')){title=element.getAttribute('data-sst-title');} 4110else if(element.getAttribute('title')){title=element.getAttribute('title');} 4111else if(element.getAttribute('data-title')){title=element.getAttribute('data-title');} 4112else{var elemWithTitle=element.querySelector('[title]');if(elemWithTitle){title=elemWithTitle.getAttribute('title');}} 4113var data={'sstEvent':'linkClick','link':element.getAttribute('href'),'target':element.getAttribute('target'),'title':title,};if(element.getAttribute('data-sst-category')){data.category=element.getAttribute('data-sst-category');} 4114else if(element.classList.contains('btn')||element.querySelector('.btn')){data.category='button';if(!title){data.title=element.innerText;}} 4115window['sstDataLayer']=window['sstDataLayer']||[];window['sstDataLayer'].push(data);}} 4116addEventListeners();})(); 4117 4118function sendNoBounce(seconds){window['sstDataLayer']=window['sstDataLayer']||[];window['sstDataLayer'].push({'sstEvent':'noBounce','seconds':seconds,});} 4119const second=1000;const initialSeconds=[5,10];initialSeconds.forEach(function(seconds){setTimeout(function(){sendNoBounce(seconds);},seconds*second);});let seconds=0;let interval=15;setTimeout(function scheduleNoBounce(){seconds+=interval;interval*=1.2;if(document.visibilityState==='visible'){sendNoBounce(seconds);} 4120setTimeout(scheduleNoBounce,interval*second);},interval*second); 4121 4122(function(){window.Redx_Analytics_Event_Base=function(){var _name;this.setName=function(name){_name=name;};this.getName=function(){return _name;};};})(); 4123 4124(function(){window.Redx_Analytics_Event_Generic=function(){var _category;var _action;var _label;var _value;var _noninteraction=true;this.setCategory=function(category){_category=category;};this.getCategory=function(){return _category;};this.setAction=function(action){_action=action;};this.getAction=function(){return _action;};this.setLabel=function(label){_label=label;};this.getLabel=function(){return _label;};this.setValue=function(value){_value=value;};this.getValue=function(){return _value;};this.setNonInteraction=function(noninteraction){_noninteraction=noninteraction;};this.getNonInteraction=function(){return _noninteraction;};};Redx_Analytics_Event_Generic.create=function(){var obj=new Redx_Analytics_Event_Generic();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameGeneric);return obj;};Redx_Analytics_Event_Generic.prototype=new Redx_Analytics_Event_Base();})(); 4125 4126(function(){window.Redx_Analytics_Event_VirtualPageView=function(){var _url;var _title;this.setUrl=function(url){_url=url;};this.getUrl=function(){return _url;};this.setTitle=function(title){_title=title;};this.getTitle=function(){return _title;};};Redx_Analytics_Event_VirtualPageView.create=function(url){var obj=new Redx_Analytics_Event_VirtualPageView();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameVirtualPageView);obj.setUrl(url);return obj;};Redx_Analytics_Event_VirtualPageView.prototype=new Redx_Analytics_Event_Base();})(); 4127 4128(function(){window.Redx_Analytics_Event_Ecommerce_Base=function(){var _currencyCode;this.setCurrencyCode=function(currencyCode){_currencyCode=currencyCode;};this.getCurrencyCode=function(){return _currencyCode;};};Redx_Analytics_Event_Ecommerce_Base.prototype=new Redx_Analytics_Event_Base();})(); 4129 4130(function(){window.Redx_Analytics_Event_Ecommerce_Impression=function(){var _name;var _id;var _price;var _brand;var _category;var _variant;var _list;var _position;this.setName=function(name){_name=name;};this.getName=function(){return _name;};this.setId=function(id){_id=id;};this.getId=function(){return _id;};this.setPrice=function(price){_price=price;};this.getPrice=function(){return _price;};this.setBrand=function(brand){_brand=brand;};this.getBrand=function(){return _brand;};this.setCategory=function(category){_category=category;};this.getCategory=function(){return _category;};this.setVariant=function(variant){_variant=variant;};this.getVariant=function(){return _variant;};this.setList=function(list){_list=list;};this.getList=function(){return _list;};this.setPosition=function(position){_position=position;};this.getPosition=function(){return _position;};this.getData=function(){var json={};if(this.getName()){json.name=this.getName();} 4131if(this.getId()){json.id=this.getId();} 4132if(this.getPrice()){json.price=this.getPrice();} 4133if(this.getBrand()){json.brand=this.getBrand();} 4134if(this.getCategory()){json.category=this.getCategory();} 4135if(this.getVariant()){json.variant=this.getVariant();} 4136if(this.getList()){json.list=this.getList();} 4137if(this.getPosition()){json.position=this.getPosition();} 4138return json;};};Redx_Analytics_Event_Ecommerce_Impression.create=function(){return new Redx_Analytics_Event_Ecommerce_Impression();};})(); 4139 4140(function(){window.Redx_Analytics_Event_Ecommerce_ProductImpression=function(){var _impressions=[];this.addImpression=function(impression){_impressions.push(impression);};this.getDataType=function(){return'impressions';};this.hasImpressions=function(){return _impressions.length;};this.getData=function(){var ret=[];for(var i=0;i<_impressions.length;i++){ret.push(_impressions[i].getData());} 4141return ret;};};Redx_Analytics_Event_Ecommerce_ProductImpression.create=function(){var obj=new Redx_Analytics_Event_Ecommerce_ProductImpression();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameEcommerceProductImpression);return obj;};Redx_Analytics_Event_Ecommerce_ProductImpression.prototype=new Redx_Analytics_Event_Ecommerce_Base();})(); 4142 4143(function(){window.Redx_Analytics_Event_Ecommerce_Product=function(){var _name;var _id;var _sku;var _price;var _brand;var _category;var _variant;var _quantity;var _dimensions={};var _coupon;this.setName=function(name){_name=name;};this.getName=function(){return _name;};this.setId=function(id){_id=id;};this.getId=function(){return _id;};this.setPrice=function(price){_price=price;};this.getPrice=function(){return _price;};this.setBrand=function(brand){_brand=brand;};this.getBrand=function(){return _brand;};this.setCategory=function(category){_category=category;};this.getCategory=function(){return _category;};this.setVariant=function(variant){_variant=variant;};this.getVariant=function(){return _variant;};this.setQuantity=function(quantity){_quantity=quantity;};this.getQuantity=function(){return _quantity;};this.setDimension=function(number,value){_dimensions[number]=value;};this.getDimension=function(number){return _dimensions[number];};this.setCoupon=function(coupon){_coupon=coupon;};this.getCoupon=function(coupon){return _coupon;};this.setSku=function(sku){_sku=sku;};
4143this.getSku=function(sku){return _sku;};this.getData=function(){var json={};if(this.getName()){json.name=this.getName();} 4144if(this.getId()){json.id=this.getId();} 4145if(this.getSku()){json.sku=this.getSku();} 4146if(this.getPrice()){json.price=this.getPrice();} 4147if(this.getBrand()){json.brand=this.getBrand();} 4148if(this.getCategory()){json.category=this.getCategory();} 4149if(this.getVariant()){json.variant=this.getVariant();} 4150if(this.getQuantity()){json.quantity=this.getQuantity();} 4151if(this.getCoupon()){json.coupon=this.getCoupon();} 4152if(_dimensions){for(var dimNumber in _dimensions){json['dimension'+dimNumber]=_dimensions[dimNumber];}} 4153return json;};};Redx_Analytics_Event_Ecommerce_Product.create=function(){return new Redx_Analytics_Event_Ecommerce_Product();};})(); 4154 4155(function(){window.Redx_Analytics_Event_Ecommerce_ProductClick=function(){var _products=[];var _list;this.addProduct=function(product){_products.push(product);};this.getDataType=function(){return'click';};this.setList=function(list){_list=list;};this.getList=function(){return _list;};this.getData=function(){var ret={};ret.actionField={'list':this.getList()};ret.products=[];for(var i=0;i<_products.length;i++){ret.products.push(_products[i].getData());} 4156return ret;};};Redx_Analytics_Event_Ecommerce_ProductClick.create=function(){var obj=new Redx_Analytics_Event_Ecommerce_ProductClick();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameEcommerceProductClick);return obj;};Redx_Analytics_Event_Ecommerce_ProductClick.prototype=new Redx_Analytics_Event_Ecommerce_Base();})(); 4157 4158(function(){window.Redx_Analytics_Event_Ecommerce_ProductDetailImpression=function(){var _products=[];var _list='';this.addProduct=function(product){_products.push(product);};this.getDataType=function(){return'detail';};this.setList=function(list){_list=list;};this.getList=function(){return _list;};this.getData=function(){var ret={};ret.actionField={'list':this.getList()};ret.products=[];for(var i=0;i<_products.length;i++){ret.products.push(_products[i].getData());} 4159return ret;};};Redx_Analytics_Event_Ecommerce_ProductDetailImpression.create=function(){var obj=new Redx_Analytics_Event_Ecommerce_ProductDetailImpression();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameEcommerceProductDetail);return obj;};Redx_Analytics_Event_Ecommerce_ProductDetailImpression.prototype=new Redx_Analytics_Event_Ecommerce_Base();})(); 4160 4161(function(){window.Redx_Analytics_Event_Ecommerce_ProductAddToCart=function(){var _products=[];var _list='';this.addProduct=function(product){_products.push(product);};this.getDataType=function(){return'add';};this.setList=function(list){_list=list;};this.getList=function(){return _list;};this.getData=function(){var ret={};if(this.getList()){ret.actionField={'list':this.getList()};} 4162ret.products=[];for(var i=0;i<_products.length;i++){ret.products.push(_products[i].getData());} 4163return ret;};};Redx_Analytics_Event_Ecommerce_ProductAddToCart.create=function(){var obj=new Redx_Analytics_Event_Ecommerce_ProductAddToCart();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameEcommerceAddToCart);return obj;};Redx_Analytics_Event_Ecommerce_ProductAddToCart.prototype=new Redx_Analytics_Event_Ecommerce_Base();})(); 4164 4165(function(){window.Redx_Analytics_Event_Ecommerce_ProductRemoveFromCart=function(){var _products=[];this.addProduct=function(product){_products.push(product);};this.getDataType=function(){return'remove';};this.getData=function(){var ret={};ret.products=[];for(var i=0;i<_products.length;i++){ret.products.push(_products[i].getData());} 4166return ret;};};Redx_Analytics_Event_Ecommerce_ProductRemoveFromCart.create=function(){var obj=new Redx_Analytics_Event_Ecommerce_ProductRemoveFromCart();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameEcommerceRemoveFromCart);return obj;};Redx_Analytics_Event_Ecommerce_ProductRemoveFromCart.prototype=new Redx_Analytics_Event_Ecommerce_Base();})(); 4167 4168(function(){window.Redx_Analytics_Event_Ecommerce_Checkout=function(){var _products=[];var _step;var _option;this.addProduct=function(product){_products.push(product);};this.getDataType=function(){return'checkout';};this.setStep=function(step){_step=step;};
4168this.getStep=function(){return _step;};this.setOption=function(option){_option=option;};this.getOption=function(){return _option;};this.getData=function(){var ret={};ret.actionField={'step':this.getStep()};if(this.getOption()){ret.actionField.option=this.getOption();} 4169ret.products=[];for(var i=0;i<_products.length;i++){ret.products.push(_products[i].getData());} 4170return ret;};};Redx_Analytics_Event_Ecommerce_Checkout.create=function(){var obj=new Redx_Analytics_Event_Ecommerce_Checkout();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameEcommerceCheckout);return obj;};Redx_Analytics_Event_Ecommerce_Checkout.prototype=new Redx_Analytics_Event_Ecommerce_Base();})(); 4171 4172(function(){window.Redx_Analytics_Event_Ecommerce_Purchase=function(){var _products=[];var _id;var _revenue;var _tax;var _shipping;var _coupon;this.addProduct=function(product){_products.push(product);};this.getDataType=function(){return'purchase';};this.setId=function(id){_id=id;};this.getId=function(){return _id;};this.setRevenue=function(revenue){_revenue=revenue;};this.getRevenue=function(){return _revenue;};this.setTax=function(tax){_tax=tax;};this.getTax=function(){return _tax;};this.setShipping=function(shipping){_shipping=shipping;};this.getShipping=function(){return _shipping;};this.setCoupon=function(coupon){_coupon=coupon;};this.getCoupon=function(){return _coupon;};this.getData=function(){var ret={};ret.actionField={'id':this.getId(),'revenue':this.getRevenue(),'tax':this.getTax(),'shipping':this.getShipping(),'coupon':this.getCoupon()};ret.products=[];for(var i=0;i<_products.length;i++){ret.products.push(_products[i].getData());} 4173return ret;};};Redx_Analytics_Event_Ecommerce_Purchase.create=function(){var obj=new Redx_Analytics_Event_Ecommerce_Purchase();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameEcommercePurchase);return obj;};Redx_Analytics_Event_Ecommerce_Purchase.prototype=new Redx_Analytics_Event_Ecommerce_Base();})(); 4174 4175(function(){window.Redx_Analytics_Event_Ecommerce_Promotion=function(){var _name;var _id;var _creative;var _position;this.setName=function(name){_name=name;};this.getName=function(){return _name;};this.setId=function(id){_id=id;};this.getId=function(){return _id;};this.setCreative=function(creative){_creative=creative;};this.getCreative=function(){return _creative;};this.setPosition=function(position){_position=position;};this.getPosition=function(){return _position;};this.getData=function(){var json={};if(this.getName()){json.name=this.getName();} 4176if(this.getId()){json.id=this.getId();} 4177if(this.getCreative()){json.creative=this.getCreative();} 4178if(this.getPosition()){json.position=this.getPosition();} 4179return json;};};Redx_Analytics_Event_Ecommerce_Promotion.create=function(){return new Redx_Analytics_Event_Ecommerce_Promotion();};})(); 4180 4181(function(){window.Redx_Analytics_Event_Ecommerce_PromotionView=function(){var _promotions=[];this.addPromotion=function(promotion){_promotions.push(promotion);};this.getDataType=function(){return'promoView';};this.getData=function(){var ret={};ret.promotions=[];for(var i=0;i<_promotions.length;i++){ret.promotions.push(_promotions[i].getData());} 4182return ret;};};Redx_Analytics_Event_Ecommerce_PromotionView.create=function(){var obj=new Redx_Analytics_Event_Ecommerce_PromotionView();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameEcommercePromotionView);return obj;};Redx_Analytics_Event_Ecommerce_PromotionView.prototype=new Redx_Analytics_Event_Ecommerce_Base();})(); 4183 4184(function(){window.Redx_Analytics_Event_Ecommerce_PromotionClick=function(){var _promotions=[];this.addPromotion=function(promotion){_promotions.push(promotion);};this.getDataType=function(){return'promoClick';};this.getData=function(){var ret={};ret.promotions=[];for(var i=0;i<_promotions.length;i++){ret.promotions.push(_promotions[i].getData());} 4185return ret;};};Redx_Analytics_Event_Ecommerce_PromotionClick.create=function(){var obj=new Redx_Analytics_Event_Ecommerce_PromotionClick();obj.setName(document.body.dataset.xtxDefaultGtmTrackingEventNameEcommercePromotionClick);return obj;};Redx_Analytics_Event_Ecommerce_PromotionClick.prototype=new Redx_Analytics_Event_Ecommerce_Base();})(); 4186 4187(function(){window.Redx_Analytics=function(){var _doDebug=false;this.sendVirtualPageView=function(eventObj){if(this.isDefaultGtmTracking()){window['dataLayer']=window['dataLayer']||[];window['dataLayer'].push({'virtualPageViewUrl':eventObj.getUrl(),'event':eventObj.getName()});}else if(typeof ga!=='undefined'){if(eventObj.getTitle()){ga('send','pageview',{'page':eventObj.getUrl(),'title':eventObj.getTitle()});} 4188else{ga('send','pageview',eventObj.getUrl());}}else if(typeof _gaq!=='undefined'){_gaq.push(['_trackPageview',eventObj.getUrl()]);}else if(typeof _gat!='undefined'){_gat._getTrackers()[0]._trackPageview(eventObj.getUrl());}};this.sendEvent=function(eventObj){if(this.isDefaultGtmTracking()){window['dataLayer']=window['dataLayer']||[];var obj={'event':eventObj.getName(),'category':eventObj.getCategory(),'action':eventObj.getAction(),'label':eventObj.getLabel(),'value':eventObj.getValue(),'noninteraction':eventObj.getNonInteraction()?'1':'0'};window['dataLayer'].push(obj);if(_doDebug){console.log(obj);}}else if(typeof ga!=='undefined'){ga('send',{hitType:'event',eventCategory:eventObj.getCategory(),eventAction:eventObj.getAction(),eventLabel:encodeURI(eventObj.getLabel())});}else if(typeof _gaq!=='undefined'){_gaq.push(['_trackEvent',eventObj.getCategory(),eventObj.getAction(),eventObj.getLabel()]);}};this.sendEcommerceEvent=function(eventObj){if(this.isDefaultGtmTracking()){var obj={};obj.event=eventObj.getName();obj.ecommerce={};if(eventObj.getCurrencyCode()){obj.ecommerce['currencyCode']=eventObj.getCurrencyCode();} 4189obj.ecommerce[eventObj.getDataType()]=eventObj.getData();window['dataLayer']=window['dataLayer']||[];window['dataLayer'].push(obj);if(_doDebug){console.log(obj);}}};this.isDefaultGtmTracking=function(){return(document.body&&document.body.dataset&&typeof document.body.dataset.xtxDefaultGtmTracking!=='undefined');};this.setDebug=function(debug){console.log(debug?'Redx_Analytics debugging ist aktiviert.':'Redx_Analytics debugging ist deaktiviert.');_doDebug=debug;};};var instance=null;Redx_Analytics.getInstance=function(){if(instance===null){instance=new Redx_Analytics();} 4190return instance;};})(); 4191 4192var VideoTracking=(function(){function VideoTracking(){this.youtubeDefaultPath="https://www.youtube.com/watch?v=";this.vimeoDefaultPath="https://vimeo.com/";} 4193VideoTracking.prototype.init=function(){this.addEventListeners();};VideoTracking.prototype.addEventListeners=function(){document.addEventListener('xtx.component.video.statusChanged',function(event){var videoTag=event.target;if(videoTag.hasAttribute('data-background-video')){return;} 4194var isLoop=videoTag.loop;if(isLoop&&(event.detail.counter>1||event.detail.status==='replay')){return;} 4195if(!VideoTracking.isInViewport(videoTag)){return;} 4196var analyticsEvent=window.Redx_Analytics_Event_Generic.create();analyticsEvent.setName('event');analyticsEvent.setCategory('Video');if(videoTag.hasAttribute('data-sst-video-name')){analyticsEvent.setLabel(videoTag.getAttribute(' data-sst-video-name'));} 4197analyticsEvent.setNonInteraction(false);switch(event.detail.status){case"started":analyticsEvent.setAction('Start');break;case"replay":analyticsEvent.setAction('Replay');break;case"ended":analyticsEvent.setAction('End');break;default:return;} 4198window.Redx_Analytics.getInstance().sendEvent(analyticsEvent);});};VideoTracking.isInViewport=function(videoTag){var rect=videoTag.getBoundingClientRect();var height=(window.innerHeight||document.documentElement.clientHeight);var width=(window.innerWidth||document.documentElement.clientWidth);return(((rect.top>=0&&rect.top<=height)||(rect.bottom>=0&&rect.bottom<=height))&&((rect.left>=0&&rect.left<=width)||(rect.right>=0&&rect.right<=width)));};return VideoTracking;}());(function(){(new VideoTracking().init());})(); 4199 4200(function(){window.Redx_Analytics_Ecommerce=function(){var _dataProductListPrefix='data-xtx-default-gtm-tracking-product-list';var _dataProductDetailPrefix='data-xtx-default-gtm-tracking-product-detail';var _dataProductAddToCartPrefix='data-xtx-default-gtm-tracking-product-add-to-cart';var _dataProductRemoveFromCartPrefix='data-xtx-default-gtm-tracking-product-remove-from-cart';var _dataCheckout='data-xtx-default-gtm-tracking-checkout';var _dataCheckoutProduct=_dataCheckout+'-product';var _dataPurchase='data-xtx-default-gtm-tracking-purchase';var _dataPurchaseProduct=_dataPurchase+'-product';var _dataPromotion='data-xtx-default-gtm-tracking-promotion';var _actualProductLists=null;let self=this;this.resetImpressionTracking=function(){jQuery('[data-xtx-default-gtm-tracking-product-impression-tracked]').each(function(){jQuery(this).removeAttr('data-xtx-default-gtm-tracking-product-impression-tracked');});};this.doTrackImpression=function(){var win=jQuery(window);var viewport={top:win.scrollTop(),left:win.scrollLeft()};viewport.right=viewport.left+win.width();viewport.bottom=viewport.top+win.height();var products=jQuery('['+_dataProductListPrefix+'="1"]:visible');var position=1;products.each(function(){jQuery(this).attr(_dataProductListPrefix+'-position',position);position++;});var impressions=[];var currencyCode='';var metaTitle=jQuery('title').text();products.each(function(){var obj=jQuery(this);if(!obj.attr('data-xtx-default-gtm-tracking-product-impression-tracked')){var bounds=obj.offset();bounds.right=bounds.left+obj.outerWidth();bounds.bottom=bounds.top+obj.outerHeight();if((!(viewport.right<bounds.left||viewport.left>bounds.right||viewport.bottom<bounds.top||viewport.top>bounds.bottom))&&obj.attr(_dataProductListPrefix+'-id')){var id=obj.attr(_dataProductListPrefix+'-id');self.setActualProductList(id,jQuery('title').text());var impression=Redx_Analytics_Event_Ecommerce_Impression.create();impression.setId(id);impression.setName(obj.attr(_dataProductListPrefix+'-name'));impression.setPrice(obj.attr(_dataProductListPrefix+'-price'));impression.setBrand(obj.attr(_dataProductListPrefix+'-brand'));impression.setCategory(obj.attr(_dataProductListPrefix+'-category'));impression.setVariant(obj.attr(_dataProductListPrefix+'-variant'));impression.setList(metaTitle);impression.setPosition(parseInt(obj.attr(_dataProductListPrefix+'-position')));impressions.push(impression);currencyCode=obj.attr(_dataProductListPrefix+'-currency-code');obj.attr('data-xtx-default-gtm-tracking-product-impression-tracked',true)}}});if(impressions.length&¤cyCode){var eventObj=Redx_Analytics_Event_Ecommerce_ProductImpression.create();eventObj.setCurrencyCode(currencyCode);for(var i=0;i<impressions.length;i++){eventObj.addImpression(impressions[i]);} 4201Redx_Analytics.getInstance().sendEcommerceEvent(eventObj);}};var _initActualProductList=function(){if(_actualProductLists===null){_actualProductLists={};} 4202try{var sessValue=window.localStorage.getItem('actualProductListsObj');if(sessValue){var sessObj=JSON.parse(sessValue);if(sessObj){_actualProductLists=sessObj;}}}catch(error){}};this.setActualProductList=function(id,actualProductList){try{_initActualProductList();_actualProductLists[id]=actualProductList;window.localStorage.setItem('actualProductListsObj',JSON.stringify(_actualProductLists));}catch(error){}};this.getActualProductList=function(id){if(document.referrer&&document.referrer.indexOf(location.protocol+'//'+location.host)===0){_initActualProductList();return _actualProductLists[id]?_actualProductLists[id]:'';} 4203return'';};this.doTrackClick=function(clickedObj){var obj=jQuery(clickedObj).closest('['+_dataProductListPrefix+'="1"]');if(obj.length){var actualList=jQuery('title').text();var eventObj=Redx_Analytics_Event_Ecommerce_ProductClick.create();eventObj.setCurrencyCode(obj.attr(_dataProductListPrefix+'-currency-code'));
4203eventObj.setList(actualList);var id=obj.attr(_dataProductListPrefix+'-id');var product=Redx_Analytics_Event_Ecommerce_Product.create();product.setName(obj.attr(_dataProductListPrefix+'-name'));product.setId(id);product.setPrice(obj.attr(_dataProductListPrefix+'-price'));product.setBrand(obj.attr(_dataProductListPrefix+'-brand'));product.setCategory(obj.attr(_dataProductListPrefix+'-category'));product.setVariant(obj.attr(_dataProductListPrefix+'-variant'));eventObj.addProduct(product);Redx_Analytics.getInstance().sendEcommerceEvent(eventObj);this.setActualProductList(id,actualList);}};this.doTrackDetailImpression=function(){var me=this;jQuery('['+_dataProductDetailPrefix+'="1"]').each(function(){var obj=jQuery(this);var id=obj.attr(_dataProductDetailPrefix+'-id');var eventObj=Redx_Analytics_Event_Ecommerce_ProductDetailImpression.create();eventObj.setCurrencyCode(obj.attr(_dataProductDetailPrefix+'-currency-code'));eventObj.setList(me.getActualProductList(id));var product=Redx_Analytics_Event_Ecommerce_Product.create();product.setName(obj.attr(_dataProductDetailPrefix+'-name'));product.setId(id);product.setPrice(obj.attr(_dataProductDetailPrefix+'-price'));product.setBrand(obj.attr(_dataProductDetailPrefix+'-brand'));product.setCategory(obj.attr(_dataProductDetailPrefix+'-category'));product.setVariant(obj.attr(_dataProductDetailPrefix+'-variant'));eventObj.addProduct(product);Redx_Analytics.getInstance().sendEcommerceEvent(eventObj);});};var _getPreparedProductValue=function(value){if(value=='redx_analytics_ecommerce_empty_value'){return'';} 4204return value;};var _doTrackProducts=function(ecommerceEvent,prefix){let sendEvent=false;jQuery('['+prefix+'="1"]:not([data-gtm-tracked])').each(function(){var obj=jQuery(this);obj.attr('data-gtm-tracked',true);var product=Redx_Analytics_Event_Ecommerce_Product.create();if(typeof ecommerceEvent.setList==='function'){ecommerceEvent.setList(self.getActualProductList(obj.attr(prefix+'-product-id')));} 4205ecommerceEvent.setCurrencyCode(obj.attr(prefix+'-currency-code'));product.setName(_getPreparedProductValue(obj.attr(prefix+'-name')));product.setId(_getPreparedProductValue(obj.attr(prefix+'-id')));product.setPrice(_getPreparedProductValue(obj.attr(prefix+'-price')));product.setBrand(_getPreparedProductValue(obj.attr(prefix+'-brand')));product.setCategory(_getPreparedProductValue(obj.attr(prefix+'-category')));product.setVariant(_getPreparedProductValue(obj.attr(prefix+'-variant')));product.setQuantity(_getPreparedProductValue(parseInt(obj.attr(prefix+'-quantity'))));product.setSku(_getPreparedProductValue(obj.attr(prefix+'-sku')));product.setCoupon(_getPreparedProductValue(obj.attr(prefix+'-coupon')));var dimensions=[].filter.call(this.attributes,function(at){return new RegExp(prefix+'-dimension-').test(at.name);});if(dimensions.length){for(var i=0;i<dimensions.length;i++){var dimValue=dimensions[i].value;if(jQuery.isNumeric(dimValue)&&Math.floor(dimValue)==dimValue){dimValue=parseInt(dimValue);} 4206dimValue=_getPreparedProductValue(dimValue);product.setDimension(dimensions[i].name.replace(new RegExp(prefix+'-dimension-'),''),dimValue);}} 4207ecommerceEvent.addProduct(product);sendEvent=true;});if(sendEvent){Redx_Analytics.getInstance().sendEcommerceEvent(ecommerceEvent);}};this.doTrackAddToCart=function(){_doTrackProducts(Redx_Analytics_Event_Ecommerce_ProductAddToCart.create(),_dataProductAddToCartPrefix);};this.doTrackRemoveFromCart=function(){_doTrackProducts(Redx_Analytics_Event_Ecommerce_ProductRemoveFromCart.create(),_dataProductRemoveFromCartPrefix);};this.doTrackCheckout=function(){jQuery('['+_dataCheckout+'="1"]').each(function(){var obj=jQuery(this);var eventObj=Redx_Analytics_Event_Ecommerce_Checkout.create();eventObj.setCurrencyCode(obj.attr(_dataCheckout+'-currency-code'));eventObj.setStep(parseInt(obj.attr(_dataCheckout+'-step')));eventObj.setOption(obj.attr(_dataCheckout+'-option'));_doTrackProducts(eventObj,_dataCheckoutProduct);});};this.doTrackPurchase=function(){jQuery('['+_dataPurchase+'="1"]').each(function(){var obj=jQuery(this);var eventObj=Redx_Analytics_Event_Ecommerce_Purchase.create();eventObj.setCurrencyCode(obj.attr(_dataPurchase+'-currency-code'));eventObj.setId(obj.attr(_dataPurchase+'-id'));eventObj.setRevenue(obj.attr(_dataPurchase+'-revenue'));eventObj.setTax(obj.attr(_dataPurchase+'-tax'));eventObj.setShipping(obj.attr(_dataPurchase+'-shipping'));eventObj.setCoupon(obj.attr(_dataPurchase+'-coupon')?obj.attr(_dataPurchase+'-coupon'):'');_doTrackProducts(eventObj,_dataPurchaseProduct);});};this.getDataAttributeNamePromotion=function(){return _dataPromotion;};this.doTrackPromotionView=function(elemObj){var elements=elemObj?jQuery(elemObj):jQuery('['+_dataPromotion+'="1"]:visible');if(elements.length){var win=jQuery(window);var viewport={top:win.scrollTop(),left:win.scrollLeft()};viewport.right=viewport.left+win.width();viewport.bottom=viewport.top+win.height();var promotions=[];elements.each(function(){var obj=jQuery(this);if(!obj.attr(_dataPromotion+'-view-tracked')){var bounds=obj.offset();bounds.top+=1;bounds.right=bounds.left+obj.outerWidth();bounds.bottom=bounds.top+obj.outerHeight();if((!(viewport.right<bounds.left||viewport.left>bounds.right||viewport.bottom<bounds.top||viewport.top>bounds.bottom))&&obj.attr(_dataPromotion+'-id')){var promotion=Redx_Analytics_Event_Ecommerce_Promotion.create();promotion.setId(obj.attr(_dataPromotion+'-id'));promotion.setName(obj.attr(_dataPromotion+'-name'));promotion.setCreative(obj.attr(_dataPromotion+'-creative'));promotion.setPosition(obj.attr(_dataPromotion+'-position'));promotions.push(promotion);obj.attr(_dataPromotion+'-view-tracked',true);}}});if(promotions.length){var eventObj=Redx_Analytics_Event_Ecommerce_PromotionView.create();for(var i=0;i<promotions.length;i++){eventObj.addPromotion(promotions[i]);} 4208Redx_Analytics.getInstance().sendEcommerceEvent(eventObj);}}};this.doTrackPromotionClick=function(clickedObj){var obj=jQuery(clickedObj).closest('['+_dataPromotion+']');if(obj.length&&!obj.attr(_dataPromotion+'-click-tracked')){obj.attr(_dataPromotion+'-click-tracked',true);var eventObj=Redx_Analytics_Event_Ecommerce_PromotionClick.create();var promotion=Redx_Analytics_Event_Ecommerce_Promotion.create();promotion.setId(obj.attr(_dataPromotion+'-id'));promotion.setName(obj.attr(_dataPromotion+'-name'));promotion.setCreative(obj.attr(_dataPromotion+'-creative'));promotion.setPosition(obj.attr(_dataPromotion+'-position'));eventObj.addPromotion(promotion);Redx_Analytics.getInstance().sendEcommerceEvent(eventObj);}};};var instance=null;Redx_Analytics_Ecommerce.getInstance=function(){if(instance===null){instance=new Redx_Analytics_Ecommerce();} 4209return instance;};if(typeof jQuery!=='undefined'){jQuery(function(){if(jQuery('[data-xtx-default-gtm-tracking-product-list="1"]').length){let trackImpressions=function(){Redx_Analytics_Ecommerce.getInstance().doTrackImpression();};jQuery(window).on('scroll',trackImpressions);jQuery(document).ready(trackImpressions);document.addEventListener('xtx.presentation.accordion.open',trackImpressions,false);document.addEventListener('xtx-datanavigator-navigated',trackImpressions,false);document.addEventListener('xtx.presentation.tabs.show',trackImpressions,false);} 4210var detailLinks=jQuery('[data-product-detail-link="1"],[data-xtx-default-gtm-tracking-product-list-detail-link="1"]');
4210if(detailLinks.length){detailLinks.on('mousedown',function(event){if(event.which!==3){Redx_Analytics_Ecommerce.getInstance().doTrackClick(this);}});} 4211if(jQuery('[data-xtx-default-gtm-tracking-product-detail="1"]').length){jQuery(document).ready(function(){Redx_Analytics_Ecommerce.getInstance().doTrackDetailImpression();});} 4212let trackAddToCart=function(){Redx_Analytics_Ecommerce.getInstance().doTrackAddToCart();};jQuery(document).ready(trackAddToCart);document.addEventListener('xtx.tracking.ecommerce.cart.updated',trackAddToCart,false);let removeFromCart=function(){Redx_Analytics_Ecommerce.getInstance().doTrackRemoveFromCart();};jQuery(document).ready(removeFromCart);document.addEventListener('xtx.tracking.ecommerce.cart.updated',removeFromCart,false);if(jQuery('[data-xtx-default-gtm-tracking-checkout="1"]').length){jQuery(document).ready(function(){Redx_Analytics_Ecommerce.getInstance().doTrackCheckout();});} 4213if(jQuery('[data-xtx-default-gtm-tracking-purchase="1"]').length){jQuery(document).ready(function(){Redx_Analytics_Ecommerce.getInstance().doTrackPurchase();});} 4214var promotions=jQuery('[data-xtx-default-gtm-tracking-promotion="1"]');if(promotions.length){jQuery(window).on('scroll',function(){Redx_Analytics_Ecommerce.getInstance().doTrackPromotionView();});jQuery(document).ready(function(){Redx_Analytics_Ecommerce.getInstance().doTrackPromotionView();});promotions.on('mousedown',function(event){if(event&&event.which!=3){Redx_Analytics_Ecommerce.getInstance().doTrackPromotionClick(this);}});}});}})(); 4215 4216function showFormSettings(form_module_key){var chooser=$('SiteX_sitex_pages_form_module_key').value;var ua=navigator.userAgent;$('redx_forms').style.display='none';if(chooser==form_module_key){$('redx_forms').style.display='table-row-group';}} 4217function checkmaxlength(id,max_length){var field=document.getElementById(id);if(field){var text=field.value;if(text.length>=max_length){field.value=text.substring(0,max_length);}}} 4218 4219function loadFixedContentAjax(encryptedKey,encryptedPageKey,idPrefix){var request=new XMLHttpRequest();request.onreadystatechange=function(){if(request.readyState===XMLHttpRequest.DONE){var fixedContentContainer=document.querySelector("#"+idPrefix+encryptedKey);var fixedContentContainerWrapper=document.querySelector("#"+idPrefix+encryptedKey+" [data-offcanvas-content] .content_wrapper");if(request.status===0||(request.status>=200&&request.status<400)){fixedContentContainer.dataset.contentLoaded=1;fixedContentContainerWrapper.innerHTML=JSON.parse(request.responseText).data.content;const fixedContentLoadedEvent=new CustomEvent('xsites.fixedcontent.loaded',{bubbles:true,cancelable:true,detail:{id:idPrefix+encryptedKey}});document.dispatchEvent(fixedContentLoadedEvent);}else{console.log(request);} 4220if(App!==undefined){App.removeLoadingSpinnerFromElement(fixedContentContainer);}}};
4220request.open("get","/ajaxendpoint/redx/content/page/fixedcontent/"+encryptedKey+"?page="+encryptedPageKey,true);request.send({});} 4221function SlideoutController(){this._init=function(){window.addEventListener("DOMContentLoaded",function(slideoutController){Array.prototype.forEach.call(document.querySelectorAll("#fixedContentButtons .slideoutButton :is(a, button), :is(a, button).slideoutButton"),function(button){button.addEventListener("click",function(ev){ev.preventDefault();ev.stopPropagation();const eventOpen=new Event('xtx.navigation.offcanvas.open',{bubbles:true,cancelable:true});document.querySelector("#slideout_"+this.closest('[data-slideout]').dataset.slideout).dispatchEvent(eventOpen);document.body.classList.add("slideoutOpen");return false;});button.addEventListener("mouseover",function(){if(this.parentNode.previousElementSibling){this.parentNode.previousElementSibling.classList.add("prev-active");} 4222this.parentNode.classList.add("active");});button.addEventListener("mouseout",function(){if(this.parentNode.previousElementSibling){this.parentNode.previousElementSibling.classList.remove("prev-active");} 4223this.parentNode.classList.remove("active");});});Array.prototype.forEach.call(document.querySelectorAll(".slideout"),function(slideoutController,slideout){slideout.querySelector(".close").addEventListener("click",function(ev){ev.preventDefault();var eventClose=document.createEvent('Event');eventClose.initEvent('xtx.navigation.offcanvas.close',true,true);slideout.dispatchEvent(eventClose);document.body.classList.remove("slideoutOpen");});slideout.addEventListener('xtx.navigation.offcanvas.open',function(){if(this.dataset.contentLoaded===undefined){if(App!==undefined){App.setLoadingSpinnerOnElement(slideout,"large");} 4224loadFixedContentAjax(slideout.dataset.slideout,slideout.dataset.page,'slideout_');}}.bind(slideout,slideoutController));}.bind(this,slideoutController));}.bind(window,this));};this._init();} 4225function ModalController(){this._init=function(){window.addEventListener("DOMContentLoaded",function(modalController){Array.prototype.forEach.call(document.querySelectorAll("#fixedContentButtons .fixedContentModalButton :is(a, button), :is(a, button).fixedContentModalButton"),function(button){button.addEventListener("click",function(ev){ev.preventDefault();ev.stopPropagation();const eventOpen=new Event('xtx.navigation.offcanvas.open',{bubbles:true,cancelable:true});document.querySelector("#modal_"+this.closest('[data-fixed-content-modal]').dataset.fixedContentModal).dispatchEvent(eventOpen);return false;});});Array.prototype.forEach.call(document.querySelectorAll(".fixed-content-modal"),function(modalController,modal){modal.addEventListener('xtx.navigation.offcanvas.open',function(){this.open();if(this.dataset.contentLoaded===undefined){if(App!==undefined){App.setLoadingSpinnerOnElement(modal.querySelector('.content_wrapper'),"large");} 4226loadFixedContentAjax(modal.dataset.fixedContentModal,modal.dataset.fixedContentModal,'modal_');}}.bind(modal,modalController));}.bind(this,modalController));}.bind(window,this));};this._init();} 4227window.slideoutController=new SlideoutController();window.modalController=new ModalController(); 4228 4229function RedxSessionSecurityCsrfProtection(){} 4230RedxSessionSecurityCsrfProtection.getToken=function(){return document.body.dataset.csrftoken;};RedxSessionSecurityCsrfProtection.getCsrfQueryString=function(delimiter){const token=RedxSessionSecurityCsrfProtection.getToken();let ret='';if(token){delimiter=(typeof delimiter==='undefined')?'&':delimiter;ret=delimiter+'csrftoken='+token;} 4231return ret;};RedxSessionSecurityCsrfProtection.isSameOrigin=function(url){const loc=window.location,a=document.createElement('a');a.href=url;return a.hostname===null||a.hostname===''||a.hostname===loc.hostname;};RedxSessionSecurityCsrfProtection.getResponseHeaderFromFetchArguments=function(arguments,name){if(arguments[1]&&arguments[1].headers){return arguments[1].headers[name];} 4232return null;};RedxSessionSecurityCsrfProtection.showSnackbar=function(message,status){if(typeof RedxSnackbar==='function'){new RedxSnackbar({message:message,status:status,timeout:false});}};(function(){let validationErrorSnackbarShown=false;const op=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){const resp=op.apply(this,arguments);const token=RedxSessionSecurityCsrfProtection.getToken();this.addEventListener('load',function(){if(this.getAllResponseHeaders().indexOf('x-csrf-validation')>=0&&this.getResponseHeader('x-csrf-validation')==='error'){if(!validationErrorSnackbarShown){validationErrorSnackbarShown=true;RedxSessionSecurityCsrfProtection.showSnackbar(this.getResponseHeader('x-redx-error-message'),'error');}}});if(token&&RedxSessionSecurityCsrfProtection.isSameOrigin(arguments[1])){this.setRequestHeader('X-CSRF-TOKEN',token);} 4233return resp;};const originalFetch=window.fetch;window.fetch=function(){const token=RedxSessionSecurityCsrfProtection.getToken();if(token&&arguments[0]&&arguments[1]&&RedxSessionSecurityCsrfProtection.isSameOrigin(arguments[0])&&!RedxSessionSecurityCsrfProtection.getResponseHeaderFromFetchArguments(arguments,'X-CSRF-TOKEN')){arguments[1].headers=arguments[1].headers||{};arguments[1].headers['X-CSRF-TOKEN']=token;} 4234for(let i=0;i<arguments.length;
4234i++){if(typeof arguments[i].method!=='undefined'&&(arguments[i].method.toUpperCase()==="GET"||arguments[i].method.toUpperCase()==="HEAD")){arguments[i].body=undefined;}} 4235return originalFetch.apply(window,arguments).then(function(result){if(result&&result.headers&&result.headers.get('x-csrf-validation')==='error'&&!validationErrorSnackbarShown){validationErrorSnackbarShown=true;RedxSessionSecurityCsrfProtection.showSnackbar(result.headers.get('x-redx-error-message'),'error');} 4236return result;});};}());
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.