1/* Base: Replace all SVG images with inline SVG */ 2 3/* TODO: kesobb torolheto, ha a lentebbi modszer biztosan mukodik 4 5document.querySelectorAll('img.svg').forEach(function(img) { 6 var imgID = img.getAttribute('id'); 7 var imgClass = img.getAttribute('class'); 8 var imgURL = img.getAttribute('src'); 9 10 fetch(imgURL) 11 .then(function(response) { 12 return response.text(); 13 }) 14 .then(function(data) { 15 var parser = new DOMParser(); 16 var xmlDoc = parser.parseFromString(data, 'text/xml'); 17 var svg = xmlDoc.getElementsByTagName('svg')[0]; 18 19 if (!svg) { return; } 20 21 // Add replaced image's ID to the new SVG 22 if (typeof imgID !== 'undefined') { 23 svg.setAttribute('id', imgID); 24 } 25 // Add replaced image's classes to the new SVG 26 if (typeof imgClass !== 'undefined') { 27 svg.setAttribute('class', imgClass + ' replaced-svg'); 28 } 29 30 // Remove any invalid XML tags 31 svg.removeAttribute('xmlns:a'); 32 33 // Replace image with new SVG 34 img.parentNode.replaceChild(svg, img); 35 }); 36}); 37*/ 38 39/* TODO: kesobb torolheto, ha a lentebbi modszer biztosan mukodik 40 41// Global cache to store fetched SVG data 42var svgCache = {}; 43 44document.querySelectorAll('img.svg[data-src], img.svg[src]').forEach(function (img) { 45 const imgID = img.getAttribute('id'); 46 const imgClass = img.getAttribute('class'); 47 const imgURL = img.getAttribute('data-src') || img.getAttribute('src'); // Use data-src if available, fallback to src 48 49 if (!imgURL) return; // Exit if there's no valid URL 50 51 // Check localStorage for the SVG data 52 if (localStorage.getItem(imgURL)) { 53 console.log(`Using cached SVG from localStorage for: ${imgURL}`); 54 replaceImgWithSvg(img, localStorage.getItem(imgURL), imgID, imgClass); 55 } else if (svgCache[imgURL]) { 56 console.log(`Using cached SVG in memory for: ${imgURL}`); 57 replaceImgWithSvg(img, svgCache[imgURL], imgID, imgClass); 58 } else { 59 console.log(`Fetching SVG for: ${imgURL}`); 60 fetch(imgURL) 61 .then(response => response.text()) 62 .then(data => { 63 // Store in both localStorage and svgCache 64 localStorage.setItem(imgURL, data); 65 svgCache[imgURL] = data; 66 replaceImgWithSvg(img, data, imgID, imgClass); 67 }); 68 } 69}); 70 71function replaceImgWithSvg(img, svgData, imgID, imgClass) { 72 const parser = new DOMParser(); 73 const xmlDoc = parser.parseFromString(svgData, 'image/svg+xml'); 74 const svg = xmlDoc.getElementsByTagName('svg')[0]; 75 76 if (!svg) return; 77 78 if (imgID) svg.setAttribute('id', imgID); 79 if (imgClass) svg.setAttribute('class', imgClass + ' replaced-svg'); 80 81 svg.removeAttribute('xmlns:a'); 82 83 const fragment = document.createDocumentFragment(); 84 fragment.appendChild(svg); 85 img.parentNode.replaceChild(fragment, img); 86} 87 */ 88 89// Global cache to store fetched SVG data in memory only 90 91const svgCache = {}; 92const requestCache = {}; // Track ongoing fetch requests 93 94document.addEventListener('DOMContentLoaded', () => { 95 document.querySelectorAll('img.svg[data-src], img.svg[src]').forEach(function (img) { 96 const imgID = img.getAttribute('id'); 97 const imgClass = img.getAttribute('class'); 98 const imgURL = img.getAttribute('data-src') || img.getAttribute('src'); // Use data-src if available, fallback to src 99 100 if (!imgURL) return; // Exit if there's no valid URL 101 102 // Check if SVG data is already cached 103 if (svgCache[imgURL]) { 104 replaceImgWithSvg(img, svgCache[imgURL], imgID, imgClass); 105 } else if (requestCache[imgURL]) { 106 // If a fetch is already in progress, wait for it to complete 107 requestCache[imgURL].then(data => { 108 replaceImgWithSvg(img, data, imgID, imgClass); 109 }); 110 } else { 111 // Store the fetch promise in requestCache 112 requestCache[imgURL] = fetch(imgURL) 113 .then(response => response.text()) 114 .then(data => { 115 svgCache[imgURL] = data; // Store the SVG data in memory cache 116 delete requestCache[imgURL]; // Remove from requestCache once resolved 117 replaceImgWithSvg(img, data, imgID, imgClass); 118 return data; 119 }) 120 .catch(error => { 121 console.error(`Failed to fetch SVG for ${imgURL}`, error); 122 delete requestCache[imgURL]; // Clean up on error 123 }); 124 } 125 });
126}); 127 128function replaceImgWithSvg(img, svgData, imgID, imgClass) { 129 const parser = new DOMParser(); 130 const xmlDoc = parser.parseFromString(svgData, 'image/svg+xml'); 131 const svg = xmlDoc.getElementsByTagName('svg')[0]; 132 133 if (!svg) return; 134 135 // Add replaced image's ID and class to the new SVG 136 if (imgID) svg.setAttribute('id', imgID); 137 if (imgClass) svg.setAttribute('class', imgClass + ' replaced-svg'); 138 139 svg.removeAttribute('xmlns:a'); // Remove any invalid XML tags 140 141 // Replace the image with the new SVG 142 const fragment = document.createDocumentFragment(); 143 fragment.appendChild(svg); 144 img.parentNode?.replaceChild(fragment, img); 145} 146 147/* Base: Activate Select2 */ 148 149$(document).ready(function() { 150 $('.select2').select2(); 151}); 152 153/* Base: Activate tooltips */ 154 155const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]') 156const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl)) 157 158/* Base: Toggle menu + transform icon */ 159/* 160document.querySelector(".navbar-toggler").addEventListener("click", function(e) { 161 document.querySelector(".svg-menu-toggle").classList.toggle("active"); 162 document.querySelector(".menu").classList.toggle("active"); 163 document.body.classList.toggle("menu-open"); 164 //e.preventDefault(); 165}); 166 167/* Base: Toggle header class onscroll */ 168 169window.addEventListener('scroll', function() { 170 if (window.scrollY > 50) { 171 document.body.classList.add('scrolled'); 172 } else { 173 document.body.classList.remove('scrolled'); 174 } 175}); 176 177/* Base: Dropdown Mega Menu Functions */ 178 179$(document).ready(function() { 180 181 // Submenu toggler interaction 182 $('.submenu-toggler').on('mouseenter click', function() { 183 var dataId = $(this).data('id'); 184 $('.submenu-toggler').removeClass('active'); 185 $(this).addClass('active'); 186 $(this).closest('.menu-dropdown').find('.mega-menu-content div').removeClass('active'); 187 $(this).closest('.menu-dropdown').find('.mega-menu-content div[data-id="' + dataId + '"]').addClass('active'); 188 $(this).closest('.menu-dropdown').find('.mega-menu-content').addClass('active'); 189 $(this).closest('.menu-dropdown').addClass('open'); 190 }); 191 192 // Hover effect for <a> elements inside mega-menu-content 193 $('.mega-menu-content a').on('mouseenter', function() { 194 $(this).closest('ul').find('a').removeClass('active'); 195 $(this).addClass('active'); 196 }); 197 198 // Remove the active class when the mouse leaves the .mega-menu-content 199 $('.mega-menu-content').on('mouseleave', function() { 200 $(this).find('a').removeClass('active'); 201 }); 202 203 // Remove the classes when the mouse leaves the menu-dropdown 204 $('.menu-dropdown').on('mouseleave', function() { 205 $(this).find('.mega-menu-content div').removeClass('active'); 206 $(this).find('.mega-menu-content').removeClass('active'); 207 $(this).find('.submenu-toggler').removeClass('active'); 208 $(this).find('.mega-menu-content a').removeClass('active'); 209 $(this).removeClass('open'); 210 }); 211 212 // Case 1: Handle nav-back click inside .mega-menu-content 213 $('.mega-menu-content .nav-back').on('click', function(e) { 214 e.preventDefault(); 215 // Find the closest parent div with class 'active' and remove 'active' class 216 $(this).closest('div.active').removeClass('active'); 217 // Remove the active class from the closest mega-menu-content 218 $(this).closest('.mega-menu-content').removeClass('active'); 219 }); 220 221 // Case 2: Handle nav-back click inside .nav-item.nav-item-header 222 $('.nav-item.nav-item-header .nav-back').on('click', function(e) { 223 e.preventDefault(); 224 // Find the closest .menu-dropdown and remove 'active' class 225 $(this).closest('.menu-dropdown').removeClass('active open'); 226 }); 227 228 // Menu dropdown toggler hover 229 $('.menu-dropdown-toggler').hover( 230 function() { 231 $(this).find('.menu-dropdown').addClass('active'); 232 }, 233 function() { 234 if (!$(this).find('.menu-dropdown').hasClass('open')) { 235 $(this).find('.menu-dropdown').removeClass('active'); 236 } 237 } 238 ); 239 240 // Listen for mouseenter event on the links inside .mega-menu-content that have a data-category attribute 241 $('.mega-menu-content a[data-category]').on('mouseenter', function() { 242 // Get the data-category value from the hovered element 243 var newCategoryId = $(this).data('category'); 244 245 // Update the hrefs in .submenu-filter by replacing the current category_id with the new one 246 $('.submenu-filter a').each(function() { 247 var href = $(this).attr('href'); 248 // Replace the existing category_id with the new one 249 var updatedHref = href.replace(/category_id=\d*/, 'category_id=' + newCategoryId); 250 $(this).attr('href', updatedHref); 251 });
252 }); 253 254 // Listen for mouseleave event on the .mega-menu-content 255 $('.mega-menu-content').on('mouseleave', function() { 256 // Clear the category_id in .submenu-filter hrefs 257 $('.submenu-filter a').each(function() { 258 var href = $(this).attr('href'); 259 // Remove the category_id value, leaving it empty 260 var updatedHref = href.replace(/category_id=\d*/, 'category_id='); 261 $(this).attr('href', updatedHref); 262 }); 263 }); 264 265}); 266 267/* Base: Toggle header dropdown */ 268 269$(".dropdown-close").click(function() { 270 $(".menu-selfcare").dropdown("toggle"); 271}); 272 273/* Base: Trigger modal from URL hash - regiojatek.hu/#modal-newsletter */ 274 275/* 276document.addEventListener('DOMContentLoaded', function() { 277 if (window.location.hash) { 278 var hash = window.location.hash; 279 var modalElement = document.querySelector(hash); 280 if (modalElement && typeof bootstrap !== 'undefined') { 281 var modal = new bootstrap.Modal(modalElement); 282 modal.toggle(); 283 } 284 } 285}); 286*/ 287 288document.addEventListener('DOMContentLoaded', function() { 289 let modalSelector = null; 290 291 // Check for hash in the URL (e.g., #modal-newsletter) 292 if (window.location.hash) { 293 modalSelector = window.location.hash; 294 } 295 296 // Check for any parameter in the URL starting with "modal-" 297 const urlParams = new URLSearchParams(window.location.search); 298 for (const [key] of urlParams.entries()) { 299 if (key.startsWith('modal-')) { 300 modalSelector = '#' + key; 301 break; 302 } 303 } 304 305 // If a valid modal selector is found, attempt to open the modal 306 if (modalSelector) { 307 const modalElement = document.querySelector(modalSelector); 308 if ( 309 modalElement && 310 modalElement.classList.contains('modal') && 311 typeof bootstrap !== 'undefined' 312 ) { 313 const modal = new bootstrap.Modal(modalElement); 314 modal.show(); 315 } 316 } 317}); 318 319/* Order: Coupons toggler */ 320 321$('.coupons-toggler').click(function() { 322 $('.order-coupon').toggleClass('active'); 323}); 324 325/* Order: Summary toggler */ 326 327$('.summary-title').click(function() { 328 $('.order-summary').toggleClass('active'); 329}); 330 331/* Order: Choose payment */ 332 333$('.choose-payment a').click(function(e) { 334 $('.choose-payment a').removeClass('base'); 335 $('.choose-payment a').removeClass('active'); 336 $(this).addClass('active'); 337 e.preventDefault(); 338}); 339 340/* Order: Choose + activate transport */ 341 342// $('.choose-transport a').click(function(e) { 343// $('.choose-transport a').removeClass('base'); 344// $('.choose-transport a').removeClass('active'); 345// $(this).addClass('active'); 346// e.preventDefault(); 347// }); 348// 349// $('.t-person').click(function(e) { 350// $('.transport-container').removeClass('active'); 351// $('.t-person-container').addClass('active'); 352// }); 353// 354// $('.t-parcel').click(function(e) { 355// $('.transport-container').removeClass('active'); 356// $('.t-parcel-container').addClass('active'); 357// }); 358// 359// $('.t-delivery').click(function(e) { 360// $('.transport-container').removeClass('active'); 361// $('.t-delivery-container').addClass('active'); 362// }); 363 364/* Order: Choose + activate delivery */ 365 366// $('.choose-delivery a').click(function(e) { 367// $('.choose-delivery a').removeClass('base'); 368// $('.choose-delivery a').removeClass('active'); 369// $(this).addClass('active'); 370// e.preventDefault(); 371// }); 372 373/* Order: Activate billing & shipping */ 374 375$('.order-data-toggler').click(function(e) { 376 $('.order-billing').addClass('active'); 377 $('.order-shipping').addClass('active'); 378 e.preventDefault(); 379}); 380 381/* Product: Gallery thumbnails scroll */ 382 383$(document).on('click', '#more-thumbnails', function() { 384 let scrollableElement = $('.thumbnails-scroll'); 385 let scrollTop = scrollableElement.scrollTop(); 386 let innerHeight = scrollableElement.innerHeight(); 387 let scrollHeight = scrollableElement[0].scrollHeight; 388 389 // Calculate the remaining scroll distance to the bottom
390 const remainingScroll = scrollHeight - (scrollTop + innerHeight); 391 392 if ($(this).hasClass('end')) { 393 // Scroll back to the top if the "end" class is present 394 scrollableElement.animate({ scrollTop: 0 }, 300); 395 $(this).removeClass('end'); // Remove "end" class to reset for next scroll down 396 } else { 397 // If the remaining scroll distance is less than or equal to 384px, scroll exactly to the bottom 398 if (remainingScroll <= 384) { 399 scrollableElement.animate({ scrollTop: scrollHeight }, 300); 400 $(this).addClass('end'); // Add "end" class since we're reaching the bottom 401 } else { 402 // Otherwise, scroll down by 384px 403 scrollableElement.animate({ scrollTop: '+=384px' }, 300); 404 } 405 } 406}); 407 408/* Product: Description toggler */ 409 410$(document).ready(function() { 411 const productDesc = $('.product-desc > div'); // Select inner content 412 const toggler = $('.product-desc-toggler'); 413 const maxHeight = 117; 414 415 // Show or hide toggler based on content height 416 toggler.toggle(productDesc.prop('scrollHeight') > maxHeight); 417 418 // Toggle content visibility on button click 419 toggler.click(function(e) { 420 e.preventDefault(); 421 $('.product-desc').toggleClass('active'); 422 productDesc.css('max-height', productDesc.css('max-height') === 'none' ? maxHeight : 'none'); 423 }); 424}); 425 426/* Product: Floating toggle onscroll */ 427 428var $bodyScrolled = $('body'); 429var $headerScrolled = $('header'); 430 431$(window).scroll(function(){ 432 if ($(this).scrollTop() > 200) { 433 if (!$bodyScrolled.hasClass('scrolled-more')) { 434 /* Meg a fixre valtas elott lemerjuk, mekkora helyet foglal a fejlec 435 a folyamban (margoval egyutt) - ezt kapja meg a tartalom paddingkent, 436 igy nem ugrik fel es az oldal magassaga sem valtozik. */ 437 document.documentElement.style.setProperty('--header-flow-height', $headerScrolled.outerHeight(true) + 'px'); 438 $bodyScrolled.addClass('scrolled-more'); 439 } 440 } else { 441 $bodyScrolled.removeClass('scrolled-more'); 442 } 443}); 444 445/* Base: Vissza a lap tetejere gomb (a .back-top lathatosagat CSS-bol a 446 scrolled-more osztaly kapcsolja, itt csak a sima gorgetes van) */ 447 448$(document).on('click', '.back-top', function(e) { 449 e.preventDefault(); 450 $('html, body').animate({ scrollTop: 0 }, 300); 451}); 452 453/* Lists: Dropdown select toggler */ 454 455// Click event handler for the span inside .select-container 456$('.select-container > .select-toggler').click(function() { 457 // Find the closest select2 element above this span within the same .select-container 458 $(this).siblings('select.select2').select2('open'); 459}); 460 461$(document).ready(function() { 462 $('.select2-custom-width').select2({ 463 dropdownCssClass: 'custom-dropdown-width' // Add a custom class to the dropdown 464 }); 465}); 466 467/* Lists: Mobile filters toggler */ 468 469$('.filters-toggler').click(function(e) { 470 $('.mobile-filters').toggleClass('active'); 471 e.preventDefault(); 472}); 473 474$('.sublevel-toggler').click(function(e) { 475 $(this).closest('li').find('.sublevel').first().toggleClass('active'); 476 e.preventDefault(); 477}); 478 479/* Lists: Partner lists more category toggler */ 480 481$('.partner-categories-toggler').click(function(e) { 482 $('.partner-categories').toggleClass('active'); 483 e.preventDefault(); 484}); 485 486/* Lists: Main and subcategories lists filters + fixed top */ 487 488$(document).ready(function() { 489 $('.categories-list > div > a').on('click', function(event) { 490 event.preventDefault(); // Prevents the page from reloading 491 $(this).closest('div').toggleClass('active'); // Toggles the active class on the closest div 492 }); 493}); 494 495$(document).ready(function() { 496try { 497 var $categoriesList = $('.categories-list'); 498 if ($categoriesList.length === 0) { 499 return; 500 } 501 502 var offsetTop = $categoriesList.offset().top; // Get the initial top offset of the div 503 504 $(window).on('scroll', function() { 505 if ($(window).scrollTop() >= offsetTop) { 506 $categoriesList.addClass('fixed'); 507 } else { 508 $categoriesList.removeClass('fixed'); 509 } 510 }); 511 } catch (e) { console.error(e); } 512}); 513 514/* Profile: List dropdown toggler on mobile */ 515 516$('.list-dropdown-toggler a').click(function(e) { 517 $('.list-dropdown').toggleClass('active'); 518 e.preventDefault(); 519}); 520 521/* Profile: Modify toggler */ 522 523$('.modify-toggler').click(function(e) { 524 e.preventDefault(); 525 var closestBox = $(this).closest('.box');
526 closestBox.find('.modify').toggleClass('active'); 527 closestBox.find('.modify-content').toggleClass('active'); 528}); 529 530/* Profile: Add kids toggler */ 531 532$('.kids-add-toggler').click(function(e) { 533 $('.kids-new').toggleClass('active'); 534 e.preventDefault(); 535}); 536 537 538/* Stores: Header menu toggler */ 539 540let menuTimeout; 541 542// Hover on the .nav-stores link 543$('.nav-stores').on('mouseenter', function() { 544 clearTimeout(menuTimeout); // Clear the timeout if it exists 545 $('.menu-stores').addClass('active'); 546}); 547 548// Hover on the .menu-stores div 549$('.menu-stores').on('mouseenter', function() { 550 clearTimeout(menuTimeout); // Clear the timeout when hovering the menu 551}); 552 553// Mouse leave from both .nav-stores and .menu-stores 554$('.nav-stores, .menu-stores').on('mouseleave', function() { 555 menuTimeout = setTimeout(function() { 556 $('.menu-stores').removeClass('active'); 557 }, 100); // Delay before removing the active class to allow transition between elements 558}); 559 560// Remove the active class when .nav-close is clicked 561$('.menu-stores .nav-close').on('click', function(e) { 562 e.preventDefault(); // Prevent the default action of the anchor tag 563 $('.menu-stores').removeClass('active'); 564}); 565 566/* Stores: More toggler on mobile */ 567 568$(document).ready(function(){ 569 $('.stores-toggler').on('click', function(e){ 570 e.preventDefault(); 571 $(this).closest('.stores-container').find('.stores').toggleClass('active'); 572 }); 573}); 574 575/* Activate slick slider for USP */ 576 577$(document).ready(function(){ 578 579 $('.slick-primary').slick({ 580 lazyLoad: 'ondemand', 581 infinite: false, 582 slidesToShow: 4, 583 slidesToScroll: 1, 584 dots: false, 585 arrows: true, 586 touchThreshold: 30, 587 responsive: [ 588 { 589 breakpoint: 1200, 590 settings: { 591 slidesToShow: 4, 592 slidesToScroll: 1, 593 } 594 }, 595 { 596 breakpoint: 992, 597 settings: { 598 slidesToShow: 3, 599 slidesToScroll: 1, 600 } 601 }, 602 { 603 breakpoint: 768, 604 settings: { 605 slidesToShow: 3, 606 slidesToScroll: 1, 607 arrows: false, 608 infinite: true, 609 } 610 } 611 ] 612 }); 613 614 $('.slick-secondary').slick({ 615 infinite: false, 616 slidesToShow: 3, 617 slidesToScroll: 1, 618 dots: false, 619 arrows: true, 620 touchThreshold: 30, 621 responsive: [ 622 { 623 breakpoint: 1200, 624 settings: { 625 slidesToShow: 3, 626 slidesToScroll: 1, 627 } 628 }, 629 { 630 breakpoint: 992, 631 settings: { 632 slidesToShow: 2, 633 slidesToScroll: 1, 634 } 635 }, 636 { 637 breakpoint: 768, 638 settings: { 639 slidesToShow: 3, 640 slidesToScroll: 1, 641 arrows: false, 642 infinite: true, 643 } 644 } 645 ] 646 }); 647 648 $('.slick-third').slick({ 649 infinite: false, 650 slidesToShow: 6, 651 slidesToScroll: 1, 652 dots: false, 653 arrows: true, 654 touchThreshold: 30, 655 responsive: [ 656 { 657 breakpoint: 1200, 658 settings: { 659 slidesToShow: 4, 660 slidesToScroll: 1, 661 } 662 }, 663 { 664 breakpoint: 992, 665 settings: { 666 slidesToShow: 3, 667 slidesToScroll: 1, 668 } 669 }, 670 { 671 breakpoint: 768, 672 settings: { 673 slidesToShow: 3, 674 slidesToScroll: 1, 675 arrows: false, 676 infinite: true, 677 } 678 } 679 ] 680 }); 681 682 $('.slick-forth').slick({ 683 infinite: false, 684 slidesToShow: 8, 685 slidesToScroll: 1, 686 dots: false, 687 arrows: true, 688 touchThreshold: 30, 689 responsive: [ 690 { 691 breakpoint: 1200, 692 settings: { 693 slidesToShow: 6, 694 slidesToScroll: 1, 695 } 696 }, 697 { 698 breakpoint: 992, 699 settings: { 700 slidesToShow: 4, 701 slidesToScroll: 1, 702 } 703 }, 704 { 705 breakpoint: 768, 706 settings: { 707 slidesToShow: 3, 708 slidesToScroll: 1,
709 arrows: false, 710 infinite: true, 711 } 712 } 713 ] 714 }); 715 716 $('.slick-fifth').slick({ 717 lazyLoad: 'ondemand', 718 infinite: false, 719 slidesToShow: 2, 720 slidesToScroll: 1, 721 dots: false, 722 arrows: true, 723 touchThreshold: 30, 724 responsive: [ 725 { 726 breakpoint: 1200, 727 settings: { 728 slidesToShow: 2, 729 slidesToScroll: 1, 730 } 731 }, 732 { 733 breakpoint: 992, 734 settings: { 735 slidesToShow: 2, 736 slidesToScroll: 1, 737 } 738 }, 739 { 740 breakpoint: 768, 741 settings: { 742 slidesToShow: 1, 743 slidesToScroll: 1, 744 arrows: false, 745 infinite: true, 746 } 747 } 748 ] 749 }); 750 751 $('.slick-store').slick({ 752 infinite: false, 753 slidesToShow: 1, 754 slidesToScroll: 1, 755 dots: false, 756 arrows: true, 757 touchThreshold: 30, 758 responsive: [ 759 { 760 breakpoint: 768, 761 settings: { 762 slidesToShow: 2, 763 slidesToScroll: 1, 764 arrows: false, 765 infinite: true, 766 } 767 } 768 ] 769 }); 770 771 $('.modal').on('shown.bs.modal', function (e) { 772 $('.slick-store').slick('setPosition'); /* This will reposition the slick elements in the modal */ 773 }) 774 775}); 776 777/* 100vh szamitas ordernel, mobilon hibasan mukodott .order-summary title-nek */ 778 779function updateViewportHeight() { 780 const vh = window.innerHeight * 0.01; 781 document.documentElement.style.setProperty('--vh', `${vh}px`); 782} 783updateViewportHeight(); 784window.addEventListener('resize', updateViewportHeight); 785 786/* Molin AI default gomb elrejtese */ 787 788const hideMolinWidget = () => { 789 const molin = document.querySelector("molin-shop-ai"); 790 if (molin && molin.shadowRoot) { 791 const bubble = molin.shadowRoot.querySelector("mw-bubble"); 792 if (bubble) { 793 bubble.style.display = "none"; 794 return true; 795 } 796 } 797 return false; 798}; 799 800const interval = setInterval(() => { 801 if (hideMolinWidget()) { 802 clearInterval(interval); 803 } 804}, 500); // Try every 0.5 seconds until it appears 805 806/* Select 2 width correction */ 807 808(function () { 809 // â konstansok â 810 const LABEL_PADDING_FIX = 20; // mindig levonjuk a mért label-szélességbÅl 811 const EXTRA_GAP = 0; // kis légrés 812 813 // â helpers â 814 function measureLabelWidth($container) { 815 const el = $container.find('.select-toggler')[0]; 816 if (!el) return 0; 817 818 let w = el.getBoundingClientRect().width; 819 820 if (!w) { 821 const clone = el.cloneNode(true); 822 clone.style.cssText += 'position:absolute;left:-9999px;top:-9999px;visibility:hidden;display:inline-block;white-space:nowrap;'; 823 document.body.appendChild(clone); 824 w = clone.getBoundingClientRect().width; 825 clone.remove(); 826 } 827 // levonjuk a fix paddinget, de ne legyen mÃnusz 828 return Math.max(0, Math.ceil(w) - LABEL_PADDING_FIX); 829 } 830 831 function getArrowAndPadding($sel2Container) { 832 const $rendered = $sel2Container.find('.select2-selection__rendered'); 833 const $arrow = $sel2Container.find('.select2-selection__arrow'); 834 835 const cs = window.getComputedStyle($rendered[0]); 836 const pad = (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0); 837 const arrowW = $arrow.length ? $arrow[0].getBoundingClientRect().width : 0; 838 839 return { pad, arrowW }; 840 } 841 842 function sizeOne($select) { 843 const $wrap = $select.closest('.select-container'); 844 const inst = $select.data('select2'); 845 if (!inst || !inst.$container) return; 846 847 const labelW = measureLabelWidth($wrap); 848 const $sel2 = inst.$container; 849 const { pad, arrowW } = getArrowAndPadding($sel2); 850 851 const w = Math.ceil(labelW + pad + arrowW + EXTRA_GAP); 852 $sel2.css('width', w + 'px'); 853 } 854 855 function sizeAll() { 856 $('.filters .select2').each(function () { sizeOne($(this)); }); 857 } 858 859 // â init (ha máshol inicializálod, a select2() rész kihagyható) â 860 $('.filters .select2').select2({ 861 minimumResultsForSearch: Infinity, 862 dropdownAutoWidth: true, 863 width: 'resolve' 864 }).on('select2:open select2:close select2:select', sizeAll); 865 866 $(window).on('load resize', sizeAll); 867 sizeAll(); 868})(); 869 870/* Aruhaz galeria zoom a terkepen */ 871 872$(document).ready(function() { 873 const $zoomContainer = $('#zoom-container'); 874 875 $(document).on('mouseenter', '#modal-store-item .slick-slide img', function() { 876 const fullImageUrl = $(this).closest('a').attr('href'); 877 878 // A térkép elrejtése 879 $('#modalMap').hide(); 880 881 // BeállÃtjuk a háttérképet a konténernek 882 $zoomContainer.css({ 883 'display': 'block', 884 'background-image': 'url(' + fullImageUrl + ')', 885 'background-position': '50% 50%' // Alaphelyzet: középen 886 }); 887 });
888 889 $(document).on('mousemove', '#modal-store-item .slick-slide img', function(e) { 890 const $img = $(this); 891 const offset = $img.offset(); 892 893 // Kurzor helyzete a kis képen belül százalékban (0-100) 894 const posX = ((e.pageX - offset.left) / $img.width()) * 100; 895 const posY = ((e.pageY - offset.top) / $img.height()) * 100; 896 897 // A háttérkép pozÃcióját pont ugyanoda toljuk 898 $zoomContainer.css({ 899 'background-position': posX + '% ' + posY + '%' 900 }); 901 }); 902 903 $(document).on('mouseleave', '#modal-store-item .slick-slide img', function() { 904 $zoomContainer.hide(); 905 $('#modalMap').show(); 906 }); 907 908 // Ha véletlenül kattintanának a kis képre, ne vigye el az oldalról 909 $(document).on('click', '#modal-store-item .slick-slide a', function(e) { 910 e.preventDefault(); 911 }); 912});
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.