PageSourceSearch

https://farmlinkr.com/wp-content/themes/ecotech/assets/js/frontend.js?ver=1.1.8.1701417860

js farmlinkr.com collected 2026-10-07 02:55:02 UTC 34,696 bytes, 834 lines download raw bytes

1(function ($) {
2    'use strict';
3
4    var get_url       = function (endpoint) {
5            return ecotech_params.ecotech_ajax_url.toString().replace(
6                '%%endpoint%%',
7                endpoint
8            );
9        },
10        get_cookie    = function (name) {
11
12            var e, b, cookie = document.cookie, p = name + '=';
13
14            if (!cookie) {
15                return;
16            }
17
18            b = cookie.indexOf('; ' + p);
19
20            if (b === -1) {
21                b = cookie.indexOf(p);
22
23                if (b !== 0) {
24                    return null;
25                }
26            } else {
27                b += 2;
28            }
29
30            e = cookie.indexOf(';', b);
31
32            if (e === -1) {
33                e = cookie.length;
34            }
35
36            return decodeURIComponent(cookie.substring(b + p.length, e));
37
38        },
39        set_cookie    = function (name, value, expires, path, domain, secure) {
40
41            var d = new Date();
42
43            if (typeof (expires) === 'object' && expires.toGMTString) {
44                expires = expires.toGMTString();
45            } else if (parseInt(expires, 10)) {
46                d.setTime(d.getTime() + (parseInt(expires, 10) * 1000));
47                expires = d.toGMTString();
48            } else {
49                expires = '';
50            }
51
52            document.cookie = name + '=' + encodeURIComponent(value) +
53                              (expires ? '; expires=' + expires : '') +
54                              (path ? '; path=' + path : '') +
55                              (domain ? '; domain=' + domain : '') +
56                              (secure ? '; secure' : '');
57
58        },
59        remove_cookie = function (name, path, domain, secure) {
60            set_cookie(name, '', -1000, path, domain, secure);
61        };
62
63    var Mobile_Detect = {
64        Mobile: function () {
65            return navigator.userAgent.match(
66                /(iPhone|iPod|Android|Phone|DROID|ZuneWP7|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/
67            );
68        },
69        Tablet: function () {
70            return navigator.userAgent.match(
71                /(Tablet|iPad|Kindle|Playbook|Nexus|Xoom|SM-N900T|GT-N7100|SAMSUNG-SGH-I717|SM-T330NU)/
72            );
73        },
74        any   : function () {
75            return (Mobile_Detect.Mobile() || Mobile_Detect.Tablet());
76        }
77    };
78
79    $(document).on('click', '.view-all-menu > a', function () {
80        var button   = $(this),
81            vertical = button.closest('.header-vertical'),
82            items    = button.data('items'),
83            open     = button.data('alltext'),
84            close    = button.data('closetext'),
85            menus    = vertical.find('ul.vertical-menu > li:nth-child(n+' + (items + 1) + ')');
86
87        button.toggleClass('open-cate close-cate');
88
89        if (button.hasClass('close-cate')) {
90            button.html(close);
91            menus.slideDown();
92        } else {
93            button.html(open);
94            menus.slideUp();
95        }
96
97        return false;
98    });
99
100    /* AJAX TABS */
101    $(document).on('click', '.ovic-tabs .tabs-list .tab-link, .ovic-accordion .panel-heading a', function (e) {
102        e.preventDefault();
103        var $this       = $(this),
104            $data       = $this.data(),
105            $tabID      = $($this.attr('href')),
106            $tabItem    = $this.closest('.tab-item'),
107            $tabContent = $tabID.closest('.tabs-container,.ovic-accordion'),
108            $loaded     = $this.closest('.tabs-list,.ovic-accordion').find('a.loaded').attr('href');
109
110        if ($data.ajax == 1 && !$this.hasClass('loaded')) {
111            $tabContent.addClass('loading');
112            $tabItem.addClass('active').closest('.tabs-list').find('.tab-item').not($tabItem).removeClass('active');
113            $.ajax({
114                type     : 'POST',
115                url      : get_url('content_ajax_tabs'),
116                data     : {
117                    security: ecotech_params.security,
118                    section : $data.section,
119                },
120                success  : function (response) {
121                    $('[href="' + $loaded + '"]').removeClass('loaded');
122                    if (response) {
123                        $tabID.html(response);
124                        if ($tabID.find('.owl-slick').length) {
125                            $tabID.find('.owl-slick').ecotech_init_carousel();
126                        }
127                        if ($tabID.find('.elementor-section-slide').length) {
128                            $tabID.find('.elementor-section-slide').ecotech_init_carousel();
129                        }
130                        if ($tabID.find('.equal-container.better-height').length) {
131                            $tabID.find('.equal-container.better-height').ecotech_better_equal_elems();
132                        }
133                        if ($tabID.find('.ecotech-countdown').length && $.fn.ecotech_countdown) {
134                            $tabID.find('.ecotech-countdown').ecotech_countdown();
135                        }
136                        if ($tabID.find('.ovic-products').length && $.fn.ecotech_load_infinite) {
137                            $tabID.find('.ovic-products').ecotech_load_infinite();
138                        }
139                        if ($tabID.find('.yith-wcqv-button,.compare-button a.compare,.yith-wcwl-add-to-wishlist a').length) {
140                            $tabID.find('.yith-wcqv-button,.compare-button a.compare,.yith-wcwl-add-to-wishlist a').ecotech_bootstrap_tooltip();
141                        }
142                    } else {
143                        $tabID.html('<div class="alert alert-warning">' + ecotech_params.tab_warning + '</div>');
144                    }
145                    /* for accordion */
146                    $this.closest('.panel-default').addClass('active').siblings().removeClass('active');
147                    $this.closest('.ovic-accordion').find($tabID).slideDown(400);
148                    $this.closest('.ovic-accordion').find('.panel-collapse').not($tabID).slideUp(400);
149                },
150                complete : function () {
151                    $this.addClass('loaded');
152                    $tabContent.removeClass('loading');
153                    setTimeout(function ($tabID, $tab_animated, $loaded) {
154                        $tabID.addClass('active').siblings().removeClass('active');
155                        $tabID.animation_tabs($tab_animated);
156                        $($loaded).html('');
157                    }, 10, $tabID, $data.animate, $loaded);
158                },
159                ajaxError: function () {
160                    $tabContent.removeClass('loading');
161                    $tabID.html('<div class="alert alert-warning">' + ecotech_params.tab_warning + '</div>');
162                }
163            });
164        } else {
165            $tabItem.addClass('active').closest('.tabs-list').find('.tab-item').not($tabItem).removeClass('active');
166            $tabID.addClass('active').siblings().removeClass('active');
167            /* for accordion */
168            $this.closest('.panel-default').addClass('active').siblings().removeClass('active');
169            $this.closest('.ovic-accordion').find($tabID).slideDown(400);
170            $this.closest('.ovic-accordion').find('.panel-collapse').not($tabID).slideUp(400);
171            /* for animate */
172            $tabID.animation_tabs($data.animate);
173        }
174    });
175    /* ANIMATE */
176    $.fn.animation_tabs             = function ($tab_animated) {
177        $tab_animated = ($tab_animated === undefined || $tab_animated === '') ? '' : $tab_animated;
178        if ($tab_animated !== '') {
179            $(this).find('.owl-slick .slick-active, .product-list-grid .product-item').each(function (i) {
180                var $this  = $(this),
181                    $style = $this.attr('style'),
182                    $delay = i * 200;
183
184                $style = ($style === undefined) ? '' : $style;
185                $this.attr('style',
186                    $style +
187                    ';-webkit-animation-delay:' + $delay + 'ms;' +
188                    '-moz-animation-delay:' + $delay + 'ms;' +
189                    '-o-animation-delay:' + $delay + 'ms;' +
190                    'animation-delay:' + $delay + 'ms;'
191                ).addClass($tab_animated + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
192                    $this.removeClass($tab_animated + ' animated');
193                    $this.attr('style', $style);
194                });
195            });
196        }
197    };
198    $.fn.ecotech_init_carousel      = function () {
199        $(this).not('.slick-initialized').each(function () {
200            var $this   = $(this),
201                $config = $this.data('slick') !== undefined ? $this.data('slick') : [];
202
203            if ($this.hasClass('flex-control-thumbs')) {
204                $config = $this.closest('.single-product-wrapper').data('slick');
205            }
206            if ($this.hasClass('elementor-section-slide')) {
207                $this = $this.children('.elementor-container');
208
209                if ($this.children('.elementor-row').length) {
210                    $this = $this.children('.elementor-row');
211                }
212                if ($this.hasClass('slick-initialized')) {
213                    return false;
214                }
215            }
216            if ($config.length <= 0) {
217                return false;
218            }
219            if ($('body').hasClass('rtl')) {
220                $config.rtl = true;
221            }
222            if ($config.vertical == true) {
223                $config.prevArrow = '<span class="fa fa-angle-up prev"></span>';
224                $config.nextArrow = '<span class="fa fa-angle-down next"></span>';
225            } else {
226                $config.prevArrow = '<span class="fa fa-angle-left prev"></span>';
227                $config.nextArrow = '<span class="fa fa-angle-right next"></span>';
228            }
229            if ($this.hasClass('custom-dots')) {
230                $config.customPaging = function (slider, i) {
231                    var $thumb = $(slider.$slides[i]).data('thumb');
232                    var $title = $(slider.$slides[i]).data('title');
233                    return '<figure><img src="' + $thumb + '" alt="' + $title + '"></figure>';
234                };
235            }
236
237            $this.slick($config);
238
239            if ($this.hasClass('custom-dots')) {
240                $this.find('.slick-dots').not('.slick-initialized').each(function () {
241                    var $dots = {
242                        slidesToShow : 3,
243                        initialSlide : 1,
244                        centerPadding: 0,
245                        slidesMargin : 0,
246                        infinite     : true,
247                        centerMode   : true,
248                        focusOnSelect: true,
249                        dots         : true,
250                        arrows       : false,
251                    };
252
253                    if ($('body').hasClass('rtl')) {
254                        $dots.rtl = true;
255                    }
256
257                    $(this).slick($dots);
258                });
259            }
260        });
261    };
262    $.fn.ecotech_better_equal_elems = function () {
263        if (!Mobile_Detect.Mobile() && ecotech_params.disable_equal == false) {
264            var $this = $(this);
265
266            $this.on('ecotech_better_equal_elems', function () {
267                setTimeout(function () {
268                    $this.each(function () {
269                        if ($(this).find('.equal-elem').length) {
270                            $(this).find('.equal-elem').css({
271                                'height': 'auto'
272                            });
273                            var $height = 0;
274                            $(this).find('.equal-elem').each(function () {
275                                if ($height < $(this).height()) {
276                                    $height = $(this).height();
277                                }
278                            });
279                            $(this).find('.equal-elem').height($height);
280                        }
281                    });
282                }, 300);
283            }).trigger('ecotech_better_equal_elems');
284
285            $(window).on('resize', function () {
286                $this.trigger('ecotech_better_equal_elems');
287            });
288        }
289    };
290    $.fn.ecotech_sticky_header      = function () {
291        $(this).each(function () {
292            var $this     = $(this),
293                $sticky   = $this.find('.header-sticky'),
294                $height   = $sticky.height(),
295                $vertical = $this.find('.header-vertical .block-content').height();
296
297            if (ecotech_params.sticky_menu == 'template') {
298                $sticky = $('#header-sticky');
299            }
300
301            $(document).on('scroll', function (event) {
302                var sh = $height,
303                    st = $(this).scrollTop();
304
305                if ($this.find('.header-vertical .block-content').length) {
306                    sh = sh + $vertical;
307                }
308
309                if (st > sh) {
310                    $sticky.addClass('is-sticky');
311                } else {
312                    $sticky.removeClass('is-sticky');
313                    $('#header-sticky').find('.ecotech-dropdown.open').removeClass('open');
314                }
315            });
316        });
317    };
318    /* DROPDOWN */
319    $(document).on('click', function (event) {
320        var $target  = $(event.target).closest('.ecotech-dropdown'),
321            $current = $target.closest('.ecotech-parent-toggle'),
322            $parent  = $('.ecotech-dropdown');
323
324        if ($target.length) {
325            $parent.not($target).not($current).removeClass('open');
326            if ($(event.target).is('[data-ecotech="ecotech-dropdown"]') ||
327                $(event.target).closest('[data-ecotech="ecotech-dropdown"]').length) {
328                if ($target.hasClass('overlay')) {
329                    if ($target.hasClass('open')) {
330                        $('body').removeClass('active-overlay');
331                    } else {
332                        $('body').addClass('active-overlay');
333                    }
334                }
335                $target.toggleClass('open');
336                event.preventDefault();
337            }
338        } else {
339            $('.ecotech-dropdown').removeClass('open');
340            if ($target.hasClass('overlay') || !$target.length) {
341                $('body').removeClass('active-overlay');
342            }
343        }
344    });
345    /* LOOP GALLERY IMAGE */
346    $(document).on('click', '.product-item .product-loop-gallery a', function (event) {
347        var $this     = $(this),
348            $img      = $this.attr('data-image'),
349            $index    = $this.attr('data-index'),
350            $parent   = $this.closest('.product-item'),
351            $slide    = $parent.find('.thumb-wrapper'),
352            $main_img = $parent.find('.wp-post-image');
353
354        if ($main_img) {
355            if ($this.hasClass('dot-item') && $slide.length) {
356                $slide.slick('slickGoTo', $index);
357            } else {
358                $main_img.attr('src', $img).attr('srcset', $img);
359                $main_img.css({
360                    '-webkit-transform' : 'scale(0.5)',
361                    '-moz-transform'    : 'scale(0.5)',
362                    '-ms-transform'     : 'scale(0.5)',
363                    '-o-transform'      : 'scale(0.5)',
364                    'transform'         : 'scale(0.5)',
365                    'opacity'           : '0',
366                    '-webkit-transition': 'all 0.3s ease',
367                    '-moz-transition'   : 'all 0.3s ease',
368                    '-ms-transition'    : 'all 0.3s ease',
369                    '-o-transition'     : 'all 0.3s ease',
370                    'transition'        : 'all 0.3s ease',
371                }).load(function () {
372                    var image = $(this);
373                    setTimeout(function () {
374                        image.css({
375                            '-webkit-transform' : 'scale(1)',
376                            '-moz-transform'    : 'scale(1)',
377                            '-ms-transform'     : 'scale(1)',
378                            '-o-transform'      : 'scale(1)',
379                            'transform'         : 'scale(1)',
380                            'opacity'           : '1',
381                            '-webkit-transition': 'all 0.3s ease',
382                            '-moz-transition'   : 'all 0.3s ease',
383                            '-ms-transition'    : 'all 0.3s ease',
384                            '-o-transition'     : 'all 0.3s ease',
385                            'transition'        : 'all 0.3s ease',
386                        });
387                    }, 300);
388                });
389            }
390            $(this).addClass('gallery-active').siblings().removeClass('gallery-active');
391        }
392
393        event.preventDefault();
394    });
395    /* BUTTON TOOLTIP */
396    $.fn.ecotech_bootstrap_tooltip = function () {
397        if ($.fn.ovic_add_notify) {
398            $(this).each(function () {
399                var $this    = $(this),
400                    $product = $this.closest('.product-item'),
401                    $text    = $this.text(),
402                    $place   = 'left';
403
404                if ($('body').hasClass('rtl')) {
405                    $place = 'right';
406                }
407                if ($product.length) {
408                    if (
409                        $product.hasClass('list') ||
410                        $product.hasClass('style-02') ||
411                        $product.hasClass('style-13') ||
412                        $product.hasClass('style-16')
413                    ) {
414                        $this.tooltip({
415                            trigger  : 'hover',
416                            placement: 'top',
417                            container: 'body',
418                            title    : $text,
419                        });
420                    }
421                    if (
422                        $product.hasClass('style-01') ||
423                        $product.hasClass('style-05') ||
424                        $product.hasClass('style-06') ||
425                        $product.hasClass('style-12')
426                    ) {
427                        $this.tooltip({
428                            trigger  : 'hover',
429                            placement: $place,
430                            container: 'body',
431                            title    : $text,
432                        });
433                    }
434                }
435            });
436        }
437    }
438    /* TOGGLE WIDGET */
439    $.fn.ovic_category_product = function () {
440        $(this).each(function () {
441            var $main = $(this);
442            $main.find('.cat-parent').each(function () {
443                if ($(this).hasClass('current-cat-parent')) {
444                    $(this).addClass('show-sub');
445                    $(this).children('.children').slideDown(400);
446                }
447                $(this).children('.children').before('<span class="carets"></span>');
448            });
449            $main.children('.cat-parent').each(function () {
450                var curent = $(this).find('.children');
451                $(this).children('.carets').on('click', function () {
452                    $(this).parent().toggleClass('show-sub');
453                    $(this).parent().children('.children').slideToggle(400);
454                    $main.find('.children').not(curent).slideUp(400);
455                    $main.find('.cat-parent').not($(this).parent()).removeClass('show-sub');
456                });
457                var next_curent = $(this).find('.children');
458                next_curent.children('.cat-parent').each(function () {
459                    var child_curent = $(this).find('.children');
460                    $(this).children('.carets').on('click', function () {
461                        $(this).parent().toggleClass('show-sub');
462                        $(this).parent().parent().find('.cat-parent').not($(this).parent()).removeClass('show-sub');
463                        $(this).parent().parent().find('.children').not(child_curent).slideUp(400);
464                        $(this).parent().children('.children').slideToggle(400);
465                    })
466                });
467            });
468        });
469    };
470    /* QUANTITY */
471    if (!String.prototype.getDecimals) {
472        String.prototype.getDecimals = function () {
473            var num   = this,
474                match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
475            if (!match) {
476                return 0;
477            }
478            return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0));
479        };
480    }
481    $(document).on('click', '.quantity-plus, .quantity-minus', function (e) {
482        e.preventDefault();
483        // Get values
484        var $qty       = $(this).closest('.quantity').find('.qty'),
485            currentVal = parseFloat($qty.val()),
486            max        = parseFloat($qty.attr('max')),
487            min        = parseFloat($qty.attr('min')),
488            step       = $qty.attr('step');
489
490        if (!$qty.is(':disabled')) {
491            // Format values
492            if (!currentVal || currentVal === '' || currentVal === 'NaN') currentVal = 0;
493            if (max === '' || max === 'NaN') max = '';
494            if (min === '' || min === 'NaN') min = 0;
495            if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') step = '1';
496
497            // Trigger change event
498            $qty.trigger('change');
499        }
500    });
501    /* UPDATE COUNT WISHLIST */
502    $(document).on('added_to_wishlist removed_from_wishlist', function () {
503        $.get(get_url('update_wishlist_count'), function (count) {
504            if (!count) {
505                count = 0;
506            }
507            $('.block-wishlist .count').text(count);
508        });
509    });
510
511    $(document).on('click', '.action-to-top', function (e) {
512        $('html, body').animate({scrollTop: 0}, 800);
513        e.preventDefault();
514    });
515
516    if (ecotech_params.ajax_comment == 1) {
517        $(document).on('click', '#comments .woocommerce-pagination a', function () {
518            var $this        = $(this),
519                $comment     = $this.closest('#comments'),
520                $commentlist = $comment.find('.commentlist'),
521                $pagination  = $this.closest('.woocommerce-pagination');
522
523            $comment.addClass('loading');
524            $.ajax({
525                type   : 'GET',
526                url    : $this.attr('href'),
527                data   : {
528                    ovic_raw_content: 1,
529                },
530                success: function (response) {
531                    if (!response) {
532                        return;
533                    }
534                    var $html    = $.parseHTML(response, document, true),
535                        $nav     = $('#comments .woocommerce-pagination', $html).length ? $('#comments .woocommerce-pagination', $html)[0].innerHTML : '',
536                        $content = $('#comments .commentlist', $html).length ? $('#comments .commentlist', $html)[0].innerHTML : '';
537
538                    if ($content !== '') {
539                        $commentlist.html($content);
540                    }
541                    $pagination.html($nav);
542                    $comment.removeClass('loading');
543                },
544            });
545
546            return false;
547        });
548    }
549
550    $(document).on('click', '.scroll-content .scroll-prev', function (e) {
551
552        event.preventDefault();
553
554        var content = $(this).closest('.scroll-content'),
555            type    = content.data('scroll'),
556            mobile  = content.data('mobile'),
557            step    = content.data('step') != undefined ? content.data('step') : '200',
558            config  = {
559                scrollLeft: '-=' + step + 'px'
560            };
561
562        if (type == 'vertical') {
563            if (mobile == true && window.matchMedia("(max-width: 767px)").matches) {
564                config = {
565                    scrollLeft: '-=' + step + 'px'
566                };
567            } else {
568                config = {
569                    scrollTop: '-=' + step + 'px'
570                };
571            }
572        }
573
574        content.children('.scroll-list').animate(config, 'slow');
575
576    });
577
578    $(document).on('click', '.scroll-content .scroll-next', function (e) {
579
580        event.preventDefault();
581
582        var content = $(this).closest('.scroll-content'),
583            type    = content.data('scroll'),
584            mobile  = content.data('mobile'),
585            step    = content.data('step') != undefined ? content.data('step') : '200',
586            config  = {
587                scrollLeft: '+=' + step + 'px'
588            };
589
590        if (type == 'vertical') {
591            if (mobile == true && window.matchMedia("(max-width: 767px)").matches) {
592                config = {
593                    scrollLeft: '+=' + step + 'px'
594                };
595            } else {
596                config = {
597                    scrollTop: '+=' + step + 'px'
598                };
599            }
600        }
601
602        content.children('.scroll-list').animate(config, 'slow');
603
604    });
605
606    $(document).on('change', '#ecotech_disabled_popup_by_user', function () {
607        if ($(this).is(':checked')) {
608            set_cookie('ecotech_disabled_popup_by_user', 'true');
609        } else {
610            set_cookie('ecotech_disabled_popup_by_user', '');
611        }
612    });
613
614    $(document).on('wc-product-gallery-after-init', function (event, gallery, params) {
615        if ($(this).find('.flex-control-thumbs').length) {
616            $(this).find('.flex-control-thumbs').ecotech_init_carousel();
617        }
618    });
619
620    if ($('.woocommerce-product-gallery').attr("data-columns")) {
621        $('.woocommerce-product-gallery').css({ '--columns' : $('.woocommerce-product-gallery').attr("data-columns") });
622    }
623
624    $(document).on('ovic_success_load_more_post', function (event, content) {
625        if ($.fn.ecotech_bootstrap_tooltip && $(event.target).find('.yith-wcqv-button,.compare-button a.compare,.yith-wcwl-add-to-wishlist a').length) {
626            $(event.target).find('.yith-wcqv-button,.compare-button a.compare,.yith-wcwl-add-to-wishlist a').ecotech_bootstrap_tooltip();
627        }
628        if ($(event.target).find('.owl-slick').length) {
629            $(event.target).find('.owl-slick').ecotech_init_carousel();
630        }
631        if ($('.equal-container.better-height').length) {
632            $('.equal-container.better-height').ecotech_better_equal_elems();
633        }
634    });
635
636    $(document).on('scroll', function () {
637        if ($(window).scrollTop() > 400) {
638            $('.backtotop').addClass('show');
639        } else {
640            $('.backtotop').removeClass('show');
641        }
642    });
643
644    $(document).on('click', '.overlay-body', function (e) {
645        $('body').removeClass('ovic-open-mobile-menu');
646        $('body').removeClass('open-header-settings');
647        $('body').removeClass('open-mobile-sidebar');
648        $('body').removeClass('open-header-minicart');
649        $('.ovic-menu-clone-wrap').removeClass('open');
650        e.preventDefault();
651    });
652
653    $(document).on('click', '.entry-summary-end .close-entry', function (e) {
654        $(this).closest('.ecotech-dropdown').removeClass('open');
655        $('body').removeClass('active-overlay');
656        e.preventDefault();
657    });
658
659    $(document).on('click', '.open-sidebar', function () {
660        $('body').addClass('open-mobile-sidebar');
661        return false;
662    });
663
664    $(document).on('click', '.close-sidebar', function () {
665        $('body').removeClass('open-mobile-sidebar');
666        return false;
667    });
668
669    $(document).on('click', '.block-minicart.popup .woo-cart-link', function () {
670        $('body').addClass('open-header-minicart');
671        return false;
672    });
673
674    $(document).on('click', '.close-minicart', function () {
675        $('body').removeClass('open-header-minicart');
676        return false;
677    });
678
679    $(document).on('click', '.vertical-menu > .menu-item-has-children > .carets:not(:last-child), .vertical-menu > .menu-item > .sub-menu:not(.megamenu) .menu-item-has-children > .carets:not(:last-child)', function () {
680        var menu_item = $(this).closest('.menu-item');
681        menu_item.toggleClass('show-sub');
682        if (menu_item.find('.sub-menu.megamenu .owl-slick').length) {
683            menu_item.find('.sub-menu.megamenu .owl-slick').slick('setPosition');
684        }
685        return false;
686    });
687
688    $(document).on('wc_fragments_refreshed wc_fragments_loaded', function () {
689        if ($('.woocommerce-mini-cart').length && $.fn.scrollbar) {
690            $('.woocommerce-mini-cart').scrollbar({'ignoreMobile': true});
691        }
692    });
693
694    $(document).on('updated_wc_div', function (event) {
695        if ($(event.target).find('.cross-sells .owl-slick').length > 0) {
696            $(event.target).find('.cross-sells .owl-slick').ecotech_init_carousel();
697        }
698    });
699
700    $(document).ready(function () {
701        $('.ovic-tabs').each(function (index, el) {
702            $(this).find('.section-down').on('click', function (e) {
703                if ($('.ovic-tabs').eq(index + 1).length == 1) {
704                    $('html, body').animate({
705                        scrollTop: $('.ovic-tabs').eq(index + 1).offset().top - 100
706                    }, 'slow');
707                }
708
709                e.preventDefault();
710            });
711            $(this).find('.section-up').on('click', function (e) {
712                if ($('.ovic-tabs').eq(index - 1).length == 1) {
713                    $('html, body').animate({
714                        scrollTop: $('.ovic-tabs').eq(index - 1).offset().top - 100
715                    }, 'slow');
716                }
717
718                e.preventDefault();
719            });
720        });
721    });
722
723    $(document).ready(function () {
724        if ($('.category-search-option').length) {
725            $('.category-search-option').chosen();
726            $('.category-search-option').on('change', function (event, value) {
727                var $this  = $(this),
728                    $form  = $this.closest('form'),
729                    $input = $form.find('input[type="search"]');
730
731                $input.removeData();
732
733                if ('selected' in value) {
734                    $input.attr('data-custom-params', JSON.stringify({"product_cat": value.selected}));
735                }
736            });
737        }
738    });
739
740    window.addEventListener("load", function load() {
741        /**
742         * remove listener, no longer needed
743         * */
744        window.removeEventListener("load", load, false);
745        /**
746         * start functions
747         * */
748        if ($('.owl-slick').length) {
749            $('.owl-slick').ecotech_init_carousel();
750        }
751        if ($('.elementor-section-slide').length) {
752            $('.elementor-section-slide').ecotech_init_carousel();
753        }
754        if ($('.equal-container.better-height').length) {
755            $('.equal-container.better-height').ecotech_better_equal_elems();
756        }
757        if ($('.shop-before-control select').length) {
758            $('.shop-before-control select').chosen({disable_search_threshold: 10});
759        }
760        if ($('.widget_product_categories .product-categories').length) {
761            $('.widget_product_categories .product-categories').ovic_category_product();
762        }
763        if ($('.ecotech-popup-newsletter').length && get_cookie('ecotech_disabled_popup_by_user') !== 'true' && $.fn.magnificPopup) {
764            var popup  = document.getElementById('ecotech-popup-newsletter'),
765                effect = popup.getAttribute('data-effect'),
766                delay  = popup.getAttribute('data-delay');
767
768            setTimeout(function () {
769                $.magnificPopup.open({
770                    items       : {
771                        src: '#ecotech-popup-newsletter'
772                    },
773                    type        : 'inline',
774                    removalDelay: 600,
775                    callbacks   : {
776                        beforeOpen: function () {
777                            this.st.mainClass = effect;
778                        }
779                    },
780                    midClick    : true
781                });
782            }, delay);
783        }
784        /**
785         * check not mobile
786         * */
787        if (!Mobile_Detect.any()) {
788            if ($('.header').length && ecotech_params.sticky_menu !== 'none' && window.matchMedia("(min-width: 1199px)").matches) {
789                $('.header').ecotech_sticky_header();
790            }
791            if ($('.yith-wcqv-button,.compare-button a.compare,.yith-wcwl-add-to-wishlist a').length) {
792                $('.yith-wcqv-button,.compare-button a.compare,.yith-wcwl-add-to-wishlist a').ecotech_bootstrap_tooltip();
793            }
794        }
795        /* SCROLLBAR */
796        if ($.fn.scrollbar) {
797            if ($('.dokan-store-widget #cat-drop-stack > ul').length) {
798                $('.dokan-store-widget #cat-drop-stack > ul').scrollbar({'ignoreMobile': true});
799            }
800            if ($('.widget-area .widget_product_categories .product-categories').length) {
801                $('.widget-area .widget_product_categories .product-categories').scrollbar({'ignoreMobile': true});
802            }
803            if ($('.widget-area .widget_layered_nav .woocommerce-widget-layered-nav-list').length) {
804                $('.widget-area .widget_layered_nav .woocommerce-widget-layered-nav-list').scrollbar({'ignoreMobile': true});
805            }
806            if ($('.widget-area .widget_layered_nav .group-color').length) {
807                $('.widget-area .widget_layered_nav .group-color').scrollbar({'ignoreMobile': true});
808            }
809            if ($('.widget-area .widget_layered_nav .group-image').length) {
810                $('.widget-area .widget_layered_nav .group-image').scrollbar({'ignoreMobile': true});
811            }
812            if ($('.widget-area .ovic-price-filter .price-filter-inner').length) {
813                $('.widget-area .ovic-price-filter .price-filter-inner').scrollbar({'ignoreMobile': true});
814            }
815        }
816    }, false);
817
818    if (ecotech_params.is_preview) {
819        //
820        // Elementor scripts
821        //
822        $(window).on('elementor/frontend/init', function () {
823            elementorFrontend.hooks.addAction('frontend/element_ready/global', function ($scope, $) {
824                $scope.find('.owl-slick').ecotech_init_carousel();
825                $scope.find('.elementor-section-slide').ecotech_init_carousel();
826                $scope.find('.equal-container.better-height').ecotech_better_equal_elems();
827                if ($.fn.ecotech_countdown) {
828                    $scope.find('.ecotech-countdown').ecotech_countdown();
829                }
830            });
831        });
832    }
833
834})(window.jQuery);

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.