1document.addEventListener('DOMContentLoaded', function() { 2 // Zobrazenie breadcrumb v mobile 3 if (window.innerWidth < 992) { 4 let items = document.querySelectorAll('.breadcrumb-list-item'); 5 if (items.length > 0) { 6 items.forEach(item => item.style.display = 'none'); 7 let lastItem = items[items.length - 1]; 8 lastItem.style.display = 'inline'; 9 lastItem.classList.add('mobile-back-item'); 10 } 11 } 12 13 // PridaÅ¥ do koÅ¡Ãka na mobile - vyrolovanie 14 function showElement() { 15 const element = document.querySelector(".imp-cart"); 16 if (element) { 17 element.classList.add("visible"); 18 } 19 } 20 showElement(); // zavolaÅ¥ funkciu, aby sa element zobrazil 21 22 // NezobraziÅ¥ owl s kategóriami v hlaviÄke na mobiloch 23 if (window.innerWidth <= 768) { 24 var element = document.getElementById('im-cats'); 25 if (element) { 26 element.parentNode.removeChild(element); 27 } 28 } 29 30// Funkcia, ktorá pridá alebo odstráni triedy a vlastnosti podľa pozÃcie scrollu 31function handleScroll() { 32 const path = window.location.pathname; 33 34 // Zastavà skript na stránke koÅ¡Ãka alebo pokladne 35 if (path.includes('/kosik') || path.includes('/kontrola-objednavky')) { 36 return; 37 } 38 39 const scrollPosition = window.scrollY || document.documentElement.scrollTop; 40 41 const header = document.querySelector('header'); 42 const catsElement = document.querySelector('.im-cats'); 43 const plcElement = document.querySelector('.sticky-plc'); 44 45 if (header) { 46 if (scrollPosition >= 200 && !header.classList.contains('sticky')) { 47 header.classList.add('sticky'); 48 } else if (scrollPosition < 200 && header.classList.contains('sticky')) { 49 header.classList.remove('sticky'); 50 } 51 } 52 53 if (catsElement) { 54 if (scrollPosition >= 200 && !catsElement.classList.contains('sticky-cat')) { 55 catsElement.classList.add('sticky-cat'); 56 } else if (scrollPosition < 200 && catsElement.classList.contains('sticky-cat')) { 57 catsElement.classList.remove('sticky-cat'); 58 } 59 } 60 61 if (plcElement) { 62 if (scrollPosition >= 200) { 63 plcElement.style.display = 'block'; 64 } else { 65 plcElement.style.display = 'none'; 66 } 67 } 68} 69 70 71// Debounce mechanizmus pre optimalizáciu scroll eventu 72let debounceTimeout; 73const debounceDelay = 80; // Môžete prispôsobiÅ¥ Äas v milisekundách 74 75window.addEventListener('scroll', function() { 76 clearTimeout(debounceTimeout); 77 debounceTimeout = setTimeout(handleScroll, debounceDelay); 78}); 79 80 81 // jQuery ÄasÅ¥ 82 jQuery(document).ready(function($) { 83 // Handle mobile category menu toggle 84 $('.mob-cat-menu').on('click', function() { 85 $('.mob-menu-wrapper').addClass('show-menu'); 86 }); 87 88 $('.close-this').on('click', function() { 89 $('.mob-menu-wrapper').removeClass('show-menu'); 90 }); 91 92 // Handle mobile search box toggle 93 $('.mob-search').on('click', function(e) { 94 e.stopPropagation(); 95 $('.mob-search-box').addClass('show'); 96 }); 97 98 $('.close-this').on('click', function() { 99 $('.mob-search-box').removeClass('show'); 100 }); 101 102 // Hide mobile search box when clicking outside of it 103 $(document).on('click', function(e) { 104 if (!$(e.target).closest('.mob-search-box').length) { 105 $('.mob-search-box').removeClass('show'); 106 } 107 }); 108 }); 109 110}); 111 112jQuery(function($){ 113 // vyber originálny shipping block z order review 114 var $shipping = $('#order_review .shipping'); 115 116 // skopÃruj ho alebo presuÅ vizuálne do custom kontajnera 117 if ($shipping.length) { 118 // metóda 1: append, element sa presunie 119 $shipping.appendTo('.shipping_block'); 120 121 // metóda 2: clone, element zostane v pôvodnom DOM, pluginy ho vidia 122 // var $clone = $shipping.clone(true, true); 123 // $('.shipping_block').append($clone); 124 } 125 126 // zabezpeÄenie update_checkout pri zmene dopravy 127 $(document.body).on('change', '.shipping_block input.shipping_method', function(){ 128 $('body').trigger('update_checkout'); 129 });
130}); 131 132// Billing company fields toggle 133if (typeof billingFieldsData !== 'undefined') { 134 jQuery(function ($) { 135 var isVelkoobchod = billingFieldsData.isVelkoobchod === 'yes'; 136 137 138 function toggleFields(isChecked) { 139 var $companyFields = $('#billing_company_field, #billing_ico_field, #billing_dic_field, #billing_icdph_field'); 140 var $requiredFields = $('#billing_company, #billing_ico, #billing_dic'); 141 142 if (isChecked) { 143 $companyFields.addClass('fcf-visible'); 144 $requiredFields.prop('required', true); 145 } else { 146 $companyFields.removeClass('fcf-visible'); 147 $requiredFields.prop('required', false); 148 } 149} 150 151 function init() { 152 var $checkbox = $('#billing_nakupujete_na_firmu'); 153 if ($checkbox.length === 0) return; 154 155 if (isVelkoobchod) { 156 $checkbox.prop('checked', true).prop('disabled', true); 157 if ($('#billing_nakupujete_na_firmu_hidden').length === 0) { 158 $checkbox.after('<input type="hidden" id="billing_nakupujete_na_firmu_hidden" name="billing_nakupujete_na_firmu" value="Ãno">'); 159 } 160 toggleFields(true); 161 } else { 162 toggleFields($checkbox.is(':checked')); 163 $checkbox.off('change.billingFields').on('change.billingFields', function () { 164 toggleFields($(this).is(':checked')); 165 }); 166 } 167 } 168 169 // Reinicializácia po každom WC ajax refresh (zmena dopravy, kupón atÄ.) 170 $(document).on('updated_checkout', function () { 171 init(); 172 }); 173 174 init(); 175 }); 176}
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.