PageSourceSearch

https://eaccess-edu.eu/wp-content/themes/agrosector/woocommerce/js/theme-woo.js?ver=6.0.17

js eaccess-edu.eu collected 2026-10-08 09:11:12 UTC 22,257 bytes, 584 lines download raw bytes

1jQuery(document).ready(function ($) {
2    gt3_animate_cart();
3    gt3_spinner_up_down();
4    gt3_size_guide();
5    gt3_comment_label();
6    gt3_category_accordion();
7    woocommerce_triger_lightbox();
8    gt3_replace_product_gallery_trigger();
9    gt3_sticky_thumb();
10    gt3_infinite_scroll();
11});
12
13jQuery(window).load(function ($) {
14    if (jQuery(".gt3-animation-wrapper.gt3-anim-product").length) {
15        gt3_scroll_animation(jQuery('.gt3-animation-wrapper.gt3-anim-product'), false);
16    }
17    gt3_product_single_carousel();
18});
19
20jQuery(window).resize(function ($) {
21
22});
23
24function viewport() {
25    /* http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/ */
26    var e = window, a = 'inner';
27    if (!('innerWidth' in window)) {
28        a = 'client';
29        e = document.documentElement || document.body;
30    }
31    return {width: e[a + 'Width'], height: e[a + 'Height']};
32}
33
34jQuery(document).ajaxComplete(function () {
35    var select = jQuery('#yith-quick-view-modal .variations select');
36    if (select.length) {
37        select.on('change', function () {
38            var thumbnails = jQuery('#yith-quick-view-modal .gt3-thumbnails-control');
39            var selectEmpty = true;
40
41            select.each(function () {
42                var easyzoom = jQuery("#yith-quick-view-content .woocommerce-product-gallery__image").easyZoom();
43                var api = easyzoom.data('easyZoom');
44                api.teardown();
45                api._init();
46
47                if (this.value !== '') {
48                    selectEmpty = false;
49                }
50            });
51
52            if (selectEmpty) {
53                thumbnails.css({'height': 'auto'});
54            } else {
55                thumbnails.find('.gt3-thumb-control-item:first').trigger("click");
56                thumbnails.css({'height': '0'});
57            }
58        })
59    }
60});
61
62function gt3_sticky_thumb() {
63    var window_width = viewport().width,
64        gt3_sticky_thumb = jQuery('.gt3_sticky_thumb'),
65        gt3_thumb_sticky_thumb_vertical = jQuery('.gt3_thumb_sticky_thumb_vertical');
66
67    if (gt3_sticky_thumb.length) {
68        if (window_width < 768) {
69            gt3_sticky_thumb.trigger("sticky_kit:detach");
70        } else {
71            gt3_sticky_thumb.stick_in_parent();
72        }
73    }
74
75    if (gt3_thumb_sticky_thumb_vertical.length) {
76        if (window_width < 768) {
77            gt3_thumb_sticky_thumb_vertical.find('.gt3-single-content-wrapper').trigger("sticky_kit:detach");
78        } else {
79            gt3_thumb_sticky_thumb_vertical.find('.gt3-single-content-wrapper').stick_in_parent();
80        }
81    }
82}
83
84function gt3_product_single_carousel() {
85    var $wrap_vert_thumb = jQuery('.gt3_thumb_vertical'),
86        $wrap_vert_thumb_flex = jQuery('.gt3_thumb_vertical.gt3_carousel_thumb');
87    if ($wrap_vert_thumb_flex.length) {
88        var $gallery_height = $wrap_vert_thumb_flex.find('.woocommerce-product-gallery__wrapper').height();
89        var $control_wrap = $wrap_vert_thumb_flex.find('.flex-control-nav.flex-control-thumbs');
90        var $control_thumb = $wrap_vert_thumb_flex.find('.flex-control-nav.flex-control-thumbs > li');
91        var $max_thumb = Math.round($gallery_height / $control_thumb.outerHeight());
92        var $control_height = $control_thumb.height() + $control_thumb.outerHeight() * ($max_thumb - 1);
93
94        var window_width = viewport().width;
95        if (window_width < 768) {
96            $wrap_vert_thumb_flex.find('.flex-control-nav.flex-control-thumbs > li').removeClass('point');
97            return;
98        }
99        $control_wrap.css({'height': $control_height});
100
101        if ($control_thumb.length > $max_thumb) {
102            if (!$wrap_vert_thumb_flex.find('.gt3_control_wrapper').length) {
103                $control_wrap.wrap('<div class="gt3_control_wrapper"></div>').before('<span class="gt3_control_prev"></span>').after('<span class="gt3_control_next"></span>');
104            }
105            $control_wrap = $wrap_vert_thumb_flex.find('.flex-control-nav.flex-control-thumbs');
106            $wrap_vert_thumb_flex.find('.flex-control-nav.flex-control-thumbs > li:nth-child(' + $max_thumb + 'n + 1)').addClass('point');
107
108            var $position;
109            var $currentElement = $control_thumb.first();
110            var $thumb_next = $wrap_vert_thumb_flex.find('.gt3_control_next');
111            var $thumb_prev = $wrap_vert_thumb_flex.find('.gt3_control_prev');
112            $thumb_prev.addClass('hidden');
113
114            $thumb_next.on('click', function () {
115                var $nextElement = $currentElement.nextAll('li.point');
116                if ($nextElement.length) {
117                    $currentElement = $nextElement.slice(0, 1);
118                    $position = $control_wrap.scrollTop() + $currentElement.position().top;
119                    $control_wrap.stop(true).animate({
120                        scrollTop: $position
121                    }, 600);
122                }
123
124                $thumb_prev.removeClass('hidden');
125                if ($nextElement.length === 1) $thumb_next.addClass('hidden');
126
127                return false;
128            });
129
130            $thumb_prev.on('click', function () {
131                var $prevElement = $currentElement.prevAll('li.point');
132                if ($prevElement.length) {
133                    $currentElement = $prevElement.slice(0, 1);
134                    $position = $control_wrap.scrollTop() + $currentElement.position().top;
135                    $control_wrap.stop(true).animate({
136                        scrollTop: $position
137                    }, 600);
138                }
139
140                $thumb_next.removeClass('hidden');
141                if ($prevElement.length === 1) $thumb_prev.addClass('hidden');
142
143                return false;
144            });
145        }
146    }
147}
148
149jQuery(document).ajaxComplete(function () {
150    if (!jQuery('.gt3-thumbnails-control.slick-slider').length) {
151        gt3_thumbnails_slider();
152    }
153    var modal = jQuery('#yith-quick-view-modal'), easyzoom, api,
154        select = modal.find('.variations select');
155    if (select.length) {
156        select.on('change', function () {
157            var thumbnails = modal.find('.gt3-thumbnails-control');
158            var selectEmpty = true;
159
160            select.each(function () {
161                easyzoom = modal.find('.woocommerce-product-gallery__image').easyZoom();
162                api = easyzoom.data('easyZoom');
163                api.teardown();
164                api._init();
165
166                if (this.value !== '') {
167                    selectEmpty = false;
168                }
169            });
170
171            if (selectEmpty) {
172                thumbnails.css({'height': 'auto'});
173            } else {
174                thumbnails.find('.gt3-thumb-control-item:first').trigger("click");
175                thumbnails.css({'height': '0'});
176            }
177        })
178    }
179});
180
181function gt3_thumbnails_slider() {
182    var controls_wrapper, slides, slide, item;
183    var slider_wrap = jQuery('#yith-quick-view-content'),
184        slider = slider_wrap.find('.woocommerce-product-gallery__wrapper');
185    if (slider.length) {
186        slides = slider.find('.woocommerce-product-gallery__image');
187        controls_wrapper = jQuery('<div class="gt3-thumbnails-control"></div>');
188
189        for (var i = 0; i < slides.length; i++) {
190            slide = slides[i];
191            item = '<div class="gt3-thumb-control-item"><img src="' + jQuery(slide).attr('data-thumb') + '"></div>';
192            controls_wrapper.append(item);
193        }
194
195        slider.parent().append(controls_wrapper);
196
197        imagesLoaded(slider.parent(), gt3_vertical_thumb);
198        slider_wrap.find('.woocommerce-product-gallery__image').easyZoom();
199    }
200}
201
202function gt3_vertical_thumb() {
203    var quick_view_content = jQuery('#yith-quick-view-content');
204    if (quick_view_content.length) {
205        quick_view_content.each(function () {
206            var cur_slidesToShow = 1;
207            var cur_sliderAutoplay = 4000;
208            var cur_fade = true;
209
210            jQuery(this).find('.woocommerce-product-gallery__wrapper').slick({
211                slidesToShow: cur_slidesToShow,
212                slidesToScroll: cur_slidesToShow,
213                autoplay: false,
214                autoplaySpeed: cur_sliderAutoplay,
215                speed: 500,
216                dots: false,
217                fade: cur_fade,
218                focusOnSelect: true,
219                arrows: false,
220                infinite: false,
221                asNavFor: jQuery(this).find('.gt3-thumbnails-control')
222            });
223            jQuery(this).find('.gt3-thumbnails-control').slick({
224                slidesToShow: 4,
225                slidesToScroll: 1,
226                nextArrow: '<i class="slick-next fa fa-angle-right"></i>',
227                prevArrow: '<i class=" slick-prev fa fa-angle-left"></i>',
228                asNavFor: jQuery(this).find('.woocommerce-product-gallery__wrapper'),
229                dots: false,
230                focusOnSelect: true,
231                infinite: false
232            });
233            var x = jQuery(this).find('.woocommerce-product-gallery')[0];
234            jQuery(x).addClass('ready');
235        });
236    }
237}
238
239function gt3_scroll_animation($wrapper, newItem) {
240    if (typeof $wrapper === 'string') {
241        $wrapper = jQuery($wrapper);
242    }
243    var order = 0,
244        lastOffsetTop = 0,
245        delay;
246    jQuery.each($wrapper, function (index, value) {
247        var wrapper = jQuery(this);
248        wrapper.imagesLoaded(function () {
249            var elOffset = wrapper.offset(),
250                windowHeight = jQuery(window).outerHeight(),
251                offset = 20;
252            if (elOffset.top > (windowHeight + offset)) {
253                if (order === 0) {
254                    lastOffsetTop = elOffset.top;
255                } else {
256                    if (lastOffsetTop !== elOffset.top) {
257                        order = 0;
258                        lastOffsetTop = elOffset.top;
259                    }
260                }
261                order++;
262                index = order;
263            }
264            delay = index * 0.20;
265            wrapper.css({
266                'transition-delay': delay + 's'
267            });
268            wrapper.attr('data-delay', delay);
269        });
270    });
271    $wrapper.appear(function () {
272        var wrapper = jQuery(this),
273            windowScrollTop = jQuery(window).scrollTop();
274        if (newItem) {
275            wrapper.addClass('loaded');
276        } else {
277            var addLoaded = setTimeout(function () {
278                wrapper.addClass('loaded');
279            }, 300);
280            if (windowScrollTop > 100) {
281                clearTimeout(addLoaded);
282                wrapper.addClass('loaded');
283            }
284        }
285        var elDur = wrapper.css('transition-duration'),
286            elDelay = wrapper.css('transition-delay'),
287            timeRemove = elDur.split('s')[0] * 1000 + elDelay.split('s')[0] * 1000 + 4000,
288            notRemove = '.will-progress';
289        wrapper.not(notRemove).delay(timeRemove).queue(function () {
290            wrapper.removeClass('loaded gt3-anim-product').dequeue();
291        });
292        wrapper.delay(timeRemove).queue(function () {
293            wrapper.css('transition-delay', '');
294        });
295    }, {
296        accX: 0,
297        accY: 30
298    });
299}
300
301// Cart Count Icon Animation
302function gt3_animate_cart() {
303    jQuery.fn.shake = function (intShakes, intDistance, intDuration) {
304        this.each(function () {
305            for (var x = 1; x <= intShakes; x++) {
306                jQuery(this).animate({left: (intDistance * -1)}, (((intDuration / intShakes) / 4)))
307                    .animate({left: intDistance}, ((intDuration / intShakes) / 2))
308                    .animate({left: 0}, (((intDuration / intShakes) / 4)));
309            }
310        });
311        return this;
312    };
313    jQuery(document.body).live('added_to_cart', function (el, data, params) {
314        setTimeout(function () {
315            jQuery(".gt3_header_builder_cart_component").addClass("show_cart");
316            jQuery(".woo_mini-count").shake(3, 1.2, 300);
317            jQuery(".gt3-loading-overlay, .gt3-loading").remove();
318        }, 300);
319        setTimeout(function () {
320            jQuery(".gt3_header_builder_cart_component").removeClass("show_cart");
321        }, 2800);
322    });
323}
324
325// Input spinner
326function gt3_spinner_up_down() {
327    var rtime;
328    var timeout = false;
329    var delta = 400;
330
331    jQuery('body').on('tap click', '.gt3_qty_spinner .quantity-up', function () {
332        var input = jQuery(this).parent().find('input[type="number"]'),
333            max = input.attr('max'),
334            oldValue = parseFloat(input.val()),
335            newVal;
336        if (oldValue >= max && '' !== max) {
337            newVal = oldValue;
338        } else {
339            newVal = oldValue + 1;
340        }
341        input.val(newVal).addClass('allotted');
342        input.trigger("change");
343
344        gt3_timeout(input);
345    });
346
347    jQuery('body').on('tap click', '.gt3_qty_spinner .quantity-down', function () {
348        var input = jQuery(this).parent().find('input[type="number"]'),
349            min = input.attr('min'),
350            oldValue = parseFloat(input.val()),
351            newVal;
352        if (oldValue <= min && '' !== min) {
353            newVal = oldValue;
354        } else {
355            newVal = oldValue - 1;
356        }
357        input.val(newVal).addClass('allotted');
358        input.trigger("change");
359
360        gt3_timeout(input);
361    });
362
363    function gt3_timeout(input) {
364        rtime = new Date();
365        if (timeout === false) {
366            timeout = true;
367            setTimeout(clickend, delta);
368        }
369
370        function clickend() {
371            if (new Date() - rtime < delta) {
372                setTimeout(clickend, delta);
373            } else {
374                timeout = false;
375                input.removeClass('allotted');
376            }
377        }
378    }
379}
380
381function gt3_size_guide() {
382    var size_popup = jQuery('.gt3_block_size_popup');
383    if (size_popup.length) {
384        size_popup.on('tap click', function () {
385            image_size_popup = jQuery('.image_size_popup');
386            image_size_popup.addClass('active');
387            if (image_size_popup.hasClass('active')) {
388                jQuery(document).keyup(function (e) {
389                    if (e.keyCode === 27) image_size_popup.removeClass('active');
390                });
391                jQuery('.image_size_popup .layer, .image_size_popup .close').on('tap click', function () {
392                    image_size_popup.removeClass('active');
393                });
394            }
395        });
396    }
397}
398
399function gt3_comment_label() {
400    if (jQuery('#respond #commentform p[class*="comment-form-"] > label').length) {
401        jQuery('#respond #commentform p[class*="comment-form-"] > label').each(function () {
402            var _this_label = jQuery(this);
403            _this_label.parent().find('input, textarea').on('focus', function () {
404                _this_label.addClass('gt3_onfocus');
405            }).on('blur', function () {
406                if (jQuery(this).val() === "") {
407                    _this_label.removeClass('gt3_onfocus');
408                } else {
409                    _this_label.addClass('gt3_onfocus');
410                }
411            });
412        })
413    }
414}
415
416function gt3_category_accordion() {
417    var widget_product_categories = jQuery('.widget_product_categories');
418    if (widget_product_categories.length) {
419        widget_product_categories.each(function () {
420            var $this = jQuery(this);
421            var elements = $this.find('.product-categories>li.cat-parent');
422
423            for (var i = 0; i < elements.length; i++) {
424                if (jQuery(elements[i]).hasClass('current-cat-parent')) {
425                    jQuery(elements[i]).addClass('open').find('.current-cat').parent().slideDown();
426                }
427                jQuery(elements[i]).append("<span class=\"gt3-button-cat-open\"></span>");
428            }
429        });
430        jQuery(".gt3-button-cat-open").on("click", function () {
431            jQuery(this).parent().toggleClass('open');
432            if (jQuery(this).parent().hasClass('open')) {
433                jQuery(this).parent().children('.children').slideDown();
434            } else {
435                jQuery(this).parent().children('.children').slideUp();
436            }
437        })
438    }
439}
440
441// func called from frontend
442function gt3_clear_recently_products(el) {
443    document.cookie = 'gt3_product_recently_viewed=;path=/';
444    jQuery(el).parent().fadeOut(400);
445}
446
447function woocommerce_triger_lightbox() {
448    jQuery('.woocommerce-product-gallery .woocommerce-product-gallery__wrapper').on('click', function () {
449        jQuery('.woocommerce-product-gallery a.woocommerce-product-gallery__trigger').trigger("click");
450    });
451}
452
453function gt3_replace_product_gallery_trigger() {
454    var $product_gallery = jQuery('.woocommerce-product-gallery');
455    if ($product_gallery.length) {
456        $product_gallery.append(jQuery('.woocommerce-product-gallery__trigger'));
457    }
458}
459
460function gt3_infinite_scroll() {
461    if (window.sessionStorage && sessionStorage.getItem('gt3-show_all') && sessionStorage.getItem('gt3-show_all') === 'true') {
462        jQuery('.infinite_scroll-view_all').removeClass('infinite_scroll-view_all').addClass('infinite_scroll-always');
463    }
464    var elem = jQuery('.infinite_scroll-always .products');
465    if (elem.length) {
466        elem.each(function () {
467            var $this = jQuery(this);
468            $this.infiniteScroll({
469                path: ".next.page-numbers",
470                append: ".products > .product",
471                prefill: true,
472                scrollThreshold: viewport().height * 1.2,
473                history: false,
474                hideNav: '.woocommerce-pagination',
475                status: '.spinner.infinite-scroll'
476            });
477            $this.on('append.infiniteScroll', function () {
478                if (jQuery(".gt3-animation-wrapper.gt3-anim-product").length) {
479                    gt3_scroll_animation('.gt3-animation-wrapper.gt3-anim-product:not(.loaded)', true);
480                }
481            });
482
483            if (window.sessionStorage && sessionStorage.getItem('gt3-show_all') && sessionStorage.getItem('gt3-show_all') === 'true') {
484                sessionStorage.setItem('gt3-show_all', 'false');
485                setCookie('gt3-show_all', 'false');
486
487                $this.imagesLoaded(function () {
488                    setTimeout(function () {
489                        gt3_scrollTo($this.find('.product:first-of-type'), 2500);
490                    }, 500);
491                });
492
493            }
494        });
495    }
496
497    var elem2 = jQuery('.infinite_scroll-view_all .products');
498    if (elem2.length) {
499        elem2.each(function () {
500            var $this = jQuery(this),
501                $top_nav = $this.prev('.gt3-products-header').find('.gt3-pagination_nav');
502            $top_nav.find('.gt3_show_all').on('click tap', function (e) {
503                var $button = jQuery(this);
504                if (window.sessionStorage && sessionStorage.getItem('gt3-show_all') !== 'true') {
505                    if ($button.hasClass('first-page')) {
506                        e.preventDefault();
507                        $top_nav.find('.gt3_show_all_li').fadeOut(300);
508                        $this.next('.spinner.infinite-scroll').fadeIn(300);
509                        setTimeout(function () {
510                            gt3_scrollTo($this.find('.product:first-of-type'), 2500);
511                        }, 500);
512                    } else {
513                        sessionStorage.setItem('gt3-show_all', 'true');
514                        setCookie('gt3-show_all', 'true');
515                    }
516                }
517
518                $this.infiniteScroll({
519                    path: ".next.page-numbers",
520                    append: ".products > .product",
521                    prefill: true,
522                    scrollThreshold: viewport().height * 1.2,
523                    history: false,
524                    hideNav: '.gt3-products-bottom .woocommerce-pagination',
525                    status: '.spinner.infinite-scroll'
526                });
527                $this.on('append.infiniteScroll', function () {
528                    if (jQuery(".gt3-animation-wrapper.gt3-anim-product").length) {
529                        gt3_scroll_animation('.gt3-animation-wrapper.gt3-anim-product:not(.loaded)', false);
530                    }
531                });
532            });
533        });
534    }
535}
536
537function gt3_scrollTo(element, duration, callback) {
538    if (typeof element !== "number") {
539        element = element.offset().top - 200;
540    }
541    window.scrollTo({
542        top: element,
543        behavior: "smooth"
544    });
545}
546
547function setCookie(name, value, options) {
548    options = options || {};
549
550    jQuery.extend(options, {
551        path: '/',
552        expires: 2592000 // month
553    });
554
555    var expires = options.expires;
556
557    if (typeof expires === "number" && expires) {
558        var d = new Date();
559        d.setTime(d.getTime() + expires * 1000);
560        expires = options.expires = d;
561    }
562    if (expires && expires.toUTCString) {
563        options.expires = expires.toUTCString();
564    }
565
566    var updatedCookie = name + "=" + (typeof value === "object" ? JSON.stringify(value) : value);
567
568    for (var propName in options) {
569        updatedCookie += "; " + propName;
570        var propValue = options[propName];
571        if (propValue !== true) {
572            updatedCookie += "=" + propValue;
573        }
574    }
575
576    document.cookie = updatedCookie;
577}
578
579function getCookie(name) {
580    var matches = document.cookie.match(new RegExp(
581        "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
582    ));
583    return matches ? decodeURIComponent(matches[1]) : undefined;
584};

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.