/* NIE UŻYWAĆ ZNACZNIKÓW PHP PLIK TEN JEST MINIFIKOWANY JAKO PLIK TEKSTOWY */ function loading_start_order() { var left=screen.width/2-300/2; var top=screen.height/2-200/2; if (window.pageYOffset != null) topy = window.pageYOffset; else if (document.body.scrollTop != null) topy = document.body.scrollTop; top=top+topy; getId('loading').style.display='block'; getId('loading').style.top=top+'px'; getId('loading').style.left=left+'px'; } function loading_stop_order() { getId('loading').style.display='none'; } function showTicketText() { var ticketCode = $('ticketCode').get('html'); var ticketValue = $('ticketValue').get('html'); var text = def.ticket_discount.your_ticket2; text = text.replace('{{dis_vol}}', ticketValue); text = text.replace('{{dis_code}}', ticketCode); new rc_windows({ id:'rc_window_new_ticket', container: $(document.body), useOverlay: true, width:700, height:300, title:def.ticket_discount.your_ticket, contentHTML: text }); } var timeOutH= ''; function sendDiscountCode(t) { clearTimeout(timeOutH); value = t.value; if(value.length > 0) { timeOutH = setTimeout(function() { sum(); },5000); } } function copy_register_input_value (e) { var target = e.target; var newID = target.id.replace('address', 'invoice'); var otherTarget = document.getElementById(newID); if (otherTarget) { otherTarget.value = target.value otherTarget.focus(); otherTarget.blur(); target.focus(); } } function register_invoice(t) { if($('get_invoice').get('checked')==true) { if($('invoice_div')) { $('invoice_div').setStyle('display','block'); section=document.getElementById('invoice_div'); } else { section=document.getElementById('invoice-form'); } if(!section) return; inputs=section.getElementsByTagName('input'); for(var i=0; i 0) { var opt = {}; var sizeId = jQ(inputQuantity).attr('data-size-id'); var sizeOptionId = jQ('#size_' + sizeId).attr('data-option-size-id'); ++optionsQuantity; itemsToOpt[optionsQuantity] = items; opt[sizeOptionId] = ',,,' + sizeId; opts[optionsQuantity] = opt; } }); var complementaryQuantityInputs = jQ('#productsComplementaryContainer').find('[id^=\'products_quantity_\']'); var complementaryOpt = {}; var complementaryOpts = {}; var complementaryPids = {}; var complementaryItemsToOpt = {}; var complementaryPid = 0; var complementaryOptionsQuantity = 0; if(jQ('#complementaryStatus').val() == 1){ jQ(complementaryQuantityInputs).each(function (key, inputQuantity) { var items = jQ(inputQuantity).val(); complementaryPid = jQ(inputQuantity).attr('data-product-id'); if (items > 0 && complementaryPid > 0) { var complementaryOpt = {}; var sizeId = jQ(inputQuantity).attr('data-size-id'); var sizeOptionId = jQ('#size_' + sizeId).attr('data-option-size-id'); ++complementaryOptionsQuantity; complementaryItemsToOpt[complementaryOptionsQuantity] = items; complementaryOpt[sizeOptionId] = ',,,' + sizeId; complementaryOpts[complementaryOptionsQuantity] = opt; complementaryPids[complementaryOptionsQuantity] = complementaryPid; } }); } if (s == true) { var allXhrToCart = []; for (i = 1; i <= optionsQuantity; ++i) { (function (i) { var formData = new FormData() formData.append('products_id', pid) formData.append('item', itemsToOpt[i]) //formData.append('options', opts[i]) aotfd(formData, 'options', opts[i]); formData.append('ajax', 0) //formData.append('screenIinfo', screenIinfo) aotfd(formData, 'screenIinfo', screenIinfo); var pinfoPatternCheck = document.getElementById('pinfo-pattern-check') if (pinfoPatternCheck && pinfoPatternCheck.checked === true) { var fileInput = document.getElementById('products_file_to_order') if (fileInput && fileInput.files && fileInput.files.length > 0) { formData.append('file', fileInput.files[0]) } } allXhrToCart.push(new Promise(function (resolve, reject) { jQ.ajax({ type: 'POST', url: '/ajax/cart/index/', data: formData, cache: false, contentType: false, processData: false, method: 'POST', async: false, }).done(function (data) { resolve(); }).fail(function (data) { reject(); }); })) })(i); } if(jQ('#complementaryStatus').val() == 1 && complementaryOptionsQuantity > 0){ for (i = 1; i <= complementaryOptionsQuantity; ++i) { (function (i) { var formData = new FormData() formData.append('products_id', complementaryPids[i]) formData.append('item', complementaryItemsToOpt[i]) aotfd(formData, 'options', complementaryOpts[i]); formData.append('ajax', 0) //formData.append('screenIinfo', screenIinfo) aotfd(formData, 'screenIinfo', screenIinfo); allXhrToCart.push(new Promise(function (resolve, reject) { jQ.ajax({ type: 'POST', url: '/ajax/cart/index/', data: formData, cache: false, contentType: false, processData: false, method: 'POST', async: false, }).done(function (data) { resolve(); }).fail(function (data) { reject(); }); })) })(i); } } Promise.all(allXhrToCart).then(function () { loading_stop(); show_cross_buy_fast(pid); }).catch(function () { jQ('#opt_error').show(); loading_stop(); salert_mini(def.index.alert_pinfo_options, 'warning'); }) } else { jQ('#opt_error').show(); loading_stop(); salert_mini(def.index.alert_pinfo_options, 'warning'); } } function add_cart_event() { //usuniete z V4 - nowa funkcja add_cart_event_new } function add_cart_brief() { $$('.pinfo-brief-to-cart').each(function(el, i) { el.addEvent('click', function(e) { if($('listing_msg')) $('listing_msg').innerHTML = ''; var pid = this.get('data-id'); var dataType = this.get('data-type'); var opt = {}; var opts = {}; var opts1 = new Array(); opts1[0] = {}; opts1[1] = {}; var opts1s = new Array(); opts1s[0] = {}; opts1s[1] = {}; var suff = 'brief'; var s = true; if($('options_form' + suff)) { var sels = $('options_form' + suff).getElementsByTagName('select'); for(var i = 0; i < sels.length; i++) { if(sels[i].id.lastIndexOf("options[") == 0) { if(sels[i].selectedIndex == 0) s = false; else { var s1 = sels[i].id.split('['); s2 = s1[1].replace(']', ''); var o = sels[i].value.split(','); opt[o[3]] = o[3]; var re = /[^0-9]/gi; var on = sels[i].id.replace(re, ''); opts[s2] = sels[i].value; } } if(sels[i].id.lastIndexOf("options1[") == 0) { if(sels[i].selectedIndex == 0 && sels[i].disabled == false) s = false; else { if(sels[i].disabled == false) { var s1 = sels[i].id.split('['); s2 = s1[2].replace(']', ''); s1 = s1[1].replace(']', ''); var o = sels[i].value.split(','); opt[o[3]] = o[3]; var re = /[^0-9]/gi; var on = sels[i].id.replace(re, ''); opts1[s1][s2] = sels[i].value; opts1s[s1][o[3]] = o[3]; } } } } if(s) { var req = new Request({ method: 'post', url: '/ajax/pinfo/items_cart/', data: { "pid": pid, "item": $('buy_quantity_input'+suff).get('value'), "opt": opt, "opt1": opts1s }, onComplete: function(data) { var d = data.split('~') if(d[0] == 0) { salert_mini(def.index.alert_pinfo_items_cart + d[1], 'warning'); $('buy_quantity_input').set('value', d[1]); } else { new Request({ method: 'post', async: false, url: '/ajax/cart/index/', data: { "products_id": pid, "item": $('buy_quantity_input'+suff).get('value'), "options": opts, "ajax": 1, "screenIinfo": screenIinfo }, onComplete: function(data) { window.location.href = '/_cart/index/'; } }).send(); } } }).send(); } else { jQuery('#opt_error').show(); salert_mini(def.index.alert_pinfo_options, 'warning'); } } else { new Request({ method: 'post', async: false, url: '/ajax/cart/index/', data: { "products_id": pid, "item": $('buy_quantity_input'+suff).get('value'), "options": opts, "ajax": 1, "screenIinfo": screenIinfo }, onComplete: function(data) { window.location.href = '/_cart/index/'; } }).send(); } }); }); } function add_cart_pinfo_new() { // Zdarzenie dodania do koszyka var rc_event_add_product_to_cart = (function (suffix, selected_item_count, products_id) { try { var products_options_parsed = getProductOptions(suffix); var products_options = products_options_parsed.data.map(function (value) { return { options_values_id: value.id }; }); window.fetch && fetch('/ajax.php?p=conversion&f=products_info&ssl=1', { method: 'POST', body: JSON.stringify({ products: [{ products_id: products_id, item: selected_item_count, options: products_options }] }), credentials: 'same-origin', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } }) .then(function (response) { return response.json() }) .then(function (response) { response.products.forEach(function (product) { window.jQuery && jQuery(document.body).trigger('rc_event_add_product_to_cart', product); console.log('rc_event_add_product_to_cart', product); }); }) } catch (exception) { console.error(exception); } }); $$('.pinfo-to-cart').each(function(el, i) { el.addEvent('click', function(e) { if($('listing_msg')) $('listing_msg').innerHTML = ''; var pid = this.get('data-id'); var dataType = this.get('data-type'); var opt = {}; var opts = {}; var opts1 = new Array(); opts1[0] = {}; opts1[1] = {}; var opts1s = new Array(); opts1s[0] = {}; opts1s[1] = {}; var suff = ''; var s = true; if($('options_form' + suff)) { var sels = $('options_form' + suff).getElementsByTagName('select'); for(var i = 0; i < sels.length; i++) { if(sels[i].id.lastIndexOf("options[") == 0) { if(sels[i].selectedIndex == 0) s = false; else { var s1 = sels[i].id.split('['); s2 = s1[1].replace(']', ''); var o = sels[i].value.split(','); opt[o[3]] = o[3]; var re = /[^0-9]/gi; var on = sels[i].id.replace(re, ''); opts[s2] = sels[i].value; } } if(sels[i].id.lastIndexOf("options1[") == 0) { if(sels[i].selectedIndex == 0 && sels[i].disabled == false) s = false; else { if(sels[i].disabled == false) { var s1 = sels[i].id.split('['); s2 = s1[2].replace(']', ''); s1 = s1[1].replace(']', ''); var o = sels[i].value.split(','); opt[o[3]] = o[3]; var re = /[^0-9]/gi; var on = sels[i].id.replace(re, ''); opts1[s1][s2] = sels[i].value; opts1s[s1][o[3]] = o[3]; } } } } if(s) { var req = new Request({ method: 'post', url: '/ajax/pinfo/items_cart/', data: { "pid": pid, "item": $('buy_quantity_input').get('value'), "opt": opt, "opt1": opts1s, "opt2": opts }, onComplete: function(data) { var d = data.split('~') if(d[0] == 0) { salert_mini(def.index.alert_pinfo_items_cart + d[1], 'warning'); $('buy_quantity_input').set('value', d[1]); } else { rc_event_add_product_to_cart(suff, $('buy_quantity_input').get('value'), pid); if(dataType == 'true' || RC_SHOP_ID=='10107') send_form_buy_fast($('options_form'), $(el).get('data-alert'), $(el).get('data-id')); else send_form_pinfo($('options_form'), $(el).get('data-alert')); } } }).send(); } else { jQuery('#opt_error').show(); salert_mini(def.index.alert_pinfo_options, 'warning'); } } else { rc_event_add_product_to_cart(suff, $('buy_quantity_input').get('value'), pid); if(dataType == 'true') send_form_buy_fast($('options_form'), $(el).get('data-alert'), $(el).get('data-id')); else send_form_pinfo($('options_form'), $(el).get('data-alert')); } }); }); } function add_cart_event_new() { $$('.add-to-cart:not(.ready)').each(function(el,i){ $(el).addClass('ready'); var pid = $(el).get('data-id'); var ct = $(el).get('data-ct'); var item=1; var itemn = $(el).get('data-item'); var type=$(el).get('data-type'); if(!type) type=0; $(el).addEvent('click', function(e){ if($(itemn)) if($(itemn).get('value')>0) item=$(itemn).get('value'); var pict='fb' new Request({ method: 'post', url: '/ajax/pinfo/addcart/', data: {'pid':pid,item:item,pict:pict, checkOptions:1,type:type,ct:ct}, onComplete: function(data) { if(!data) window.location.href='/p/0/'+pid+'/.html'; else { var d=data.split('~'); switch(d[0]) { case '1': case '2': var hrefValue = ''; var rc_w=new rc_windows({ id:'rc_window_opt', container: $(document.body), useOverlay: true, width:665, height:300, title:def.index.window_opt_title, contentHTML:d[1], onComplete: function(){ } }); $('rc_window_opt_body').set('html',d[1]); hrefValue = $$('.modal-to-cart').get('href'); $$('.modal-to-cart').set('href','javascript:;'); new Request({ method: 'post', url: '/ajax/pinfo/inventory/', data: {'pid0':pid,pict:pict, searcher:true}, onComplete: function(data) { $('inventory_opt_cont'+pict+'_'+pid).set('html',data); $$('.modal-to-cart').set('href',hrefValue); if(typeof jQuery !== "undefined") { jQuery("body").trigger('inventoryLoaded'); } } }).send(); break; default: items_cart('products_quantity'+ct+'_'+pid,type,ct, pict); break; } } } }).send(); }); }); } function add_cart_event_10651() { //usuniete z v4 } function add_cart_event_7546() { //usuniete z v4 } function tocart(x) { if(x=='true') { var req = new Request({ method: 'post', url: '/ajax/account/lost_cart_window/', data: {"tocart":1}, onComplete: function(data) { close_window_out($('rc_window_lcart'),1,2000); window.location.href='/_cart/index/'; } }).send(); } if(x=='false') { var req = new Request({ method: 'post', url: '/ajax/account/lost_cart_window/', data: {"nocart":1}, onComplete: function(data) { close_window_out($('rc_window_lcart'),1,2000); window.location.href='/'; } }).send(); } } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop; } function video_change(t) { getId('v1').innerHTML=' ' } function change_div(did,act) { if(act==1) { $(did).getChildren('.tm1').set('class', 'tm1h fl'); $(did).getChildren('.tm2').set('class', 'tm2h fl'); $(did).getChildren('.tm3').set('class', 'tm3h fl'); } else { $(did).getChildren('.tm1h').set('class', 'tm1 fl'); $(did).getChildren('.tm2h').set('class', 'tm2 fl'); $(did).getChildren('.tm3h').set('class', 'tm3 fl'); } } function showGallery() { gallery = new rc_gallery({container: $(document.body)}); return false; } function clock(cid) { ndate=$('boxclock-'+cid).get('html'); var d1=ndate.split(' '); var d=d1[0].split('-'); var t=d1[1].split(':'); var now = new Date().getTime()/1000; var dayend = new Date(d[0],d[1]-1,d[2],t[0],t[1],t[2]).getTime()/1000; var sec = Math.abs(now-dayend); var min = Math.floor(sec/60); var hours = Math.floor(min/60); var days = Math.floor(hours/24); var years = Math.floor(days/365); sec = Math.floor(sec-min*60); min = Math.floor(min-hours*60); hours = Math.floor(hours-days*24); days = Math.floor(days-years*365); var r=""; if(days>0) r=r+"dni: "+days; if(days==0) { if(hours>0) r=r+hours; if(min>0) r=r+":"+((min<10)?"0":"")+min; if(sec>=0) r=r+":"+((sec<10)?"0":"")+sec; } $('boxclock_show-'+cid).innerHTML =r; if (now 0){ jQuery('.cart .mdi-cart').css('color','#d60270'); } } } else { if(RC_SHOP_ID==9604) { jQuery('.cart .mdi-cart').css('color','#666'); } if(typeof jQuery(this).attr('data-empty') == 'undefined'){ jQuery(this).html(''); }else{ jQuery(this).html(jQuery(this).attr('data-empty')); } } }); jQuery('.ajax-items-cart-value').each(function(){ if(res[1]!=0) { jQuery(this).html(res[1]); } else { if(typeof jQuery(this).attr('data-empty') == 'undefined'){ jQuery(this).html('0.00'); }else{ jQuery(this).html(jQuery(this).attr('data-empty')); } } }); jQuery('.ajax-items-compare').each(function(){ if(res[4]!=0) { jQuery(this).html(res[4]); } else { if(typeof jQuery(this).attr('data-empty') == 'undefined'){ jQuery(this).html(''); }else{ jQuery(this).html(jQuery(this).attr('data-empty')); } } }); jQuery('.ajax-items-wishlist').each(function(){ if(res[5]!=0) { jQuery(this).html(res[5]); } else { if(typeof jQuery(this).attr('data-empty') == 'undefined'){ jQuery(this).html(''); }else{ jQuery(this).html(jQuery(this).attr('data-empty')); } } }); var type = dget('header_shopping_cart','type'); update_header_cart_preview(type); } }).send(); } function toggleClassOnHeaderBox(boxClass, items) { if($$(boxClass)) { if(items > 0) { $$(boxClass).addClass('active_a'); if(boxClass=='.rc-header-shopping-cart' && $$('.cart_box2')) $$('.cart_box2').addClass('active_a'); } else { $$(boxClass).removeClass('active_a'); if(boxClass=='.rc-header-shopping-cart' && $$('.cart_box2')) $$('.cart_box2').removeClass('active_a'); } } } function cart_del_ajax(pid) { loading_start(); var type = dget('header_shopping_cart','type'); jQuery.post('/ajax/cart/del/',{'pid':pid}).done(function(dataItem) { if (window.location.href.indexOf('/step4') !== -1) { window.location.href = window.location.protocol + '//' + window.location.hostname + '/_cart/index/' return } if(typeof sum == 'function') sum(); if(jQuery('[id="trp['+pid+']"]')) jQuery('[id="trp['+pid+']"]').remove(); ajax_shopping_cart(); ajax_header_shopping_cart(); var data = pid.split('_'); rc_event_remove_product_from_cart(data[1],dataItem,data[0]); loading_stop(); }); } function rc_event_remove_product_from_cart(suffix, selected_item_count, products_id) { return new Promise(function (resolve, reject) { var products_options_parsed = getProductOptions(suffix); var products_options = products_options_parsed.data.map(function (value) { return { options_values_id: value.id }; }); console.log("products_options:".products_options); if (!window.fetch) { return resolve('fetch not defined'); } fetch('/ajax.php?p=conversion&f=products_info&ssl=1', { method: 'POST', body: JSON.stringify({ products: [{ products_id: products_id, item: selected_item_count, options: products_options }] }), credentials: 'same-origin', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } }) .then(function (response) { return response.json() }) .then(function (response) { response.products.forEach(function (product) { window.jQuery && jQuery(document.body).trigger('rc_event_remove_product_from_cart', product); console.log('rc_event_remove_product_from_cart', product); }); resolve(); }).catch(resolve); }); } function openAllegroLoginWindow() { var rc_w=new rc_windows({ id:'rc_window_allegro', container: $(document.body), useOverlay: true, width:600, height:300, title:def.login.login + ' przez Allegro', contentAJAX:'/ajax/login/allegro/', varAJAX:{"pid":1,"item":1}, contentHTML: '/ajax/login/allegro/', onComplete: function(){ var exV = new fValidator("f_login", { languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "login_bt", fValidate_send:function(){ $('f_login').set('send', {onComplete: function(data) { rc_w.close_window(); window.location.reload(); }}); $('f_login').send(); } }); $('login').addEvent('keydown', function(event){if(event.key=='enter' && $('pass').get('value')!='') exV._onSubmit(event)}); $('pass').addEvent('keydown', function(event){if(event.key=='enter' && $('login').get('value')!='') exV._onSubmit(event)}); } }); } var ready='domready'; if (Browser.Engine.trident4) ready='load'; function addSaveCartValidator(popup) { var exV = new fValidator("q_savecart", {languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "saveCart_bt", fValidate_send:function(){ $('q_savecart').set('send', {onComplete: function(data) {}}); $('q_savecart').send(); $(popup).destroy(); salert(def.index.recommend_msg,5000,false,false,'none'); } }); } window.addEvent(ready, function() { $$('[id^=q_recommend_text]').each(function(el,i){ if ($(el.id)){ $(el.id).addEvent('click', function(e){ var rc_w=new rc_windows({ id:'rc_window3', container: $(document.body), useOverlay: true, width:600, height:300, title: def.index.box_recommend_shop_title, contentAJAX:'/ajax/recommend/index/', onComplete: function(){ $(rc_w.options.id+'_title').set('html',$(rc_w.options.id+'_title').get('html')); var exV = new fValidator("q_recommend", {languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "recommend_bt", fValidate_send:function(){ $('q_recommend').set('send', {onComplete: function(data) { rc_w.close_window(); salert(def.index.recommend_msg,5000,false,false,'none'); close_window_out($('rc_window3'),1,5000); }}); $('q_recommend').send(); } }); } }); }); } }); if ($('saveCartBt')){ $('saveCartBt').addEvent('click', function(e){ var rc_w=new rc_windows({ id:'rc_window7', container: $(document.body), useOverlay: true, width:600, height:300, title: def.cart.saveCart, contentAJAX:'/ajax/info/save_cart/', onComplete: function(){ jQuery(window).trigger('saveCartModalLoaded'); $(rc_w.options.id+'_title').set('html',$(rc_w.options.id+'_title').get('html')); var exV = new fValidator("q_savecart", {languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "saveCart_bt", fValidate_send:function(){ $('q_savecart').set('send', {onComplete: function(data) { rc_w.close_window(); salert(def.index.recommend_msg,5000,false,false,'none'); close_window_out($('rc_window7'),1,5000); }}); $('q_savecart').send(); } }); } }); }); } if($('conf_o') && RC_SHOP_ID!=3830) var exV = new fValidator("conf_o", { languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "orders_realize_bt", fValidate_send:function(){ if(this.submitBt){ document.getElementById(this.submitBt).style.pointerEvents = "none"; document.getElementById(this.submitBt).style.opacity = "0.8"; } if(RC_SHOP_ID!=3830) { // klikochron if(typeof sisuIsValid === "function"){ if(!sisuIsValid()) return false; } orders_realize(); if($('conf_o')) { order_send('conf_o'); $('conf_o').set('id','conf_o1'); }; } } }); $$('[id^=register_user_text]','.registerclass').each(function(el,i){ if ($(el)){ $(el).addEvent('click', function(e){ openRegisterWindow(); }); } }); $$('[id^=login_user_text]','.loginclass').each(function(el,i){ if ($(el)){ $(el).addEvent('click', function(e){ var JsHost = (("https:" == document.location.protocol) ? 1 : 0); if(RC_SSL_IS_ACTIVE==1 && JsHost==0) { window.location.href='https://'+location.host+'/_login/index/' } else { openLoginWindow(); } }); } }); }); function setGuest(t) { if(t.checked==true) $('guest_type').set('value',1) else $('guest_type').set('value',0) eventRegisterType(); } function rcPlaceholder() { } function addRemoveFromWishlistEvent() { $$('.remove-from-wishlist').addEvent('click', function(e) { var pid = $(this).get('data-id'); new Request({ method: 'get', url: "/rd/"+pid+"/schowek.html", onComplete: function(data) { if($$('#header_wishlist .cart-preview').length>0) { $$('#header_wishlist .cart-preview').set('html',''); } ajax_header_shopping_cart(); } }).send(); }); } function rc3Event() { $$('.add-to-compare').addEvent('click', function(e) { var pid = $(this).get('data-id'); box_compare_action('add',pid); }); $$('.remove-from-wishlist').addEvent('click', function(e) { var pid = $(this).get('data-id'); var self = this; var product = this.getParent('.product-one'); new Request({ method: 'get', url: "/rd/"+pid+"/schowek.html", onComplete: function(data) { product.morph({opacity: 0}); product.get('morph').chain(function() { product.dispose(); }); ajax_header_shopping_cart(); } }).send(); }); $$('.add-to-wishlist').addEvent('click', function(e) { var pid = $(this).get('data-id'); // Zdarzenie dodania do schowka (wishlist) var rc_event_add_to_wishlist = function (pid) { try { window.fetch && fetch('/ajax.php?p=conversion&f=products_info&ssl=1', { method: 'POST', body: JSON.stringify({ products: [{ products_id: pid, }] }), credentials: 'same-origin', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } }) .then(function (response) { return response.json() }) .then(function (response) { response.products.forEach(function (product) { window.jQuery && jQuery(document.body).trigger('rc_event_add_to_wishlist', product); console.log('rc_event_add_to_wishlist', product); }); }) } catch (exception) { console.error(exception); } }; new Request({ method: 'get', url: "/r/"+pid+"/schowek.html", onComplete: function(data) { rc_event_add_to_wishlist(pid); salert_mini(def.index.added_to_wishlist,'rc_info generic'); if($$('#header_wishlist .cart-preview').length>0) { $$('#header_wishlist .cart-preview').set('html',''); } ajax_header_shopping_cart(); } }).send(); }); if(dget('rcVer','sid',true)!=1652) $$('.let-me-know').addEvent('click', function(e) { openQuestionWindow(); }); $$('.tell-a-friend').addEvent('click', function(e) { openSendFriendWindow(); }); $$('.print-page','.print-page-btn').addEvent('click', function(e) { openPrintPageWindow(); }); $$('.add-comment').addEvent('click', function(e) { var pid = $(this).get('data-id'); var mid = $(this).get('data-mid'); open_opinions(mid,pid); }); add_cart_event_new(); } function zeroPad(n, width) { z = '0'; n = n + ''; return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; } function standard_newsletter_submit(formElement) { if (RC_SHOP_ID == 19316) { if(typeof fbq === 'function') fbq('track', 'CompleteRegistration'); } var emailInput = formElement.querySelector('[name="newsletter_email"]').value; var countCheckboxes = formElement.querySelectorAll('[name^="checkboxes"]').length; if(countCheckboxes){ save_standard_newsletter_submit(formElement); return; } var req = new Request({ async: false, method: 'post', url: '/ajax/register/get_checkboxes_for_newsletter/', data: { newsletter_email: emailInput }, onComplete: function(html) { if (html.trim() === '') { formElement.action = "/ajax/register/newsletter_add/"; save_standard_newsletter_submit(formElement,emailInput); } else { new rc_windows({ id: 'rc_window_newsletter_checkboxes', container: document.body, useOverlay: true, width: 600, height: 300, title: 'Newsletter', contentHTML:html }); new fValidator("get_checkboxes_for_newsletter", { languageConfig: { l: eval('({' + def.index.languages_fvalidator + '})') }, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "get_checkboxes_for_newsletter_bt", fValidate_send: function () { var formNewslleterInModal = document.getElementById('rc_window_newsletter_checkboxes').querySelector('form.fValidator-form'); if (window.rc_window_newsletter_recaptcha && window.rc_window_newsletter_recaptcha.element) { var clonedElement = window.rc_window_newsletter_recaptcha.element.cloneNode(true); formNewslleterInModal.appendChild(clonedElement); } standard_newsletter_submit(formNewslleterInModal); close_window_out('rc_window_newsletter_checkboxes'); close_overlay_out(0); } }); } } }).send(); } function save_standard_newsletter_submit (formElement,emailInput) { emailInput = emailInput || null $(formElement).set('send', { onComplete: function (data) { data = JSON.parse(data); if (RC_SHOP_ID == 810) { salert(data.msg, 0); } else { salert_mini(data.msg, data.status == 'error' ? 'error' : 'success'); if (RC_SHOP_ID == 24452) { var refer = ""; if(emailInput.length > 0) { refer = emailInput.replace(/(\@.*)/g, ""); } window.webeOrder = { mid: '11793', refer: refer }; if (!document.getElementById('webeConfirmScript')) { var webeScript = document.createElement('script'); webeScript.id = 'webeConfirmScript'; webeScript.src = '//webetech.pl/js/webeconfirm.js'; document.body.appendChild(webeScript); } if (!document.getElementById('webeOrderScript')) { var webeScript2 = document.createElement('script'); webeScript2.id = 'webeOrderScript'; webeScript2.src = '//webep1.com/js/webeorder.js'; document.body.appendChild(webeScript2); } } } if (data.status == 'ok') { jQuery(document.body).trigger('rc_event_newsletter_submit', { email: formElement.querySelector('[name="newsletter_email"]').value }); console.log('rc_event_newsletter_submit'); $$('[id^=newsletter_email]').set('value', ''); } } }); formElement.send(); } function newsletter_recaptcha_callback(token) { close_window_out('rc_window_newsletter_recaptcha', 1); var input = new Element('input', { name: 'g-recaptcha-response', type: 'hidden', value: token }); input.inject(window.rc_window_newsletter_recaptcha.element); standard_newsletter_submit(window.rc_window_newsletter_recaptcha.element); } function google_recaptcha_submit(element) { var script = document.createElement("script"); script.async = true; script.src = "https://www.google.com/recaptcha/api.js"; script.onload = function () { window.rc_window_newsletter_recaptcha = new rc_windows({ id: 'rc_window_newsletter_recaptcha', container: document.body, useOverlay: true, width: 600, height: 300, title: 'Google recaptcha', contentHTML: '' + '
' }); window.rc_window_newsletter_recaptcha.element = element; }; document.body.appendChild(script); } window.addEvent('domready', function() { rc3Event(); if (RC_SHOP_ID == 23020) { countdown_23020() } else { if($('promotions_date_to_timestamp')) { var countDownInterval=setInterval(function() { if((navigator.userAgent.match(/iPhone/i))) var date = new Date(parseInt($('promotions_date_to_timestamp').getElements('a').get('html')+'000')); else var date = new Date(parseInt($('promotions_date_to_timestamp').get('html')+'000')); var today = new Date(); var diff = parseInt((date.getTime()-today.getTime())/1000); var days = parseInt(diff/60/60/24); var hours = parseInt((diff-(days*60*60*24))/60/60); var minutes = parseInt((diff-(days*60*60*24)-(hours*60*60))/60); var seconds = parseInt(diff-(days*60*60*24)-(hours*60*60)-(minutes*60)); if(RC_SHOP_ID==10332) { hours += days *24; days = 0; } if(diff >= 0){ $$('.countdown-days').set('html',zeroPad(days,2)); $$('.countdown-hours').set('html',zeroPad(hours,2)); $$('.countdown-minutes').set('html',zeroPad(minutes,2)); $$('.countdown-seconds').set('html',zeroPad(seconds, 2)); }else if(diff > -5){ clearInterval(countDownInterval); location.reload(); } }, 1000); } } if($('f_help')) setPassHelpEvent(); if($('f_headlogin')) var exV = new fValidator("f_headlogin", { languageConfig: { l: eval('({' + def.index.languages_fvalidator + '})') }, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "headlogin_bt", fValidate_send: function() { $('f_headlogin').set('send', { onComplete: function(data) { window.location.reload(); } }); $('f_headlogin').send(); } }); if($('f_headregister')) var exV = new fValidator("f_headregister", { languageConfig: { l: eval('({' + def.index.languages_fvalidator + '})') }, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "headregister_bt", fValidate_send: function() { $('f_headregister').submit(); } }); $$('form[id*=newsletter]').each(function(el) { el.setStyles({ position: 'relative' }); c = el.getElement('input').getComputedSize(); var containerN = new Element('div', { id: el.get('id') + '_container' }).addClass('rc_windowContainer').setStyles({ position: 'absolute', top: (c.height + c['padding-bottom'] + c['padding-top']), left: (0), border: '1px solid #B7B7B7', padding: '5px', 'padding-bottom': '10px' }); new Element('input', { type: 'checkbox', value: 1, name: 'get_invoice', id: 'get_invoice' }).addClass('fValidate[\'required\']').inject(containerN, 'bottom'); new Element('span', { html: 'cos' }).inject(containerN, 'bottom'); if($(el.get('id') + "_bt")) new fValidator(el.get('id'), { languageConfig: { l: eval('({' + def.index.languages_fvalidator + '})') }, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: el.get('id') + "_bt", fValidate_send: function () { if (RC_NEWSLETTER_RECAPTCHA_SITEKEY) { google_recaptcha_submit(el); } else { standard_newsletter_submit(el); } } }); }); if (typeof jQuery == 'function') { jQuery(document).on('click', '.decrease', function(e) { var target = jQuery(this).attr('data-target'); var increment = jQuery(this).attr('data-value'); if(typeof increment == "undefined") increment = 1; increment=parseFloat(increment); var qt = parseFloat(jQuery('[id="'+target+'"]').val()); qt = (qt + increment); var qtTemp = parseInt(qt); if(qtTemp != qt) qt = qt.toFixed(2); else qt = qtTemp; jQuery('[id="'+target+'"]').val(qt); jQuery('[id="'+target+'"]').trigger('change'); var target_id = target.replace('item[','').replace(']',''); var part = target_id.split('_'); var products_id = part[0]; rc_event_add_product_to_cart("", 1, products_id); }); jQuery(document).on('click', '.increase', function(e) { var target = jQuery(this).attr('data-target'); var qt = parseFloat(jQuery('[id="'+target+'"]').val()); var min_order = jQuery('[id="'+target+'"]').data('min-order'); var increment = jQuery(this).attr('data-value'); if(typeof increment == "undefined") increment = 1; increment=parseFloat(increment) if(qt>increment) { qt = (qt - increment); if(min_order > 0 && min_order > qt) qt = min_order; var qtTemp = parseInt(qt); if(qtTemp != qt) qt = qt.toFixed(2); else qt = qtTemp; jQuery('[id="'+target+'"]').val(qt); }else if (jQuery('[id="'+target+'"]').attr('data-from') == '0'){ jQuery('[id="'+target+'"]').val(0); } jQuery('[id="'+target+'"]').trigger('change'); var target_id = target.replace('item[','').replace(']',''); var part = target_id.split('_'); var products_id = part[0]; rc_event_remove_product_from_cart("", 1, products_id); }); jQuery('.table-delete').on('click',function(e) { var pid = ''; var id = jQuery(this).children('a').attr('data-id'); var options = jQuery(this).children('a').attr('data-options'); pid = id + '_' + options; cart_del_ajax(pid) }); jQuery('.remove-from-cart').on('click',function(e) { var pid = ''; var id = jQuery(this).attr('data-id'); var options = jQuery(this).attr('data-options'); pid = id + '_' + options; cart_del_ajax(pid) }); jQuery('.remove-from-wishlist').on('click',function() { var pid = ''; var id = jQuery(this).attr('data-id'); var req = new Request({ method: 'get', url: '/rd/'+id+'/schowek.html', onComplete: function(data) { if($$('#header_wishlist .cart-preview').length>0) { $$('#header_wishlist .cart-preview').set('html',''); } ajax_header_shopping_cart(); } }).send(); }); } add_cart_pinfo_new(); $$('.change-search-list-type').addEvent('click', function(e) { $$('.change-search-list-type').removeClass('btn-active'); $(this).addClass('btn-active'); var newClass = $(this).get('data-class'); $$('ul.listing-classic').each(function(el) { $(el).removeProperty('class'); $(el).addClass('listing-classic'); $(el).addClass(newClass); $$('.product-one', '.product-many').removeClass('ready') correctBoxesHeight1(); }); Cookie.write('change-search-list-type', newClass, {duration: 30}); }); if($$('.fValidator-form').length>0 && $$('#f_login').length>0) { var exV = new fValidator("f_login", { languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "login_bt", fValidate_send:function(){ $('f_login').set('send', {onComplete: function(data) { var havecart; var req = new Request({ async: false, method: 'post', url: '/ajax/account/lost_cart_window/', data: {"havecart":1}, onComplete: function(win) { havecart=win; } }).send(); if(havecart.trim()=='havecart') { var rc_w2=new rc_windows({ id:'rc_window_lcart', container: $(document.body), useOverlay: true, width:600, height:170, title:def.index.lost_cart_window, contentAJAX:'/ajax/account/lost_cart_window/', varAJAX:{"window":1}, onComplete: function(){ } }); return 0; } window.location.reload(); }}); $('f_login').send(); } }); } if($('ajax_header_cart_items')) { $('ajax_header_cart_items').set('html',''); if($('ajax_header_cart_value')) $('ajax_header_cart_value').set('html',''); } else { if($('ajax_header_cart_content')) $('ajax_header_cart_content').set('html',''); } ajax_header_shopping_cart(); $$('.box_Carousel').each(function(el,i){ var box=el.id.split('-'); var box_config={}; if($('config-'+box[2])) { var as = $('config-'+box[2]).getElements('span'); as.each(function(el1,i){ box_config[el1.get('id')]=parseInt(el1.get('html')); }); } new RCCarousel(el.id, {id:box[2],width:box_config['config-opt-width-'+box[2]], height:box_config['config-opt-height-'+box[2]],duration:box_config['config-opt-duration-'+box[2]],delay:box_config['config-opt-delay-'+box[2]],box:box_config['config-opt-box-'+box[2]],autoplay:box_config['config-opt-autoplay-'+box[2]]}); }); if($('header_top_menu')) size=$('header_top_menu').getSize(); $$('[id^=header_second_menu_]').each(function(el2,i2){ if($('header_top_menu')) el2.setStyle('top',size.y); }); $$('[id^=second_menu_show_]').each(function(el,i){ el.addEvent('click', function(e){ id=el.get('id').split('_'); $$('[id^=header_second_menu_]').each(function(el2,i2){ if(el2.get('id')!='header_second_menu_'+id[3]) el2.setStyle('display','none'); }); if($('header_second_menu_'+id[3])) $('header_second_menu_'+id[3]).toggle(); }); }); $(document.body).addEvent('click', function(e){ $$('[id^=header_second_menu_]').each(function(el,i){ if(e.target.id.length>0 && (e.target.get('id').match('second_menu_show_') || e.target.get('id').match('second_menu_ashow_'))) { } else { $$('[id^=header_second_menu_]').each(function(el2,i2){ el2.setStyle('display','none'); }); } }); }); }); window.addEvent('load', function() { $$('.box_Carousel').each(function(el,i){ var rcmax=0; var size=0; var box=el.id.split('-'); if($('rc-carousel-inner-'+box[2])) { var divs = $('rc-carousel-inner-'+box[2]).getElements('div'); divs.each(function(el1){ if(el1.className=='rc-carousel-animate') { size=el1.getSize(); if(size.y>rcmax) rcmax=size.y; } }); $('rc-carousel-inner-'+box[2]).setStyle("height",rcmax); } }); }); function setPassHelpEvent(ind) { if(!ind) ind=''; if(!$("f_help"+ind)) ind=''; var exV = new fValidator("f_help"+ind, { languageConfig:{l:eval('({' + def.index.languages_fvalidator + '})')}, msgClass: "rc_div_alert", msgContainerTag: "div", submitBt: "login_help_bt"+ind, fValidate_send:function(){ $('f_help'+ind).set('send', {onComplete: function(data) { var json = JSON.parse(data); if($('login_help_bt')) $('login_help_bt').hide(); if (json['pass'] == 'recaptcha_failed') { salert(def.login.recaptcha_failed,def.index.overlay_time,false,false,'none'); } else if(json['pass'] == 'ok'){ salert(def.login.ok_pass,def.index.overlay_time,false,false,'none'); } else if (json['pass'] == 'no_data') { salert(def.login.no_data,def.index.overlay_time,false,false,'none'); } else if (json['pass'] == 'order_only') { forgetLinkSend(json['email']); } if($('rc_window2')){ close_window_out($('rc_window2'),1,def.index.overlay_time); } }}); $('f_help'+ind).send(); } }); } function pass_help(alert){ if(alert==1) { if($('rc_alert0')) { close_window_out($('rc_alert0'),0) overlay=false; } } if($('rc_window1')) { close_window_out($('rc_window1'),0) overlay=false; } else overlay=true; var rc_w=new rc_windows({ id:'rc_window2', container: $(document.body), useOverlay: overlay, width:600, height:300, title: def.login.send_password, contentAJAX:'/ajax/login/help/', varAJAX:{"pid":1,"item":1}, contentHTML: '/ajax/login/help/', onComplete: function(){ setPassHelpEvent(2); jQuery(window).trigger('passwordResetModalLoaded'); $('login_email').addEvent('keydown', function(event){if(event.key=='enter' && $('token').get('value')!='') exV._onSubmit(event)}); var lang = RC_SESSION_LANG_CODE == 'cz' ? 'cs' : RC_SESSION_LANG_CODE; jQuery.getScript('https://www.google.com/recaptcha/api.js?hl=' + lang); } }); } function forgetLinkSend(email) { var rc_wf = new rc_windows({ id: "rc_window4", container: $(document.body), useOverlay: overlay, width: 600, height: 300, title: def.index.anonimizeWindow, varAJAX: {"pid": 2,"email": email}, contentAJAX: "/ajax/login/forget/", onComplete: function () { function forgetLink(){ $("forget").set("send", { onComplete: function (data) { var json = JSON.parse(data); salert(def.index.anonimizeData, def.index.overlay_time, false, false, "none"); if ($("rc_window4")) { close_window_out($("rc_window4"), 1, def.index.overlay_time); } } }); $("forget").send(); } document.querySelector('#forget_bt').addEventListener('click', forgetLink); } }); } var cat_ajax_list = function() { $$('[id^=catl_]').each(function(el){ el.removeEvents('click'); }); $$('[id^=catl_]').each(function(el){ el.addEvent('click',function(){ var id=el.get('id').replace('catl_',''); if($('catls_'+id)) { $('catls_'+id).toggle(); } else { var req = new Request({ method: 'post', url: '/ajax/categories_ajax/get_tree/', data: {"cid":id}, onComplete: function(data) { var nElement = new Element('div', { id: 'catls_'+id }); nElement.set('html',data); el.grab(nElement,'after'); cat_ajax_list(); loading_stop(); if(RC_SESSION_CAT_LIST==1 && RC_SESSION_AJAX_CONTENT=='true' && window.location.search=="" && dget('rcVer','sid',true)!=2065) { window.location.href='/c/'+id+'/'+ href; } } }).send(); } }); }); } window.addEvent('domready', function() { $$('[id^=widget_shop]').each(function(el,i){ if(el.get('class')=='widgets_fcenter_left') { var half=window.getWidth()/2; el.setStyle('left',half+el.getStyle('left').toInt()); } if(el.get('class')=='widgets_fcenter_right') { var half=window.getWidth()/2; el.setStyle('right',half+el.getStyle('right').toInt()); } }); if(RC_SUGGEST_SEARCH_IS_ACTIVE=='1') { /*$$('[name^=search_value]').each(function(elm,i){ elm.addEvent('keyup',function(event){ var value=elm.get('value'); if(value.length>=2){ c=elm.getCoordinates(); suggers_search(value); } }); }); */ if($('search_value')){ var elm = $('search_value'); elm.addEvent('keyup',function(event){ var value=elm.get('value'); if(value.length>=2){ c=elm.getCoordinates(); suggers_search(value); } }); } } cat_ajax_list(); }); function vouchers_windows(action,code) { if(action=='open') { var voucher_window_title = "Bony rabatowe"; if(def.cart.voucher_window_title) { voucher_window_title = def.cart.voucher_window_title; } var rc_w=new rc_windows({ id:'rc_window_vouchers', container: $(document.body), useOverlay: true, width:600, height:300, title: voucher_window_title, contentAJAX:'/ajax/cart/vouchers_windows/', onComplete: function(data) { vouchers_windows('send',''); } }); } if(action=='send') { var req = new Request({ method: 'post', url: '/ajax/cart/voucher/', data: {"code":code,"cart":"cart"}, onComplete: function(data) { $('vouchers_results').set('html',data); $('vcode').set('value',''); shpping_ajax($('countries').get('value')); $('vouchers_error').setStyle('display','none') if($('vouchers_error2')) { $('vouchers_error').set('html',$('vouchers_error2').get('html')); $('vouchers_error').setStyle('display','block') var vouchers_error = (function () {$('vouchers_error').setStyle('display','none')}).delay(3000); } } }).send(); } if (action == 'del') { var req = new Request({ method: 'post', url: '/ajax/cart/voucher/', data: { "code": code, "del": "del" }, onComplete: function(data) { $('vouchers_results').set('html', data); shpping_ajax($('countries').get('value')); } }).send(); } } function open_presentation(href, w, h) { if (!w) w = 630; if (!h) h = 420; var rc_w2 = new rc_windows({ id: 'rc_window_pres', container: $(document.body), useOverlay: true, width: w, height: h, type: 'iframe', title: 'Prezentacja 360', contentAJAX: href, onComplete: function() {} }); $('rc_window_pres_body').setStyle('width', $('rc_window_pres_body').getSize().x + 30); } window.addEvent("resize", function() { $$('.rc_windowContainer').each(function(el){ size= el.getSize(); el.setStyle('left',(document.body.clientWidth/2-size.x/2)); }); }); function discounts_info(pid) { var rc_w222=new rc_windows({ id:'rc_window_discounts222', container: $(document.body), useOverlay: true, width:600, height:300, title: def.index.discounts_info, contentAJAX:'/ajax/pinfo/discounts_info/', varAJAX:{"pid":pid}, onComplete: function(){ add_cart_event(); $$('.addcart').each(function(el){ el.addEvent('click',function(){ var timer = (function () { var rc_overlay = new Overlay({ container:$(document.body), id:'_rcw2', before:$('rc_window_opt') }); rc_overlay.show(); $$('.rc_windowbtclose').each(function(el){ el.addEvent('click',function(){ $('OverlayContainer_rcw2').destroy(); }) }); }).delay(500); var timer = (function () { $$('.rc_button').each(function(el){ el.addEvent('click',function(){ var timer = (function () { $('OverlayContainer_rcw2').destroy(); }).delay(1500); }) }); }).delay(2000); }) }); if(document.location.href.match('_cart')) { $$('.rc_windowbtclose').each(function(el){ el.addEvent('click',function(){ document.location.href='/_cart/index/'; }) }); } } }) } function filterDelete(el, isInput) { if ($(el)) { if (isInput) { if ($(el).set('value', '')); } else { if ($(el).get('checked')) $(el).set('checked', false); else $(el).set('checked', true); } } sendFilterForm(); } function sendFilterForm() { $('f_filter').submit(); } var linkChanged = function(url, data) { if (!data) data = { filter: false }; if (history.pushState) window.history.pushState(data, null, url); else window.location.href = url; }; var onCompleted = function(data) { var content; content = $$('.content_center_in'); if (content.length) content.set('html', data); else { if ($('content_x')) $('content_x').set('html', data); else if ($('content_2')) $('content_2').set('html', data); } ajaxPagination(); new MultiSelect(".MultiSelect"); slideContent(); add_cart_event(); }; function ajaxPagination() { if ($('sort')) { $('sort').removeProperty('onchange'); $('sort').addEvent('change', function() { var url = window.location.protocol + '//' + window.location.host + window.location.pathname; var re = /[\&]?sort=[\s\S]*[\&]/gi; var re1 = /[\&]?sort=[\s\S]*/gi; var search = window.location.search.substring(1).replace(re, '&').replace(re1, ''); if (search.length > 0) url = url + '?' + search + '&sort=' + $('sort').get('value'); else url = url + '?sort=' + $('sort').get('value'); linkChanged(url); window.scrollTo(0, 0); }); } if ($('pop')) { $('pop').removeProperty('onchange'); $('pop').addEvent('change', function() { var url = window.location.protocol + '//' + window.location.host + window.location.pathname; var re = /[\&]?pop=[\s\S]*[\&]/gi; var re1 = /[\&]?pop=[\s\S]*/gi; var search = window.location.search.substring(1).replace(re, '&').replace(re1, ''); if (search.length > 0) url = url + '?' + search + '&pop=' + $('pop').get('value'); else url = url + '?pop=' + $('pop').get('value'); linkChanged(url); window.scrollTo(0, 0); }); } if ($$('.li_listing')) { $$('.li_listing').removeProperty('onclick'); $$('.li_listing').addEvent('click', function(e) { var url = $(this).getElement('a').get('href'); linkChanged(url); window.scrollTo(0, 0); }); } } function getUrlVars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; } function sendFilterFormAjax() { var search = true; var key = $('keywords').get('value').replace(/\s+/gi, '').length var cat = /\/c\//.test(window.location.href); if (getUrlVars()['keywords'] && getUrlVars()['keywords'].length > 0 && key < 2 && cat == false) search = false; var url = window.location.protocol + '//' + window.location.host + $('f_filter').get('action') + '?' + $('f_filter').toQueryString(); if (search) linkChanged(url, { filter: true }); else { $('keywords').setStyles({ 'border': '1px solid red' }) } } function copyAddress() { jQuery('[data-copy]').each(function(index) { el = jQuery(this); var id = el.attr('id').replace('address[', '').replace(']', ''); if (el.attr('data-copy') == "") { var elTo = jQuery('[id^="invoice[' + id + ']"]')[0]; jQuery(elTo).val(el.val()); } else { var elTo = jQuery('[class^="' + el.attr('data-copy') + '"]')[0]; jQuery(elTo).val(el.val()); } }); } function categoriesSearcherEvent() { if ($('search_value')) { if ($('categories_search_value')) $('categories_search_value').fade('out'); $('search_value').addEvent('click', function(e) { categoriesSearcher(1); }) $(document.body).addEvent('click', function(e) { categoriesSearcher(0, e.target); }) } } function categoriesSearcher(t,id) { var pid=null; if(id && id.length>0) { idValue = id.get('id'); if(idValue == 'search_value') pid = $('categories_searcher'); } else idValue = ''; var pid1=''; if(pid!=null && pid.length>0) { pid1=pid.get('id'); } if($('categories_search_value')) { visibility = document.getElementById("categories_search_value").style.visibility if(visibility=='visible' && t==0 && idValue!='search_value' && idValue!='categories_searcher' && pid1!='categories_searcher') { if($('search_value').get('value')=="") { $('categories_search_value').fade('out'); } } if(visibility=='hidden' && t==1) { $('categories_search_value').fade('in'); } } } function check_items() { var pid = $('products_id').get('value'); var opt={}; var opts={}; var opts1=new Array(); opts1[0]={}; opts1[1]={}; var opts1s=new Array(); opts1s[0]={}; opts1s[1]={}; var suff=''; var s=true; if($('options_form'+suff)) { var sels = $('options_form'+suff).getElementsByTagName('select'); for(var i=0; i 1) { qt--; $(target).set('value', qt); $(target).onkeyup(); $(target).trigger('change'); } } function inventoryLoadedAddEvent() { jQuery(document).on('inventoryLoaded',toolTipsWitoutIcon); } function toolTipsWitoutIcon() { jQuery('.withoutIcon').tooltip('destroy') jQuery('.withoutIcon').tooltip().on('hidden.bs.tooltip', function(){ jQuery(this).css('display',''); }); } var timeOutMinOrder = ''; function isMinOrder(obj) { clearTimeout(timeOutMinOrder); timeOutMinOrder = setTimeout (function(){ var min_order = jQuery(obj).data('min-order'); var actual_value = jQuery(obj).val(); if(actual_value < min_order) jQuery(obj).val(min_order); },800); } function order_send(fid) { $(fid).set("send", { onComplete: function (msg) { try { var data = JSON.parse(msg); if(!data.order_id){ throw 1; } //data.location if (window.dataLayer && RC_SHOP_ID!=131) { rc_event_purchase(data.order_id, data.location); } else { window.location.href = data.location; } }catch (e) { window.location.href = '/_cart/index/'; } } }).send(); } function rc_event_purchase(orderId, location) { var request = { "orders":[{orders_id: orderId}] }; window.fetch && fetch("/ajax.php?p=conversion&f=orders_info&ssl=1", { method: "POST", body: JSON.stringify(request), credentials: "same-origin", headers: { "Accept": "application/json", "Content-Type": "application/json" } }).then(function (response) { return response.json(); }).then(function (response) { var order = response.orders.pop(); console.log("rc_event_purchase", order); var products = order.products.map(function (product) { return { "name": product.name, "id": product.products_id, "price": product.payment_gross_price, "brand": product.pr_name, "category": product.main_category_path, "variant": null, "quantity": product.item }; }); var promise = new Promise(function (resolve,reject) { window.dataLayer.push({ "event": "purchase", "ecommerce": { "currencyCode": order.currency, "purchase": { "actionField": { "id": order.orders_id, "affiliation": order.affiliation_name, "revenue": order.gross_price, "tax": order.gross_tax_price, "shipping": order.gross_shipping_price }, "products": products } }, "eventCallback": function () { resolve(); } }); setTimeout(reject, 3000,"timeout"); }); promise.then(function () { return window.fetch && fetch("/scripts_cron/_api/confirmPurchase.php").then(function () { console.log("confirmed"); window.location.href = location; }); }).catch(function (err) { console.error(err); window.location.href = location; }); }).catch(console.error); } function countdown_23020 () { var anyCountdown = document.querySelector('[id^="promotions_date_to_timestamp"]') if(anyCountdown) { var countdowns = document.querySelectorAll('.countdown-clock') countdowns.forEach(function (element) { var id = element.dataset.id var countDownInterval=setInterval(function() { if((navigator.userAgent.match(/iPhone/i))) var date = new Date(parseInt($('promotions_date_to_timestamp_' + id).getElements('a').get('html')+'000')); else var date = new Date(parseInt($('promotions_date_to_timestamp_' + id).get('html')+'000')); var today = new Date(); var diff = parseInt((date.getTime()-today.getTime())/1000); var days = parseInt(diff/60/60/24); var hours = parseInt((diff-(days*60*60*24))/60/60); var minutes = parseInt((diff-(days*60*60*24)-(hours*60*60))/60); var seconds = parseInt(diff-(days*60*60*24)-(hours*60*60)-(minutes*60)); if(diff >= 0){ element.querySelector('.countdown-days').textContent = zeroPad(days, 2) element.querySelector('.countdown-hours').textContent = zeroPad(hours, 2) element.querySelector('.countdown-minutes').textContent = zeroPad(minutes, 2) element.querySelector('.countdown-seconds').textContent = zeroPad(seconds, 2) }else if(diff > -5){ clearInterval(countDownInterval); location.reload(); } }, 1000); }) } } function set_cookie_settings(type = "") { var analytics = document.getElementById('analytics_cookies_checkbox'); var marketing = document.getElementById('marketing_cookies_checkbox'); var userData = document.getElementById('user_data_cookies_checkbox'); var personalization = document.getElementById('personalization_cookies_checkbox'); if(type == 1) { var allCookies = document.querySelectorAll('.singleCookie input'); allCookies.forEach((cookie) => { cookie.checked = 'checked'; }); } if (analytics && marketing) { new Request({ method: "post", url: "/ajax/info/set_cookie_settings/", data: { marketing: marketing.checked, analytics: analytics.checked, user_data: userData.checked, personalization: personalization.checked }, onComplete: function (data) { trigger_consent_event(analytics.checked, marketing.checked, userData.checked, personalization.checked); let cookieBanner = document.getElementById('cookies-new'); if(cookieBanner) { let activeElements = cookieBanner.querySelectorAll('.active'); if(activeElements) { activeElements.forEach((item) => { item.classList.remove('active'); }) } } } }).send(); } } function toggle_cookie(id) { let cookies = document.querySelectorAll('.singleCookie'); if(!cookies[id].classList.contains('active')) { for (let i = 0; i < cookies.length; i++) { cookies[i].classList.remove('active'); cookies[id].classList.add('active'); } } else { cookies[id].classList.remove('active'); } } function trigger_consent_event(analytics, marketing, userData, personalization) { var consent_settings = { ad_user_data: userData ? 'granted' : 'denied', //Określa stan zgody na wysyłanie do Google danych użytkownika związanych z reklamami. ad_personalization: personalization ? 'granted' : 'denied', //Określa stan zgody na reklamy spersonalizowane. ad_storage: marketing ? 'granted' : 'denied', analytics_storage: analytics ? 'granted' : 'denied', }; window.jQuery && jQuery(document.body).trigger('rc_event_consent_update', consent_settings); }