PageSourceSearch

https://www.mueloliva.es/wp-content/themes/organico/assets/js/custom.js?v=0.1

js mueloliva.es collected 2026-09-26 04:26:38 UTC 89,166 bytes, 2,546 lines download raw bytes

1(function ($) {
2    $(".ftc-title.weight-3 h2").each(function() {
3  // Some Vars
4  var elText,
5  openSpan = '<span class="first-word">',
6  closeSpan = '</span>';
7  
8  // Make the text into array
9  elText = $(this).text().split(" ");
10  
11  // Adding the open span to the beginning of the array
12  elText.unshift(openSpan);
13  
14  // Adding span closing after the first word in each sentence
15  elText.splice(3, 0, closeSpan);
16  
17  // Make the array into string 
18  elText = elText.join(" ");
19  
20  // Change the html of each element to style it
21  $(this).html(elText);
22});
23    "use strict";
24    
25    $('.portfolio-inner a[rel^="prettyPhoto"]').prettyPhoto({
26        show_title: false
27        ,deeplinking: false
28        ,social_tools: false
29    });
30   $(window).on("load", function() {
31    if (typeof $.fn.isotope == "function") {
32      $(".ftc-portfolio-wrapper .portfolio-inner").isotope({ filter: "*" });
33    }
34  });
35	 $('.ftc-portfolio-wrapper .portfolio-inner').imagesLoaded().progress( function() {
36   $('.ftc-portfolio-wrapper .portfolio-inner').isotope();
37});
38
39    /*ajax single cart*/
40    $(document).on('click', '.product.product-type-simple .single_add_to_cart_button, section.ftc-sticky-atc .single-add-to-cart .single_add_to_cart_button:not(.disabled)', function (e) {
41      e.preventDefault();
42      var notification = $('.ftc-single-added');
43
44      var $thisbutton = $(this),
45      $form = $thisbutton.closest('form.cart'),
46      id = $thisbutton.val(),
47      product_qty = $form.find('input[name=quantity]').val() || 1,
48      product_id = $form.find('input[name=product_id]').val() || id,
49      variation_id = $form.find('input[name=variation_id]').val() || 0;
50
51      var data = {
52        action: 'woocommerce_ajax_add_to_cart',
53        product_id: product_id,
54        product_sku: '',
55        quantity: product_qty,
56        variation_id: variation_id,
57    };
58
59    $(document.body).trigger('adding_to_cart', [$thisbutton, data]);
60
61    $.ajax({
62        type: 'post',
63        url: wc_add_to_cart_params.ajax_url,
64        data: data,
65        beforeSend: function (response) {
66          $thisbutton.removeClass('added').addClass('loading');
67      },
68      complete: function (response) {
69          $thisbutton.addClass('added').removeClass('loading');
70      },
71      success: function (response) {
72
73          if (response.error && response.product_url) {
74            window.location = response.product_url;
75            return;
76        } else {
77            $(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash, $thisbutton]);
78        }
79        setTimeout(function() {
80
81            notification.addClass("show_ad").delay(2500).queue(function(){
82              $(this).removeClass("show_ad").dequeue();
83          });
84        }, 200);
85    },
86});
87
88    return false;
89});
90
91    $('.ftc-portfolio-wrapper .filter-bar li').on('click', function(){
92        $(this).siblings('li').removeClass('current');
93        $(this).addClass('current');
94        var container = $(this).parents('.ftc-portfolio-wrapper').find('.portfolio-inner');
95        var data_filter = $(this).data('filter');
96        container.isotope({filter: data_filter});
97    });
98
99    $('.ftc-portfolio-wrapper').each(function(){
100        var element = $(this);
101        var atts = element.data('atts');
102        
103        element.find('a.load-more').on('click', function(){
104            var button = $(this);
105            if( button.hasClass('loading') ){
106                return false;
107            }
108            
109            button.addClass('loading');
110            var paged = button.attr('data-paged');
111            
112            $.ajax({
113                type : "POST",
114                timeout : 30000,
115                url : ftc_shortcode_params.ajax_uri,
116                data : {
117                    action: 'ftc_portfolio_load_items',
118                    paged: paged,
119                    atts : atts
120                },
121                error: function(xhr,err){
122
123                },
124                success: function(response) {
125                    button.removeClass('loading');
126                    button.attr('data-paged', ++paged);
127                    if( response != 0 && response != '' ){
128                        if( typeof $.fn.isotope == 'function' ){                                        
129                            element.find('.portfolio-inner').isotope('insert', $(response));
130                            element.find('.filter-bar li.current').trigger('click');
131                            setTimeout(function(){
132                                element.find('.portfolio-inner').isotope('layout');
133                            }, 500);
134                        }
135                    }
136                    else{ /* No results */
137                        button.parent().remove();
138                    }
139                }
140            });
141            
142            return false;
143        });
144    });
145
146// end
147/*summary fixed*/
148if( $(window).width()  > 768 ){
149    $('.ftc-single-grid').each(function(){
150      var height_header = $('.site-header').height() + $('.site-content .ftc-breadcrumb').height() + 70;
151      var height_im = $('.single-product .ftc-grid-main-images').height() - 270;
152      var height_tabs = $('.single-product .woocommerce-tabs #tab-description').height();
153      var width_sum = $('.ftc-single-grid .summary.entry-summary').width();
154
155      var  height_sum = $(window).height() - height_header;
156
157      jQuery(window).scroll(function() {
158        var scroll_top_pro = jQuery(this).scrollTop();
159        if (scroll_top_pro > height_header && scroll_top_pro < height_im) {
160          /* Scroll Down */
161
162          if($("body").hasClass("admin-bar")){
163            jQuery(".summary.entry-summary").addClass("fixed").fadeIn(100).css({'top': '30px','width': +  width_sum +  'px'});
164        }else{
165            jQuery(".summary.entry-summary").addClass("fixed").fadeIn(100).css({'top': '0px','width': +  width_sum +  'px'});
166        }
167    } else if(scroll_top_pro > height_im){
168      jQuery(".summary.entry-summary").removeClass("fixed").attr('style','').css({'position': 'absolute','top': 'auto','bottom': '0px'});
169  }else {
170      /* Scroll Up */
171      jQuery(".summary.entry-summary").removeClass("fixed").attr('style','');
172  }
173});
174  });
175}
176
177/*$(document).ready(function() {
178    $("#readMore, #readless").on("click",function(){
179        $(".collapsed-content").toggle('slow', 'swing');
180        $(".full-content").toggle('slow', 'swing');
181            $("#readMore").toggle();// "read more link id"
182            $("#readless").toggle();
183            return false;
184        });
185});*/
186
187
188/*$(document).ready(function() {
189    $("#readmore_des, #readless_des").on("click",function(){
190        $(".desciption_content").toggle('slow', 'swing');
191        $(".description_fullcontent").toggle('slow', 'swing');
192        $("#readmore_des").toggle();
193        $("#readless_des").toggle();
194
195        return false;
196    });
197});*/
198
199    // notice wishlist/
200    /*if($('body').hasClass('yith-wishlist')){
201        yith_wcwl_l10n.enable_notices = true ;
202    }*/
203// end
204/* Light box */
205$( '.swipebox' ).swipebox( {
206        useCSS : true, // false will force the use of jQuery for animations
207        useSVG : true, // false to force the use of png for buttons
208        initialIndexOnArray : 0, // which image index to init when a array is passed
209        hideCloseButtonOnMobile : false, // true will hide the close button on mobile devices
210        removeBarsOnMobile : true, // false will show top bar on mobile devices
211        hideBarsDelay : 3000, // delay before hiding bars on desktop
212        videoMaxWidth : 1140, // videos max width
213        beforeOpen: function() {}, // called before opening
214        afterOpen: null, // called after opening
215        afterClose: function() {}, // called after closing
216        loopAtEnd: false // true will return to the first image after the last image is reached
217    } );
218
219$('.details-img').imagesLoaded( function() {
220    $(".details_thumbnails li a").on("click",function() {
221        var changeSrc = $(this).attr("href");
222        $(".attachment-shop_single.size-shop_single").attr("src", changeSrc);
223        $(".ftc_lightbox .swipebox").attr("href", changeSrc);
224        $(".images .woocommerce-product-gallery__image a.swipebox").attr("href", changeSrc);
225        return false;
226    });
227});
228
229
230/* Cookie Notice */
231function ftc_cookie_popup() {
232    var cookies_version = ftc_shortcode_params.cookies_version;
233    if( $.cookie( 'ftc_cookies_' + cookies_version ) == 'accepted' ) return;
234    var popup = $( '.ftc-cookies-popup' );
235
236    setTimeout(function() {
237        popup.addClass('popup-display');
238        popup.on('click', '.cookies-accept-btn', function(e) {
239            e.preventDefault();
240            acceptCookies();
241        })
242    }, 2500 );
243
244    var acceptCookies = function() {
245        popup.removeClass('popup-display').addClass('popup-hide');
246        $.cookie( 'ftc_cookies_' + cookies_version, 'accepted', { expires: 60, path: '/' } );
247    };
248}
249ftc_cookie_popup();
250
251/* Single Product Size Chart */
252jQuery('a.ftc-size_chart').prettyPhoto({
253    deeplinking: false
254    ,opacity: 0.9
255    ,social_tools: false
256    ,default_width: 800
257    ,default_height: 506
258    ,theme: 'ftc-size_chart'
259    ,changepicturecallback: function(){
260        jQuery('.ftc-size-chart').addClass('loaded');
261    }
262}); 
263/* Single Product Video */
264jQuery('a.ftc-product-video-button').prettyPhoto({
265    deeplinking: false,
266    opacity: 0.9,
267    social_tools: false,
268    default_width: 800,
269    default_height: 506,
270    theme: 'ftc-product-video',
271    changepicturecallback: function () {
272        jQuery('.ftc-product-video').addClass('loaded');
273    }
274});
275
276/* Product Category Show Top Content Widget Area */
277$('.prod-cat-show-top-content-button a').on('click', function(){
278    $(this).toggleClass('active');
279    
280    $('.product-category-top-content').slideToggle('fast');
281    $('.product-category-top-content').toggleClass('showne');
282    return false;
283});
284
285/*footer - mobile -element*/
286if( $(window).width() < 481 ){
287    $('.respon_footer .active_col .elementor-heading-title').append('<i class="icon-arrow-down"></i>');
288    $('.respon_footer ').each(function(){
289        $(this).find('.elementor-heading-title').on('click', function(e){
290            e.preventDefault();
291            $(this).closest('.elementor-heading-title').toggleClass('active');
292            $(this).closest('.respon_footer .active_col').find('.elementor-widget-icon-list').slideToggle("fast");
293            $(this).closest('.respon_footer .active_col').find('.elementor-widget-ftc-gallery-instagram').slideToggle("fast");
294            $(this).closest('.respon_footer .active_col').find('.elementor-widget-text-editor').slideToggle("fast");
295            $(this).closest('.respon_footer .active_col').find('.elementor-widget-ftc_single_image').slideToggle("fast");
296            $(this).closest('.respon_footer .active_col').find('.elementor-widget-ftc-cf7-forms').slideToggle("fast");
297        });
298    });
299}
300
301if( $(window).width() < 481 ){
302    $('.footer-mobi .col-active .heading-title').append('<i class="icon-arrow-down"></i>');
303    $('.footer-mobi ').each(function(){
304        $(this).find('.heading-title').on('click', function(e){
305            e.preventDefault();
306            $(this).closest('.heading-title').toggleClass('active');
307            $(this).closest('.footer-mobi .col-active').find('.bullet').slideToggle("fast");
308            $(this).closest('.footer-mobi .col-active').find('.text-contact').slideToggle("fast");
309            $(this).closest('.footer-mobi .col-active').find('.instagram-block').slideToggle("fast");
310            $(this).closest('.footer-mobi .col-active').find('.form-mobi').slideToggle("fast");
311        });
312    });
313}
314if( $(window).width() < 481 ){
315    $('.footer-dropdown .col-dropdown .elementor-heading-title').append('<i class="icon-arrow-down"></i>');
316    $('.footer-dropdown').each(function(){
317        $(this).find('.elementor-heading-title').on('click', function(e){
318            e.preventDefault();
319            $(this).closest('.elementor-heading-title').toggleClass('active');
320            $(this).closest('.footer-dropdown .col-dropdown').find('.elementor-widget-icon-list').slideToggle("fast");
321            $(this).closest('.footer-dropdown .col-dropdown').find('.address-dropdown').slideToggle("fast");
322        });
323    });
324}
325
326/* Mega Main Menu Mobile */
327if($('#main-menu').length){
328	if($('#main-menu').closest('.ftc-mobile-wrapper').css('display') != 'none'){
329		$('#main-menu').smartmenus({
330			subMenusSubOffsetX: 1,
331			subMenusSubOffsetY: -8
332		});
333	}
334}
335
336/*Menu Mobile*/
337$(document).ready(function(){
338    $('.ftc-mobile-wrapper .mega_main_menu.primary.mobile_minimized-enable > .menu_holder > .menu_inner >  ul > li.menu-item-has-children').on("click",function(){
339        $(this).toggleClass('active');
340        $(this).find(">.mega_dropdown").slideToggle();
341    });
342});
343
344/* Single Product - Variable Product options */
345$(document).on('click', '.variations_form .ftc-product-attribute .option a', function(){
346    var _this = $(this);
347    var val = _this.closest('.option').data('value');
348    var selector = _this.closest('.ftc-product-attribute').siblings('select');
349    if( selector.length > 0 ){
350        if( selector.find('option[value="' + val + '"]').length > 0 ){
351            selector.val(val).change();
352            _this.closest('.ftc-product-attribute').find('.option').removeClass('selected');
353            _this.closest('.option').addClass('selected');
354        }
355    }
356    return false;
357});
358
359$('.variations_form').on('click', '.reset_variations', function(){
360    $(this).closest('.variations').find('.ftc-product-attribute .option').removeClass('selected');
361});
362
363/* product vendor */  
364$(document).ready(function() {
365    if($('.wcvendors_sold_by_in_loop').length){
366     $('.product .item-description').addClass('wc-vendor');      
367 }
368
369});
370$(document).ready(function() {
371    if($('.page-container .ftc-sidebar#left-sidebar').length){
372        $('.page-container').find('.pv_shop_description').addClass('col-md-9');
373    }
374});
375$(document).ready(function() {
376    if($('.page-container .ftc-sidebar#right-sidebar').length){
377        $('.page-container').find('.pv_shop_description').addClass('col-md-12');
378    }
379});
380
381$('a.ftc-readmore').hover(function(e){
382    $(this).attr('title', '');
383});
384
385
386$(".vertical-menu").on("click",function () {
387    $(this).find(".mega_main_menu.vertical").slideToggle("fast");
388});
389
390    //header sticky menu
391    var top_spacing = 0;
392    if (jQuery(window).width() > 300) {
393        if (
394            jQuery("body").hasClass("logged-in") &&
395            jQuery("body").hasClass("admin-bar")
396            ) {
397            top_spacing = 30;
398    }
399    var top_begin = jQuery("header.site-header").height() + 30;
400
401    setTimeout(function() {
402        jQuery(".header-sticky").sticky({
403            topSpacing: top_spacing,
404            topBegin: top_begin
405        });
406    }, 200);
407    var old_scroll_top = 0;
408    var extra_space = 0 + top_spacing + top_begin;
409    jQuery(window).scroll(function() {
410        if (jQuery(".is-sticky").length > 0) {
411            var scroll_top = jQuery(this).scrollTop();
412            if (scroll_top > old_scroll_top && scroll_top > extra_space) {
413
414                /*Scroll Down*/
415                jQuery(".header-sticky").addClass("header-sticky-hide");
416                /* jQuery(".header-sticky").attr("style", "");*/
417                
418            } else {
419
420                /*Scroll Up*/
421                if (jQuery(".header-sticky").hasClass("header-sticky-hide")) {
422                    jQuery(".header-sticky").removeClass("header-sticky-hide");
423                }
424            }
425            old_scroll_top = scroll_top;
426        }
427    });
428}  
429
430/* Mobile sticky */
431$(window).scroll(function() {
432  var heightHeader = $(".header-ftc").height();
433  if ($(this).scrollTop() > heightHeader) {
434    $(".header-ftc ").addClass("header-sticky-mobile");
435} else {
436    $(".header-ftc ").removeClass("header-sticky-mobile");
437}
438});
439
440/* Popup Newletter */
441$(document).ready(function() {
442    $('.newsletterpopup .close-popup, .popupshadow').on('click', function(){
443        $('.newsletterpopup').hide();
444        $('.popupshadow').hide();
445    });    
446});
447$( window ).load(function() {
448   if($('.newsletterpopup').length){
449    var cookieValue = $.cookie("ftc_popup");
450    if(cookieValue == 1) {
451        $('.newsletterpopup').hide();
452        $('.popupshadow').hide();
453    }else{
454        $('.newsletterpopup').show();
455        $('.popupshadow').show();
456    }               
457}     
458});
459$(document).on('change','#ftc_dont_show_again',function(){
460    if ($(this).is(':checked')) {
461     $.cookie("ftc_popup", 1, { expires : 24 * 60 * 60 * 1000 });
462 }
463}); 
464/* Mobile Navigation */
465function ftc_open_menu() {
466    var body = $('body');
467
468    body.on("click", ".mobile-nav", function() {
469        if (body.hasClass("has-mobile-menu")) {
470            body.removeClass("has-mobile-menu");
471        } else {
472            body.addClass("has-mobile-menu");
473        }
474    });
475    body.on("click", ".btn-toggle-canvas", function() {
476        body.removeClass("has-mobile-menu");
477    });
478    body.on("click touchstart", ".ftc-close-popup", function() {
479        body.removeClass("has-mobile-menu");
480    });
481}
482ftc_open_menu();
483
484      // Show hide popover
485      $(".dropdown-button").on("click",function () {
486        $(this).find("#dropdown-list").slideToggle("fast");
487    });
488      // drop-down
489      $(".dropdown-menu-header_click").on("click",function () {
490        $(this).find("#dropdown-list_click").slideToggle("fast");
491    });
492      $(".menu-icon-home45").on("click",function () {
493        $('.menu-home45').slideToggle("fast");
494    });
495      
496      $(".menu-ftc").on("click",function () {
497        $('#primary-menu').slideToggle("fast");
498    });
499      $('.mega_main_menu').parent().addClass('menu-fix');
500      
501      
502      $('img.ftc-image').each(function () {
503        if ($(this).data('src')) {
504            $(this).attr('src', $(this).data('src'));
505        }
506    });
507      
508      $(".ftc_quickshop_thumbnail").on("click",function () {
509         $(this).closest(".images-slider-wrapper").find(".item-image .quick_image").attr("src",$(this).attr("data-hover"));
510     });
511      /** To Top button **/
512      if( $('html').offset().top < 100 ){
513        $("#to-top").hide().addClass("off");
514    }
515    $(window).scroll(function(){
516        if( $(this).scrollTop() > 100 ){
517            $("#to-top").removeClass("off").addClass("on");
518        } else {
519            $("#to-top").removeClass("on").addClass("off");
520        }
521    });
522    $('#to-top .scroll-button').on("click",function(){
523        $('body,html').animate({
524            scrollTop: '0px'
525        }, 1000);
526        return false;
527    });
528
529    if( typeof ftc_shortcode_params._ftc_enable_ajax_search != 'undefined' && ftc_shortcode_params._ftc_enable_ajax_search == 1 ){
530        ftc_ajax_search();
531    }
532    /* Cloud Zoom */
533    function ftc_cloud_zoom(){
534       jQuery('.cloud-zoom-wrap .cloud-zoom-big').remove();
535       jQuery('.cloud-zoom, .cloud-zoom-gallery').unbind('click');
536       var clz_width = jQuery('.cloud-zoom, .cloud-zoom-gallery').width();
537       var clz_img_width = jQuery('.cloud-zoom, .cloud-zoom-gallery').children('img').width();
538       var cl_zoom = jQuery('.cloud-zoom, .cloud-zoom-gallery').not('.on_pc');
539       var temp = (clz_width-clz_img_width)/2;
540       if(cl_zoom.length > 0 ){
541          cl_zoom.data('zoom',null).siblings('.mousetrap').unbind().remove();
542          cl_zoom.CloudZoom({ 
543             adjustX:temp   
544         });
545      }
546  }
547
548  ftc_cloud_zoom();
549  if( $('.cloud-zoom, .cloud-zoom-gallery').length > 0 ){
550      $('form.variations_form').on('found_variation',function( event, variation ){
551         $('.cloud-zoom, .cloud-zoom-gallery').CloudZoom({}); 
552     }).on('reset_image',function(){
553         $('.cloud-zoom, .cloud-zoom-gallery').CloudZoom({});
554     });
555 }
556 /** Ajax search **/
557 function ftc_ajax_search(){
558    var search_string = '';
559    var search_previous_string = '';
560    var search_timeout;
561    var search_input;
562    var search_cache_data = {};
563    jQuery('.ftc_search_ajax').append('<div class="ftc-enable-ajax-search"></div>');
564    var ftc_enable_ajax_search = jQuery('.ftc-enable-ajax-search');
565    
566    jQuery('.ftc_search_ajax input[name="s"]').on('keyup', function(e){
567        search_input = jQuery(this);
568        ftc_enable_ajax_search.hide();
569        
570        search_string = jQuery.trim(jQuery(this).val());
571        if( search_string.length < 2 ){
572            search_input.parents('.ftc_search_ajax').removeClass('loading');
573            return;
574        }
575        
576        if( search_cache_data[search_string] ){
577            ftc_enable_ajax_search.html(search_cache_data[search_string]);
578            ftc_enable_ajax_search.show();
579            search_previous_string = '';
580            search_input.parents('.ftc_search_ajax').removeClass('loading');
581            
582            ftc_enable_ajax_search.find('.view-all a').on('click', function(e){
583                e.preventDefault();
584                search_input.parents('form').submit();
585            });
586            
587            return;
588        }
589        
590        clearTimeout(search_timeout);
591        search_timeout = setTimeout(function(){
592            if( search_string == search_previous_string || search_string.length < 2 ){
593                return;
594            }
595            search_previous_string = search_string;
596            search_input.parents('.ftc_search_ajax').addClass('loading');
597            
598            
599            var category = '';
600            var select_category = search_input.parents('.ftc_search_ajax').siblings('.select-category');
601            if( select_category.length > 0 ){
602                category = select_category.find(':selected').val();
603            }
604            
605            jQuery.ajax({
606                type : 'POST'
607                ,url : ftc_shortcode_params.ajax_uri
608                ,data : {
609                    action : 'ftc_ajax_search',
610                    search_string: search_string,
611                    category: category,
612                    security: ftc_platform.ajax_nonce
613                }
614                ,error : function(xhr,err){
615                    search_input.parents('.ftc_search_ajax').removeClass('loading');
616                }
617                ,success : function(response){
618                    if( response != '' ){
619                        response = JSON.parse(response);
620                        if( response.search_string == search_string ){
621                            ftc_enable_ajax_search.html(response.html);
622                            search_cache_data[search_string] = response.html;
623                            
624                            ftc_enable_ajax_search.css({
625                                'position': 'absolute'
626                                ,'display': 'block'
627                                ,'z-index': '999'
628                            });
629                            
630                            search_input.parents('.ftc_search_ajax').removeClass('loading');
631                            
632                            ftc_enable_ajax_search.find('.view-all a').on('click', function(e){
633                                e.preventDefault();
634                                search_input.parents('form').submit();
635                            });
636                        }
637                    }
638                    else{
639                        search_input.parents('.ftc_search_ajax').removeClass('loading');
640                    }
641                }
642            });
643        }, 500);
644    });
645
646    ftc_enable_ajax_search.on("hover",function(){}, function(){ftc_enable_ajax_search.show();});
647
648    jQuery('body').on('click', function(){
649        ftc_enable_ajax_search.hide();
650    });
651
652    jQuery('.ftc-search-product select.select-category').on('change', function(){
653        search_previous_string = '';
654        search_cache_data = {};
655        jQuery(this).parents('.ftc-search-product').find('.ftc_search_ajax input[name="s"]').trigger('keyup');
656    });
657}
658    // FTC Owl slider
659    $('.footer-top11 .ftc-sb-brandslider').each(function () { 
660        var margin = $(this).data('margin');
661        var columns = $(this).data('columns');
662        var nav = $(this).data('nav') == 1;  
663        var dots = $(this).data('dots') == 1; 
664        var auto_play = $(this).data('auto_play') == 1;             
665        var slider = $(this).data('slider') == 1;
666        var desksmall_items = $(this).data('desksmall_items');
667        var tabletmini_items = $(this).data('tabletmini_items');
668        var tablet_items = $(this).data('tablet_items');
669        var mobile_items = $(this).data('mobile_items');
670        var mobilesmall_items = $(this).data('mobilesmall_items');        
671        
672        if( slider ){ 
673            var _slider_data ={
674                loop: true
675                , nav: nav
676                , dots: dots
677                , navSpeed: 1000
678                ,navText: [,]
679                , rtl: $('body').hasClass('rtl')
680                , margin: margin
681                , autoplay: auto_play
682                , autoplayTimeout: 5000
683                , autoplaySpeed: 1000
684                , responsiveBaseElement: $('body')
685                , responsiveRefreshRate: 400
686                , responsive: {
687                    0:{
688                      items: mobilesmall_items
689                  },
690                  490:{
691                      items: mobile_items
692                  },
693                  650:{
694                      items: tabletmini_items
695                  },
696                  768:{
697                      items: tablet_items
698                  },
699                  991:{
700                      items: desksmall_items
701                  },
702                  1199:{
703                      items:7
704                  }
705              }
706              ,onInitialized: function(){
707                $(this).addClass('loaded').removeClass('loading');
708            }
709        };
710        $(this).find('.meta-slider > div').owlCarousel(_slider_data);
711    }
712
713});
714    
715    $('.ftc-sb-brandslider,.ftc-product-slider,.ftc-list-category-slider').each(function () { 
716        var margin = $(this).data('margin');
717        var columns = $(this).data('columns');
718        var nav = $(this).data('nav') == 1;  
719        var dots = $(this).data('dots') == 1; 
720        var auto_play = $(this).data('auto_play') == 1;             
721        var slider = $(this).data('slider') == 1;
722        var desksmall_items = $(this).data('desksmall_items');
723        var tabletmini_items = $(this).data('tabletmini_items');
724        var tablet_items = $(this).data('tablet_items');
725        var mobile_items = $(this).data('mobile_items');
726        var mobilesmall_items = $(this).data('mobilesmall_items');        
727        
728        if( slider ){ 
729            var _slider_data ={
730                loop: true
731                , nav: nav
732                , dots: dots
733                , navSpeed: 1000
734                ,navText: [,]
735                , rtl: $('body').hasClass('rtl')
736                , margin: margin
737                , autoplay: auto_play
738                , autoplayTimeout: 5000
739                , autoplaySpeed: 1000
740                , responsiveBaseElement: $('body')
741                , responsiveRefreshRate: 400
742                , responsive: {
743                    0:{
744                      items: mobilesmall_items
745                  },
746                  490:{
747                      items: mobile_items
748                  },
749                  650:{
750                      items: tabletmini_items
751                  },
752                  768:{
753                      items: tablet_items
754                  },
755                  991:{
756                      items: desksmall_items
757                  },
758                  1199:{
759                      items:columns
760                  }
761              }
762              ,onInitialized: function(){
763                $(this).addClass('loaded').removeClass('loading');
764            }
765        };
766        $(this).find('.meta-slider > div').owlCarousel(_slider_data);
767    }
768
769});
770    
771    $('.ftc-product-time-deal').each(function () { 
772        var margin = $(this).data('margin');
773        var columns = $(this).data('columns');
774        var nav = $(this).data('nav') == 1;  
775        var dots = $(this).data('dots') == 1; 
776        var auto_play = $(this).data('auto_play') == 1;             
777        var slider = $(this).data('slider') == 1;
778        var desksmall_items = $(this).data('desksmall_items');
779        var tabletmini_items = $(this).data('tabletmini_items');
780        var tablet_items = $(this).data('tablet_items');
781        var mobile_items = $(this).data('mobile_items');
782        var mobilesmall_items = $(this).data('mobilesmall_items');        
783        
784        if( slider ){ 
785            var _slider_data ={
786                loop: true
787                , nav: nav
788                , dots: dots
789                , navSpeed: 1000
790                ,navText: [,]
791                , rtl: $('body').hasClass('rtl')
792                , margin: 0
793                , padding: 15
794                , autoplay: auto_play
795                , autoplayTimeout: 5000
796                , autoplaySpeed: 1000
797                , responsiveBaseElement: $('body')
798                , responsiveRefreshRate: 400
799                , responsive: {
800                    0:{
801                      items: mobilesmall_items
802                  },
803                  480:{
804                      items: mobile_items
805                  },
806                  640:{
807                      items: tabletmini_items
808                  },
809                  768:{
810                      items: tablet_items
811                  },
812                  991:{
813                      items: desksmall_items
814                  },
815                  1199:{
816                      items:columns
817                  }
818              }
819              ,onInitialized: function(){
820                $(this).addClass('loaded').removeClass('loading');
821            }
822        };
823        $(this).find('.meta-slider > div').owlCarousel(_slider_data);
824    }
825
826});
827
828    /* Load more Product*/
829    $('.ftc-product').each(function () {
830        var element = $(this);
831        var atts = element.data('atts');
832
833        /* Show more */
834        element.find('a.load-more').on('click', function () {
835            var button = $(this);
836            if (button.hasClass('loading')) {
837                return false;
838            }
839            button.addClass('loading');
840            var paged = button.attr('data-paged');
841
842            $.ajax({
843                type: "POST",
844                timeout: 30000,
845                url: ftc_shortcode_params.ajax_uri,
846                data: {
847                    action: 'ftc_products_load_items',
848                    paged: paged,
849                    atts: atts
850                },
851                error: function (xhr, err) {
852
853                },
854                success: function (response) {
855                    button.removeClass('loading');
856                    button.attr('data-paged', ++paged);
857                    if (response != 0 && response != '') {
858                        element.find('.products').append(response);
859                        ftc_quickshop_process_action();
860                    }
861                    else { /* No results */
862                        button.parent().remove();
863                    }
864                }
865            });
866            
867            return false;
868        });
869    });
870
871
872    $('.ftc-sb-blogs').each(function() {
873        var element = $(this);
874        var atts = element.data('atts');
875
876        /* Slider */
877        if (atts.is_slider) {
878            var nav = parseInt(atts.show_nav) == 1;
879            var dots = parseInt(atts.dots) == 1;
880            var auto_play = parseInt(atts.auto_play) == 1;
881            var margin = parseInt(atts.margin);
882            var columns = parseInt(atts.columns);
883            var desksmall_items = parseInt(atts.desksmall_items);
884            var tablet_items = parseInt(atts.tablet_items);
885            var tabletmini_items = parseInt(atts.tabletmini_items);
886            var mobile_items = parseInt(atts.mobile_items);
887            var mobilesmall_items = parseInt(atts.mobilesmall_items);
888
889            var slider_data = {
890                loop: true,
891                nav: nav,
892                dots: true,
893                navText: [, ],
894                navSpeed: 1000,
895                slideBy: 1,
896                rtl: $('body').hasClass('rtl'),
897                margin: margin,
898                navRewind: false,
899                autoplay: auto_play,
900                autoplayTimeout: 5000,
901                autoplayHoverPause: true,
902                autoplaySpeed: false,
903                autoHeight: true,
904                mouseDrag: true,
905                touchDrag: true,
906                responsiveBaseElement: $('body'),
907                responsiveRefreshRate: 400,
908                responsive: {
909                    0: {
910                        items: mobilesmall_items
911                    },
912                    490: {
913                        items: mobile_items
914                    },
915                    650: {
916                        items: tabletmini_items
917                    },
918                    768: {
919                        items: tablet_items
920                    },
921                    991: {
922                        items: desksmall_items
923                    },
924                    1199: {
925                        items: columns
926                    }
927                },
928                onInitialized: function() {
929                    element.find('.meta-slider').addClass('loaded').removeClass('loading');
930                }
931            };
932            element.find('.meta-slider > .blogs').owlCarousel(slider_data);
933        }
934        
935        var masonry = false;
936        if (atts.is_masonry && typeof $.fn.isotope == 'function') {
937            masonry = true;
938        }
939
940        if (masonry) {
941            $(window).on('load', function() {
942                element.find('.blogs').isotope();
943            });
944        }
945        /* Show more */
946        element.find('a.load-more').on('click', function () {
947            var button = $(this);
948            if (button.hasClass('loading')) {
949                return false;
950            }
951
952            button.addClass('loading');
953            var paged = button.attr('data-paged');
954
955            $.ajax({
956                type: "POST",
957                timeout: 30000,
958                url: ftc_shortcode_params.ajax_uri,
959                data: {
960                    action: 'ftc_blogs_load_items',
961                    paged: paged,
962                    atts: atts
963                },
964                error: function (xhr, err) {
965
966                },
967                success: function (response) {
968                    button.removeClass('loading');
969                    button.attr('data-paged', ++paged);
970                    if (response != 0 && response != '') {
971                        if (masonry) {
972                            element.find('.blogs').isotope('insert', $(response));
973                            setTimeout(function () {
974                                element.find('.blogs').isotope('layout');
975                            }, 500);
976                        } else { /* Append and Update first-last classes */
977                            element.find('.blogs').append(response);
978
979                            var columns = parseInt(atts.columns);
980                            element.find('.blogs .item').removeClass('first last');
981                            element.find('.blogs .item').each(function (index, ele) {
982                                if (index % columns == 0) {
983                                    $(ele).addClass('first');
984                                }
985                                if (index % columns == columns - 1) {
986                                    $(ele).addClass('last');
987                                }
988                            });
989                        }
990                        ftc_blog_gallery();
991                    } else { /* No results */
992                        button.parent().remove();
993                    }
994                }
995            });
996
997            return false;
998        });
999
1000    });
1001// Gallery post, image slider
1002function ftc_blog_gallery() {
1003    $('.blog-image.gallery,.ftc-image-slider .ftc__slider__image').each(function () {
1004        $(this).addClass('loaded').removeClass('loading');
1005        $(this).owlCarousel({
1006            items: 1
1007            ,loop: true
1008            ,nav: true
1009            ,dots: true
1010            ,navText: [,]
1011            ,navSpeed: 1000
1012            ,slideBy: 1
1013            ,rtl: $('body').hasClass('rtl')
1014            ,margin: 10
1015            ,navRewind: false
1016            ,autoplay: true
1017            ,autoplayTimeout: 1000
1018            ,autoplayHoverPause: true
1019            ,autoplaySpeed: 4000
1020            ,autoHeight: true
1021            ,responsive:{
1022                0:{
1023                    items : 1
1024                }
1025            }
1026
1027        });
1028
1029    });
1030}
1031ftc_blog_gallery();
1032
1033$('.slider-product-8.ftc-product-slider').each(function () { 
1034    var dot = $('.owl-dots .owl-dot');      
1035    dot.each(function() {
1036        var index = $(this).index() + 1;
1037        if(index < 10){
1038            $(this).html('').append(index);
1039        }else{
1040         $(this).html(index);
1041     }
1042 });   
1043
1044});
1045
1046
1047
1048     // Woocommerce Quantity on GitHub
1049     $( document ).on( 'click', '.plus, .minus', function() {
1050
1051        // Get values
1052        var $qty        = $( this ).closest( '.quantity' ).find( '.qty' ),
1053        currentVal  = parseFloat( $qty.val() ),
1054        max         = parseFloat( $qty.attr( 'max' ) ),
1055        min         = parseFloat( $qty.attr( 'min' ) ),
1056        step        = $qty.attr( 'step' );
1057
1058        // Format values
1059        if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0;
1060        if ( max === '' || max === 'NaN' ) max = '';
1061        if ( min === '' || min === 'NaN' ) min = 0;
1062        if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) === 'NaN' ) step = 1;
1063
1064        // Change the value
1065        if ( $( this ).is( '.plus' ) ) {
1066
1067            if ( max && ( max == currentVal || currentVal > max ) ) {
1068                $qty.val( max );
1069            } else {
1070                $qty.val( currentVal + parseFloat( step ) );
1071            }
1072
1073        } else {
1074
1075            if ( min && ( min == currentVal || currentVal < min ) ) {
1076                $qty.val( min );
1077            } else if ( currentVal > 0 ) {
1078                $qty.val( currentVal - parseFloat( step ) );
1079            }
1080
1081        }
1082
1083        // Trigger change event
1084        $qty.trigger( 'change' );
1085
1086    });
1087     /* Product thumbnails slider */
1088     if ($('.single-product').length > 0) {
1089        /* Horizontal slider */
1090        var wrapper = $('.single-product .product:not(.vertical-thumbnail) .details-img .thumbnails.loading');
1091        wrapper.find('.details_thumbnails.owl-carousel').owlCarousel({
1092            loop: false
1093            , nav: true
1094            , navText: [, ]
1095            , dots: false
1096            , navSpeed: 1000
1097            , rtl: $('body').hasClass('rtl')
1098            , margin: 16
1099            , navRewind: false
1100            , autoplay: true
1101            , autoplayHoverPause: true
1102            , autoplaySpeed: 1000
1103            , responsiveBaseElement: wrapper
1104            , responsiveRefreshRate: 1000
1105            , responsive: {
1106                0: {
1107                    items: 1
1108                },
1109                100: {
1110                    items: 2
1111                },
1112                300: {
1113                    items: 3
1114                }
1115            }
1116            , onInitialized: function () {
1117                wrapper.addClass('loaded').removeClass('loading');
1118            }
1119        });
1120
1121        /* Vertical slider */
1122        var wrapper = $('.single-product .product.vertical-thumbnail .details-img .thumbnails.loading');
1123
1124        if (wrapper.length > 0 && typeof $.fn.carouFredSel == 'function') {
1125            var items = 4;
1126            if ($('#left-sidebar').length > 0 || $('#right-sidebar').length > 0) {
1127                items = 3;
1128            }
1129            if ($('#left-sidebar').length > 0 && $('#right-sidebar').length > 0) {
1130                items = 4;
1131            }
1132
1133            var _slider_data = {
1134                items: items
1135                , direction: 'up'
1136                , width: 'auto'
1137                , height: '150px'
1138                , infinite: true
1139                , prev: wrapper.find('.owl-prev').selector
1140                , next: wrapper.find('.owl-next').selector
1141                , auto: {
1142                    play: true
1143                    , timeoutDuration: 5000
1144                    , duration: 800
1145                    , delay: 3000
1146                    , items: 1
1147                    , pauseOnHover: true
1148                }
1149                , scroll: {
1150                    items: 1
1151                }
1152                , swipe: {
1153                    onTouch: true
1154                    , onMouse: true
1155                }
1156                , onCreate: function () {
1157                    wrapper.addClass('loaded').removeClass('loading');
1158                }
1159            };
1160
1161            wrapper.find('.details_thumbnails').carouFredSel(_slider_data);
1162            
1163
1164            $(window).on('load', function () {
1165                $(window).trigger('resize');
1166            });
1167
1168            $(window).on('resize orientationchange', $.debounce(250, function () {
1169                if ($(window).width() < 420) {
1170                    _slider_data.items = 2;
1171                } else if ($(window).width() < 500) {
1172                    _slider_data.items = 3;
1173                } else if ($(window).width() < 768) {
1174                    _slider_data.items = 4;
1175                } else {
1176                    _slider_data.items = items;
1177                }
1178                wrapper.find('.details_thumbnails').trigger('configuration', _slider_data);
1179            }));
1180        }
1181    }
1182
1183    var wrapper = $('.single-product .ftc-adzoom.details-img.vertical .images .images');
1184
1185    if (wrapper.length > 0 && typeof $.fn.carouFredSel == 'function') {
1186        var items = 4;
1187        if ($('#left-sidebar').length > 0 || $('#right-sidebar').length > 0) {
1188            items = 3;
1189        }
1190        if ($('#left-sidebar').length > 0 && $('#right-sidebar').length > 0) {
1191            items = 4;
1192        }
1193
1194        var _slider_data = {
1195            items: items
1196            , direction: 'up'
1197            , width: 'auto'
1198            , height: '150px'
1199            , infinite: true
1200            , prev: wrapper.find('.owl-prev').selector
1201            , next: wrapper.find('.owl-next').selector
1202            , auto: {
1203                play: true
1204                , timeoutDuration: 5000
1205                , duration: 800
1206                , delay: 3000
1207                , items: 1
1208                , pauseOnHover: true
1209            }
1210            , scroll: {
1211                items: 1
1212            }
1213            , swipe: {
1214                onTouch: true
1215                , onMouse: true
1216            }
1217            , onCreate: function () {
1218                wrapper.addClass('loaded').removeClass('loading');
1219            }
1220        };
1221
1222        wrapper.find('.flex-control-thumbs').carouFredSel(_slider_data);
1223
1224        $(window).on('load', function () {
1225            $(window).trigger('resize');
1226        });
1227
1228        $(window).on('resize orientationchange', $.debounce(250, function () {
1229            if ($(window).width() < 420) {
1230                _slider_data.items = 2;
1231            } else if ($(window).width() < 500) {
1232                _slider_data.items = 3;
1233            } else if ($(window).width() < 768) {
1234                _slider_data.items = 4;
1235            } else {
1236                _slider_data.items = items;
1237            }
1238            wrapper.find('.flex-control-thumbs').trigger('configuration', _slider_data);
1239        }));
1240    }
1241    
1242    // Related products
1243    $('.single-product .related .products').each(function () {
1244     $(this).addClass('loaded').removeClass('loading');
1245     $(this).owlCarousel({ 
1246        loop: false
1247        , nav: true
1248        , navText: [, ]
1249        , dots: true
1250        , navSpeed: 1000
1251        , slideBy: 1
1252        , rtl: jQuery('body').hasClass('rtl')
1253        , margin: 0
1254        , autoplayTimeout: 5000
1255        , responsiveRefreshRate: 400
1256        , responsive: {
1257            0: {
1258                items: 2
1259            },
1260            520: {
1261                items: 2
1262            },
1263            640: {
1264                items: 3
1265            },
1266            950: {
1267                items: 4
1268            }
1269        }       
1270    });
1271
1272 });
1273    $('.single-product .up-sells .products,.woocommerce .cross-sells .products,.single-product .ftc-cross-sells .products, .woocommerce .ftc-cross-sells .products').each(function () {
1274     $(this).addClass('loaded').removeClass('loading');
1275     $(this).owlCarousel({ 
1276        loop: false
1277        , nav: true
1278        , navText: [, ]
1279        , dots: true
1280        , navSpeed: 1000
1281        , slideBy: 1
1282        , rtl: jQuery('body').hasClass('rtl')
1283        , margin: 0
1284        , autoplayTimeout: 5000
1285        , responsiveRefreshRate: 400
1286        , responsive: {
1287            0: {
1288                items: 2
1289            },
1290            520: {
1291                items: 2
1292            },
1293            640: {
1294                items: 3
1295            },
1296            950: {
1297                items: 4
1298            },
1299            1199: {
1300                items: 4
1301              }
1302        }       
1303    });
1304
1305 });
1306
1307// Related post
1308$('.single-post .related-posts.loading .meta-slider .blogs').each(function () {
1309 $(this).addClass('loaded').removeClass('loading');
1310 $(this).owlCarousel({ 
1311    loop: true
1312    , nav: false
1313    , navText: [, ]
1314    , dots: false
1315    , navSpeed: 1000
1316    , slideBy: 1
1317    , rtl: jQuery('body').hasClass('rtl')
1318    , margin: 30
1319    , autoplayTimeout: 5000
1320    , responsiveRefreshRate: 400
1321    , responsive: {
1322        0: {
1323            items: 1
1324        },
1325        600: {
1326            items: 2
1327        },
1328        800: {
1329            items: 2
1330        }
1331    }       
1332});
1333
1334});
1335
1336 // Category dropdown
1337 $(document).on('click', '.widget_categories span.icon-toggle', function(){
1338    if (!$(this).parent().hasClass('active')) {
1339        $(this).parent().find('ul.children:first').slideDown(300);
1340        $(this).parent().addClass('active');
1341    } else {
1342        $(this).parent().find('ul.children').slideUp(300);
1343        $(this).parent().removeClass('active');
1344        $(this).parent().find('li.cat-parent').removeClass('active');
1345    }
1346});
1347 $('.widget_categories li.current-cat').siblings('.icon-toggle').parents('ul.children').trigger('click').slideUp(300); 
1348
1349 $(document).on('click', '.widget-container.ftc-product-categories-widget .icon-toggle', function(){
1350
1351    if (!$(this).parent().hasClass('active')) {
1352        $(this).parent().addClass('active');
1353        $(this).parent().find('ul.children:first').slideDown(300);
1354    } else {
1355       $(this).parent().find('ul.children').slideUp(300);
1356       $(this).parent().removeClass('active');
1357       $(this).parent().find('li.cat-parent').removeClass('active');
1358   }
1359});
1360
1361 $('.widget-container.ftc-product-categories-widget').each(function (){  
1362    $(this).find('ul.children').parent('li').addClass('cat-parent');
1363    $(this).find('li.current').parents('ul.children').siblings('.icon-toggle').trigger('click');
1364});
1365
1366 $('.widget-container.widget_categories').each(function (){  
1367    $(this).find('ul.children').parent('li').addClass('cat-parent');
1368    $(this).find('li.current').parents('ul.children').siblings('.icon-toggle').trigger('click');
1369});
1370 $(".widget-container.widget_categories li.cat-parent").on("click",function () {
1371    $(this).find("ul.children").slideToggle("fast");
1372    $(this).toggleClass('active');
1373});
1374 
1375 
1376 $('.widget-container.yith-woocommerce-ajax-product-filter').each(function (){  
1377    $(this).find('ul.children').parent('li').addClass('cat-parent');
1378    $(this).find('li.current').parents('ul.children').siblings('.icon-toggle').trigger('click');
1379});
1380 $(".widget-container.yith-woocommerce-ajax-product-filter li.cat-parent").on("click",function () {
1381    $(this).find("ul.children").slideToggle("fast");
1382    $(this).toggleClass('active');
1383});
1384
1385 $('.widget-title-wrapper a.block-control').on('click', function (e) {
1386    e.preventDefault();
1387    $(this).parent().siblings().slideToggle(400);
1388    $(this).toggleClass('active');
1389});
1390
1391 ftc_widget_on_off();
1392 if (!on_touch) {
1393    $(window).on('resize', $.throttle(250, function () {
1394        ftc_widget_on_off();
1395    }));
1396}
1397    // Woocommerce Order by
1398    $('form.woocommerce-ordering ul.orderby ul a').on('click', function (e) {
1399        e.preventDefault();
1400        if ($(this).hasClass('current')) {
1401            return;
1402        }
1403        $(this).closest('form.woocommerce-ordering').find('select.orderby').val($(this).attr('data-orderby'));
1404        $(this).closest('form.woocommerce-ordering').submit();
1405    });
1406    // Product slider in tab 
1407    function ftc_slider_products_categorytabs_is_slider(element, show_nav, auto_play, columns, responsive, margin) {
1408        if (element.find('.products .ftc-products').length > 0) {
1409            show_nav = (show_nav == 1) ? true : false;
1410            auto_play = (auto_play == 1) ? true : false;
1411            columns = parseInt(columns);
1412            var _slider_data = {
1413                loop: true
1414                , nav: show_nav
1415                , navText: [, ]
1416                , dots: true
1417                , navSpeed: 1000
1418                , slideBy: 1
1419                , rtl: $('body').hasClass('rtl')
1420                , margin: 0
1421                , navRewind: false
1422                , autoplay: auto_play
1423                , autoplayTimeout: 5000
1424                , autoplayHoverPause: false
1425                , autoplaySpeed: 1000
1426                , mouseDrag: true
1427                , touchDrag: true
1428                , responsiveBaseElement: $('body').find('.products')
1429                , responsiveRefreshRate: 400
1430                , responsive: {
1431                    0: {
1432                        items: 1
1433                    },
1434                    320: {
1435                        items: 2
1436                    },
1437                    470: {
1438                        items: 3
1439                    },
1440                    670: {
1441                        items: 4
1442                    },
1443                    870: {
1444                        items: 5
1445                    },
1446                    1100: {
1447                        items: columns
1448                    }
1449                }
1450                , onInitialized: function () {
1451
1452                }
1453            };
1454
1455            if (responsive != undefined) {
1456                _slider_data.responsive = responsive;
1457            }
1458
1459            if (margin != undefined) {
1460                _slider_data.margin = margin;
1461            }
1462
1463            element.find('.products').owlCarousel(_slider_data);
1464        }
1465    }
1466
1467    var ftc_type_of_products_data = [];
1468    
1469    $('.ftc-products-category .row-tabs .tab-item').on('click', function () {
1470        /* Tab */
1471        if ($(this).hasClass('current') || $(this).parents('.ftc-products-category').find('.row-content').hasClass('loading')) {
1472            return;
1473        }
1474        $(this).parents('.ftc-products-category').find('.row-tabs .tab-item').removeClass('current');
1475        $(this).addClass('current')
1476
1477        var element =$(this).parents('.ftc-products-category') ;
1478        var atts = element.data('atts');
1479        var margin = 0; 
1480        var responsive = {
1481            0: {
1482                items: 2
1483            }, 
1484            440: {
1485                items: 2
1486            }, 
1487            900: {
1488                items: 3
1489            }, 
1490            1000: {
1491                items: atts.columns
1492            }
1493        };              
1494        if (ftc_type_of_products_data[$(this).parents('.ftc-products-category').attr('id')] != undefined) {          
1495            if (typeof ftc_quickshop_process_action == 'function') {
1496                ftc_quickshop_process_action();
1497            }
1498            $(this).parents('.ftc-products-category').find('.lazy-loading img').each(function () {
1499                if ($(this).data('src')) {
1500                    $(this).attr('src', $(this).data('src'));
1501                }
1502            });
1503            $(this).parents('.ftc-products-category').find('.lazy-loading').removeClass('lazy-loading').addClass('lazy-loaded');           
1504        }
1505        $(this).parents('.ftc-products-category').find('.row-content').addClass('loading');
1506
1507        $.ajax({
1508            type: "POST",
1509            timeout: 30000,
1510            url: ftc_shortcode_params.ajax_uri,
1511            data: {
1512                action: 'ftc_get_product_content_in_category_tab_2',
1513                atts: atts,
1514                product_cat: $(this).data('product_cat')
1515            },
1516            error: function (xhr, err) {
1517            },
1518            success: function (response) {
1519                if (response) {                    
1520                    element.find('.column-products .products.owl-carousel').owlCarousel('destroy');
1521                    element.find('.row-content > div').remove();
1522                    element.find('.row-content').append(response);
1523                    if (typeof ftc_quickshop_process_action == 'function') {
1524                        ftc_quickshop_process_action();
1525                    } 
1526                    ftc_countdown(element.find('.product .counter-wrapper'));
1527                    ftc_slider_products_categorytabs_is_slider(element, atts.show_nav, atts.auto_play, atts.columns, responsive, margin);
1528                }
1529                element.find('.row-content').removeClass('loading');
1530            }
1531        });
1532    });
1533
1534    $('.ftc-products-category').each(function () {
1535        var current_tab = 1;
1536        var count_tab = $(this).find('.row-tabs .tab-item').length;
1537        var atts = $(this).data('atts');
1538        if (atts.current_tab != undefined) {
1539            var defined_current_tab = parseInt(atts.current_tab);
1540            if (defined_current_tab > 1 && defined_current_tab <= count_tab) {
1541                current_tab = defined_current_tab;
1542            }
1543        }
1544
1545        $(this).find('.row-tabs .tab-item').eq(current_tab - 1).trigger('click');
1546    });
1547
1548// Countdown
1549function ftc_countdown(countdown) {
1550    if (countdown.length > 0) {
1551        var interval = setInterval(function () {
1552            countdown.each(function (index,countdown) {
1553                var day = 0;
1554                var hour = 0;
1555                var minute = 0;
1556                var second = 0;
1557
1558                var delta = 0;
1559                var time_day = 60 * 60 * 24;
1560                var time_hour = 60 * 60;
1561                var time_minute = 60;
1562
1563                $(countdown).find('.days .number-wrapper .number').each(function (i, e) {
1564                    day = parseInt($(e).text());
1565                });
1566                $(countdown).find('.hours .number-wrapper .number').each(function (i, e) {
1567                    hour = parseInt($(e).text());
1568                });
1569                $(countdown).find('.minutes .number-wrapper .number').each(function (i, e) {
1570                    minute = parseInt($(e).text());
1571                });
1572                $(countdown).find('.seconds .number-wrapper .number').each(function (i, e) {
1573                    second = parseInt($(e).text());
1574                });
1575
1576                if (day != 0 || hour != 0 || minute != 0 || second != 0) {
1577                    delta = (day * time_day) + (hour * time_hour) + (minute * time_minute) + second;
1578                    delta--;
1579
1580                    day = Math.floor(delta / time_day);
1581                    delta -= day * time_day;
1582
1583                    hour = Math.floor(delta / time_hour);
1584                    delta -= hour * time_hour;
1585
1586                    minute = Math.floor(delta / time_minute);
1587                    delta -= minute * time_minute;
1588
1589                    if (delta > 0) {
1590                        second = delta;
1591                    } else {
1592                        second = '0';
1593                    }
1594
1595                    day = (day < 10) ? ftc_start_number_timer(day, 2) : day.toString();
1596                    hour = (hour < 10) ? ftc_start_number_timer(hour, 2) : hour.toString();
1597                    minute = (minute < 10) ? ftc_start_number_timer(minute, 2) : minute.toString();
1598                    second = (second < 10) ? ftc_start_number_timer(second, 2) : second.toString();
1599
1600                    $(countdown).find('.days .number-wrapper .number').each(function (i, e) {
1601                        $(e).text(day);
1602                    });
1603
1604                    $(countdown).find('.hours .number-wrapper .number').each(function (i, e) {
1605                        $(e).text(hour);
1606                    });
1607
1608                    $(countdown).find('.minutes .number-wrapper .number').each(function (i, e) {
1609                        $(e).text(minute);
1610                    });
1611
1612                    $(countdown).find('.seconds .number-wrapper .number').each(function (i, e) {
1613                        $(e).text(second);
1614                    });
1615                }
1616
1617            });
1618        }, 1000);
1619    }
1620}
1621
1622ftc_countdown($('.product .counter-wrapper, .ftc-countdown .counter-wrapper'));
1623function ftc_start_number_timer(str, max) {
1624    str = str.toString();
1625    return str.length < max ? ftc_start_number_timer('0' + str, max) : str;
1626}
1627 // Testimonial         
1628 $('.test-home11.ftc-sb-testimonial.ftc-slider').each(function () {
1629    var slider = true;
1630    if ($(this).find('.item').length <= 1) {
1631        slider = false;
1632    }
1633    var columns = 1;
1634    if (slider) {
1635     var nav = $(this).data('nav') == 1;
1636     var dots = $(this).data('dots') == 1;
1637     columns = $(this).data('columns');
1638     var autoplay = $(this).data('autoplay') == 1;                
1639     $(this).addClass('loaded').removeClass('loading');
1640     $(this).owlCarousel({
1641        items: 1
1642        , loop: true
1643        , nav: nav
1644        , dots: dots
1645        , animateIn: 'fadeIn'
1646        , animateOut: 'fadeOut'
1647        , navText: [, ]
1648        , navSpeed: 1000
1649        , rtl: $('body').hasClass('rtl')
1650        , margin: 0
1651        , autoplay: autoplay
1652        , autoplayTimeout: 5000
1653        , center: true
1654        , responsive: {
1655            0: {
1656                items: 3
1657            },
1658            700: {
1659                items: columns
1660            }
1661        }
1662    });
1663 }
1664});
1665 $('.ftc-sb-testimonial.ftc-slider').each(function () {
1666    var slider = true;
1667    if ($(this).find('.item').length <= 1) {
1668        slider = false;
1669    }
1670    var columns = 1;
1671    if (slider) {
1672     var nav = $(this).data('nav') == 1;
1673     var dots = $(this).data('dots') == 1;
1674     columns = $(this).data('columns');
1675     var autoplay = $(this).data('autoplay') == 1;                
1676     $(this).addClass('loaded').removeClass('loading');
1677     $(this).owlCarousel({
1678        items: 1
1679        , loop: true
1680        , nav: nav
1681        , dots: dots
1682        , animateIn: 'fadeIn'
1683        , animateOut: 'fadeOut'
1684        , navText: [, ]
1685        , navSpeed: 1000
1686        , rtl: $('body').hasClass('rtl')
1687        , margin: 30
1688        , autoplay: autoplay
1689        , autoplayTimeout: 5000
1690        , center: false
1691        , responsive: {
1692            0: {
1693                items: 1
1694            },
1695            700: {
1696                items: columns
1697            }
1698        }
1699    });
1700 }
1701});
1702
1703// Google map
1704function ftc_googlemap_start_up(map_content_obj, address, zoom, map_type, title) {
1705    var geocoder, map;
1706    geocoder = new google.maps.Geocoder();
1707
1708    geocoder.geocode({'address': address}, function (results, status) {
1709        if (status == google.maps.GeocoderStatus.OK) {
1710            var _ret_array = new Array(results[0].geometry.location.lat(), results[0].geometry.location.lng());
1711            map.setCenter(results[0].geometry.location);
1712            var marker = new google.maps.Marker({
1713                map: map
1714                , title: title
1715                , position: results[0].geometry.location
1716            });
1717        }
1718    });
1719
1720    var mapCanvas = map_content_obj.get(0);
1721    var mapOptions = {
1722        center: new google.maps.LatLng(44.5403, -78.5463)
1723        , zoom: zoom
1724        , mapTypeId: google.maps.MapTypeId[map_type]
1725        , scrollwheel: false
1726        , zoomControl: true
1727        , panControl: true
1728        , scaleControl: true
1729        , streetViewControl: false
1730        , overviewMapControl: true
1731        , disableDoubleClickZoom: false
1732    }
1733    map = new google.maps.Map(mapCanvas, mapOptions)
1734}
1735
1736$(window).on('load resize', function () {
1737    $('.google-map-container').each(function () {
1738        var element = $(this);
1739        var map_content = $(this).find('> div');
1740        var address = element.data('address');
1741        var zoom = element.data('zoom');
1742        var map_type = element.data('map_type');
1743        var title = element.data('title');
1744        ftc_googlemap_start_up(map_content, address, zoom, map_type, title);
1745    });
1746});
1747
1748 // Product widget
1749 $('.ftc-product-items-widget.ftc-slider').each(function () {      
1750    var nav = $(this).data('nav') == 1;
1751    var auto_play = $(this).data('auto_play') == 1;
1752    var columns = $(this).data('columns');
1753    var margin = $(this).data('margin');
1754
1755    $(this).owlCarousel({
1756        loop: true
1757        , items: 1
1758        , nav: nav
1759        , navText: [, ]
1760        , dots: false
1761        , navSpeed: 1000
1762        , slideBy: 1
1763        , rtl: $('body').hasClass('rtl')
1764        , navRewind: false
1765        , columns: columns
1766        , margin: margin
1767        , autoplay: auto_play
1768        , autoplayTimeout: 5000
1769        , responsiveRefreshRate: 1000
1770        , responsive: {
1771            0: {
1772                items: columns
1773            }
1774        }
1775    });
1776});
1777
1778 function ftc_update_information_tini_wishlist() {
1779    if (typeof ftc_shortcode_params.ajax_uri == 'undefined') {
1780        return;
1781    }
1782    var wishlist = jQuery('.ftc-my-wishlist');
1783    if (wishlist.length == 0) {
1784        return;
1785    }
1786
1787    wishlist.addClass('loading');
1788    jQuery.ajax({
1789        type: 'POST'
1790        , url: ftc_shortcode_params.ajax_uri
1791        , data: {
1792            action: 'update_tini_wishlist'
1793        }
1794        , success: function (response) {
1795            var first_icon = wishlist.children('i.fa:first');
1796            wishlist.html(response);
1797            if (first_icon.length > 0) {
1798                wishlist.prepend(first_icon);
1799            }
1800            wishlist.removeClass('loading');
1801        }
1802    });
1803}
1804
1805$('body').on('added_to_wishlist', function () {
1806    ftc_update_information_tini_wishlist();
1807    $('.yith-wcwl-wishlistaddedbrowse.show, .yith-wcwl-wishlistexistsbrowse.show').closest('.yith-wcwl-add-to-wis
1807hlist').addClass('added');
1808});
1809$(document).on('click', '#yith-wcwl-form table tbody tr td a.remove, #yith-wcwl-form table tbody tr td a.add_to_cart_button', function () {
1810    var old_num_product = $('#yith-wcwl-form table tbody tr[id^="yith-wcwl-row"]').length;
1811    var count = 1;
1812    var time_interval = setInterval(function () {
1813        count++;
1814        var new_num_product = $('#yith-wcwl-form table tbody tr[id^="yith-wcwl-row"]').length;
1815        if (old_num_product != new_num_product || count == 20) {
1816            clearInterval(time_interval);
1817            ftc_update_information_tini_wishlist();
1818        }
1819    }, 500);
1820});
1821/* Product  360*/
1822$('a.ftc-video360').magnificPopup({
1823    type: 'inline',
1824    mainClass: 'product-360',
1825    preloader: false,
1826    fixedContentPos: false,
1827    callbacks: {
1828        open: function() {
1829            $(window).resize()
1830        },
1831    },
1832});
1833
1834/* Infinite-Shop */
1835function ftc_infinite_shop() {
1836    var container = $('.archive.infinite .woocommerce > .products, .archive.term-all-goods .woocommerce > .products'),
1837    paginationNext = '.woocommerce-pagination li a.next';
1838    if (container.length === 0 || $(paginationNext).length === 0) {
1839        return;
1840    }
1841    var loadProduct = container.infiniteScroll({
1842        path: paginationNext,
1843        append: '.product',
1844        checkLastPage: true,
1845        status: '.page-load-status',
1846        hideNav: '.woocommerce-pagination',
1847        history: 'push',
1848        debug: false,
1849        scrollThreshold: 400,
1850        loadOnScroll: true
1851    });
1852    loadProduct.on('append.infiniteScroll', function (event, response, path, items) {
1853        $('img.ftc-lazy-load').on('load', function () {
1854            $(this).parents('.lazy-loading').removeClass('lazy-loading').addClass('lazy-loaded');
1855        });
1856        $('img.ftc-lazy-load').each(function () {
1857            if ($(this).data('src')) {
1858                $(this).attr('src', $(this).data('src'));
1859            }
1860        });
1861        ftc_quickshop_process_action();
1862    })
1863}
1864
1865ftc_infinite_shop();
1866
1867/* Product  360*/
1868$('a.ftc-video360').magnificPopup({
1869    type: 'inline',
1870    mainClass: 'product-360',
1871    preloader: false,
1872    fixedContentPos: false,
1873    callbacks: {
1874        open: function () {
1875            $(window).resize()
1876        },
1877    },
1878});
1879
1880function ftc_quickshop_process_action() {
1881    jQuery('a.quickview').prettyPhoto({
1882        deeplinking: false
1883        , opacity: 0.9
1884        , social_tools: false
1885        , default_width: 900
1886        , default_height: 450
1887        , theme: 'pp_woocommerce'
1888        , changepicturecallback: function () {
1889            jQuery('.pp_inline').find('form.variations_form').wc_variation_form();
1890            jQuery('.pp_inline').find('form.variations_form .variations select').change();
1891            jQuery('body').trigger('wc_fragments_loaded');
1892
1893            jQuery('.pp_inline .variations_form').on('click', '.reset_variations', function () {
1894                jQuery(this).closest('.variations').find('.ftc-product-attribute .option').removeClass('selected');
1895            });
1896
1897            jQuery('.pp_woocommerce').addClass('loaded');
1898
1899            var _this = jQuery('.ftc-quickshop-wrapper .images-slider-wrapper');
1900
1901            if (_this.find('.image-item').length <= 1) {
1902                return;
1903            }
1904
1905            var owl = _this.find('.image-items').owlCarousel({
1906                items: 1
1907                , loop: true
1908                , nav: true
1909                , navText: [, ]
1910                , dots: false
1911                , navSpeed: 1000
1912                , slideBy: 1
1913                , rtl: jQuery('body').hasClass('rtl')
1914                , margin: 10
1915                , navRewind: false
1916                , autoplay: false
1917                , autoplayTimeout: 5000
1918                , autoplayHoverPause: false
1919                , autoplaySpeed: false
1920                , mouseDrag: true
1921                , touchDrag: true
1922                , responsiveBaseElement: _this
1923                , responsiveRefreshRate: 1000
1924                , onInitialized: function () {
1925                    _this.addClass('loaded').removeClass('loading');
1926                }
1927            });
1928
1929        }
1930    });
1931
1932}
1933ftc_quickshop_process_action();
1934
1935function ftc_widget_on_off() {
1936    if (typeof ftc_shortcode_params._ftc_enable_responsive != 'undefined' && !ftc_shortcode_params._ftc_enable_responsive) {
1937        return;
1938    }
1939    jQuery('.wpb_widgetised_column .widget-title-wrapper a.block-control, .footer-container .widget-title-wrapper a.block-control').remove();
1940    var window_width = jQuery(window).width();
1941    window_width += ftc_take_width_of_scrollbar();
1942    if (window_width >= 992 ) {
1943
1944        jQuery('.widget-title-wrapper a.block-control').removeClass('active').hide();
1945        jQuery('.widget-title-wrapper a.block-control').parent().siblings().show();
1946    } else {
1947        jQuery('.widget-title-wrapper a.block-control').addClass('active').show();
1948        jQuery('.widget-title-wrapper a.block-control').parent().siblings().show();
1949        jQuery('.wpb_widgetised_column .widget-title-wrapper, .footer-container .widget-title-wrapper').siblings().show();
1950    }
1951}
1952
1953
1954(function (a) {
1955    jQuery.browser.ftc_mobile = /android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
1955sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))
1956})(navigator.userAgent || navigator.vendor || window.opera);
1957function ftc_is_device_like_smartphone() {
1958    var is_touch = !!("ontouchstart" in window) ? true : false;
1959    if (jQuery.browser.ftc_mobile) {
1960        is_touch = true;
1961    }
1962    return is_touch;
1963}
1964var on_touch = ftc_is_device_like_smartphone();
1965
1966function ftc_take_width_of_scrollbar() {
1967    var $inner = jQuery('<div style="width: 100%; height:200px;">test</div>'),
1968    $outer = jQuery('<div style="width:200px;height:150px; position: absolute; top: 0; left: 0; visibility: hidden; overflow:hidden;"></div>').append($inner),
1969    inner = $inner[0],
1970    outer = $outer[0];
1971
1972    jQuery('body').append(outer);
1973    var width1 = inner.offsetWidth;
1974    $outer.css('overflow', 'scroll');
1975    var width2 = outer.clientWidth;
1976    $outer.remove();
1977
1978    return (width1 - width2);
1979}
1980
1981    // Ajax Remove Cart
1982    if( $('ftc-shop-cart')){
1983        $(document).on('click', '.cart-item-wrapper .remove', function(event){
1984            event.preventDefault();
1985            $(this).closest('li').addClass('loading');
1986            
1987            jQuery.ajax({
1988                type : 'POST'
1989                ,url : ftc_shortcode_params.ajax_uri 
1990                ,data : {
1991                    action : 'ftc_remove_cart_item', 
1992                    cart_item_key : $(this).data('key'),
1993                    security: ftc_platform.ajax_nonce
1994                }
1995                ,success : function(data){
1996                    if ( data && data.fragments ) {
1997
1998                        $.each( data.fragments, function( key, value ) {
1999                            $( key ).replaceWith( value );
2000                        });
2001                    }
2002                }
2003            });
2004        });
2005    }
2006    
2007     //Milestone      
2008     if( typeof $.fn.waypoint == 'function' && typeof $.fn.countTo == 'function' ){
2009      $('.ftc-number').waypoint(function(){
2010       var element = $(this.element);
2011       var number = element.data('number');
2012       element.find('.number').countTo({
2013        from: 0
2014        ,to: number
2015        ,speed: 1000
2016        ,refreshInterval: 50,
2017        formatter: function (value, options) {
2018          return value.toFixed(options.decimals);
2019      },
2020      onUpdate: function (value) {
2021       console.debug(this);
2022   },
2023   onComplete: function (value) {
2024       console.debug(this);
2025   }
2026});
2027   }, {offset: '100%'});
2028  }
2029  $(document).on('mouseenter', '.ftc_thumb_list_hover', function(){
2030     $(this).closest(".ftc-product").find(".item-image a img").attr("src",$(this).attr("data-hover"));   
2031 }); 
2032
2033 // Parallax Background Speed
2034 function ftc_parallax_background(){
2035    jQuery('.ftc-prlx-background').each(function(){
2036        var prlx_speed = jQuery(this).data('prlx-speed');
2037        if( typeof prlx_speed == 'undefined' ){
2038            prlx_speed = 1;
2039        }
2040        prlx_speed = parseFloat(prlx_speed);
2041
2042        jQuery(this).parallax('50%', prlx_speed);
2043    });
2044}
2045ftc_parallax_background();
2046
2047/* show/hide filter products */
2048/*if ($(this).width() < 991 ) {
2049    $('.widget-container.widget_text .widget-title').on('click', function(){
2050        $('.widget-container.widget_layered_nav, .widget-container.widget_price_filter').slideToggle();
2051        $('.widget-container.widget_layered_nav, .widget-container.widget_price_filter').toggleClass('show');
2052        $(this).toggleClass('active');
2053        return true;
2054    });
2055}*/
2056
2057/*filter by products*/
2058if ($(this).width()<991) {
2059    $('.button-sidebar').bind('click', function(){
2060        $('body').toggleClass("sidebar-show");
2061        $('.button-sidebar').toggleClass('active');
2062        $('.archive .ftc-sidebar, .single-product .ftc-sidebar').toggleClass("show-popup");
2063
2064        $('body').on("click", ".ftc-close-popup", function(){
2065            $('.archive .ftc-sidebar, .single-product .ftc-sidebar').removeClass('show-popup');
2066            $('body').removeClass("sidebar-show");
2067            $('.button-sidebar').removeClass('active');
2068        });
2069        return false;
2070    });
2071
2072}
2073
2074/*Scroll animation Shop*/
2075// Detect request animation frame
2076var scroll = window.requestAnimationFrame ||
2077// IE Fallback
2078function(callback){ window.setTimeout(callback, 1000/60)};
2079var elementsToShow = document.querySelectorAll('.archive .animation-shop .ftc-product.product');
2080
2081function ftc_animation_loop() {
2082
2083    Array.prototype.forEach.call(elementsToShow, function(element){
2084        if (isElementInViewport(element)) {
2085            element.classList.add('is-visible');
2086        } else {
2087            element.classList.remove('is-visible');
2088        }
2089    });
2090
2091    scroll(ftc_animation_loop);
2092}
2093
2094// Call the loop for the first time
2095ftc_animation_loop();
2096
2097function isElementInViewport(el) {
2098// special bonus for those using jQuery
2099if (typeof jQuery === "function" && el instanceof jQuery) {
2100    el = el[0];
2101}
2102var rect = el.getBoundingClientRect();
2103return (
2104    (rect.top <= 0
2105        && rect.bottom >= 0)
2106    ||
2107    (rect.bottom >= (window.innerHeight || document.documentElement.clientHeight) &&
2108        rect.top <= (window.innerHeight || document.documentElement.clientHeight))
2109    ||
2110    (rect.top >= 0 &&
2111        rect.bottom <= (window.innerHeight || document.documentElement.clientHeight))
2112    );
2113}
2114
2115/*Load more button product in shop*/
2116function ftc_button_loadmore_infinite(){
2117    var paginationNext = ".woocommerce-pagination li a.next";
2118    var $container = $('.ftc-button-infinite .woocommerce .products').infiniteScroll({
2119// options...
2120path: paginationNext,
2121append: ".product",
2122checkLastPage: true,
2123status: ".ftc-loading-shop",
2124hideNav: ".woocommerce-pagination",
2125history: "push",
2126debug: false,
2127scrollThreshold: 400,
2128loadOnScroll: false,
2129// enable button
2130button: '.ftc-load-more-button-shop',
2131});
2132    $container.on("append.infiniteScroll", function(event, response, path, items){
2133        $("img.ftc-lazy-load").on("load", function() {
2134            $(this)
2135            .parents(".lazy-loading")
2136            .removeClass("lazy-loading")
2137            .addClass("lazy-loaded");
2138        });
2139        $("img.ftc-lazy-load").each(function() {
2140            if ($(this).data("src")) {
2141                $(this).attr("src", $(this).data("src"));
2142            }
2143        });
2144        ftc_quickshop_process_action();
2145    });
2146
2147    var $viewMoreButton = $('.ftc-load-more-button-shop');
2148
2149// get Infinite Scroll instance
2150var infScroll = $container.data('infiniteScroll');
2151
2152$container.on( 'load.infiniteScroll', onPageLoad );
2153 $container.on( 'last.infiniteScroll', onPageLoad, function( event, body, path ) {
2154        $viewMoreButton.remove();
2155    });
2156
2157ftc_animation_loop();
2158
2159function onPageLoad() {
2160    if ( infScroll.loadCount == 1 ) {
2161    // after 2nd page loaded
2162    // disable loading on scroll
2163    $container.infiniteScroll( 'option', {
2164        loadOnScroll: false,
2165    });
2166    // show button
2167    $viewMoreButton.show();
2168    // remove event listener
2169    $container.off( 'load.infiniteScroll', onPageLoad );
2170
2171}
2172}
2173}
2174ftc_button_loadmore_infinite();
2175
2176/*Shop Carousel*/
2177$(".archive .products.slider-shop").each(function() {
2178
2179    var _slider_data = {
2180        loop: true,
2181        nav: true,
2182        dots: true,
2183        navSpeed: 1000,
2184        navText: [,],
2185        rtl: $("body").hasClass("rtl"),
2186        margin: 0,
2187        autoplay: true,
2188        autoplayTimeout: 5000,
2189        autoplaySpeed: 4000,
2190        responsiveBaseElement: $("body"),
2191        responsiveRefreshRate: 400,
2192        responsive: {
2193            0: {
2194                items: 2,
2195                margin: 0,
2196
2197            },
2198            480: {
2199                items: 2
2200            },
2201            640: {
2202                items: 3
2203            },
2204            768: {
2205                items: 3
2206            },
2207            991: {
2208                items: 4
2209            },
2210            1199: {
2211                items: 4
2212            }
2213        },
2214        onInitialized: function() {
2215            $('.archive .products.slider-shop').append("<div class='container-load'><div class='ftc-loader'><div class='loader--dot'></div><div class='loader--dot'></div><div class='loader--dot'></div><div class='loader--dot'></div><div class='loader--dot'></div><div class='loader--dot'></div><div class='loader--text'></div></div></div>");
2216            $('.archive .woocommerce-pagination').hide();
2217
2218            setTimeout(function(){
2219                $('.archive .products.slider-shop').addClass("loaded").removeClass("loading").fadeIn(500);
2220                $('.archive .products.slider-shop').find('.container-load').remove('.container-load');
2221                $('.archive .woocommerce-pagination').show();
2222            }, 3000);
2223        }
2224    };
2225    $(this).owlCarousel(_slider_data);
2226
2227});
2228
2229/*Advanced filter*/
2230$(".ftc-advanced-filter .ftc-product-tabs-filter li").on("click", function() {
2231    $('.woocommerce.columns-3').addClass("space_filter");
2232    $(this)
2233    .siblings("li")
2234    .removeClass("current");
2235    $(this).addClass("current");
2236    var container = $(this)
2237    .parents(".woocommerce")
2238    .find(".products:not(.list)");
2239    var data_filter = $(this).data("filter");
2240    container.isotope({ filter: data_filter });
2241});
2242
2243/*Vertical gallery*/
2244$(document).ready(function() {
2245    if (typeof $.fn.carouFredSel == 'function') {
2246        $('.details_thumbnails.vertical').carouFredSel({
2247            items: 4
2248            , direction: 'up'
2249            , width: '100px'
2250            , height: '300px'
2251            , infinite: true
2252            , prev: $('.thumbnails.ftc-slider').find('.owl-prev').selector
2253            , next: $('.thumbnails.ftc-slider').find('.owl-next').selector
2254            , auto: {
2255                play: false
2256                , timeoutDuration: 5000
2257                , duration: 800
2258                , delay: 3000
2259                , items: 1
2260                , pauseOnHover: true
2261            }
2262            , scroll: {
2263                items: 1
2264            }
2265            , swipe: {
2266                onTouch: true
2267                , onMouse: true
2268            }
2269            , onCreate: function () {
2270                $(this).addClass('loaded').removeClass('loading');
2271            }
2272        });
2273    }
2274});
2275
2276
2277$(window).on('load', function(){
2278    var heighttttt = $(' .details-img ol.flex-control-nav.flex-control-thumbs').height();
2279    $('.details-img div.images .woocommerce-product-gallery__trigger,.single-product .ftc-adzoom.details-img a.ftc-product-video-button, .woocommerce .product .images a.ftc-video360').attr('style','bottom:' + (heighttttt + 25) + 'px');
2280});
2281
2282/*filter box*/
2283jQuery(document).ready(function($){
2284    $('.button-filter-boxed a').on('click', function(e){
2285        e.preventDefault();
2286        $('.woocommerce .ftc-filter-boxed').toggleClass('showw');
2287        if($('.woocommerce .ftc-filter-boxed').hasClass('showw') ){
2288            $('body #main-content').addClass('change');
2289            if($('body #main-content').hasClass('change') ){
2290                if (jQuery(window).width() > 740 && jQuery(window).width() < 991) {
2291                    $('body #main-content').attr('style','width:70%; float:right').fadeIn(500);
2292                }else{
2293                    $('body #main-content').attr('style','width:75%; float:right').fadeIn(500);
2294                }
2295            }
2296            else{
2297                $('body #main-content').attr('style','').fadeIn(500);
2298            }
2299        }
2300        if (jQuery(window).width() > 740) {
2301            if($('.woocommerce .ftc-filter-boxed').hasClass('showw') ){
2302                e.stopPropagation();
2303                $('body').on('click', function(){
2304                    $('.woocommerce .ftc-filter-boxed').removeClass('showw');
2305                    $('body #main-content').attr('style','').fadeIn(500);
2306                });
2307                $('.woocommerce-result-count').hide();
2308                $('.button-filter-boxed').addClass('activee');
2309            }else{
2310                $('.woocommerce-result-count').show();
2311                $('.button-filter-boxed').removeClass('activee');
2312            }
2313        }
2314    });
2315});
2316
2317
2318if ($(this).width()<991) {
2319    $('.wcfmmp-store-page-wrap .widget-title').on('click', function(){
2320        $('.wcfmmp-store-page-wrap .widget-title').toggleClass('active');
2321        $('.wcfmmp-store-page-wrap .sidebar .widget .categories_list').slideToggle();
2322        return false;
2323    });
2324}
2325
2326/*scroll stiky add to cart*/
2327$(window).scroll(function() {
2328    if ($(this).scrollTop() > ($('.single-product .details-img').height() + $('.site-header').height() + $('.ftc-breadcrumb').height()) && $(window).width() > 991 && $('body').hasClass('single-product')) {
2329        $("section.ftc-sticky-atc").addClass("show");
2330        $("section.ftc-sticky-atc").closest('body').find('footer').attr('style','padding-bottom:120px');
2331    } else {
2332        $("section.ftc-sticky-atc ").removeClass("show");
2333        $('footer').attr('style','');
2334    }
2335});
2336
2337
2338/*fix speed resize img product*/
2339$(".thum_list_gallery").each(function(){
2340    $(".thum_list_gallery").hide();
2341    setTimeout(function(){
2342        $('.thum_list_gallery').show();
2343    }, 3000);
2344});
2345
2346$(".details-thumbnails").each(function(){
2347    $(".details-thumbnails").hide();
2348    setTimeout(function(){
2349        $('.details-thumbnails').show();
2350    }, 6000);
2351});
2352
2353/*shop variation*/
2354$(document).ready(function() {
2355    $('.images .woocommerce-product-gallery__image a .cover_image img, .images .woocommerce-product-gallery__image a .hover_image img, .images .woocommerce-product-gallery__image a .no_image img').addClass('wp-post-image');
2356});
2357
2358/*form login*/
2359$(document).ready(function() {
2360    $('.move-button a').on('click', function(){
2361        $('.lg_rgter').toggle('slow', 'swing');
2362    });
2363});
2364
2365/*element-gallery*/
2366$('.ftc-product').each(function(){
2367    jQuery('.ftc-product .ftc-thumbnails-gallery ul li span').mouseenter(function(event){
2368        jQuery('.selected').removeClass('selected');
2369        jQuery(this).addClass('selected');
2370        jQuery(this).closest('.ftc-product').find('.images a .cover_image').addClass('active');
2371        var changeSrc = jQuery(this).find('img').attr("src");
2372        jQuery("a .cover_image.active .attachment-shop_catalog").attr("srcset", changeSrc).fadeIn(300);
2373        event.preventDefault();
2374    });
2375
2376    jQuery(".ftc-product .ftc-thumbnails-gallery ul li span").mouseleave(function() {
2377        jQuery("a .cover_image.active .attachment-shop_catalog").attr("srcset", '').fadeIn(300);
2378        jQuery(this).closest('.ftc-product').find('.images a .cover_image').removeClass('active');
2379    });
2380
2381});
2382
2383
2384/*hover gallery on product*/
2385function ftc_thumbnail_gallery() {
2386    jQuery('.ftc-product .thum_list_gallery ul li a').mouseenter(function(event){
2387        jQuery('.active').removeClass('active');
2388        jQuery(this).addClass('active');
2389        jQuery(this).closest('.ftc-product').find('.images a .cover_image').addClass('active');
2390        var changeSrc = jQuery(this).attr("href");
2391        jQuery("a .cover_image.active .attachment-shop_catalog").attr("srcset", changeSrc).fadeIn(300);
2392        event.preventDefault();
2393    });
2394
2395    jQuery(".ftc-product .thum_list_gallery ul li a").mouseleave(function() {
2396        jQuery("a .cover_image.active .attachment-shop_catalog").attr("srcset", '').fadeIn(300);
2397    });
2398
2399}
2400$('.thum_list_gallery ul li a').on('click' , function(t){
2401  t.preventDefault();
2402});
2403ftc_thumbnail_gallery();
2404
2405
2406/*dropdown header element*/
2407$( document ).on('click','.header-icon' , function () {
2408 $(".content-dropdown").slideToggle("slow");
2409});
2410
2411/* search header element*/
2412$(".header-ftc-element button.search-button").on('click',function() {
2413    $(".ftc_search_ajax").slideToggle("fast");
2414});
2415
2416$(document).ready(function() {
2417    $('.summary .compare.button').on('click', function(){
2418        $('.summary .compare.button').addClass('adding');
2419    });
2420    $('.summary .yith-wcwl-add-to-wishlist .add_to_wishlist').on('click', function(){
2421        $('.summary .add_to_wishlist').addClass('adding');
2422    });
2423    $('.item-description .meta_info a.compare').on('click', function(){
2424        $('.item-description .meta_info a.compare').addClass('adding');
2425    });
2426    $('.item-description .meta_info .yith-wcwl-add-to-wishlist .add_to_wishlist').on('click', function(){
2427        $('.item-description .meta_info .yith-wcwl-add-to-wishlist .add_to_wishlist').addClass('adding');
2428    });
2429});
2430
2431/*ajax grouped single product*/
2432function ajax_single_group_addtocart(){
2433	if ( typeof wc_cart_fragments_params === 'undefined' ) {
2434		return false;
2435	}
2436	$('td.woocommerce-grouped-product-list-item__quantity input.input-text.qty.text').attr('placeholder','0');
2437	var $warp_fragment_refresh = {
2438		url: wc_cart_fragments_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_refreshed_fragments' ),
2439		type: 'POST',
2440		complete: function (response) {
2441			$('.single_add_to_cart_button').addClass('added').removeClass('loading');
2442		},
2443		success: function( data ) {
2444			if ( data && data.fragments ) {
2445
2446				$.each( data.fragments, function( key, value ) {
2447					  $( key ).replaceWith( value );
2448				});
2449
2450				$( document.body ).trigger( 'wc_fragments_refreshed' ).addClass('cart-canvas');
2451			}
2452		}
2453	};
2454	$('.product.product-type-grouped .entry-summary form.cart').on('submit', function (e)
2455	{
2456		e.preventDefault();
2457		$('.single_add_to_cart_button').removeClass('added').addClass('loading');
2458
2459		var product_url = window.location,
2460		form = $(this);
2461
2462		$.post(product_url, form.serialize() + '&_wp_http_referer=' + product_url, function (result)
2463		{
2464		  var cart_dropdown = $('.widget_shopping_cart', result)
2465
2466			// update dropdown cart
2467			$('.widget_shopping_cart').replaceWith(cart_dropdown);
2468
2469			// update fragments
2470			$.ajax($warp_fragment_refresh);
2471		});
2472	});
2473}
2474ajax_single_group_addtocart();
2475
2476
2477/*pop-up cart*/
2478var timeout;
2479
2480  jQuery( function( $ ) {
2481   $('.ftc-off-canvas-cart .woocommerce.widget_shopping_cart .cart_list li').each(function(){
2482    $('.woocommerce').on('change keyup', 'input.qty', function(){
2483
2484      if ( timeout !== undefined ) {
2485        clearTimeout( timeout );
2486      }
2487       var $el = $(this);
2488      timeout = setTimeout(function() {
2489
2490        $("[name='update_cart']").trigger("click");
2491
2492        $el.closest('.ftc-off-canvas-cart .woocommerce.widget_shopping_cart .cart_list li').addClass('loading');
2493
2494    }, 500 ); // 1 second delay, half a second (500) seems comfortable too
2495
2496
2497
2498    });
2499  });
2500 } );
2501
2502
2503  jQuery(document).on('submit', '.ftc-off-canvas-cart .shop_table.cart form', function() {   
2504    updateMiniCartQuantity();
2505    return false;
2506  });
2507
2508  function updateMiniCartQuantity() {
2509    var cartForm = jQuery('.shop_table.cart form');
2510    jQuery('<input />').attr('type', 'hidden')
2511    .attr('name', 'update_cart')
2512    .attr('value', 'Update Cart')
2513    .appendTo(cartForm);
2514
2515    var formData = cartForm.serialize();
2516    jQuery.ajax({
2517      type: cartForm.attr('method'),
2518      url: cartForm.attr('action'),
2519      data: formData,
2520      dataType: 'html',
2521      success: function(response) {
2522        console.log(response);
2523        let wc_cart_fragment_url = (wc_cart_fragments_params.wc_ajax_url).replace("%%endpoint%%", "get_refreshed_fragments");
2524        jQuery.ajax({
2525          type: 'post',
2526          url: wc_cart_fragment_url,
2527          success: function(response) {
2528            console.log(response);
2529            var mini_cart_wrapper = jQuery('.widget_shopping_cart_content');
2530            var parent = mini_cart_wrapper.parent();
2531            mini_cart_wrapper.remove();
2532            parent.append(response.fragments['div.widget_shopping_cart_content']);
2533
2534          },
2535          complete: function() {
2536            cartForm = jQuery('.shop_table.cart form');
2537            $('.off-canvas-cart-title .title').trigger( 'wc_fragment_refresh' );
2538          }
2539        });
2540      }
2541    });
2542  }
2543
2544
2545
2546})(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.