PageSourceSearch

https://vitkin-winery.co.il/wp-content/themes/epicod-vitkin/js/main.js?ver=344

js vitkin-winery.co.il collected 2026-09-25 00:39:11 UTC 32,637 bytes, 1,007 lines download raw bytes

1(function($) {
2$(document).ready(function(){
3
4
5
6
7
8	const isRTL = $('html').attr('lang') === 'he-IL' || $('html').attr('lang') === 'ar';
9
10    const $popup = $('#age-confirmation-popup');
11
12    // Check if the user has already confirmed their age
13    if (!sessionStorage.getItem('ageConfirmed')) {
14        let hasScrolled = false;
15
16        // Show the popup when the user scrolls down
17        $(window).on('scroll', function () {
18            if (!hasScrolled) {
19                hasScrolled = true;
20                $popup.fadeIn(); // Display the popup with fade-in effect
21            	$('body').css('overflow', 'hidden');
22            }
23        });
24
25        // Handle the Yes button click
26        $('#age-confirmation-yes').on('click', function () {
27            sessionStorage.setItem('ageConfirmed', 'true');
28            $popup.fadeOut(); // Hide the popup with fade-out effect
29        	$('body').css('overflow', ''); 
30        });
31
32        // Handle the No button click
33        $('#age-confirmation-no').on('click', function () {
34            alert('You must be 18 or older to enter this site.');
35            window.location.href = 'https://www.google.com'; // Redirect to a different page
36        });
37    }
38
39
40
41	const menuTrigger = $('#open-menu');
42	const navigation = $('#site-navigation');
43	const focusableMenuElements = 'a, button, input, [tabindex]:not([tabindex="-1"])';
44	let hrefElement = jQuery('a[href*="#"]');
45
46	let focusLoopHandler;
47
48	menuTrigger.on('click', function(e) {
49	    e.preventDefault();
50	    if ($(this).hasClass('triggered')) {
51	        closeMenu();
52	    } else {
53	        openMenu();
54	    }
55	});
56
57	function openMenu() {
58	    menuTrigger.attr({
59	    'aria-expanded': true,
60	    'aria-label': 'Close menu',
61	    }); // Set aria-expanded to true when opening the menu
62	    menuTrigger.find('.bar').addClass('animate');
63	    navigation.addClass('open').attr('aria-hidden', false); // Set aria-hidden to false when opening the menu
64	    menuTrigger.addClass('triggered');
65	    $('body').addClass('menu-open');
66
67	    // Get all focusable elements inside the menu and include the menu trigger
68	    const focusableElements = $(menuTrigger).add(navigation.find(focusableMenuElements));
69	    const firstElement = focusableElements.first();
70	    const lastElement = focusableElements.last();
71
72	    // Focus the first menu item when the menu opens
73	    firstElement.focus();
74
75	    // Loop focus within the menu
76	    focusLoopHandler = function(e) {
77	        if (e.key === 'Tab') {
78	            if (e.shiftKey) {
79	                // If Shift+Tab pressed
80	                if (document.activeElement === firstElement[0]) {
81	                    e.preventDefault();
82	                    lastElement.focus();
83	                }
84	            } else {
85	                // If Tab pressed
86	                if (document.activeElement === lastElement[0]) {
87	                    e.preventDefault();
88	                    firstElement.focus();
89	                }
90	            }
91	        }
92	    };
93
94	    navigation.on('keydown', focusLoopHandler);
95	}
96
97	function closeMenu() {
98	    menuTrigger.attr({
99	    'aria-expanded': false,
100	    'aria-label': 'Open menu',
101	    }); // Set aria-expanded to false when closing the menu
102	    menuTrigger.find('.bar').removeClass('animate');
103	    navigation.removeClass('open').attr('aria-hidden', true); // Set aria-hidden to true when closing the menu
104	    menuTrigger.removeClass('triggered');
105	    $('body').removeClass('menu-open');
106
107	    // Remove the focus loop handler
108	    navigation.off('keydown', focusLoopHandler);
109
110	    // Find the next focusable element outside the menu
111	    const nextFocusableElement = findNextFocusableElement(menuTrigger);
112
113	    // Set focus to the next focusable element outside the menu
114	    if (nextFocusableElement.length > 0) {
115	        nextFocusableElement.focus();
116	    }
117	}
118
119	function findNextFocusableElement(element) {
120	    const allFocusableElements = $('body').find(focusableMenuElements).not(navigation.find(focusableMenuElements));
121	    const currentIndex = allFocusableElements.index(element);
122	    return allFocusableElements.eq(currentIndex + 1);
123	}
124
125	// Ensure focus leaves the navigation menu when the menu trigger button is clicked
126	menuTrigger.on('keydown', function(e) {
127	    if (e.key === 'Tab' && !e.shiftKey && !navigation.hasClass('open')) {
128	        const nextFocusableElement = findNextFocusableElement(menuTrigger);
129	        if (nextFocusableElement.length > 0) {
130	            e.preventDefault();
131	            nextFocusableElement.focus();
132	        }
133	    }
134	});
135
136
137
138	hrefElement.on('click', function (e) {
139		// closeMenu();
140	    var windowHeight = jQuery(window).height();
141	    var target = this.hash;
142	    console.log(target);
143	    $target = jQuery(target);
144	    if ($target.length) {
145
146	        e.preventDefault();
147	        // e.stopImmediatePropagation();
148
149	        closeMenu();
150
151	        
152
153	        jQuery('nav li').removeClass('active');
154	        jQuery(this).parents('li').addClass('active');
155
156	 
157	        offset = $target.offset().top - ($('.site-header').height()*1.5);
158
159	        jQuery('html, body').stop().animate({
160	            'scrollTop': offset
161	        }, 500, 'swing', function () {
162	          // console.log($($target).find('a.target-anchor'));
163	          // $($target).find('a.target-anchor').focus();
164	            // window.location.hash = target;
165	            // jQuery(document).on("scroll", onScroll);
166	        });
167	    } else {
168	        window.location.hash = '';
169	    }
170	});
171
172
173	if (window.location.hash) {
174
175	    console.log(window.location.hash);
176
177	    jQuery('html, body').stop().animate({
178	        'scrollTop': $(window.location.hash).offset().top - ($('.site-header').height()*1.5)
179	    }, 500, 'swing', function () {});
180
181	}
182
183
184    $('.products-ticker').each(function(index) {
185    	const $this = $(this);
186        const $slider =  $this.find('.products-ticker-slick'); // Cache the current instance of the slider
187
188        // Initialize the slider
189        $slider.slick({
190            slidesToShow: 5,
191            arrows: false,
192            slidesToScroll: 1,
193            centerMode: true, // Center the active slide
194            centerPadding: '8rem', // Adjust padding as needed
195            infinite: true,
196            focusOnSelect: true,
197            rtl: isRTL, // Enable RTL mode
198	        responsive: [
199	            {
200	                breakpoint: 769, // Screen width <= 1200px
201	                settings: {
202	                	dots: true,
203	                    // slidesToShow: 3,
204	                    centerPadding: '0', // Adjust padding for medium screens
205	                }
206	            },	            
207	            {
208	                breakpoint: 481, // Screen width <= 1200px
209	                settings: {
210	                	dots: true,
211	                	infinite: true,
212	                    slidesToShow: 3,
213	                }
214	            },
215	        ]
216
217        });
218
219
220
221	function updateProductText($slider) {
222	    // Get the current active slide
223	    const $currentSlide = $slider.find('.slick-current');
224	    const currentItemText = $currentSlide.find('.product-text-wrap').clone();
225	    const $currentRow = $slider.parents('section');
226
227	     $currentRow.find('.product-text').html(currentItemText);
228	}
229
230
231   // Event: Update text on slide change
232    $slider.on('afterChange', function () {
233        updateProductText($slider);
234    });
235
236    // Event: Update text on initialization
237    $slider.on('init', function () {
238        updateProductText($slider);
239    });
240
241    // Manually call updateProductText for initial load
242    updateProductText($slider); 
243
244
245        $slider.on('click', '.item', function(event) {
246            event.preventDefault(); // Prevent default link behavior
247            $slider.slick('slickGoTo', itemIndex, true); // The 'true' parameter animates the slide change
248
249            // Update product text when a slide is clicked
250            updateProductText($slider);
251        });
252
253    });
254
255
256    $('.mosaic').each(function(index) {
257    	const $this = $(this);
258        const $slider =  $this.find('.mosaic-gallery');
259        const $bullets = $this.find('.gallery-bullets');
260
261	    $slider.slick({
262	    	slidesToShow: 1,
263	    	rtl: isRTL,
264	        dots: true,
265	        arrows: false,
266	        fade: true, // Enables fade effect
267	        speed: 500, // Transition speed
268	        cssEase: 'linear', // Use linear transition
269	        appendDots: $bullets, // Append bullets to the custom container
270	        customPaging: function(slider, i) {
271	            return '<button class="slick-bullet"></button>'; // Custom bullet
272	        },
273	        autoplay: true,
274	        autoplaySpeed: 3000,
275	        pauseOnHover: true,	    
276	        adaptiveHeight: false,    
277	    }); 
278
279	    setGalleryWrapperDimensions($slider);       
280	    // Use the afterChange event to set dimensions after any slide change
281	    $slider.on('afterChange', function(event, slick, currentSlide) {
282	       // setGalleryWrapperDimensions($slider); // Update dimensions after slide change
283	    });
284
285	    // Add window resize listener
286	    $(window).on('resize', function() {
287	    	console.log('sfsfsf');
288	        setGalleryWrapperDimensions($slider);
289	    });
290
291    });
292
293
294
295    // Reusable function to set the dimensions of the gallery wrapper based on the first image
296// Reusable function to set the dimensions of the gallery wrapper based on the first image
297function setGalleryWrapperDimensions($slider) {
298    const firstImage = $slider.find('.gallery-item img').first(); // Get the first image wrapped in gallery-item
299
300    // Debug: log the first image element
301    // console.log('First Image Element:', firstImage); 
302
303    if (firstImage.length) { // Check if the first image exists
304        // Wait for the first image to load
305        firstImage.on('load', function() {
306            const imgWidthPx = $(this).width();
307            const imgHeightPx = $(this).height();
308            
309            const rootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize); // In pixels
310            const imgWidthRem = imgWidthPx / rootFontSize;
311            const imgHeightRem = imgHeightPx / rootFontSize;
312            
313            // Set the wrapper dimensions in rem
314            $slider.css({
315                height: `${imgHeightRem}rem`, // Set height in rem
316                width: `${imgWidthRem}rem` // Set width in rem
317            });
318
319            // Set the width of the bullets container in rem
320            $slider.next('.gallery-bullets').css({
321                width: `${imgWidthRem}rem` // Match the width of the image
322            });
323
324            // Force Slick to recalculate dimensions
325            $slider.slick('setPosition');
326        });
327
328        // In case the image is cached and load event doesn't fire
329        if (firstImage[0].complete) {
330            firstImage.trigger('load'); // Manually trigger load event
331        }
332    } else {
333        console.warn('No image found in the gallery item.'); // Warning if no image is found
334    }
335}
336
337
338
339
340	// const quickViewModal = $('#quick-view-modal');
341    // const quickViewContent = quickViewModal.find('.quick-view-content');
342
343    // // Use event delegation to handle clicks on dynamically cloned buttons
344    // $(document).on('click', '.quick-view-button', function () {
345    //     const productId = $(this).data('product_id'); // Get the product ID from the button
346    //     console.log('Clicked product ID:', productId); // Log the clicked product ID
347    //     fetchProduct(productId);
348    // });
349
350    // $('#close-quick-view').on('click', function () {
351    //     quickViewModal.hide(); // Hide the modal when closed
352    // });
353
354	// function fetchProduct(productId) {
355	//     $.ajax({
356	//         url: customAjax.ajax_url,
357	//         method: 'POST',
358	//         data: {
359	//             action: 'fetch_product',
360	//             product_id: productId
361	//         },
362	//         success: function (response) {
363	//             if (response.success) {
364	//             	console.log(response.data);
365	//                 displayQuickView(response.data);
366	//             } else {
367	//                 console.error('Error fetching product:', response.data);
368	//             }
369	//         },
370	//         error: function (error) {
371	//             console.error('Error fetching product:', error);
372	//         }
373	//     });
374	// }
375
376	// function displayQuickView(product) {
377	//     $('#quick-view-modal .product-name').text(product.name);
378	//     $('#quick-view-modal .product-image').attr('src', product.image).attr('alt', product.name);
379	//     $('#quick-view-modal .product-description').html(product.description);
380	//     $('#quick-view-modal .product-price').html(product.price_html);
381
382	//     // Clear existing repeater content
383	//     const repeaterContainer = $('#quick-view-modal .acf-repeater');
384	//     repeaterContainer.empty();
385
386	//     // Loop through list_items array and append each item
387	//     product.list_items.forEach(item => {
388	//         const repeaterItem = `
389	//             <div class="repeater-item">
390	//                 <p>${item.sub_field_1}</p>
391	//                 <p>${item.sub_field_2}</p>
392	//                 <!-- Add other subfields as needed -->
393	//             </div>
394	//         `;
395	//         repeaterContainer.append(repeaterItem);
396	//     });
397
398    // 	// Render the Add to Cart form including quantity input and any custom HTML
399    // 	$('#quick-view-modal .add-to-cart-form').html(product.add_to_cart_form);
400
401	//     quickViewModal.show();
402	// }
403
404
405
406    // $('#virtual-product-form').validate({
407    //     rules: {
408    //         vaucher_recipient: {
409    //             required: true
410    //         },
411    //         vaucher_blessing: {
412    //             maxlength: 100
413    //         }
414    //     },
415    //     messages: {
416    //         vaucher_recipient: {
417    //             required: 'יש להזין שם מלא של מקבל השובר'
418    //         },
419    //         vaucher_blessing: {
420    //             maxlength: 'ברכה לא יכולה להכיל יותר מ-100 תווים'
421    //         }
422    //     }
423    // });
424
425
426    $(document).on('click', '.add_to_cart_button:not(.product_type_composite)', function(e) {
427    	e.preventDefault();
428        var $button = $(this);
429        var $product = $button.closest('.product'); // Adjust selector for your product container
430
431        // Add the loader to the product container
432        $product.block({
433            message: null,
434        });
435    });
436
437    function toggleMinicart() {
438    	if($('body').hasClass('minicart-open')) {
439    		$('body').removeClass('minicart-open');
440    	}else {
441    		$('body').addClass('minicart-open');
442    	}
443    }
444
445    $(document).on('click' , '.toggle-minicart' , function(e){
446    	e.preventDefault();
447    	toggleMinicart();
448    });
449
450
451    jQuery('body').on('added_to_cart', () => {
452        console.log('product added to cart');
453        $('.product').unblock();
454        toggleMinicart(); // 'this' refers to the Vue instance
455    });
456
457    jQuery('body').on('removed_from_cart', () => {
458        console.log('product removed_from_cart from cart');
459        $( document.body ).trigger( 'update_checkout' );
460    });
461
462
463    function validateRequiredRows() {
464        const totalRows = $('.composite-row').length;
465        const selectedProducts = $('#selected-composite-products').val().split(',');
466        const validSelections = selectedProducts.filter(item => item !== "" && item !== null && item !== undefined);
467        console.log('validSelections' , validSelections);
468        if (validSelections.length < totalRows) {
469            alert('יש לבחור '+totalRows+' פריטים לתוך המארז');
470            return false;
471        }
472
473        return true;
474    }
475
476
477
478    $(document).on('click' , '.single_add_to_cart_button' , function(e) {
479        e.preventDefault();
480        var $button = $(this);
481        var $product = $button.closest('.product'); 
482        const isCompositeProduct = $('#composite-total-price').length > 0;
483
484        $product.block({
485            message: null,
486        });
487
488        if (isCompositeProduct) {
489            // Handle composite product validation
490            if (!validateRequiredRows()) {
491                $product.unblock(); // Unblock UI if validation fails
492                return false;
493            }
494        }
495
496        // Check if the custom virtual product form is present and validate it
497        if ($('#virtual-product-form').length) {
498            console.log('Validating form...');
499            if (!$('#virtual-product-form').valid()) {
500                console.log('Form validation failed');
501                alert('יש להזין את שם מקבל השובר');
502                $('.product').unblock();
503                return false; // Stop if validation fails
504            } else {
505
506            	$('.cart').find('.dynamic-hidden-field').remove();
507
508		        $('#virtual-product-form').find('input, textarea, select').each(function() {
509		            let fieldName = $(this).attr('name');
510		            let fieldValue = $(this).val();
511
512		            // Perform validation if needed (e.g., check if required field is filled)
513		            if ($(this).prop('required') && !fieldValue) {
514		                alert(`Please fill in the required field: ${fieldName}`);
515		                return false; // Stop if validation fails
516		            }
517
518		            // Create a hidden input in the WooCommerce form
519		            $('<input>')
520		                .attr('type', 'hidden')
521		                .attr('name', fieldName)
522		                .attr('class', 'dynamic-hidden-field') // Add a class for easy removal
523		                .val(fieldValue)
524		                .appendTo('.cart'); // Append hidden field to WooCommerce form
525		        });
526        
527                console.log('Form validation passed');
528            }
529        }
530
531        let productID = $(this).val();
532        let quantity = $(this).closest('form').find('input[name="quantity"]').val() || 1;
533
534        rudrAddToCart(productID, quantity);
535    });
536
537	function rudrAddToCart(product_id, quantity = 1) {
538	    // Check if WooCommerce AJAX parameters are available
539	    if (typeof wc_add_to_cart_params === 'undefined') {
540	        return false;
541	    }
542
543	    // Serialize the form data to capture all fields
544	    let formData = $('.cart').serialize();
545
546	    // Add product ID and quantity to form data
547	    formData += `&product_id=${product_id}&quantity=${quantity}`;
548
549	    // Post request to WooCommerce's add-to-cart endpoint
550	    $.post(
551	        wc_add_to_cart_params.wc_ajax_url.toString().replace('%%endpoint%%', 'add_to_cart'),
552	        formData, // Send all form data
553	        function(response) {
554	            if (!response) return;
555
556	            // Handle redirect if set in WooCommerce settings
557	            if (response.error && response.product_url) {
558	                window.location = response.product_url;
559	                return;
560	            }
561	            if (wc_add_to_cart_params.cart_redirect_after_add === 'yes') {
562	                window.location = wc_add_to_cart_params.cart_url;
563	                return;
564	            }
565	            console.log('Cart updated. Refreshing fragments...');
566	            // Refresh cart fragments
567	            $(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash]);
568	            //$( document.body ).trigger( 'wc_fragment_refresh' );
569	        }
570	    );
571	}
572	
573    // $('.products-ticker-slick').slick({
574    //     slidesToShow: 5,
575    //     slidesToScroll: 1,
576    //     centerMode: true, // Center the active slide
577    //     centerPadding: '8rem', // Adjust padding as needed
578    //     infinite: true,
579    //     focusOnSelect: true,
580    //     rtl: true, // Enable RTL mode
581    // });
582
583    // // Function to update product text display
584    // function updateProductText(index) {
585    //     const currentSlide = $('.products-ticker-slick .item').eq(index);
586    //     const title = currentSlide.data('title');
587    //     const price = currentSlide.data('price');
588        
589    //     // Update the product text display
590    //     $('#product-title').text(title);
591    //     $('#product-price').text(price);
592    // }
593
594    // // Set initial content from the first slide
595    // updateProductText(1); // Set initial text for the first slide
596
597    // // Handle slide click event
598    // $('.products-ticker-slick').on('click', '.item', function(event) {
599    //     event.preventDefault(); // Prevent default link behavior
600
601    //     // Get the index of the clicked item and move it to the center
602    //     const index = $(this).index();
603    //     $('.products-ticker-slick').slick('slickGoTo', index, true); // The 'true' parameter animates the slide change
604
605    //     // Update product text when a slide is clicked
606    //     updateProductText(index);
607    // });
608    // // Update product text when the slide changes (afterChange event)
609    // $('.products-ticker-slick').on('afterChange', function(event, slick, currentSlide) {
610    //     updateProductText(currentSlide+1);
611    // });
612
613
614    // Trigger checkout update when the mini-cart updates
615    $(document.body).on('wc_fragments_refreshed', function () {
616        // Check if we are on the checkout page
617        if ($('.woocommerce-checkout').length) {
618            $.ajax({
619                url: customAjax.ajax_url,
620                type: 'POST',
621                data: {
622                    action: 'woocommerce_update_order_review',
623                    security: customAjax.update_order_review_nonce
624                },
625                success: function (response) {
626                    if (response) {
627                        // Replace the checkout review sections with the updated ones
628                        $('.woocommerce-checkout-review-order-table').replaceWith(
629                            $(response).find('.woocommerce-checkout-review-order-table')
630                        );
631                        $('.woocommerce-checkout-payment').replaceWith(
632                            $(response).find('.woocommerce-checkout-payment')
633                        );
634                    }
635                },
636                error: function (xhr, status, error) {
637                    console.error('Checkout update failed:', error);
638                }
639            });
640        }
641    });   
642
643
644        // Show popup with WooCommerce notices or custom messages
645    function showUnifiedPopup(contentSelector) {
646        const $popup = $('#unified-popup');
647        const $content = $popup.find(contentSelector);
648
649        if ($content.children().length > 0) {
650            $popup.addClass('active');
651        }
652    }
653
654    // Close the popup
655    $(document).on('click', '.close-btn', function () {
656        $('#unified-popup').removeClass('active');
657    });
658
659    // Automatically show WooCommerce notices in the popup
660    $(document.body).on('added_to_cart removed_from_cart updated_cart_totals checkout_error', function () {
661        showUnifiedPopup('#woocommerce-notices');
662    });
663
664    // Replace native JavaScript alert with popup
665    window.alert = function (message) {
666        const $jsAlerts = $('#js-alerts');
667        if (!$jsAlerts.length) {
668            console.error('JS Alerts container not found.');
669            return;
670        }
671
672        const customAlert = `<div class="js-message">${message}</div>`;
673        $jsAlerts.html(customAlert);
674        showUnifiedPopup('#js-alerts');
675    };
676
677    // Example usage for other JavaScript messages
678    $(document).on('custom_event', function (event, message) {
679        const $jsAlerts = $('#js-alerts');
680        const customMessage = `<div class="js-message">${message}</div>`;
681        $jsAlerts.html(customMessage);
682        showUnifiedPopup('#js-alerts');
683    });
684
685    // Close popup when clicking outside of it
686    $(document).on('click', function (e) {
687        if (!$(e.target).closest('#unified-popup .popup-content').length) {
688            $('#unified-popup').removeClass('active');
689        }
690    });
691
692    function showWooCommerceNotices() {
693        // Get all WooCommerce notices
694        let notices = $('.woocommerce-error, .woocommerce-info, .woocommerce-message');
695
696        console.log(notices);
697
698
699        if (notices.length > 0) {
700            // Clear previous notices in the popup
701            $('#woocommerce-notices').html('');
702
703            // Append notices to the popup content
704            notices.each(function () {
705                $('#woocommerce-notices').append($(this).clone());
706            });
707
708            // notices.hide();
709
710            // Show the popup
711            $('#unified-popup').addClass('active');
712        }
713    }
714
715    showWooCommerceNotices();
716
717
718    // Listen for WooCommerce events that might add notices
719    $(document.body).on('updated_wc_div added_to_cart checkout_error', function () {
720        showWooCommerceNotices();
721    });
722
723
724
725jQuery("#submit-custom-coupon").on("click", function (e) {
726    e.preventDefault();
727    var custom_coupon = $(this).prev('input[name="custom_coupon"]').val();
728
729    jQuery.ajax({
730        type: "POST",
731        url: customAjax.ajax_url,
732        data: { action: "apply_custom_coupon", coupon: custom_coupon },
733        success: function (response) {
734            if (response.success) {
735            	alert(response.data.message);
736                jQuery(document.body).trigger("update_checkout");
737            } else {
738            	alert(response.data.message);
739            }
740        },
741        error: function () {
742        	alert('קרתה תקלה, אנה נסו מאוחר יותר');
743        },
744    });
745});
746
747
748$('#submit-vitcoins_redeem').on('click', function(e) {
749    e.preventDefault();
750
751    var vitcoins = $('#vitcoins-redeem-input').val();
752    var user_total_vitcoins = $('#vitcoins-redeem-input').data('vitcoins');
753
754    if (vitcoins) {
755        // Send AJAX request to redeem Vitcoins
756        $.ajax({
757            url: wc_checkout_params.ajax_url,
758            type: 'POST',
759            data: {
760                action: 'apply_vitcoins_redeem',
761                vitcoins: vitcoins,
762                user_total_vitcoins: user_total_vitcoins,
763            },
764            success: function(response) {
765                if (response.success) {
766                    // Update cart totals
767                    $('body').trigger('update_checkout');
768
769                    // Update the Vitcoins notice dynamically
770                    $('#vitcoins-balance').text('יש לך ' + response.data.remaining_vitcoins + ' ויתקונים זמינים.');
771                } else {
772                    alert(response.data.message || 'Error applying Vitcoins.');
773                }
774            }
775        });
776    }
777});
778
779$(document).on('click', '.remove-vitcoins', function(e) {
780    e.preventDefault();
781
782    // Send AJAX request to remove Vitcoins
783    $.ajax({
784        url: wc_checkout_params.ajax_url,
785        type: 'POST',
786        data: {
787            action: 'remove_vitcoins'
788        },
789        success: function(response) {
790            if (response.success) {
791                // Update cart totals
792                $('body').trigger('update_checkout');
793
794                // Update the Vitcoins notice dynamically
795                $('#vitcoins-balance').text('יש לך ' + response.data.remaining_vitcoins + ' ויתקונים זמינים.');
796            } else {
797                alert(response.data.message || 'Error removing Vitcoins.');
798            }
799        }
800    });
801});
802
803
804$('.woocommerce-product-gallery__wrapper.has-gallery').slick({
805  dots: true,
806  infinite: true,
807  speed: 300,
808  slidesToShow: 1,
809  slidesToScroll: 1,
810  adaptiveHeight: false,
811  rtl: isRTL,
812  autoplay: true,
813  autoplaySpeed: 4000,
814  speed: 1000,
815  fade: true,
816  cssEase: 'linear',
817  responsive: [
818    {
819      breakpoint: 768,
820      settings: {
821        adaptiveHeight: true,
822      }
823    },
824  ]
825});
826
827// Product Image Zoom on Hover
828$('.woocommerce-product-gallery').on('mousemove', function(e) {
829    var $img = $(this).find('img');
830    var offset = $(this).offset();
831    var width = $(this).width();
832    var height = $(this).height();
833    
834    // Calculate mouse position relative to the container
835    var mouseX = e.pageX - offset.left;
836    var mouseY = e.pageY - offset.top;
837    
838    // Calculate percentage position
839    var xPercent = (mouseX / width) * 100;
840    var yPercent = (mouseY / height) * 100;
841    
842    // Apply zoom and transform origin based on mouse position
843    $img.css({
844        'transform': 'scale(2)',
845        'transform-origin': xPercent + '% ' + yPercent + '%'
846    });
847});
848
849$('.woocommerce-product-gallery').on('mouseleave', function() {
850    var $img = $(this).find('img');
851    $img.css({
852        'transform': 'scale(1)',
853        'transform-origin': 'center center'
854    });
855});
856
857
858$('.widget-title').on('click' , function(){
859	$(this).next('div').slideToggle(500);
860});
861
862
863
864        $('.related ul').slick({
865            slidesToShow: 4,
866            arrows: false,
867            slidesToScroll: 1,
868            // centerMode: true, // Center the active slide
869            // centerPadding: '8rem', // Adjust padding as needed
870            // infinite: true,
871            // focusOnSelect: true,
872            rtl: isRTL, // Enable RTL mode
873	        responsive: [
874	            {
875	                breakpoint: 1025, // Screen width <= 1200px
876	                settings: {
877	                	// dots: true,
878	                    slidesToShow: 3,
879	                    centerMode: true,
880	                    infinite: true,
881	                    // centerPadding: '0', // Adjust padding for medium screens
882	                }
883	            },	            
884	            // {
885	            //     breakpoint: 481, // Screen width <= 1200px
886	            //     settings: {
887	            //     	dots: true,
888	            //     	infinite: true,
889	            //         slidesToShow: 3,
890	            //     }
891	            // },
892	        ]
893
894        });
895
896// function refreshMiniCart() {
897//     $.ajax({
898//         url: wc_add_to_cart_params.ajax_url,
899//         type: 'POST',
900//         data: { action: 'refresh_mini_cart' },
901//         success: function(response) {
902//             if (response.success && response.data) {
903//                 $('.widget_shopping_cart_content').html(response.data); // Replace mini cart content
904//             }
905//         },
906//     });
907// }
908
909
910    // $(document.body).on('wc_fragments_refreshed', function() {
911    //     // If on the checkout page, trigger the checkout update
912    //     if ($('form.checkout').length) {
913    //         $('form.checkout').trigger('update_checkout');
914    //     }
915    // });
916
917
918
919function updateShippingOptions() {
920    const $shippingContainer = $('.woocommerce-shipping-methods');
921
922    // Prevent reprocessing
923    if ($shippingContainer.data('free-shipping-processed')) {
924        return;
925    }
926
927    const $freeOption = $('input.shipping_method[value*="free_shipping"]');
928
929    if ($freeOption.length) {
930        // Select the free shipping method
931        $freeOption.prop('checked', true);
932
933        // Show only free shipping and local pickup, hide others
934        $('input.shipping_method').each(function() {
935            const $this = $(this);
936            const value = $this.val();
937
938            if (value.includes('free_shipping') || value.includes('local_pickup')) {
939                $this.closest('li').show();
940            } else {
941                $this.closest('li').hide();
942            }
943        });
944
945        // Mark as processed
946        $shippingContainer.data('free-shipping-processed', true);
947    }
948}
949
950// Initial run
951updateShippingOptions();
952
953// On WooCommerce dynamic update
954$('body').on('updated_checkout', function() {
955    updateShippingOptions();
956});
957
958
959
960// Initialize the slider
961$('.footer-logos').slick({
962    slidesToShow: 6,
963    arrows: false,
964    slidesToScroll: 1,
965    centerMode: true, // Center the active slide
966    infinite: true,
967    focusOnSelect: true,
968    rtl: isRTL, // Enable RTL mode
969    responsive: [
970        {
971            breakpoint: 769, // Screen width <= 1200px
972            settings: {
973            	dots: false,
974                slidesToShow: 4,
975                centerPadding: '0', // Adjust padding for medium screens
976            	centerMode:false,
977            	autoplay: true,
978            	autoplaySpeed: 3000,
979            }
980        },	            
981        {
982            breakpoint: 481, // Screen width <= 1200px
983            settings: {
984            	dots: false,
985            	infinite: true,
986                slidesToShow: 2,
987                centerMode: false,
988            	autoplay: true,
989            	autoplaySpeed: 3000,                
990            }
991        },
992    ]
993
994});
995
996
997    
998});
999})(jQuery);	
1000
1001
1002  document.addEventListener("DOMContentLoaded", function () {
1003    const videos = document.querySelectorAll(".lazy");
1004    videos.forEach(video => {
1005      video.src = video.getAttribute("data-src");
1006    });
1007  });

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.