document.addEventListener('DOMContentLoaded',function(){'use strict';if(typeof jtl_debug==='undefined'){return;} var debugOpen=false,jtlSetDebugWindowVisible,jtlToggleDebugWindowVisible;jtlSetDebugWindowVisible=function(visible){debugOpen=visible;if(debugOpen){$('body').addClass('jtl-debug-open');$('#jtl-debug-content').find('#jtl-debug-searchbox').focus();}else{$('body').removeClass('jtl-debug-open');$('#jtl-debug-searchbox').blur();}};jtlToggleDebugWindowVisible=function(){jtlSetDebugWindowVisible(!debugOpen);};jtl_debug.selectPath=function(element,event){var range,selection;if(document.body.createTextRange){range=document.body.createTextRange();range.moveToElementText(element);range.select();}else if(window.getSelection){selection=window.getSelection();range=document.createRange();range.selectNodeContents(element);selection.removeAllRanges();selection.addRange(range);} if(event){event.cancelBubble=true;}};jtl_debug.copy2clipboard=function(element,event){if(document.queryCommandSupported('copy')){var temp=$('');var currentColor=$(element).css('color');$('body').append(temp);temp.val($(element).text()).select();document.execCommand('copy');$(element).css('color','#777');setTimeout(function(){$(element).css('color',currentColor)},500);temp.remove();if(event){event.cancelBubble=true;}}else{jtl_debug.selectPath(this,event);}};$(function(){$('#jtl-debug-content-toggle').on('click',function(){jtlToggleDebugWindowVisible();});$('.jtl-debug-heading').on('click',function(){$(this).find('.jtl-debug-path').selectText();});$('#jtl-debug-show').on('click',function(evt){evt.preventDefault();jtlSetDebugWindowVisible(true);$('#jtl-debug-searchbox').focus().select();return false;});$('#jtl-debug-hide').on('click',function(evt){evt.preventDefault();jtlSetDebugWindowVisible(false);return false;});$(document).bind('keydown',function(evt){if(evt.ctrlKey&&(evt.which===13)){evt.preventDefault();evt.stopPropagation();evt.handled=true;jtlSetDebugWindowVisible(true);$('#jtl-debug-searchbox').focus().select();} if(evt.which===27){evt.preventDefault();jtlSetDebugWindowVisible(false);}});var secIdx=0,sections={},refIdx=0,refMap={};var transformDebugOutput=function(node){var nodeIdx=refIdx++;node.idx=nodeIdx;refMap[nodeIdx]=node;node.filter=[];if(typeof node.children==='object'){node.expanded=node.type==='section';for(var key in node.children){transformDebugOutput(node.children[key]);}} return node;};var sanitize=function(value){if(typeof value==='string'){return $('
').text(value).html();} return value;};var countChildren=function(node){if(typeof node.children!=='object'){return 0;} var count=0,childIdx;for(childIdx in node.children){count++;} return count;};var createNode=function(node,secIdx){var jNode='',childName;if(node.filter.indexOf('found-nothing')!==-1&&node.filter.indexOf('found-parent')===-1){return'';} if(node.type==='section'){jNode='
' +'
' +node.name +(countChildren(node)>0?'' +(node.expanded?'-':'+')+'':'')+'
'+'
';for(childName in node.children){if(node.expanded===true){jNode+=createNode(node.children[childName],secIdx);}} jNode+='
';}else if(node.type==='object'||node.type==='array'||node.type==='assoc_array'){jNode='
' +'' +'
';for(childName in node.children){if(node.expanded===true){jNode+=createNode(node.children[childName],secIdx);}} jNode+='
';}else{jNode='
' +'' +'' +node.key+''+' : ' +'' +((node.type==='string'&&node.value.length>500)?((sanitize(node.value)).substr(0,500)+'[...]'):sanitize(node.value))+''+'' +node.path+''+''+'
';} return jNode;};jtl_debug.toggleExpanded=function(nodeIdx,secIdx){var node=refMap[nodeIdx],childName,child,foundNothingIdx;if(typeof node==='object'){node.expanded=!node.expanded;if(typeof node.children==='object'&&node.filter.indexOf('found-parent')===-1){for(childName in node.children){child=node.children[childName];foundNothingIdx=child.filter.indexOf('found-nothing');if(foundNothingIdx!==-1){child.filter.splice(foundNothingIdx,1);}}} renderSection(sections[secIdx]);}};var collapseAll=function(node){var key;if(typeof node.expanded!=='undefined'){node.expanded=false;} if(typeof node.children==='object'){for(key in node.children){collapseAll(node.children[key]);}}};var resetFilter=function(node){var key;node.filter=[];if(typeof node.expanded!=='undefined'){node.expanded=node.type==='section';} if(typeof node.children==='object'){for(key in node.children){resetFilter(node.children[key]);}}};var showAllChildren=function(nodeIdx,secIdx){var node=refMap[nodeIdx],foundParentIdx=node.filter.indexOf('found-parent'),child,foundNothingIdx;if(foundParentIdx!==-1){node.filter.splice(foundParentIdx,1);} foundNothingIdx=node.filter.indexOf('found-nothing');if(foundNothingIdx!==-1){node.filter.splice(foundNothingIdx,1);} if(typeof node.children==='object'){for(var childName in node.children){child=node.children[childName];foundNothingIdx=child.filter.indexOf('found-nothing');if(foundNothingIdx!==-1){child.filter.splice(foundNothingIdx,1);}} renderSection(sections[secIdx]);}};var filterNode=function(term,node){var filter=[],key=(''+node.key+'').toLowerCase(),value=(''+node.value+'').toLowerCase(),path=(typeof node.path!=='undefined'&&node.path!==null)?node.path.toLowerCase():'ERROR';term=term.toLowerCase();if(term.indexOf('"')===0&&term.lastIndexOf('"')===(term.length-1)){term=term.substr(1,term.length-2);if(key===term){filter.push('found-key');} if(value===term){filter.push('found-value');}}else if(term.indexOf('$')===0||term.indexOf('>')===0){term=term.substr(1);if(path.indexOf(term)!==-1){filter.push('found-path');}}else if(term.indexOf('=')===0){if(term.indexOf('"')===1&&term.lastIndexOf('"')===term.length-1){term=term.substr(2,term.length-3);if(value===term){filter.push('found-value');}}else{term=term.substr(1);if(value.indexOf(term)!==-1){filter.push('found-value');}}}else{if(key.indexOf(term)!==-1){filter.push('found-key');} if(value.indexOf(term)!==-1){filter.push('found-value');}} return filter;};var filter=function(term,node,prevNodes){var found,i,myNodes,childName;node.filter=[];if(typeof node.expanded!=='undefined'){node.expanded=false;} if(typeof prevNodes==='undefined'){prevNodes=[];} node.filter=filterNode(term,node);found=node.filter.length>0;if(found===true){window.jtl_debug.results++;for(i=0;i .section-idx-'+section.idx);if(section.length===0){$('#jtl-debug-content').append(jTree);}else{section.empty().append(jTree);} $('.jtl-show-more-button').on('click',function(evt){evt.stopPropagation();jNode=$(this);showAllChildren(jNode.attr('data-nodeIdx'),jNode.attr('data-secidx'));});};var renderSections=function(){var idx;for(idx in sections){renderSection(sections[idx]);}};var registerSearchHandler=function(){$('#jtl-debug-searchbox').bind('keydown',function(e){var term,idx;if(e.which===13&&!e.ctrlKey){term=$('#jtl-debug-searchbox').val();if(term.trim().length===0){for(idx in sections){resetFilter(sections[idx].content);} $('#jtl-debug-search-results').text('');}else{window.jtl_debug.results=0;for(idx in sections){filter(term,sections[idx].content,[]);} $('#jtl-debug-search-results').text(window.jtl_debug.results +' '+jtl_debug.jtl_lang_var_search_results);} renderSections();}});};prepareSections();registerSearchHandler();});});;$(document).ready(function(){initGesamtpreis();});$(document).ready(function(){var observer=new MutationObserver(function(mutations){mutations.forEach(function(mutation){if(mutation.type=='childList'){if(mutation.addedNodes.length>=1){if(mutation.addedNodes[0].id=='result-wrapper'){initGesamtpreis();}}else if(mutation.removedNodes.length>=1){}}else if(mutation.type=='attributes'){}});});var observerConfig={attributes:false,childList:true,characterData:false};var targetNode=$('#content')[0];observer.observe(targetNode,observerConfig);});$.fn.getRealDimensions=function(outer){var $this=$(this);if($this.length==0){return false;} var $clone=$this.clone().show().css('visibility','hidden').insertAfter($this);var result={width:(outer)?$clone.outerWidth():$clone.innerWidth(),height:(outer)?$clone.outerHeight():$clone.innerHeight(),offsetTop:$clone.offset().top,offsetLeft:$clone.offset().left};$clone.remove();return result;} $(document).on('change keyup paste','#add-to-cart #quantity',function(el){var mindestabnahme=parseInt($('#add-to-cart #quantity').data('min')),intervall=parseInt($('#add-to-cart #quantity').data('int')),livecalc=parseInt($('#add-to-cart #quantity-grp').data('livecalc')),error=false;console.log('Menge manuell geaendert: '+$(el.target).val()+'; Mindestabnahme: '+mindestabnahme);if(!isNaN(mindestabnahme)||!isNaN(intervall)){var delay=10000;setTimeout(function(){console.log('mindestabnahme: '+mindestabnahme);if(!isNaN(mindestabnahme)){if($(el.target).val()0){$(el.target).val($(el.target).val()-rest);errorMindestabnahme();error=true;}}},delay);} calcGesamtpreis();});function errorMindestabnahme(){$(document).find('.purchase-info').addClass('alert-danger').removeClass('alert-info');var delay=1000;setTimeout(function(){$(document).find('.purchase-info').addClass('alert-info').removeClass('alert-danger');},delay);} $(document).on('change','.variation input',function(){var delay=500;setTimeout(function(){calcGesamtpreis();},delay);});$(document).on('change','.variations select',function(){var delay=500;setTimeout(function(){calcGesamtpreis();},delay);});function calcGesamtpreis(){var livecalc=parseInt($(document).find('#buy_form').data('livecalc')),cssprice=$(document).find('#buy_form').data('css-price'),cssprice1=$(document).find('#buy_form').data('css-price1'),cssbulkprice=$(document).find('#buy_form').data('css-bulkprice'),cssqty=$(document).find('#buy_form').data('css-qty');if(livecalc===1){var price=$(document).find(cssprice).text().trim(),price1=$(document).find(cssprice1).text().trim().replace('(','').replace(')',''),qty=parseFloat($(document).find('input#quantity').val()),tax=parseInt($('#quantity').data('tax')),taxFaktor=1+(tax/100),istNetto=parseInt($('#quantity').data('ist-netto')),trueNetto=parseInt($('#quantity').data('true-netto')),trueNettoWert=parseFloat($('#quantity').data('true-netto-wert')),mindestabnahme=parseInt($('#quantity').data('min')),bulkPrice_arr=$(document).find(cssbulkprice+' > table > tbody > tr'),tmpPrice=null,tmpPrice1=null,priceCalc=null,priceCalc1=null,bulkPrice=null,bulkPrice1=null,bulkPriceTmp=null,bulkPriceTmp1=null,price_arr=null,price_arr1=null,priceString='',priceString1='',gesamtpreis=null,gesamtpreis1=null,gesamtpreisString=null,gesamtpreisString1=null,textBretto=$(document).find('#buy_form').data('bretto-text');console.log('Bulk Prices:');console.log(bulkPrice_arr);console.log('Price: '+price);console.log('Price1: '+price1);if(typeof istNetto!='undefined'&&istNetto==1){taxFaktor=1;} if(typeof trueNettoWert!='undefined'&&!isNaN(trueNettoWert)){console.log('trueNettoWert: '+trueNettoWert);priceCalc=trueNettoWert;} if(typeof bulkPrice_arr!='undefined'&&bulkPrice_arr.length>0){bulkPrice_arr.each(function(index){if(!$(this).hasClass('buyedMost')){bulk_qty=parseFloat($(this).find('td:first-child').html());tmpPrice1=$(this).find('.bulk-price1').text().trim().replace('(','').replace(')','');tmpPrice=$(this).find('.bulk-price').text().trim();if(qty>=bulk_qty){price1=tmpPrice1;price=tmpPrice;$(cssbulkprice+' table > tbody tr').removeClass('set');$(this).addClass('set');} console.log(index+' - '+qty+' - '+bulk_qty+' - '+price+' - '+price1);}});console.log('Bulk Price found: '+price+' ('+price1+')');} price_arr=price.split(" ");price_arr1=price1.split(" ");price=price_arr[0].replace('.','').replace(',','.');price1=price_arr1[0].replace('.','').replace(',','.');console.log('Price: '+price);console.log('Price1: '+price1);price=parseFloat(price);price1=parseFloat(price1);tmpPrice=price;tmpPrice1=price1;if(typeof istNetto!='undefined'&&trueNetto==1){if(priceCalc==null){priceCalc=Math.round((tmpPrice/taxFaktor)*100,4)/100;priceCalc1=Math.round((tmpPrice1)*100,4)/100;} console.log('Netto: '+priceCalc);console.log('Brutto: '+priceCalc1);gesamtpreis=priceCalc*qty;gesamtpreis1=priceCalc1*qty;console.log('Gesamtpreis Netto: '+gesamtpreis);console.log('Gesamtpreis Brutto: '+gesamtpreis1);gesamtpreis=gesamtpreis*taxFaktor;gesamtpreis1=gesamtpreis1;gesamtpreis=Math.round(gesamtpreis*100,4)/100;gesamtpreis1=Math.round(gesamtpreis1*100,4)/100;}else{priceCalc=tmpPrice;priceCalc1=tmpPrice1;gesamtpreis=priceCalc*qty;gesamtpreis1=priceCalc1*qty;gesamtpreis=Math.round(gesamtpreis*100,4)/100;gesamtpreis1=Math.round(gesamtpreis1*100,4)/100;} gesamtpreis=gesamtpreis.toLocaleString(undefined,{minimumFractionDigits:2,maximumFractionDigits:2});gesamtpreis1=gesamtpreis1.toLocaleString(undefined,{minimumFractionDigits:2,maximumFractionDigits:2});priceString=price.toLocaleString(undefined,{minimumFractionDigits:2,maximumFractionDigits:2})+" "+price_arr[1];priceString1=price1.toLocaleString(undefined,{minimumFractionDigits:2,maximumFractionDigits:2})+" "+price_arr1[1];gesamtpreisString=gesamtpreis+" "+price_arr[1];gesamtpreisString1=gesamtpreis1+" "+price_arr1[1];$(document).find('#preisberechnung .preis .main').html(priceString);$(document).find('#preisberechnung .preis .small').html('('+priceString1+')');$(document).find(cssprice1).html('('+priceString1+' '+price_arr1[2]+')');$(document).find('#preisberechnung .gesamtpreis .main').html(gesamtpreisString);$(document).find('#preisberechnung .gesamtpreis .small').html('('+gesamtpreisString1+')');$(document).find(cssprice).html(priceString);$(document).find(cssprice1).html('('+priceString1+' '+textBretto+')');if(isNaN(price)){$(document).find('#preisberechnung .gesamtpreis .main').html('0,00 €');}}} function initGesamtpreis(){window.setTimeout(function(){var livecalc=parseInt($('#buy_form').data('livecalc'));if(livecalc===1){const vw=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0);var boxGesamtpreis=$(document).find('#preisberechnung'),cssqty=$(document).find('#buy_form').data('css-qty'),oQTY=$(document).find('#quantity'),qty_wrapper=oQTY.parent(),offset=(qty_wrapper.outerWidth())/2,minusButton=$('#buy_form '+cssqty+' .fa-plus').outerWidth(),pfeil=0,preis=0,gesamtpreis=0,symbolTimes=0,symbolGleich=0;if(typeof minusButton==='undefined'){console.log('minusButton neu berechnen') minusButton=$('#buy_form '+cssqty+' [data-spinner-button="up"]').outerWidth();} pfeil=oQTY.outerWidth()+offset+minusButton-45;if(vw<768) pfeil=pfeil/3;symbolTimes=$(document).find('#preisberechnung .symbol-times').outerWidth();preisDimenstions=$(document).find("#preisberechnung .preis").getRealDimensions;preis=preisDimenstions.width;symbolGleich=$(document).find('#preisberechnung .symbol-gleich').outerWidth();console.log('#add-to-cart - #quantity-grp - minusbutton - pfeil - x-symbol - preis - istgleich');console.log($(document).find('#add-to-cart').outerWidth()+' - '+qty_wrapper.outerWidth()+' - '+minusButton+' - '+pfeil+' - '+Math.abs(symbolTimes)+' - '+preis+' - '+Math.abs(symbolGleich));gesamtpreis=$(document).find('#add-to-cart').outerWidth()-minusButton-pfeil-Math.abs(symbolTimes)-preis-Math.abs(symbolGleich)-(offset)-15;$(document).find('#preisberechnung .pfeiltext').outerWidth(pfeil);$(document).find('#preisberechnung .preis').outerWidth(preis);$(document).find('#preisberechnung .gesamtpreis').outerWidth(gesamtpreis);calcGesamtpreis();boxGesamtpreis.fadeIn('slow');}},5);} var cssbulkprice=$(document).find('#buy_form').data('css-bulkprice'),cssqty=$(document).find('#buy_form').data('css-qty'),oQTY=$(document).find('#quantity'),bulks=cssbulkprice+' table > tbody tr';console.log('Bulks Prices:');console.log(bulks);$(document).on('click touch',bulks,function(){var quantity=parseInt($(this).find('td:first-child').text());if(!isNaN(quantity)){oQTY.val(quantity);$(document).find(bulks).removeClass('set');$(this).addClass('set');calcGesamtpreis();}});$(document).on('click touch','#buy_form '+cssqty+' button[data-count-up], [data-spinner-button="up"]',function(e){e.stopImmediatePropagation();console.log('klick plus');var delay=500;setTimeout(function(){calcGesamtpreis();},delay);});$(document).on('click touch','#buy_form '+cssqty+' button[data-count-down], [data-spinner-button="down"]',function(e){e.stopImmediatePropagation();console.log('klick minus');var delay=500;setTimeout(function(){calcGesamtpreis();},delay);});$(document).on('change','#product-configurator input, #product-configurator select',function(e){console.log('Konfigurator geändert');var delay=500;setTimeout(function(){calcGesamtpreis();},delay);});