(function($){let is_style='1';let input_format='0';let input_skok='1';let input_default='1';let display_type='vertical';let display_pleace='left';let input_width='60px';let input_height='42px';let input_space='5px';let input_font='14px';let input_color='#333333';let input_background='rgb(255, 255, 255)';let input_border_color='rgba(220, 220, 220, 0.88)';let input_border_width='0px';let buttons_width='30px';let buttons_height='14px';let buttons_content='text';let buttons_content_plus_text='+';let buttons_content_minus_text='-';let buttons_content_plus_font='14px';let buttons_content_minus_font='14px';let buttons_content_plus_color='#666666';let buttons_content_minus_color='#666666';let buttons_content_plus_image='';let buttons_content_minus_image='';let buttons_content_plus_backgroud='#00000000';let buttons_content_minus_backgroud='#00000000';let buttons_content_plus_rotate='0deg';let buttons_content_minus_rotate='0deg';let karta_display_type='vertical';let karta_display_pleace='left';let karta_input_width='15%';let karta_input_height='40px';let karta_input_space='0px';let karta_input_font='14px';let karta_input_color='#333333';let karta_input_background='rgb(255, 255, 255)';let karta_input_border_color='rgba(220, 220, 220, 0.88)';let karta_input_border_width='0px';let karta_buttons_width='30px';let karta_buttons_height='14px';let karta_buttons_content='text';let karta_buttons_content_plus_text='+';let karta_buttons_content_minus_text='-';let karta_buttons_content_plus_font='14px';let karta_buttons_content_minus_font='14px';let karta_buttons_content_plus_color='#666666';let karta_buttons_content_minus_color='#666666';let karta_buttons_content_plus_image='';let karta_buttons_content_minus_image='';let karta_buttons_content_plus_backgroud='#00000000';let karta_buttons_content_minus_backgroud='#00000000';let karta_buttons_content_plus_rotate='0deg';let karta_buttons_content_minus_rotate='0deg';let use_in_product_details=1;let use_in_basket_index=1;let APIloader=function APIloader(productsIds){if(!window.frontAPI){setTimeout(function(){APIloader(productsIds);},0);} else{let chunk=50;for(let i=0;i0&&product.id==Shop.pageId*1){let input=$("#box_productfull .mx_app_ilosc input");input.data('skok',product.package);if(product.package!=0){input.val(product.package);$(`#box_productfull [name="quantity"]`).val(product.package);}} let input=$(`[data-product-id=${product.id}] .mx_app_ilosc input`);input.data('skok',product.package);if(product.package!=0){if(use_in_basket_index&&$("body").is('.shop_basket')){continue;} input.val(product.package);$(`[data-product-id=${product.id}] [name^="quantity"]`).val(product.package);}}},{ids:productsIds.slice(i,i+chunk),urlParams:'?limit=50'});}}};let addEventsToInput=function addEventsToInput(ilosc){ilosc.on('change','input',function(){let skok=input_skok;if(typeof $(this).data('skok')!='undefined'){skok=parseFloat($(this).data('skok'));if(skok==0)skok=input_skok;} if($(this).val()*1>=skok){$(this).parent().parent().find("input[name^=quantity]").val($(this).val()).trigger("change");} else if($(this).val()*1=skok){$(this).parent().find("input").val(($(this).parent().find("input").val()*1-skok*1).toFixed(input_format));$(this).parent().find("input").trigger("change");} else if($(this).parent().find("input").val()*1>skok){$(this).parent().find("input").val(parseFloat(skok).toFixed(input_format));$(this).parent().find("input").trigger("change");} else{$(this).parent().find("input").addClass("mx_error").finish().delay(600).queue(function(){$(this).removeClass("mx_error").dequeue();});}});};let addInputsToList=function addInputsToList(products){productsIds=[];products.each(function(index,item){productsIds.push($(item).data('product-id'));let ilosc=$('
');let input=$('').appendTo(ilosc);let plus=$('
').insertBefore(input);let minus=$('
').insertAfter(input);if(display_pleace=="left"){ilosc.insertBefore($(item).find("form.basket fieldset button.addtobasket"));ilosc.css('display','inline-block');ilosc.css('vertical-align','middle');} else if(display_pleace=="right"){ilosc.insertAfter($(item).find("form.basket fieldset button.addtobasket"));ilosc.css('display','inline-block');ilosc.css('vertical-align','middle');} input.val(parseFloat(input_default).toFixed(input_format));addEventsToInput(ilosc);if(!is_style){plus.text("+");minus.text("-");} else{input.css({'min-height':'unset','height':'unset','padding':'0.35em','margin':'0','text-align':'center'});input.css('height',input_height);input.css('font-size',input_font);input.css('color',input_color);input.css('border-width',input_border_width);input.css('border-color',input_border_color);input.css('background',input_background);ilosc.css('position','relative');ilosc.css('width',input_width);if(display_pleace=="left"){ilosc.css('margin-right',input_space);} else if(display_pleace=="right"){ilosc.css('margin-left',input_space);if(ilosc.parent().parent().parent().find(".quickview").hasClass("quickview")&&typeof input_space!=='undefined'){let odstep=input_space.slice(0,/([^0-9-.,])/i.exec(input_space).index)*1;let end_of_str=input_space.slice(/([^0-9-.,])/i.exec(input_space).index);ilosc.css('margin-right',odstep-8+end_of_str);}} plus.css({'position':'absolute','text-align':'center','cursor':'pointer'});minus.css({'position':'absolute','text-align':'center','cursor':'pointer'});if(display_type=="none"){plus.css('display','none');minus.css('display','none');} else if(display_type=="left"){plus.css({'left':'0','top':'25%'});minus.css({'left':'0','top':'75%'});ilosc.find("input").css('text-align','right');} else if(display_type=="right"){plus.css({'right':'0','top':'25%'});minus.css({'right':'0','top':'75%'});ilosc.find("input").css('text-align','left');} else if(display_type=="vertical"){plus.css({'right':'0','top':'50%'});minus.css({'left':'0','top':'50%'});} else if(display_type=="horizontal"){plus.css({'position':'relative','transform':'unset','margin':'auto'});minus.css({'position':'relative','transform':'unset','margin':'auto'});}}});APIloader(productsIds);};addInputsToList($('.product'));$(document).on("wceAppDynamiclistCustomCallback",function(e,data){addInputsToList(data.$products);});if(use_in_product_details&&$("#box_productfull").length>0){let ilosc=$('
');let input=$('').appendTo(ilosc);let plus=$('
').insertBefore(input);let minus=$('
').insertAfter(input);if(karta_display_pleace=="left"){ilosc.insertBefore($(".form-basket .addtobasket-container .button_wrap"));ilosc.css('display','inline-block');ilosc.css('vertical-align','middle');ilosc.css('float','left');ilosc.parent().find(".quantity_wrap").hide();} else if(karta_display_pleace=="right"){ilosc.insertAfter($(".form-basket .addtobasket-container .button_wrap"));ilosc.css('display','inline-block');ilosc.css('vertical-align','middle');ilosc.css('float','right');ilosc.parent().find(".quantity_wrap").hide();} input.val(parseFloat(input_default).toFixed(input_format));addEventsToInput(ilosc);APIloader([$('[name="product_id"]').val()*1]);if(!is_style){plus.text("+");minus.text("-");} else{input.css({'min-height':'unset','height':'unset','padding':'0.35em','margin':'0','text-align':'center'});input.css('height',karta_input_height);input.css('font-size',karta_input_font);input.css('color',karta_input_color);input.css('border-width',karta_input_border_width);input.css('border-color',karta_input_border_color);input.css('background',karta_input_background);ilosc.css('position','relative');ilosc.css('width',karta_input_width);if(display_pleace=="left"){ilosc.css('margin-right',karta_input_space);} else if(display_pleace=="right"){ilosc.css('margin-left',karta_input_space);} plus.css({'position':'absolute','text-align':'center','cursor':'pointer'});minus.css({'position':'absolute','text-align':'center','cursor':'pointer'});if(karta_display_type=="none"){plus.css('display','none');minus.css('display','none');} else if(karta_display_type=="left"){plus.css({'left':'0','top':'25%'});minus.css({'left':'0','top':'75%'});ilosc.find("input").css('text-align','right');} else if(karta_display_type=="right"){plus.css({'right':'0','top':'25%'});minus.css({'right':'0','top':'75%'});ilosc.find("input").css('text-align','left');} else if(karta_display_type=="vertical"){plus.css({'right':'0','top':'50%'});minus.css({'left':'0','top':'50%'});} else if(karta_display_type=="horizontal"){plus.css({'position':'relative','transform':'unset','margin':'auto'});minus.css({'position':'relative','transform':'unset','margin':'auto'});}}} if(use_in_basket_index&&$("body").is('.shop_basket')){productsIds=[];let products=$('.productlist > tbody > tr[data-product-id]');products.each(function(index,item){productsIds.push($(item).data('product-id'));let ilosc=$('
');let input=$('').appendTo(ilosc);let plus=$('
').insertBefore(input);let minus=$('
').insertAfter(input);ilosc.prependTo($(item).find(".quantity"));ilosc.css('display','inline-block');ilosc.css('vertical-align','middle');$(item).find(".quantity .shaded_inputwrap").hide().get(0).nextSibling.remove();input.val(parseFloat($(item).find(".quantity .shaded_inputwrap input").val()).toFixed(input_format));addEventsToInput(ilosc);if(!is_style){plus.text("+");minus.text("-");} else{input.css({'min-height':'unset','height':'unset','padding':'0.35em','margin':'0','text-align':'center'});input.css('height',input_height);input.css('font-size',input_font);input.css('color',input_color);input.css('border-width',input_border_width);input.css('border-color',input_border_color);input.css('background',input_background);ilosc.css('position','relative');ilosc.css('width',input_width);if(display_pleace=="left"){ilosc.css('margin-right',karta_input_space);} else if(display_pleace=="right"){ilosc.css('margin-left',karta_input_space);} plus.css({'position':'absolute','text-align':'center','cursor':'pointer'});minus.css({'position':'absolute','text-align':'center','cursor':'pointer'});if(display_type=="none"){plus.css('display','none');minus.css('display','none');} else if(display_type=="left"){plus.css({'left':'0','top':'25%'});minus.css({'left':'0','top':'75%'});ilosc.find("input").css('text-align','right');} else if(display_type=="right"){plus.css({'right':'0','top':'25%'});minus.css({'right':'0','top':'75%'});ilosc.find("input").css('text-align','left');} else if(display_type=="vertical"){plus.css({'right':'0','top':'50%'});minus.css({'left':'0','top':'50%'});} else if(display_type=="horizontal"){plus.css({'position':'relative','transform':'unset','margin':'auto'});minus.css({'position':'relative','transform':'unset','margin':'auto'});}}});APIloader(productsIds);} let style='';style+=` \n`;$("head").append(style);}(jQuery));