// Save the original console.warn function const originalConsoleWarn = console.warn; // Override console.warn to suppress the warning console.warn = function (message) { if (message && message.includes('Found 24 elements with non-unique id')) { return; // Ignore the warning message about non-unique IDs } originalConsoleWarn.apply(console, arguments); // Call the original console.warn for other warnings }; /* console.warn = function () {}; window.onerror = function (message, source, lineno, colno, error) { return true; }; window.onunhandledrejection = function (event) { event.preventDefault(); }; */ function openLightbox() { document.getElementById('lightboxBackground').style.display = 'flex'; } function closeLightbox() { document.getElementById('lightboxBackground').style.display = 'none'; } function showTab(tabId) { // Hide all tab contents document.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active')); // Remove active class from all tabs document.querySelectorAll('.tab').forEach(tab => tab.classList.remove('active')); // Show the selected tab content and make the corresponding tab active document.getElementById(tabId).classList.add('active'); document.querySelector(`.tab[onclick="showTab('${tabId}')"]`).classList.add('active'); } // Close the lightbox when clicking outside of the modal document.getElementById('lightboxBackground').addEventListener('click', function(event) { if (event.target === this) { closeLightbox(); } }); // You can also use "$(window).load(function() {" $(function () { // Slideshow 4 $("#slider4").responsiveSlides({ auto: true, pager: true, nav: true, speed: 500, namespace: "callbacks", before: function () { $('.events').append("
  • before event fired.
  • "); }, after: function () { $('.events').append("
  • after event fired.
  • "); } }); }); jQuery(document).ready(function() { var offset = 220; var duration = 500; jQuery(window).scroll(function() { if (jQuery(this).scrollTop() > offset) { jQuery('.back-to-top').fadeIn(duration); } else { jQuery('.back-to-top').fadeOut(duration); } }); jQuery('.back-to-top').click(function(event) { event.preventDefault(); jQuery('html, body').animate({scrollTop: 0}, duration); return false; }) }); $(document).ready(function() { var s = $("#sticker"); var pos = s.position(); $(window).scroll(function() { var windowpos = $(window).scrollTop(); if (windowpos >= pos.top) { s.addClass("stick"); } else { s.removeClass("stick"); } }); }); $(document).ready(function() { $('#nav').slicknav({ allowParentLinks: "true" }); $(document).on('click', '.slicknav_btn', function(e) { e.preventDefault(); // Prevent default link action if needed $('.slicknav_menu').css('position', function(index, currentPosition) { return currentPosition === 'absolute' ? 'relative' : 'absolute'; }); $('#logo').css('position', function(index, currentPosition) { return currentPosition === 'absolute' ? 'relative' : 'absolute'; }); }); }); $(window).load(function(){ $(".ddd").on("click", function () { var $button = $(this); var oldValue = $button.closest('.sp-quantity').find("input.quntity-input").val(); // Don't allow decrementing below zero if (oldValue > 1) { var newVal = parseFloat(oldValue) - 1; } else { newVal = 1; } $button.closest('.sp-quantity').find("input.quntity-input").val(newVal); }); $(".dddd").on("click", function () { var $button = $(this); var oldValue = $button.closest('.sp-quantity').find("input.quntity-input").val(); var newVal = parseFloat(oldValue) + 1; $button.closest('.sp-quantity').find("input.quntity-input").val(newVal); }); }); $(document).ready(function(){ $(".close").click(function(){ $.ajax({ type: 'POST', url: 'script.php', success: function(data) { $('#listainfo').css('display','none'); } }); }); }); $(document).ready(function(){ $(".closecookies").click(function(){ $.ajax({ type: 'POST', url: 'script2.php', success: function(data) { $('#cookies').css('display','none'); } }); }); }); $(document).ready(function(){ $("#cookiesuhlas3").click(function(){ $.ajax({ type: 'POST', url: 'script2.php', success: function(data) { $('#lightboxBackground').css('display','none'); document.getElementById("technickeCheckbox").checked = true; document.getElementById("vykonnostCheckbox").checked = true; document.getElementById("personalizaciaCheckbox").checked = true; } }); }); }); $(window).load(function(){ $("#cookies").hide(); function ahref(){ $("#cookies").show(); }; window.setTimeout( ahref, 700 ); // 2 seconds }) function showSlidingDiv1x(){ $(".slidingDiv1x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv2x(){ $(".slidingDiv2x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv3x(){ $(".slidingDiv3x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv4x(){ $(".slidingDiv4x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv5x(){ $(".slidingDiv5x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv6x(){ $(".slidingDiv6x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv7x(){ $(".slidingDiv7x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv8x(){ $(".slidingDiv8x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv9x(){ $(".slidingDiv9x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv10x(){ $(".slidingDiv10x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv11x(){ $(".slidingDiv11x").animate({"height": "toggle"}, { duration: 250 }); } function showSlidingDiv12x(){ $(".slidingDiv12x").animate({"height": "toggle"}, { duration: 250 }); } /* function showSlidingparameter1(){ $(".parameter1").animate({"height": "toggle"}, { duration: 250 }); } */ function showSlidingparameter1() { $(".parameter1").animate( {"height": "toggle"}, { duration: 250, step: function (now, fx) { if (fx.prop === "height") { $(this).css("display", "inline-block"); } }, complete: function () { const button = $(".loadmoreitems"); if ($(".parameter1").is(":visible")) { button.html('Načítať menej '); } else { button.html('Načítať ďalšie '); } } } ); } function showSlidingmorevalues() { $(".morevalues").animate( {"height": "toggle"}, { duration: 250, step: function (now, fx) { if (fx.prop === "height") { $(this).css("display", "inline-block"); } }, complete: function () { const button = $("#morevaluesbutton"); const button2 = $("#morevaluesbutton2"); if ($(".morevalues").is(":visible")) { button.html('Načítať menej '); button2.html('Načítať menej '); } else { button.html('Načítať viac '); button2.html('Načítať viac '); } } } ); } $(document).ready(function(){ $("#vyber1").change(function(){ var cid=$(this).val(); $("#vyber3 option:not(:first)").remove(); $("#vyber4 option:not(:first)").remove(); $("#vyber5 option:not(:first)").remove(); $("#vyber6 option:not(:first)").remove(); $.ajax({ url:'moduly/ajax/load_products.php', type:'post', data:{id:cid}, success:function(res){ $("#vyber2").html(res); } }); }); }); $(document).ready(function(){ $("#vyber2").change(function(){ var cid=$("#vyber1").val(); var cid2=$(this).val(); $("#vyber4 option:not(:first)").remove(); $("#vyber5 option:not(:first)").remove(); $("#vyber6 option:not(:first)").remove(); $.ajax({ url:'moduly/ajax/load_products2.php', type:'post', data:{id:cid2, id2:cid}, success:function(res){ $("#vyber3").html(res); } }); }); }); $(document).ready(function(){ $("#vyber3").change(function(){ var cid=$("#vyber1").val(); var cid2=$("#vyber2").val(); var cid3=$("#vyber3").val(); var cid4=$(this).val(); $("#vyber5 option:not(:first)").remove(); $("#vyber6 option:not(:first)").remove(); $.ajax({ url:'moduly/ajax/load_products3.php', type:'post', data:{id:cid, id2:cid2, id3:cid3, id4:cid4}, success:function(res){ $("#vyber4").html(res); } }); }); }); $(document).ready(function(){ $("#vyber4").change(function(){ var cid=$("#vyber1").val(); var cid2=$("#vyber2").val(); var cid3=$("#vyber3").val(); var cid4=$("#vyber4").val(); var cid5=$(this).val(); $("#vyber6 option:not(:first)").remove(); $.ajax({ url:'moduly/ajax/load_products4.php', type:'post', data:{id:cid, id2:cid2, id3:cid3, id4:cid4, id5:cid5}, success:function(res){ $("#vyber5").html(res); } }); }); }); $(document).ready(function(){ $("#vyber5").change(function(){ var cid=$("#vyber1").val(); var cid2=$("#vyber2").val(); var cid3=$("#vyber3").val(); var cid4=$("#vyber4").val(); var cid5=$("#vyber5").val(); var cid6=$(this).val(); $.ajax({ url:'moduly/ajax/load_products5.php', type:'post', data:{id:cid, id2:cid2, id3:cid3, id4:cid4, id5:cid5, id6:cid6}, success:function(res){ $("#vyber6").html(res); } }); }); }); document.addEventListener("DOMContentLoaded", () => { const buttons = document.querySelectorAll(".aolej_tab-button"); const contents = document.querySelectorAll(".aolej_tab-content"); buttons.forEach(button => { button.addEventListener("click", () => { buttons.forEach(btn => btn.classList.remove("aolej_active")); contents.forEach(content => content.classList.add("aolej_hidden")); button.classList.add("aolej_active"); const tabId = button.getAttribute("data-tab"); document.getElementById(tabId).classList.remove("aolej_hidden"); }); }); }); // Save selected values on change document.getElementById('select1form1').addEventListener('change', function () { var selectedValue = this.value; localStorage.setItem('select1form1', selectedValue); // Perform AJAX request to update select1form2 options var xhr = new XMLHttpRequest(); xhr.open('GET', 'vyhladavac-dielov-xml/get_options2.php?selectedValue=' + selectedValue, true); xhr.onload = function () { if (xhr.status === 200) { var select2 = document.getElementById('select1form2'); select2.innerHTML = '' + xhr.responseText; document.getElementById('select1form3').innerHTML = ''; // Reset motor dropdown localStorage.setItem('select1form2Options', xhr.responseText); // Save updated options for select2 localStorage.removeItem('select1form2'); // Clear previously selected model localStorage.removeItem('select1form3'); // Clear previously selected motor localStorage.removeItem('select1form3Options'); // Clear motor options } }; xhr.send(); }); document.getElementById('select1form2').addEventListener('change', function () { var selectedValue = this.value; localStorage.setItem('select1form2', selectedValue); // Perform AJAX request to update select1form3 options var xhr = new XMLHttpRequest(); xhr.open('GET', 'vyhladavac-dielov-xml/get_options3.php?selectedValue3=' + selectedValue, true); xhr.onload = function () { if (xhr.status === 200) { var select3 = document.getElementById('select1form3'); select3.innerHTML = '' + xhr.responseText; localStorage.setItem('select1form3Options', xhr.responseText); // Save updated options for select3 } }; xhr.send(); }); document.getElementById('select1form3').addEventListener('change', function () { var selectedValue = this.value; localStorage.setItem('select1form3', selectedValue); }); // Restore values and options on page load window.addEventListener('load', function () { // Restore select1form1 var select1Value = localStorage.getItem('select1form1'); if (select1Value) { document.getElementById('select1form1').value = select1Value; // Restore select1form2 options var select2Options = localStorage.getItem('select1form2Options'); if (select2Options) { document.getElementById('select1form2').innerHTML = '' + select2Options; // Restore select1form2 selected value var select2Value = localStorage.getItem('select1form2'); if (select2Value) { document.getElementById('select1form2').value = select2Value; // Restore select1form3 options var select3Options = localStorage.getItem('select1form3Options'); if (select3Options) { document.getElementById('select1form3').innerHTML = '' + select3Options; // Restore select1form3 selected value var select3Value = localStorage.getItem('select1form3'); if (select3Value) { document.getElementById('select1form3').value = select3Value; } } } } } }); /*localStorage.clear();*/ // Save the active tab state document.querySelectorAll('.aolej_tab-button').forEach(function (button) { button.addEventListener('click', function () { // Remove 'aolej_active' class from all buttons document.querySelectorAll('.aolej_tab-button').forEach(function (btn) { btn.classList.remove('aolej_active'); }); // Add 'aolej_active' class to the clicked button this.classList.add('aolej_active'); // Show corresponding tab content and hide others var activeTab = this.dataset.tab; document.querySelectorAll('.aolej_tab-content').forEach(function (content) { if (content.id === activeTab) { content.classList.remove('aolej_hidden'); } else { content.classList.add('aolej_hidden'); } }); // Save the active tab state localStorage.setItem('activeTab', activeTab); }); }); // Restore the active tab state on page load window.addEventListener('load', function () { var activeTab = localStorage.getItem('activeTab') || 'aolej_tab1'; // Predvolený tab má ID 'leftTab' if (activeTab) { // Restore active button document.querySelectorAll('.aolej_tab-button').forEach(function (button) { button.classList.remove('aolej_active'); if (button.dataset.tab === activeTab) { button.classList.add('aolej_active'); } }); // Restore tab content visibility document.querySelectorAll('.aolej_tab-content').forEach(function (content) { if (content.id === activeTab) { content.classList.remove('aolej_hidden'); } else { content.classList.add('aolej_hidden'); } }); } }); // Handle browser back/forward navigation window.addEventListener('popstate', function () { var activeTab = localStorage.getItem('activeTab'); if (activeTab) { // Restore active button document.querySelectorAll('.aolej_tab-button').forEach(function (button) { button.classList.remove('aolej_active'); if (button.dataset.tab === activeTab) { button.classList.add('aolej_active'); } }); // Restore tab content visibility document.querySelectorAll('.aolej_tab-content').forEach(function (content) { if (content.id === activeTab) { content.classList.remove('aolej_hidden'); } else { content.classList.add('aolej_hidden'); } }); } }); // Toggle the dropdown open or closed function toggleDropdown(element) { element.parentElement.classList.toggle('open'); } // Update the count of selected checkboxes function updateDropdownCount(checkbox) { const dropdown = checkbox.closest('.dropdown_2024'); const checkboxes = dropdown.querySelectorAll('.dropdown-content input[type="checkbox"]'); const selectedCount = Array.from(checkboxes).filter(cb => cb.checked).length; const countText = dropdown.querySelector('.selectedCount'); if (selectedCount > 0) { countText.style.display = 'inline'; countText.textContent = `(Vybrané ${selectedCount})`; } else { countText.style.display = 'none'; } } // Filter items in the dropdown based on search input function filterItems(input) { const filter = input.value.toLowerCase(); const dropdownContent = input.parentElement; const labels = dropdownContent.querySelectorAll('label'); labels.forEach(label => { const text = label.textContent.toLowerCase(); label.style.display = text.includes(filter) ? '' : 'none'; }); } // Close the dropdown function closeDropdown(element) { const dropdown = element.closest('.dropdown_2024'); dropdown.classList.remove('open'); } // Clear all selections and close the dropdown function clearSelection(element) { const dropdown = element.closest('.dropdown_2024'); const checkboxes = dropdown.querySelectorAll('.dropdown-content input[type="checkbox"]'); checkboxes.forEach(checkbox => { checkbox.checked = false; }); const countText = dropdown.querySelector('.selectedCount'); countText.style.display = 'none'; dropdown.classList.remove('open'); } // Initialize dropdown counts on page load function initializeDropdownCounts() { document.querySelectorAll('.dropdown_2024').forEach(dropdown => { const checkboxes = dropdown.querySelectorAll('.dropdown-content input[type="checkbox"]'); const selectedCount = Array.from(checkboxes).filter(cb => cb.checked).length; const countText = dropdown.querySelector('.selectedCount'); if (selectedCount > 0) { countText.style.display = 'inline'; countText.textContent = `(Vybrané ${selectedCount})`; } else { countText.style.display = 'none'; } }); } // Close dropdowns when clicking outside document.addEventListener('click', function (event) { document.querySelectorAll('.dropdown_2024').forEach(dropdown => { if (!dropdown.contains(event.target)) { dropdown.classList.remove('open'); } }); }); // Run initialization when the DOM is fully loaded document.addEventListener('DOMContentLoaded', initializeDropdownCounts); // Reinitialize when navigating back with the browser's history window.addEventListener('pageshow', initializeDropdownCounts); $(document).ready(function(){ $("#keyword").keyup(function(){ $.ajax({ type: "POST", url: "autocomplete/autocomplete.php", data: 'keyword=' + $(this).val(), beforeSend: function(){ $("#keyword").css("background", "#FFF url(autocomplete/LoaderIcon.gif) no-repeat 165px"); }, success: function(data){ $("#suggesstion-box").show(); $("#suggesstion-box").html(data); $("#keyword").css("background", "#FFF"); } }); }); // Hide suggestion box when clicking outside $(document).click(function(e) { if (!$(e.target).closest('#suggesstion-box, #keyword').length) { $("#suggesstion-box").hide(); } }); // Prevent hiding suggestion box when clicking inside it $("#suggesstion-box").click(function(e) { e.stopPropagation(); }); // Show suggestion box when clicking on the keyword input again $("#keyword").click(function() { if ($("#suggesstion-box").html().trim() != "") { $("#suggesstion-box").show(); } }); }); function selectkeyword(val) { $("#keyword").val(val); $("#suggesstion-box").hide(); } $(document).ready(function(){ $("#keyword2").keyup(function(){ $.ajax({ type: "POST", url: "autocomplete/autocomplete2.php", data:'keyword='+$(this).val(), beforeSend: function(){ $("#keyword2").css("background","#FFF url(autocomplete/LoaderIcon.gif) no-repeat 165px"); }, success: function(data){ $("#suggesstion-box2").show(); $("#suggesstion-box2").html(data); $("#keyword2").css("background","#FFF"); } }); }); }); function selectkeyword(val) { $("#keyword2").val(val); $("#suggesstion-box2").hide(); } function remover() { var id = $(".vymazat").val(); $.ajax({ type: "GET", url: "moduly/ajax/ajaxkosikedit.php", data: "id="+ id, success: function(data) { /*alert(id);*/ /*container = $('#content'); kosikbox = $('#kosikbox'); container.load('moduly/ajax/kosik-after-delete-ajax.php?fullurl='); kosikbox.load('moduly/ajax/kosikbox.php?fullurl='); $('.vymazat').remove();*/ } }); } function closebasketwindow(){ $('#content').toggleClass("ajaxchange2"); } function closebasketwindow2(){ $('#ajaxbox').html(""); } $("#kosik_tlacidlo").hover(function () { $('#content').addClass('ajaxchange2'); }); $("#content").mouseleave(function(){ setTimeout(function(){ $('#content').removeClass('ajaxchange2'); }, 20000) }); kosikbox_mobil = $('#kosikbox_mobil'); kosikbox_mobil.load('moduly/ajax/kosikbox.php?fullurl=');