PageSourceSearch

https://www.zlatarna-jozef-gjoni.hr/wp-content/cache/busting/1/wp-…/etheme-77c694425764d7ed1c9a766bc2375881.js

js zlatarna-jozef-gjoni.hr collected 2026-10-03 00:27:26 UTC 77,616 bytes, 2,118 lines download raw bytes

1// version: 3.2
2jQuery(document).ready(function($){
3
4    // **********************************************************************//
5    // ! Search popup
6    // **********************************************************************//
7    $('.popup-with-form').magnificPopup({
8        type: 'inline',
9        closeBtnInside: true,
10        preloader: false,
11        midClick: true,
12        closeOnBgClick: true,
13        removalDelay: 300,
14        focus: '#et_modal_search',
15        mainClass: 'my-mfp-slide-bottom effect-delay2',
16        callbacks: {
17            beforeOpen: function() {
18                 this.st.focus = '#et_modal_search';
19            },
20            open: function() {
21                $('#s').focus();
22            }
23        }
24    });
25    // focus on search input for dropdown type
26    $('.search-dropdown').on('mouseover', function() {
27        $(this).find('input').focus();
28    }).on('touchstart click', '.popup-with-form', function() {
29        $('.search-dropdown').find('input').focus();
30    });
31
32
33    $('.popup-btn').magnificPopup({
34        type:'inline',
35        midClick: true // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
36    });
37
38
39
40    // **********************************************************************//
41    // ! Update cart fragments
42    // **********************************************************************//
43    // var et_fragment_refresh = {
44    //     url: myAjax.ajaxurl,
45    //     type: 'POST',
46    //     data: { action: 'et_refreshed_fragments' },
47    //     success: function( data ) {
48    //         if ( data && data.fragments ) {
49    //             $('#cartModal').replaceWith(data.fragments.cart_modal);
50    //             $('.shopping-cart-widget').replaceWith(data.fragments.top_cart);
51    //             $('.cart-totals').replaceWith(data.fragments.cart_totals);
52    //         }
53    //     }
54    // };
55    // $.ajax( et_fragment_refresh );
56    //
57    // $( document.body ).on( 'updated_wc_div', function() {
58    //     $.ajax( et_fragment_refresh );
59    // } );
60
61    // **********************************************************************//
62    // ! Contact Form ajax
63    // **********************************************************************//
64
65    var eForm = $('#contact-form');
66    var spinner = jQuery('.spinner');
67
68    $('.required-field').focus(function(){
69        $(this).removeClass('validation-failed');
70    });
71
72    eForm.find('#submit').click(function(e){
73
74        e.preventDefault();
75        $('#contactsMsgs').html('');
76        spinner.show();
77        var errmsg;
78        errmsg = '';
79
80        eForm.find('.required-field').each(function(){
81            if($(this).val() == '') {
82                    $(this).addClass('validation-failed');
83                }
84        });
85
86        if(errmsg){
87            $('#contactsMsgs').html('<p class="error">' + errmsg + '</p>');
88            spinner.hide();
89        }else{
90
91            url = eForm.attr('action');
92
93            data = eForm.serialize();
94
95            data += '&action=et_send_msg_action';
96
97            if ( $('body').hasClass('g_captcha') ) {
98                var greresponse = grecaptcha.getResponse();
99                data += '&greresponse=' + greresponse;
100            }
101
102            $.ajax({
103                url: myAjax.ajaxurl,
104                method: 'GET',
105                data: data,
106                error: function(data) {
107                    $('#contactsMsgs').html('<p class="error">Error while ajax request<span class="close-parent"></span></p>');
108                    spinner.hide();
109                },
110                success : function(data){
111                    if (data.status == 'success') {
112                        $('#contactsMsgs').html('<p class="success">' + data.msg + '<span class="close-parent"></span></p>');
113                        eForm.find("input[type=text], textarea").val("");
114                    }else{
115                        $('#contactsMsgs').html('<p class="error">' + data.msg + '<span class="close-parent"></span></p>');
116                    }
117                    spinner.hide();
118                    closeParentBtn();
119                }
120            });
121
122        }
123
124    });
125
126    // **********************************************************************//
127    // ! 8theme Mega Search
128    // **********************************************************************//
129
130    $.fn.etMegaSearch = function ( options ) {
131        var et_search = $(this);
132        var form = et_search.find('form');
133        var input = form.find('input[type="text"]');
134        var resultArea = et_search.find('.et-search-result');
135        var close = et_search.find('.et-close-results');
136
137        input.keyup(function() {
138
139            if($(this).val() == '' || $(this).val().length < 3) {
140                et_search.removeClass('loading result-exist');
141                return;
142            }
143
144            data = 's='+$(this).val() + '&products=' + et_search.data('products') + '&count=' + et_search.data('count') + '&images=' + et_search.data('images') + '&posts=' + et_search.data('posts') + '&portfolio=' + et_search.data('portfolio') + '&pages=' + et_search.data('pages') + '&action=et_get_search_result';
145
146            et_search.addClass('loading');
147            resultArea.html('');
148
149            $.ajax({
150                url: myAjax.ajaxurl,
151                method: 'GET',
152                data: data,
153                dataType: 'JSON',
154                error: function(data) {
155                    console.log('AJAX error');
156                },
157                success : function(data){
158                    if(data.results) {
159                        et_search.addClass('result-exist');
160                    } else {
161                        et_search.removeClass('result-exist');
162                    }
163                    resultArea.html(data.html);
164                },
165                complete : function() {
166                    et_search.removeClass('loading');
167                }
168            });
169        });
170
171        close.click(function() {
172            et_search.removeClass('result-exist');
173        });
174
175        return this;
176    }
177
178    $('.et-mega-search').each(function(){
179        $(this).etMegaSearch();
180    });
181
182
183    // **********************************************************************//
184    // ! Media Elements with JS
185    // **********************************************************************//
186
187    jQuery('video:not(.et-section-video)').mediaelementplayer({
188        success: function(player, node) {
189            jQuery('#' + node.id + '-mode').html('mode: ' + player.pluginType);
190        }
191    });
192
193    // **********************************************************************//
194    // ! Countdown
195    // **********************************************************************//
196
197
198    $.fn.countdown = function ( options ) {
199
200        var settings = $.extend({
201            type: "default"
202        }, options );
203
204        setInterval(function countdown_update() {
205            var countdown = $('.et-timer');
206            var eventDate = Date.parse(countdown.data('final')) / 1000;
207            var currentDate = Math.floor($.now() / 1000);
208            var days = countdown.find('.days');
209            var hours = countdown.find('.hours');
210            var minutes = countdown.find('.minutes');
211            var seconds = countdown.find('.seconds');
212
213            var remindSeconds = eventDate-currentDate;
214
215            if(remindSeconds > 0) {
216                var remindDays = Math.floor(remindSeconds / (60 * 60 * 24));
217                remindSeconds -= remindDays * 60 * 60 * 24;
218                var remindHours = Math.floor(remindSeconds / (60 * 60));
219                remindSeconds -= remindHours * 60 * 60;
220                var remindMinutes = Math.floor(remindSeconds / (60));
221                remindSeconds -= remindMinutes * 60;
222
223                if(remindDays < 10) remindDays = '0' + remindDays;
224                if(remindHours < 10) remindHours = '0' + remindHours;
225                if(remindMinutes < 10) remindMinutes = '0' + remindMinutes;
226                if(remindSeconds < 10) remindSeconds = '0' + remindSeconds;
227
228                if(days < 1 || remindDays == '00') {
229                    days.parent().hide().next().hide();
230                } else {
231                    days.text(remindDays);
232                }
233                hours.text(remindHours);
234                minutes.text(remindMinutes);
235                seconds.text(remindSeconds);
236            }
237
238        }, 1000);
239
240        return this;
241    }
242
243    $('.et-timer').countdown();
244
245
246    // **********************************************************************//
247    // ! Promo popup
248    // **********************************************************************//
249
250    var et_popup_closed = $.cookie('etheme_popup_closed');
251    $('.etheme-popup').magnificPopup({
252        type: 'inline',
253        preloader: false,
254        focus: '#username',
255        modal: true,
256        closeOnBgClick: true
257    });
258
259    if(et_popup_closed != 'do-not-show') {
260        $('.etheme-popup').click();
261    }
262
263    $(document).on('click', '.popup-modal-dismiss', function (e) {
264        e.preventDefault();
265        $.magnificPopup.close();
266        if($('#showagain:checked').val() == 'do-not-show')
267            $.cookie('etheme_popup_closed', 'do-not-show', { expires: 1, path: '/' } );
268    });
269
270
271    // **********************************************************************//
272    // ! Images lightbox
273    // **********************************************************************//
274    $("a[rel^='lightboxGall']").magnificPopup({
275        type:'image',
276        gallery:{
277            enabled:true
278        },
279        image: {
280            titleSrc: function(item) {
281                return item.el.attr('alt');
282            }
283        }
284    });
285
286    $('.slides').each(function() {
287        $(this).magnificPopup({
288            delegate: 'a[rel^=\'lightboxGall\']',
289            type: 'image',
290            gallery:{
291            enabled:true
292            },
293            image: {
294                titleSrc: function(item) {
295                    return item.el.attr('alt');
296                }
297            }
298        });
299    });
300
301
302    $("a[rel='lightbox']").magnificPopup({
303        type:'image'
304    });
305
306    // **********************************************************************//
307    // ! Mobile loader
308    // **********************************************************************//
309    $('.mobile-loader > div').fadeOut(300);
310    $('.mobile-loader').delay(300).fadeOut(800, function(){
311        $('.mobile-loader').remove();
312    });
313
314
315    // **********************************************************************//
316    // ! Product images sections loading
317    // **********************************************************************//
318
319    $('.single-product-page .images').addClass('shown');
320
321    var minusWidthTab = ( $( window ).width() < 768 ) ? 0 : 30;
322    $( window ).on( 'resize', function(){
323        var minusWidthTab = ( $( window ).width() < 768 ) ? 0 : 30;
324        $( '.tabs-under-product .tabs' ).width( $( '.content-area' ).width() - minu
324sWidthTab );
325    });
326    $( '.tabs-under-product .tabs' ).width( $( '.content-area' ).width() - minusWidthTab );
327
328    // **********************************************************************//
329    // ! Animated Counters
330    // **********************************************************************//
331
332    function animateCounter(el) {
333        var initVal = parseInt(el.text());
334        var finalVal = el.data('value');
335        if(finalVal <= initVal) return;
336        var intervalTime = 1;
337        var time = 200;
338        var step = parseInt((finalVal - initVal)/time.toFixed());
339        if(step < 1) {
340            step = 1;
341            time = finalVal - initVal;
342        }
343        var firstAdd = (finalVal - initVal)/step - time;
344        var counter = parseInt((firstAdd*step).toFixed()) + initVal;
345        var i = 0;
346        var interval = setInterval(function(){
347            i++;
348            counter = counter + step;
349            el.text(counter);
350            if(i == time) {
351                clearInterval(interval);
352            }
353        }, intervalTime);
354        el.addClass('loaded');
355    }
356
357    // **********************************************************************//
358    // ! Full width section
359    // **********************************************************************//
360
361    function et_sections(){
362
363        $('.et_section').each(function(){
364            $(this).css({
365                'left': - ($(window).width() - $('.header > .container').width())/2,
366                'width': $(window).width(),
367                'visibility': 'visible'
368            });
369            var videoTag = $(this).find('.section-back-video video');
370            videoTag.css({
371                'width': $(window).width(),
372                //'height': $(window).width() * videoTag.height() / videoTag.width()
373            });
374        });
375
376    }
377
378    et_sections()
379
380    $(window).resize(function(){
381        et_sections();
382    })
383
384
385    // **********************************************************************//
386    // ! Hidden Top Panel
387    // **********************************************************************//
388
389    $(function(){
390        var topPanel = $('.top-panel');
391        var pageWrapper = $('.page-wrapper');
392        var showPanel = $('.show-top-panel');
393        var panelHeight = topPanel.outerHeight();
394        showPanel.toggle(function(){
395            $(this).addClass('show-panel');
396            pageWrapper.attr('style','transform: translateY('+panelHeight+'px);-ms-transform: translateY('+panelHeight+'px);-webkit-transform: translateY('+panelHeight+'px);');
397            topPanel.addClass('show-panel');
398        },function(){
399            pageWrapper.attr('style','')
400            topPanel.removeClass('show-panel');
401            $(this).removeClass('show-panel');
402        });
403    });
404
405    // **********************************************************************//
406    // ! Remove some br and p
407    // **********************************************************************//
408    $('.toggle-element ~ br').remove();
409    $('.toggle-element ~ p').remove();
410    $('.block-with-ico h5').next('p').remove();
411    $('.tab-content .row-fluid').next('p').remove();
412    $('.tab-content .row-fluid').prev('p').remove();
413
414
415    // **********************************************************************//
416    // ! Update Favicon
417    // **********************************************************************//
418    function et_update_favicon() {
419        var itemsCount = $('.cart-summ').data('items-count');
420        var enableBadge = $('.shopping-cart-widget').data('fav-badge');
421        var favicon = new Favico({
422            animation : 'popFade',
423            fontStyle : 'normal',
424        });
425        if (enableBadge == 'enable') {
426            favicon.badge(itemsCount);
427        }
428    }
429
430    et_update_favicon();
431
432    // **********************************************************************//
433    // ! Fade animations
434    // **********************************************************************//
435
436    setTimeout(function() {
437        $('.fade-in').removeClass('fade-in');
438    }, 500);
439
440    // **********************************************************************//
441    // ! Products grid images slider
442    // **********************************************************************//
443
444    function contentProdImages() {
445        $('.hover-effect-slider').each(function() {
446            var slider = $(this);
447            var index = 0;
448            var autoSlide;
449            var imageLink = slider.find('.product-content-image');
450            if ( !imageLink.attr('data-images-list') ) return;
451            var imagesList = imageLink.data('images-list');
452            imagesList = imagesList.split(",");
453            var arrowsHTML = '<div class="small-slider-arrow arrow-left">left</div><div class="small-slider-arrow arrow-right">right</div>';
454            var counterHTML = '<div class="slider-counter"><span class="current-index">1</span>/<span class="slides-count">' + imagesList.length + '</span></div>';
455
456            if(imagesList.length > 1) {
457                slider.prepend(arrowsHTML);
458                slider.prepend(counterHTML);
459
460                // Previous image on click on left arrow
461                slider.find('.arrow-left').click(function(event) {
462                    if(index > 0) {
463                        index--;
464                    } else {
465                        index = imagesList.length-1; // if the first item set it to last
466                    }
467                    imageLink.find('img').attr('src', imagesList[index]); // change image src
468                    imageLink.find('img').attr('srcset', imagesList[index]);// change image srcset
469                    slider.find('.current-index').text(index + 1); // update slider counter
470                });
471
472                // Next image on click on left arrow
473                slider.find('.arrow-right').click(function(event) {
474                    if(index < imagesList.length - 1) {
475                        index++;
476                    } else {
477                        index = 0; // if the last image set it to first
478                    }
479                    imageLink.find('img').attr('src', imagesList[index]);// change image src
480                    imageLink.find('img').attr('srcset', imagesList[index]);// change image srcset
481                    slider.find('.current-index').text(index + 1);// update slider counter
482                });
483
484
485            }
486
487        });
488    }
489
490    contentProdImages();
491
492    // **********************************************************************//
493    // ! Wishlist
494    // **********************************************************************//
495    $('.yith-wcwl-add-button.show').each(function(){
496        var wishListText = $(this).find('a').text();
497        $(this).find('a').attr('data-hover',wishListText);
498    });
499
500    // **********************************************************************//
501    // ! Main Navigation plugin
502    // **********************************************************************//
503
504    $.fn.et_menu = function ( options ) {
505        var methods = {
506            showChildren: function(el) {
507                el.fadeIn(100).css({
508                    display: 'list-item',
509                    listStyle: 'none'
510                }).find('li').css({listStyle: 'none'});
511            },
512            calculateColumns: function(el) {
513                // calculate columns count
514                var columnsCount = el.find('.container > ul > li.menu-item-has-children').length;
515                var dropdownWidth = el.find('.container > ul > li').outerWidth();
516                var padding = 20;
517                if(columnsCount > 1) {
518                    dropdownWidth = dropdownWidth*columnsCount + padding;
519                    el.css({
520                        'width':dropdownWidth
521                    });
522                }
523
524                // calculate right offset of the  dropdown
525                var headerWidth = $('.menu-wrapper').outerWidth();
526                var headerLeft = $('.menu-wrapper').offset().left;
527                var dropdownOffset = el.offset().left - headerLeft;
528                var dropdownRight = headerWidth - (dropdownOffset + dropdownWidth);
529
530                if(dropdownRight < 0) {
531                    el.css({
532                        'left':'auto',
533                        'right':0
534                    });
535                }
536            },
537            openOnClick: function(el,e) {
538                var timeOutTime = 0;
539                var openedClass = "current";
540                var header = $('.header-wrapper');
541                var $this = el;
542
543
544                if($this.parent().hasClass(openedClass)) {
545                    e.preventDefault();
546                    $this.parent().removeClass(openedClass);
547                    $this.next().stop().slideUp(settings.animTime);
548                    header.stop().animate({'paddingBottom': 0}, settings.animTime);
549                } else {
550
551                    if($this.parent().find('>div').length < 1) {
552                        return;
553                    }
554
555                    e.preventDefault();
556
557                    if($this.parent().parent().find('.' + openedClass).length > 0) {
558                        timeOutTime = settings.animTime;
559                        header.stop().animate({'paddingBottom': 0}, settings.animTime);
560                    }
561
562                    $this.parent().parent().find('.' + openedClass).removeClass(openedClass).find('>div').stop().slideUp(settings.animTime);
563
564                    setTimeout(function(){
565                        $this.parent().addClass(openedClass);
566                        header.stop().animate({'paddingBottom': $this.next().height()+50},settings.animTime);
567                        $this.next().stop().slideDown(settings.animTime);
568                    },timeOutTime);
569                }
570            }
571        };
572
573        var settings = $.extend({
574            type: "default", // can be columns, default, mega, combined
575            animTime: 250,
576            openByClick: true
577        }, options );
578
579        if(settings.type == 'mega') {
580            this.find('>li>a').click(function(e) {
581                methods.openOnClick($(this),e);
582            });
583            return this;
584        }
585
586        this.find('>li').hover(function (){
587            if(!$(this).hasClass('open-by-click') || (!settings.openByClick && $(this).hasClass('open-by-click'))) {
588                if(settings.openByClick) {
589                    $('.open-by-click.current').find('>a').click();
590                    $(this).find('>a').unbind('click');
591                }
592                var dropdown = $(this).find('> .nav-sublist-dropdown');
593                methods.showChildren(dropdown);
594
595                if(settings.type == 'columns') {
596                    methods.calculateColumns(dropdown);
597                }
598            } else {
599                $(this).find('>a').unbind('click');
600                $(this).find('>a').bind('click', function(e) {
601                    methods.openOnClick($(this),e);
602                });
603            }
604        }, function () {
605            if(!$(this).hasClass('open-by-click') || (!settings.openByClick && $(this).hasClass('open-by-click'))) {
606                $(this).find('> .nav-sublist-dropdown').fadeOut(100).attr('style', '');
607            }
608        });
609
610        return this;
611    }
612
613    // First Type of column Menu
614    $('.main-nav .menu').et_menu({
615        type: "default"
616    });
617
618    $('.fixed-header .menu').et_menu({
619        openByClick: false
620    });
621
622
623
624    function et_equalize_height(elements, removeHeight) {
625        var heights = [];
626
627        if(removeHeight) {
628            elements.attr('style', '');
629        }
630
631        elements.each(function(){
632            heights.push($(this).height());
633        });
634
635        var maxHeight = Math.max.apply( Math, heights );
636        if($(window).width() > 767) {
637            elements.height(maxHeight);
638        }
639    }
640
641    $(window).resize(function(){
642        //et_equalize_height($('.product-category'), true);
643    });
644
645    // **********************************************************************//
646    // ! "Top" button
647    // **********************************************************************//
648
649    var scroll_timer;
650    var displayed = false;
651    var $message = jQuery('.back-to-top');
652
653    jQuery(window).scroll(function () {
654        window.clearTimeout(scroll_timer);
655        scroll_timer = window.setTimeout(function () {
656        if(jQuery(window).scrollTop() <= 0)
657        {
658            displayed = false;
659            $message.removeClass('btt-shown');
660        }
661        else if(displayed == false)
662        {
663            displayed = true;
664            $message.stop(true, true).addClass('btt-shown').click(function () { $message.removeClass('btt-shown'); });
665        }
666        }, 400);
667    });
668
669    jQuery('.back-to-top').click(function(e) {
670            jQuery('html, body').animate({scrollTop:0}, 600);
671            return false;
672    });
673
674    // **********************************************************************//
675    // ! Portfolio
676    // **********************************************************************//
677
678    $portfolio = $('.masonry');
679
680    $portfolio.each(function() {
681        var portfolioGrid = $(this);
682        portfolioGrid.isotope({
683            itemSelector: '.portfolio-item'
684        });
685        $(window).smartresize(function(){
686            portfolioGrid.isotope({
687                itemSelector: '.portfolio-item'
688            });
689        });
690
691        portfolioGrid.parent().find('.portfolio-filters a').click(function(){
692            var selector = $(this).attr('data-filter');
693            portfolioGrid.parent().find('.portfolio-filters a').removeClass('active');
694            if(!$(this).hasClass('active')) {
695                $(this).addClass('active');
696            }
697            portfolioGrid.isotope({ filter: selector });
698            return false;
699        });
700    });
701
702
703    setTimeout(function(){
704        $('.portfolio').addClass('with-transition');
705        $('.portfolio-item').addClass('with-transition');
706        $(window).resize();
707    },500);
708
709
710    // **********************************************************************//
711    // ! Blog isotope
712    // **********************************************************************//
713
714    $blog = $('.blog-masonry');
715
716    var type = 'article';
717
718    $blog.isotope({
719        itemSelector: type
720    });
721
722
723    $('.copyright .logo-small').click(function(){
724        var $newItems = $('');
725        $blog.isotope( 'insert', $newItems );
726    });
727
728
729
730    $(window).smartresize(function(){
731        $blog.isotope({
732            itemSelector: type
733        });
734    });
735
736    $('body').on('click', '.load-more-posts a', function(e){
737        e.preventDefault();
738
739        var url = $(this).attr('href');
740
741        if($(this).length>0) {
742            et_add_blog_posts(url);
743
744            $loading = true;
745        }
746    });
747
748    var $loading = false;
749
750    $(window).scroll(function(){
751        var $window = $(window);
752        var $element = $('.load-more-posts');
753
754        if($element.length>0) {
755            var pos = $window.scrollTop();
756
757            windowHeight = $window.height();
758            var top = $element.offset().top;
759            var height = $element.height();
760            var viewportBottom = pos + windowHeight;
761
762            // Check if totally above or totally below viewport
763            if (top + height < pos || top > viewportBottom) {
764                return;
765            }
766
767            var url = $element.find('a').attr('href');
768
769            if($element.find('a').length>0) {
770                et_add_blog_posts(url);
771
772                $loading = true;
773            }
774
775        }
776
777    });
778
779    function et_add_blog_posts(url){
780        if($loading) return;
781        $.ajax({
782            url: url,
783            method: 'GET',
784            timeout: 10000,
785            dataType: 'text',
786            beforeSend: function() {
787                $('.load-more-posts').addClass('loading');
788            },
789            success: function(data) {
790                $('.blog-masonry').addClass('with-transition');
791                $(type).addClass('with-transition');
792                $('.blog-masonry').isotope( 'insert', $(data).find('.blog-masonry ' + type) );
793                $('.load-more-posts').html($(data).find('.load-more-posts').html());
794
795
796            },
797            error: function(data) {
798                console.log('Error loading ajax content!');
799                window.location.reload();
800            },
801            complete: function() {
802
803                setTimeout(function(){
804                    $(window).resize();
805                },100);
806
807                setTimeout(function(){
808                    $loading = false;
809                },500);
810
811                $('.load-more-posts').removeClass('loading');
812            }
813        });
814
815        return;
816    }
817
818    // **********************************************************************//
819    // ! Other elements isotope
820    // **********************************************************************//
821
822    $container = $('.isotope-container');
823
824    $isotope = $('.et_isotope');
825
826    $isotope.each(function() {
827        var isotope = $(this);
828        isotope.isotope({
829            itemSelector: '.et_isotope-item'
830        });
831
832       $(window).smartresize(function(){
833            isotope.isotope({
834                itemSelector: '.et_isotope-item'
835            });
836        });
837
838        setTimeout(function(){
839            isotope.addClass('with-transition');
840            isotope.find('.et_isotope-item').addClass('with-transition');
841            $(window).resize();
842        },500);
843    });
844
845    $container.each(function() {
846        var container = $(this);
847        var isotope = container.find('.et_isotope');
848        container.find('.et_categories_filter a').data('isotope', isotope).click(function(e){
849            e.preventDefault();
850            var isotope = jQuery(this).data('isotope');
851            jQuery(this).parent().parent().find('.active').removeClass('active');
852            jQuery(this).addClass('active');
853            isotope.isotope({filter: jQuery(this).attr('data-filter')});
854        });
855    });
856
857
858    // **********************************************************************//
859    // ! Fixed header
860    // **********************************************************************//
861
862    $(window).scroll(function(){
863        if (!$('body').hasClass('fixNav-enabled')) {return false; }
864        var fixedHeader = $('.fixed-header-area');
865        var scrollTop = $(this).scrollTop();
866        var headerHeight = $('.header-wrapper').height() + 20;
867
868        if(scrollTop > headerHeight){
869            if(!fixedHeader.hasClass('fixed-already')) {
870                fixedHeader.stop().addClass('fixed-already');
871            }
872        }else{
873            if(fixedHeader.hasClass('fixed-already')) {
874                fixedHeader.stop().removeClass('fixed-already');
875            }
876        }
877    });
878    // **********************************************************************//
879    // ! Icons Preview
880    // **********************************************************************//
881
882    var modalDiv = $('#iconModal');
883
884    $('.demo-icons .demo-icon').click(function(){
885
886        var name = $(this).find('i').attr('class');
887
888
889        modalDiv.find('i').each(function(){
890            $(this).attr('class',name);
891        });
892
893        modalDiv.find('#myModalLabel').text(name);
894
895        modalDiv.modal();
896    });
897
898    // **********************************************************************//
899    // ! WooCommerce
900    // **********************************************************************//
901
902    // **********************************************************************//
903    // ! Remove from cart with AJAX
904    // **********************************************************************//
905
906    // $(document.body).on('click', '.cart-popup .delete-btn, .shopping-cart .product-remove a, .widget_shopping_cart_content .delete-btn', function(e){
907    //     e.preventDefault();
908
909    //     var $a = jQuery( e.currentTarget );
910
911    //     $.ajax({
912    //         method: "POST",
913    //         url: $a.attr( 'href' ),
914    //         error: function() {
915    //             console.log('removing from cart AJAX error');
916    //         },
917    //         success: function() {
918    //             et_update_favicon();
919    //         },
920    //         complete: function() {
921
922    //             // Use this trigger to refresh top cart after remove item
923    //             jQuery( document.body ).trigger( 'updated_wc_div' );
924    //         }
925    //     });
926
927    // });
928
929
930
931    // **********************************************************************//
932    // ! Products view switcher
933    // **********************************************************************//
934
935    function listSwitcher() {
936        var activeClass = 'switcher-active';
937        var gridClass = 'products-grid';
938        var listClass = 'products-list';
939        jQuery('.switchToList').click(function(){
940            if(!jQuery.cookie('products_page') || jQuery.cookie('products_page') == 'grid'){
941                switchToList();
942            }
943        });
944        jQuery('.switchToGrid').click(function(){
945            if(!jQuery.cookie('products_page') || jQuery.cookie('products_page') == 'list'){
946                switchToGrid();
947            }
948        });
949
950        function switchToList(){
951            jQuery('.switchToList').addClass(activeClass);
952            jQuery('.switchToGrid').removeClass(activeClass);
953            jQuery('.product-loop').fadeOut(300,function(){
954                jQuery(this).removeClass(gridClass).addClass(listClass).fadeIn(300);
955                jQuery.cookie('products_page', 'list', { expires: 3, path: '/' });
956            });
957        }
958
959        function switchToGrid(){
960            jQuery('.switchToGrid').addClass(activeClass);
961            jQuery('.switchToList').removeClass(activeClass);
962            jQuery('.product-loop').fadeOut(300,function(){
963                jQuery(this).removeClass(listClass).addClass(gridClass).fadeIn(300);
964                jQuery.cookie('products_page', 'grid', { expires: 3, path: '/' });
965            });
966        }
967    }
968
969
970
971    function check_view_mod(){
972        var activeClass = 'switcher-active';
973        if(jQuery.cookie('products_page') == 'grid' && $('body').hasClass('post-type-archive-product')) {
974            jQuery('.product-loop').removeClass('products-list').addClass('products-grid');
975            jQuery('.switchToGrid').addClass(activeClass);
976        }else if(jQuery.cookie('products_page') == 'list' && $('body').hasClass('post-type-archive-product')) {
977            jQuery('.product-loop').removeClass('products-grid').addClass('products-list');
978            jQuery('.switchToList').addClass(activeClass);
979        }else{
980            if(view_mode_default == 'list_grid' || view_mode_default == 'list') {
981                jQuery('.switchToList').addClass(activeClass);
982            }else{
983                jQuery('.switchToGrid').addClass(activeClass);
984            }
985        }
986    }
987
988    listSwitcher();
989    check_view_mod();
990
991    // **********************************************************************//
992    // ! Checkout login form
993    // **********************************************************************//
994
995    $('a.showlogin').click(function(){
996        $('form.et_login').slideToggle();
997        return false;
998    });
999
1000    // **********************************************************************//
1001    // ! Step by step checkout
1002    // **********************************************************************//
1003
1004    var stepsNav = $('.checkout-steps-nav');
1005    var steps = $('.checkout-steps');
1006    var nextStepBtn = $('.continue-checkout');
1007
1008    stepsNav.find('li a').click(function(e) {
1009        e.preventDefault();
1010        var link = $(this);
1011        var stepId = link.data('step');
1012        checkout_setup( stepId );
1013    });
1014
1015    nextStepBtn.click(function(e) {
1016        e.preventDefault();
1017        var nextId = $(this).data('next');
1018        checkout_setup( nextId );
1019    });
1020
1021    function checkout_setup( nextId ){
1022        var checkout_fields = {
1023            'first_name'  : $( '#step3 #billing_first_name' ),
1024            'last_name'   : $( '#step3 #billing_last_name' ),
1025            'email_field' : $( '#step3 #billing_email' ),
1026            'phone'       : $( '#step3 #billing_phone' ),
1027            'country'     : $( '#step3 #billing_country' ),
1028            'address_1'   : $( '#step3 #billing_address_1' ),
1029            'city'        : $( '#step3 #billing_city' ),
1030            'tate'        : $( '#step3 #billing_state' ),
1031        };
1032
1033        if ( $('#step3 #billing_postcode').is(':visible') ) {
1034            checkout_fields['postcode'] = $( '#step3 #billing_postcode' );
1035        }
1036
1037        if ( $( '#step2' ).length ) {
1038            checkout_fields['password'] = $( '#step2 #account_password' );
1039        }
1040
1041        $.ajax({
1042            url: myAjax.ajaxurl,
1043            method: "POST",
1044            data: {
1045                'action':'et_step_checkout',
1046            },
1047            success: function(data){
1048                    var messages = JSON.parse(data);
1049
1050                    messages = setup_messages( checkout_fields, nextId, messages );
1051
1052                    if ( messages == '' ){
1053                        showStep(nextId);
1054                    } else {
1055                       var checkout_errors = '<ul class="woocommerce-error">';
1056                                for( var key in messages) {
1057                                    checkout_errors += '<li>' + messages[key] + '</li>';
1058                                }
1059                        checkout_errors +='</ul>';
1060                        $( 'form.checkout.woocommerce-checkout' ).prepend( checkout_errors );
1061                    }
1062                },
1063            error: function(data){
1064                alert( 'ajax error' );
1065                return;
1066            },
1067        });
1068    }
1069
1070    function setup_messages( checkout_fields, nextId, arr ){
1071        var messages = [];
1072        $( 'ul.woocommerce-error' ).remove();
1073        jQuery.each( checkout_fields, function( i, val ) {
1074
1075            try {
1076                val = val.get( 0 ).value;
1077            }catch(err){
1078                console.log(err);
1079            }
1080
1081            if ( ( nextId === 4 || nextId === 5 || nextId === 3 ) && $( '#createaccount' ).attr(' checked')  === 'checked' ) {
1082                if ( i == 'password' && val == '' ) messages.push( arr['password'] );
1083                return messages;
1084            }
1085
1086            if ( nextId === 4 || nextId === 5 ) {
1087                if ( i == 'first_name' && val == '' ) messages.push( arr['first_name'] );
1088                if ( i == 'last_name' && val == '' ) messages.push( arr['last_name'] );
1089                if ( i == 'email_field' ) {
1090                    var atpos = val.indexOf( '@' );
1091                    if ( atpos<1 || val == '' ) {
1092                        messages.push(arr['email_field']);
1093                    }
1094
1095                }
1096                if ( i == 'phone' && val == '' ) messages.push( arr['phone'] );
1097                if ( i == 'country' && val == '' ) messages.push( arr['country'] );
1098                if ( i == 'address_1' && val == '' ) messages.push( arr['address_1'] );
1099                if ( i == 'city' && val == '' ) messages.push( arr['city'] );
1100                if ( i == 'postcode' && val == '' ) messages.push( arr['postcode'] );
1101            }
1102
1103        });
1104        return messages;
1105    }
1106
1107    steps.find('.active').show();
1108
1109    // checkout method
1110
1111    var radioBtns = $('input[name="method"]');
1112
1113    radioBtns.change(function() {
1114        var checkedMethod = jQuery(this).val();
1115
1116        checkMethod(checkedMethod);
1117    });
1118
1119    if(steps.length > 0) {
1120        checkMethod($('input[name="method"]:checked').val());
1121    }
1122
1123    function showStep(id) {
1124        var stepsNav = $('.checkout-steps-nav');
1125
1126        $('.checkout-step').fadeOut(200);
1127
1128        stepsNav.find('li a').removeClass('active filled');
1129
1130        for(var i = id; i>0; i--) {
1131            $('#tostep' + i + ' a').addClass('filled');
1132        }
1133
1134        $('#tostep' + id + ' a').addClass('active');
1135
1136        jQuery('html, body').animate({
1137            scrollTop: $('.checkout-steps-nav').offset().top - 100
1138        }, 800);
1139
1140        setTimeout(function(){
1141            $('#step' + id).fadeIn(200);
1142        }, 200);
1143    }
1144
1145
1146    function checkMethod(val){
1147        if(val == 2) {
1148            $('#tostep2').css('display','inline-block');
1149            $('#createaccount').attr('checked', true);
1150            if($('#step2').length > 0) {
1151                $('#step1 .continue-checkout').data('next',2);
1152            } else {
1153                $('#step1 .continue-checkout').data('next',3);
1154            }
1155
1156        }else{
1157            $('#tostep2').hide();
1158            $('#createaccount').attr('checked', false);
1159            $('#step1 .continue-checkout').data('next',3);
1160        }
1161    }
1162
1163
1164    /* Ajax Filter */
1165
1166    function ajaxProductLoad(url,blockId) {
1167        $.ajax({
1168            url: url,
1169            method: 'GET',
1170            timeout: 10000,
1171            dataType: 'text',
1172            success: function(data) {
1173                productLoaded(data,blockId);
1174
1175            },
1176            error: function(data) {
1177                alert('Error loading ajax content!');
1178                window.location.reload();
1179            }
1180        });
1181    }
1182
1183    function productLoaded(data,blockId) {
1184        //hide spinner
1185        $('.woocommerce-pagination').html($(data).find('.woocommerce-pagination').html());
1186        for(var i=0; i<blockId.length; i++) {
1187            jQuery(blockId[i]).html(jQuery(data).find(blockId[i]).html());
1188        }
1189        $('.content.span9').html($(data).find('.content.span9').html());
1190        $('.widget_layered_nav_filters').html($(data).find('.widget_layered_nav_filters').html());
1191        $('.content.span12').html($(data).find('.content.span12').html());
1192        //$('*').css({'cursor':'auto'});
1193        $('.product-grid').removeClass('loading').find('#floatingCirclesG').remove();
1194
1195        $('select.orderby').change(function(){
1196            $(this).closest('form').submit();
1197        });
1198
1199        $('html, body').animate({scrollTop: $('.product-loop').offset().top-100}, 500);
1200
1201        //productHover();
1202        check_view_mod();
1203        listSwitcher();
1204        contentProdImages();
1205
1206    }
1207
1208    // Reviews for woocommerce tabs.
1209
1210    $('.woocommerce-review-link').click(function() {
1211        $('#tab_reviews').click();
1212    });
1213
1214    if (!$('body').hasClass('post-type-archive-tribe_events')) {
1215
1216        if(ajaxFilterEnabled == 1 && !$('body').hasClass('single-product')) {
1217            $('.widget_layered_nav a, .woocommerce-pagination a').live('click', function(event) {
1218                var url = $(this).attr('href');
1219                if (url == '') {
1220                    url = $(this).attr('value');
1221                }
1222
1223                history.pushState({}, '', url);
1224
1225                var blockId = [];
1226
1227                jQuery('.widget_layered_nav').each(function(){
1228                    blockId.push('#' + jQuery(this).attr('id'));
1229                });
1230
1231                //$('*').css({'cursor':'progress'});
1232                $('.product-loop .product').addClass('loading').prepend('<div id="floatingCirclesG"><div class="f_circleG" id="frotateG_01"></div><div class="f_circleG" id="frotateG_02"></div><div class="f_circleG" id="frotateG_03"></div><div class="f_circleG" id="frotateG_04"></div><div class="f_circleG" id="frotateG_05"></div><div class="f_circleG" id="frotateG_06"></div><div class="f_circleG" id="frotateG_07"></div><div class="f_circleG" id="frotateG_08"></div></div>');
1233
1234                ajaxProductLoad(url,blockId);
1235                event.stopPropagation();
1236                return false;
1237            });
1238
1239            var popstatePageloadFix = {
1240                popped : ('state' in window.history && window.history.state !== null),
1241                initialUrl : location.href,
1242                initialPop : false,
1243                init : function() {
1244                    this.initialPop = !this.popped && location.href == this.initialUrl;
1245                    this.popped = true;
1246                    return this.initialPop;
1247                }
1248            };
1249
1250            $(window).on("popstate", function (event) {
1251
1252                // Ignore initial popstate that some browsers fire on page load
1253                if ( popstatePageloadFix.init() ) return;
1254
1255                location.assign(location.href);
1256
1257            });
1258
1259        }
1260    }else{
1261        return;
1262    }
1263
1264
1265    // **********************************************************************//
1266    // ! Ajax add to cart for list page
1267    // **********************************************************************//
1268    $(document).on( 'click', '.etheme_add_to_cart_button.ajax_add_to_cart', (function() {
1269        var $thisbutton = $(this);
1270        $thisbutton.parents( '.product' ).addClass( 'loading' );
1271        $thisbutton.parent().prepend('<div class="added-text"><div>' + successfullyAdded + '</div></div>');
1272        setTimeout(function() {
1273            $('.added-text').fadeOut(300);
1274            $thisbutton.parent().find('.added-text').remove();
1275            $thisbutton.parents( '.product' ).removeClass('loading');
1276        }, 3000);
1277    }));
1278
1279
1280    // **********************************************************************//
1281    // ! Ajax add to cart for single product
1282    // **********************************************************************//
1283    var modalWindow = jQuery('.etheme-simple-product').eModal();
1284
1285    $('.etheme-simple-product, .etheme-variable-add-to-cart').live('click', function(e) {
1286        e.preventDefault();
1287        // AJAX add to cart request
1288        var $thisbutton = $(this);
1289
1290        if ( $thisbutton.hasClass( 'disabled' ) ) return;
1291        var form = jQuery('form.cart');
1292        if (jQuery(this).parents().hasClass('quick-view-popup')) {
1293            if (jQuery(this).parents().hasClass('variations_form')) {
1294                form = $thisbutton.closest('.variations_form');
1295            }
1296        }
1297
1298        if ($thisbutton.is('.etheme-simple-product, .product_type_downloadable, .product_type_virtual, .woocommerce-variation-add-to-cart-enabled .etheme-variable-add-to-cart')) {
1299
1300
1301            $('#top-cart').addClass('updating');
1302
1303            formAction = $(form).attr('action');
1304
1305            var data = $(form).serializeArray();
1306
1307            modalWindow.eModal('showModal');
1308
1309            // Trigger event
1310            //$('body').trigger('adding_to_cart');
1311
1312            // Ajax action
1313            $.ajax({
1314                url: formAction,
1315                data: data,
1316                method: 'POST',
1317                timeout: 10000,
1318                dataType: 'text',
1319                error: function(data) {
1320                    modalWindow.eModal('endLoading')
1321                         .eModal('addError', 'Error with ajax')
1322                         .eModal('addBtn',{
1323                                title: contBtn,
1324                                href: 'javascript:void(0);',
1325                                cssClass: 'button small hidewindow',
1326                                hideOnClick: true
1327                            });
1328                },
1329                success : function(data,statusText,xhr ) {
1330                    jQuery('.shopping-cart-widget').html(jQuery(data).find('.shopping-cart-widget').html());
1331                    jQuery('.cart-totals').html(jQuery(data).find('.cart-totals').html());
1332                    jQuery('#shopping-cart-modal').html(jQuery(data).find('#shopping-cart-modal').html());
1333
1334                    et_update_favicon();
1335                    if($('.thumbnails img').length > 0) {
1336                        productImageSrc = $('.thumbnails img').first().attr('src');
1337                    } else if($('.main-image-slider img').length > 0) {
1338                        productImageSrc = $('.main-image-slider img').first().attr('src');
1339                    } else {
1340                        productImageSrc = $('.images img').first().attr('src');
1341                    }
1342
1343                    if ( $thisbutton.parents().hasClass( 'quick-view-popup' ) ) {
1344                        productImageSrc = $thisbutton.parents().find( '.main-image img' ).first().attr( 'src' );
1345                    }
1346
1347                    productName = $('.product_title, .product-name, .product-name-hiden').first().text();
1348
1349                    modalWindow.eModal('endLoading')
1350                         .eModal('setTitle',productName)
1351                         .eModal('addImage', productImageSrc)
1352                         .eModal('addText', successfullyAdded)
1353                         .eModal('addBtn',{
1354                                title: contBtn,
1355                                href: 'javascript:void(0);',
1356                                cssClass: 'button small hidewindow',
1357                                hideOnClick: true
1358                            })
1359                         .eModal('addBtn',{
1360                                title: checkBtn,
1361                                href: checkoutUrl,
1362                                cssClass: 'button filled active small arrow-right'
1363                            });
1364                }
1365            });
1366
1367            return false;
1368
1369        } else {
1370            return true;
1371        }
1372
1373    });
1374
1375
1376    // **********************************************************************//
1377    // ! AJAX Quick View
1378    // **********************************************************************//
1379
1380
1381    $(document.body).on('click', '.show-quickly, .show-quickly-btn', (function() {
1382        var $thisbutton = $(this);
1383        var prodid = $thisbutton.data('prodid');
1384        var magnificPopup;
1385        $.ajax({
1386            url: woocommerce_params.ajax_url,
1387            method: 'POST',
1388            data: {
1389                'action': 'et_product_quick_view',
1390                'prodid': prodid
1391            },
1392            dataType: 'html',
1393            beforeSend: function() {
1394                $thisbutton.parent().parent().addClass('loading');
1395                $thisbutton.after('<div id="floatingCirclesG"><div class="f_circleG" id="frotateG_01"></div><div class="f_circleG" id="frotateG_02"></div><div class="f_circleG" id="frotateG_03"></div><div class="f_circleG" id="frotateG_04"></div><div class="f_circleG" id="frotateG_05"></div><div class="f_circleG" id="frotateG_06"></div><div class="f_circleG" id="frotateG_07"></div><div class="f_circleG" id="frotateG_08"></div></div>');
1396            },
1397            complete: function() {
1398                $thisbutton.parent().find('#floatingCirclesG').remove();
1399                $thisbutton.parent().parent().removeClass('loading');
1400            },
1401            success: function(response){
1402
1403                $.magnificPopup.open({
1404                    items: { src: '<div class="quick-view-popup mfp-with-anim"><div class="doubled-border">' + response + '</div></div>' },
1405                    type: 'inline',
1406                    removalDelay: 500, //delay removal by X to allow out-animation
1407                    callbacks: {
1408                        beforeOpen: function() {
1409                            this.st.mainClass = 'mfp-zoom-in-to-left-out';
1410                        }
1411                    }
1412                }, 0);
1413
1414                $( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' );
1415
1416                $(function() {
1417                    $('.quick-view-popup .variations_form').wc_variation_form();
1418                    $('.quick-view-popup .variations_form .variations select').change();
1419                    et_bind_variations_form();
1420                });
1421                $('.quick-view-popup .images').addClass('shown');
1422            },
1423            error: function() {
1424                $.magnificPopup.open({
1425                    items: {
1426                        src: '<div class="quick-view-popup mfp-with-anim"><div class="doubled-border">Error with AJAX request</div></div>'
1427                    },
1428                    type: 'inline',
1429                    removalDelay: 500, //delay removal by X to allow out-animation
1430                    callbacks: {
1431                        beforeOpen: function() {
1432                            this.st.mainClass = 'mfp-zoom-in-to-left-out';
1433                        }
1434                    }
1435                }, 0);
1436            }
1437        });
1438        //alert( $thisbutton.parents(' .product ').find( '.woocommerce-Price-currencySymbol' ).first().text() );
1439
1440    }));
1441
1442
1443    // **********************************************************************//
1444    // ! Search form
1445    // **********************************************************************//
1446
1447    var searchBlock = $('.search.hide-input');
1448    var searchForm = searchBlock.find('#searchform');
1449    var searchBtn = searchForm.find('.button');
1450    var searchInput = searchForm.find('input[type="text"]');
1451
1452    searchBtn.click(function(e) {
1453        e.preventDefault();
1454        searchInput.fadeIn(200).focus();
1455        $('body').addClass('search-input-shown');
1456
1457
1458        // Hide search input on click
1459        $(document).click(function(e) {
1460            var target = e.target;
1461            if (!$(target).is('.search.hide-input') && !$(target).parents().is('.search.hide-input')) {
1462                searchInput.fadeOut(200);
1463                $('body').removeClass('search-input-shown');
1464            }
1465        });
1466
1467    });
1468
1469    // **********************************************************************//
1470    // ! Tabs
1471    // **********************************************************************//
1472
1473    var tabs = $('.tabs');
1474    $('.tabs > p > a').unwrap('p');
1475
1476    var leftTabs = $('.left-bar, .right-bar');
1477    var newTitles;
1478
1479    leftTabs.each(function(){
1480        var currTab = $(this);
1481        //currTab.find('> a.tab-title').each(function(){
1482            newTitles = currTab.find('> a.tab-title').clone().removeClass('tab-title').addClass('tab-title-left');
1483        //});
1484
1485        newTitles.first().addClass('opened');
1486
1487
1488        var tabNewTitles = $('<div class="left-titles"></div>').prependTo(currTab);
1489        tabNewTitles.html(newTitles);
1490
1491        currTab.find('.tab-content').css({
1492            'minHeight' : tabNewTitles.height()
1493        });
1494    });
1495
1496
1497    tabs.each(function(){
1498        var currTab = $(this);
1499
1500        if(!currTab.hasClass('closed-tabs')) {
1501            currTab.find('.tab-title').first().addClass('opened').next().show();
1502        }
1503
1504        currTab.find('.tab-title, .tab-title-left').click(function(e){
1505
1506            e.preventDefault();
1507
1508            var tabId = $(this).attr('id');
1509
1510            if($(this).hasClass('opened')){
1511                if(currTab.hasClass('accordion') || $(window).width() < 767){
1512                    $(this).removeClass('opened');
1513                    $('#content_'+tabId).hide();
1514                }
1515            }else{
1516                currTab.find('.tab-title, .tab-title-left').each(function(){
1517                    var tabId = $(this).attr('id');
1518                    $(this).removeClass('opened');
1519                    $('#content_'+tabId).hide();
1520                });
1521
1522
1523                if(currTab.hasClass('accordion') || $(window).width() < 767){
1524                    $('#content_'+tabId).removeClass('tab-content').show();
1525                    setTimeout(function(){
1526                        $('#content_'+tabId).addClass('tab-content').show(); // Fix it
1527                    },1);
1528                } else {
1529                    $('#content_'+tabId).show();
1530                }
1531                $(this).addClass('opened');
1532            }
1533        });
1534    });
1535
1536
1537
1538    /*
1539    * Variations images changes
1540    * to make it work properly comment in woocommerce/assets/js/frontend/add-to-cart-variation.js
1541    * this.unbind( 'check_variations update_variation_values found_variation' );
1542    */
1543
1544    function et_bind_variations_form() {
1545
1546        $( 'form.variations_form' ).on( 'found_variation', function( event, variation ) {
1547            var et_variation = {
1548                image: variation.image.src,
1549                link: variation.image.full_src,
1550                title: variation.image.title,
1551                srcset: variation.image.srcset,
1552                thumb: variation.image.thumb_src,
1553            }
1554
1555            if ( et_variation['image'] == null ) return;
1556
1557            var $product        = $(this).closest( '.product' );
1558            var $product_img    = $product.find( 'a#main-zoom-image img:eq(0)' );
1559            var $product_link   = $product.find( 'a#main-zoom-image' );
1560
1561            $product_link.attr( 'data-o_href',$product_link.attr( 'href' ) );
1562            if ( $product_link.attr('data-o_src') === undefined) {
1563                $product_link.attr('data-o_src', $product_img.attr('src'));
1564            }
1565            if ( $product_link.attr('data-thumb-o_src') === undefined) {
1566                $product_link.attr('data-thumb-o_src', $product_img.attr('data-thumb_src'));
1567            }
1568
1569
1570            if ( $( '.main-image-slider' ).hasClass( 'zoom-enabled' ) ) {
1571                if( $(window).width() > 768 && et_variation['image'].length > 5 && et_variation['link'].length > 5 ){
1572                    $( 'a#main-zoom-image' ).swinxyzoom( 'load', et_variation['image'],  et_variation['link'] );
1573                }
1574                $( 'a#main-zoom-image' ).attr('href', et_variation['link']);
1575                $( '.product-thumbnails-slider li:eq(0) img' ).attr( 'src', et_variation['thumb'] );
1576            } else {
1577                $( 'a#main-zoom-image' ).attr( 'href', et_variation['link'] );
1578                $( '.product-thumbnails-slider li:eq(0) img' ).attr('src', et_variation['thumb'] );
1579            }
1580
1581            // Do it for quick view
1582            if ( $( '.quick-view-popup' ).length > 0 ) {
1583                $( '.quick-view-popup .main-image img' ).attr( 'data-o_src', $( '.quick-view-popup .main-image img' ).attr( 'src' ) );
1584                $( '.quick-view-popup .main-image img' ).attr( 'data-o_srcset', $( '.quick-view-popup .main-image img' ).attr( 'srcset' ) );
1585                $( '.quick-view-popup .main-image img' ).attr( 'src', et_variation['image'] );
1586                $( '.quick-view-popup .main-image img' ).attr( 'srcset', et_variation['srcset'] );
1587            }
1588
1589            if ( $( '.main-image-slider .slides li' ).length > 1 ) $( '.main-image-slider' ).flexslider(0);
1590            if ( $( '.product-thumbnails-slider .slides li' ).length > 1 ) $( '.product-thumbnails-slider' ).flexslider(0);
1591        })
1592
1593        // Reset product image
1594        .on( 'reset_image', function( event ) {
1595            var $product        = $(this).closest( '.product' );
1596            var $product_img    = $product.find( 'a#main-zoom-image img:eq(0)' );
1597            var $product_link   = $product.find( 'a#main-zoom-image' );
1598            var o_data = {
1599                src: $product_img.attr( 'data-o_data-src' ),
1600                href: $product_link.attr( 'data-o_href' ),
1601                thumb: $product_link.attr('data-thumb-o_src')
1602            }
1603
1604            // Do it for quick view
1605            if ( $( '.quick-view-popup' ).length > 0 ) {
1606                o_data['href'] = $( '.quick-view-popup .main-image img' ).data( 'o_src' );
1607                o_data['srcset'] = $( '.quick-view-popup .main-image img' ).data( 'o_srcset' );
1608                $( '.quick-view-popup .main-image img' ).attr( 'src', o_data['href'] );
1609                $( '.quick-view-popup .main-image img' ).attr( 'srcset', o_data['srcset'] );
1610            }
1611
1612            if ( $( '.main-image-slider' ).hasClass( 'zoom-enabled' ) ) {
1613                if( typeof o_data['src'] != 'undefined' && typeof o_data['href'] != 'undefined' ) {
1614                    if($(window).width() > 768 && o_data['src'].length > 5 && o_data['href'].length > 5){
1615
1616                        o_data['href'] = o_data['src'];
1617                        $( 'a#main-zoom-image' ).swinxyzoom( 'load', o_data['src'],  o_data['href'] );
1618
1619                    }
1620                    $( 'a#main-zoom-image').attr('href', o_data['href'] );
1621                }
1622                $( '.product-thumbnails-slider li:eq(0) img' ).attr( 'src', o_data['thumb'] );
1623            } else {
1624                o_data['href'] = $product_img.attr( 'data-o_data-large_image' );
1625                $( '.woocommerce-product-gallery__image a' ).attr( 'href', o_data['href'] );
1626                $( 'a#main-zoom-image' ).attr( 'href', o_data['href'] );
1627                $( '.product-thumbnails-slider li:eq(0) img' ).attr( 'src', o_data['thumb'] );
1628            }
1629
1630            if ( $( '.main-image-slider .slides li' ).length > 1 ) $( '.main-image-slider' ).flexslider(0);
1631            if ( $( '.product-thumbnails-slider .slides li' ).length > 1 ) $( '.product-thumbnails-slider' ).flexslider(0);
1632        } );
1633
1634        // Return to first slide when choose option
1635        // $( document ).on( 'click', '.reset_variations', function() {
1636        //     if ( $( '.main-image-slider .slides li' ).length > 1 ) $( '.main-image-slider' ).flexslider(0);
1637        //     if ( $( '.product-thumbnails-slider .slides li' ).length > 1 ) $( '.product-thumbnails-slider' ).flexslider(0);
1638        // });
1639
1640        $( '.variations_form .variations select' ).change();
1641    }
1642
1643    et_bind_variations_form();
1644
1645
1646    // **********************************************************************//
1647    // ! Categories Accordion
1648    // **********************************************************************//
1649
1650    var plusIcon = '+';
1651    var minusIcon = '&ndash;';
1652    if(catsAccordion) {
1653        var etCats = $('.product-categories');
1654        var openerHTML = '<div class="open-this">'+plusIcon+'</div>';
1655
1656        etCats.find('> li').has('.children').has('li').addClass('parent-level0');
1657        etCats.find('li').has('.children').prepend(openerHTML);
1658
1659        if( $('.current-cat.parent-level0, .current-cat, .current-cat-parent').length > 0 ) {
1660            etCats.find('.current-cat.parent-level0, .current-cat-parent').find('> .open-this').html(minusIcon).parent().addClass('opened').find('> ul.children').show();
1661        }
1662
1663        etCats.find('.open-this').click(function() {
1664            if($(this).parent().hasClass('opened')) {
1665                $(this).html(plusIcon).parent().removeClass('opened').find('> ul, >
1665 div.nav-sublist-dropdown').slideUp(200);
1666            }else {
1667                $(this).html(minusIcon).parent().addClass('opened').find('> ul, > div.nav-sublist-dropdown').slideDown(200);
1668            }
1669        });
1670    }
1671
1672    // **********************************************************************//
1673    // ! Toggle elements
1674    // **********************************************************************//
1675
1676
1677    var etoggle = $('.toggle-block');
1678    var etoggleEl = etoggle.find('.toggle-element');
1679
1680
1681    //etoggleEl.first().addClass('opened').find('.open-this').html(minusIcon).parent().parent().find('.toggle-content').show();
1682
1683    etoggleEl.find('.toggle-title').click(function(e) {
1684        e.preventDefault();
1685        if($(this).hasClass('opened')) {
1686            $(this).removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200);
1687        }else {
1688            if($(this).parent().hasClass('noMultiple')){
1689                $(this).parent().find('.toggle-element').removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200);
1690            }
1691            $(this).addClass('opened').find('.open-this').html(minusIcon).parent().parent().find('.toggle-content').slideDown(200);
1692        }
1693    });
1694
1695
1696    // **********************************************************************//
1697    // ! Mobile navigation
1698    // **********************************************************************//
1699
1700    var navList = $('.mobile-nav div > ul');
1701    var etOpener = '<span class="open-child">(open)</span>';
1702    navList.addClass('et-mobile-menu');
1703
1704    navList.find('li:has(ul)',this).each(function() {
1705        $(this).prepend(etOpener);
1706    })
1707
1708    navList.find('.open-child').click(function(){
1709        if ($(this).parent().hasClass('over')) {
1710            $(this).parent().removeClass('over').find('>ul').slideUp(200);
1711        }else{
1712            $(this).parent().parent().find('>li.over').removeClass('over').find('>ul').slideUp(200);
1713            $(this).parent().addClass('over').find('>ul').slideDown(200);
1714        }
1715    });
1716
1717    $('.menu-icon, .close-mobile-nav').click(function(event) {
1718        if(!$('body').hasClass('mobile-nav-shown')) {
1719            $('body').addClass('mobile-nav-shown', function() {
1720                // Hide search input on click
1721                setTimeout(function(){
1722                    $(document).one("click",function(e) {
1723                        var target = e.target;
1724                        if (!$(target).is('.mobile-nav') && !$(target).parents().is('.mobile-nav')) {
1725
1726                                    $('body').removeClass('mobile-nav-shown');
1727                        }
1728                    });
1729                }, 111);
1730            });
1731
1732
1733
1734        } else{
1735            $('body').removeClass('mobile-nav-shown');
1736        }
1737    });
1738
1739    // **********************************************************************//
1740    // ! Side Block
1741    // **********************************************************************//
1742
1743    $('.side-area-icon, .close-side-area').click(function(event) {
1744        if(!$('body').hasClass('shown-side-area')) {
1745            $('body').addClass('shown-side-area', function() {
1746                // Hide search input on click
1747                setTimeout(function(){
1748                    $(document).one("click",function(e) {
1749                        var target = e.target;
1750                        if (!$(target).is('.side-area') && !$(target).parents().is('.side-area')) {
1751                            $('body').removeClass('shown-side-area');
1752                        }
1753                    });
1754                }, 111);
1755            });
1756        } else{
1757            $('body').removeClass('shown-side-area');
1758        }
1759    });
1760
1761
1762    // **********************************************************************//
1763    // ! Alerts
1764    // **********************************************************************//
1765
1766    function closeParentBtn(){
1767        var closeParentBtn = jQuery('.close-parent');
1768
1769        closeParentBtn.click(function(e){
1770            closeParent(this);
1771        });
1772
1773        function closeParent(el) {
1774            jQuery(el).parent().slideUp(100);
1775        }
1776    }
1777
1778    closeParentBtn();
1779
1780
1781    // **********************************************************************//
1782    // ! Custom Comment Form Validation
1783    // **********************************************************************//
1784    var ethemeCommentForm = $('#commentform');
1785
1786    ethemeCommentForm.find('#submit').click(function(e){
1787        $('#commentsMsgs').html('');
1788
1789        ethemeCommentForm.find('.required-field').each(function(){
1790            if($(this).val() == '') {
1791                $(this).addClass('validation-failed');
1792                e.preventDefault();
1793            }
1794        });
1795
1796    });
1797    // **********************************************************************//
1798    // ! Load in view
1799    // **********************************************************************//
1800
1801    var counters = $('.animated-counter');
1802
1803    $(window).scroll(function () {
1804
1805        var window_scroll = $(this).scrollTop();
1806
1807        counters.each(function(){
1808
1809        var el_top = $(this).offset().top;
1810        var el_height = $(this).outerHeight();
1811        var window_height = $(window).height();
1812
1813        if ( $(this).hasClass('loaded') || window_scroll < ( el_top + el_height - window_height ) ) return;
1814
1815        animateCounter($(this));
1816
1817        });
1818    });
1819
1820    // helper hex to rgb
1821    function componentToHex(c) {
1822        var hex = c.toString(16);
1823        return hex.length == 1 ? "0" + hex : hex;
1824    }
1825
1826    function rgbToHex(r, g, b) {
1827        return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
1828    }
1829
1830    function hexToRgb(hex) {
1831        var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
1832        return result ? {
1833            r: parseInt(result[1], 16),
1834            g: parseInt(result[2], 16),
1835            b: parseInt(result[3], 16)
1836        } : null;
1837    }
1838
1839    $('.parallax .banner-bg').each(function(){
1840        $(this).parallax('50%',0.05);
1841    });
1842
1843
1844    if($(window).width() > 767) {
1845        $('.parallax-section').each(function(){
1846            var speed = 0.1;
1847            if($(this).data('parallax-speed') != '') {
1848                speed = $(this).data('parallax-speed');
1849            }
1850            $(this).parallax('50%', speed);
1851        });
1852    }
1853
1854
1855}); // document ready
1856
1857
1858/*
1859Plugin: jQuery Parallax
1860Version 1.1.3
1861Author: Ian Lunn
1862Twitter: @IanLunn
1863Author URL: http://www.ianlunn.co.uk/
1864Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/
1865
1866Dual licensed under the MIT and GPL licenses:
1867http://www.opensource.org/licenses/mit-license.php
1868http://www.gnu.org/licenses/gpl.html
1869*/
1870
1871(function( $ ){
1872    var $window = $(window);
1873    var windowHeight = $window.height();
1874
1875    $window.resize(function () {
1876        windowHeight = $window.height();
1877    });
1878
1879    $.fn.parallax = function(xpos, speedFactor, outerHeight) {
1880        var $this = $(this);
1881        var getHeight;
1882        var firstTop;
1883        var paddingTop = 0;
1884
1885
1886        //get the starting position of each element to have parallax applied to it
1887        $this.each(function(){
1888            firstTop = $this.offset().top;
1889        });
1890
1891        if (outerHeight) {
1892            getHeight = function(jqo) {
1893                return jqo.outerHeight(true);
1894            };
1895        } else {
1896            getHeight = function(jqo) {
1897                return jqo.height();
1898            };
1899        }
1900
1901        // setup defaults if arguments aren't specified
1902        if (arguments.length < 1 || xpos === null) xpos = "50%";
1903        if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
1904        if (arguments.length < 3 || outerHeight === null) outerHeight = true;
1905
1906        // function to be called whenever the window is scrolled or resized
1907        function update(){
1908            var pos = $window.scrollTop();
1909
1910            $this.each(function(){
1911                var $element = $(this);
1912                var top = $element.offset().top;
1913                var height = getHeight($element);
1914                var viewportBottom = pos + windowHeight;
1915
1916                // Check if totally above or totally below viewport
1917                if (top + height < pos || top > viewportBottom) {
1918                    return;
1919                }
1920
1921
1922                //$this.css('backgroundPosition', xpos + " " + Math.round((top - viewportBottom) * speedFactor) + "px");
1923                $this.style('background-position', xpos + " " + Math.round((top - viewportBottom) * speedFactor) + "px", 'important');
1924            });
1925        }
1926
1927        $window.bind('scroll', update).resize(update);
1928        update();
1929    };
1930});
1931
1932(function($) {
1933  if ($.fn.style) {
1934    return;
1935  }
1936
1937  // Escape regex chars with \
1938  var escape = function(text) {
1939    return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1940  };
1941
1942  // For those who need them (< IE 9), add support for CSS functions
1943  var isStyleFuncSupported = !!CSSStyleDeclaration.prototype.getPropertyValue;
1944  if (!isStyleFuncSupported) {
1945    CSSStyleDeclaration.prototype.getPropertyValue = function(a) {
1946      return this.getAttribute(a);
1947    };
1948    CSSStyleDeclaration.prototype.setProperty = function(styleName, value, priority) {
1949      this.setAttribute(styleName, value);
1950      var priority = typeof priority != 'undefined' ? priority : '';
1951      if (priority != '') {
1952        // Add priority manually
1953        var rule = new RegExp(escape(styleName) + '\\s*:\\s*' + escape(value) +
1954            '(\\s*;)?', 'gmi');
1955        this.cssText =
1956            this.cssText.replace(rule, styleName + ': ' + value + ' !' + priority + ';');
1957      }
1958    };
1959    CSSStyleDeclaration.prototype.removeProperty = function(a) {
1960      return this.removeAttribute(a);
1961    };
1962    CSSStyleDeclaration.prototype.getPropertyPriority = function(styleName) {
1963      var rule = new RegExp(escape(styleName) + '\\s*:\\s*[^\\s]*\\s*!important(\\s*;)?',
1964          'gmi');
1965      return rule.test(this.cssText) ? 'important' : '';
1966    }
1967  }
1968
1969  // The style function
1970  $.fn.style = function(styleName, value, priority) {
1971    // DOM node
1972    var node = this.get(0);
1973    // Ensure we have a DOM node
1974    if (typeof node == 'undefined') {
1975      return;
1976    }
1977    // CSSStyleDeclaration
1978    var style = this.get(0).style;
1979    // Getter/Setter
1980    if (typeof styleName != 'undefined') {
1981      if (typeof value != 'undefined') {
1982        // Set style property
1983        priority = typeof priority != 'undefined' ? priority : '';
1984        style.setProperty(styleName, value, priority);
1985      } else {
1986        // Get style property
1987        return style.getPropertyValue(styleName);
1988      }
1989    } else {
1990      // Get CSSStyleDeclaration
1991      return style;
1992    }
1993  };
1994
1995// Quantity buttons
1996    $( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' );
1997
1998    $( document ).on( 'click', '.plus, .minus', function() {
1999
2000        // Get values
2001        var $qty        = $( this ).closest( '.quantity' ).find( '.qty' ),
2002            currentVal  = parseFloat( $qty.val() ),
2003            max         = parseFloat( $qty.attr( 'max' ) ),
2004            min         = parseFloat( $qty.attr( 'min' ) ),
2005            step        = $qty.attr( 'step' );
2006
2007        // Format values
2008        if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0;
2009        if ( max === '' || max === 'NaN' ) max = '';
2010        if ( min === '' || min === 'NaN' ) min = 0;
2011        if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) 
2011=== 'NaN' ) step = 1;
2012
2013        // Change the value
2014        if ( $( this ).is( '.plus' ) ) {
2015
2016            if ( max && ( max == currentVal || currentVal > max ) ) {
2017                $qty.val( max );
2018            } else {
2019                $qty.val( currentVal + parseFloat( step ) );
2020            }
2021
2022        } else {
2023
2024            if ( min && ( min == currentVal || currentVal < min ) ) {
2025                $qty.val( min );
2026            } else if ( currentVal > 0 ) {
2027                $qty.val( currentVal - parseFloat( step ) );
2028            }
2029
2030        }
2031        // Trigger change event
2032        $qty.trigger( 'change' );
2033
2034    });
2035
2036
2037    $(".submitbtn").on( 'click', function(e){
2038        e.preventDefault();
2039
2040        //jQuery('#result').html('<img src="<?php echo get_template_directory_uri(); ?>/images/loading.gif" class="loader" />').fadeIn();
2041        $( '.form-error' ).addClass( 'hidden' );
2042
2043        var greresponse = '';
2044
2045        if ( $('body').hasClass('g_captcha') ) {
2046            var greresponse = grecaptcha.getResponse();
2047        }
2048
2049        var $data = {
2050            'password1' : $( '#wp_signup_form #et_pass' ),
2051            'password2' : $( '#wp_signup_form #et_pass2' ),
2052            'usermail'  : $( '#wp_signup_form #email' ),
2053            'username'  : $( '#wp_signup_form #username' )
2054        };
2055
2056        jQuery.ajax({
2057            type: "POST",
2058            dataType: "JSON",
2059            url: myAjax.ajaxurl,
2060            data: {
2061                'action':'etheme_account_register',
2062                'password1'    : $data.password1.val(),
2063                'password2'    : $data.password2.val(),
2064                'usermail'     : $data.usermail.val(),
2065                'username'     : $data.username.val(),
2066                'greresponse'  : greresponse,
2067                security       : $( '#wp_signup_form #et_new_user_nonce' ).val(),
2068            },
2069            success: function(response){
2070
2071                if ( response.status != 'success' ) {
2072
2073                    if ( response.fields.username ) {
2074                        if ( response.fields.username == 'empty' ) {
2075                            $data.username.parents( '.form-row' ).find( '.form-error.empty' ).removeClass( 'hidden' );
2076                        } else if( response.fields.username == 'exist' ){
2077                            $data.username.parents( '.form-row' ).find( '.form-error.exists' ).removeClass( 'hidden' );
2078                        }
2079                    }
2080
2081                    if ( response.fields.usermail ) {
2082                        if ( response.fields.usermail == 'empty' ) {
2083                            $data.usermail.parents( '.form-row' ).find( '.form-error.empty' ).removeClass( 'hidden' );
2084                        } else if( response.fields.usermail == 'exists' ){
2085                            $data.usermail.parents( '.form-row' ).find( '.form-error.exists' ).removeClass( 'hidden' );
2086                        }
2086 else if ( response.fields.usermail == 'invalid' ) {
2087                            $data.usermail.parents( '.form-row' ).find( '.form-error.invalid' ).removeClass( 'hidden' );
2088                        }
2089                    }
2090
2091                    if ( response.fields.password1 ) {
2092                        if ( response.fields.password1 == 'empty' ) {
2093                            $data.password1.parents( '.form-row' ).find( '.form-error.empty' ).removeClass( 'hidden' );
2094                        } else if( response.fields.password1 == 'match' ){
2095                            $data.password1.parents( '.form-row' ).find( '.form-error.match' ).removeClass( 'hidden' );
2096                        } else if ( response.fields.password1 == 'length' ) {
2097                            $data.password1.parents( '.form-row' ).find( '.form-error.length' ).removeClass( 'hidden' );
2098                        }
2099                    }
2100
2101                    if ( response.fields.password2 ) {
2102                        if ( response.fields.password2 == 'empty' ) {
2103                            $data.password2.parents( '.form-row' ).find( '.form-error.empty' ).removeClass( 'hidden' );
2104                        } else if( response.fields.password2 == 'match' ){
2105                            $data.password2.parents( '.form-row' ).find( '.form-error.match' ).removeClass( 'hidden' );
2106                        } else if ( response.fields.password2 == 'length' ) {
2107                            $data.password2.parents( '.form-row' ).find( '.form-error.length' ).removeClass( 'hidden' );
2108                        }
2109                    }
2110                } else {
2111                    window.location.href = response.redirecturl;
2112                }
2113            }
2114        });
2115        return false;
2116    });
2117
2118})(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.