PageSourceSearch

http://eezitec.com/js/common8c64.js?ver=1765531861

js eezitec.com collected 2026-09-27 11:48:45 UTC 85,395 bytes, 1,836 lines download raw bytes

1jQuery(document).ready(function(){
2    setSubmenuTop(jQuery('header').height());
3    initUpsellsSlider();
4    if(jQuery('body').hasClass('single-product')) {
5        initBikeFrameSelect();
6        initBikesColorSelect();
7        //initFixedBarData();
8        reviewsButtonTextChange();
9        if(jQuery('.single-product-fixed-banner').length > 0) {
10            jQuery(window).on('scroll', function(){
11                var pixel = jQuery(window).scrollTop();
12                  if(pixel > jQuery('.custom-single-product-summary').height()){
13                    jQuery('.single-product-fixed-banner').addClass('active');
14                  } else {
15                    jQuery('.single-product-fixed-banner').removeClass('active');
16                  }
17            });
18        }
19    }
20    if(jQuery('body').hasClass('woocommerce-cart')) {
21        var faq = jQuery('#faq').html();
22        jQuery('#faq').remove();
23        // jQuery('.cart-collaterals').prepend(faq); 
24        jQuery('.woocommerce-cart-form').append(faq);
25    }
26    if(jQuery('.page-template-bike-gallery').length > 0) {
27        galleryImagesWaypointsInit();
28        Fancybox.bind('[data-fancybox="gallery"]', {
29        //
30        });
31    }
32    if(jQuery('.page-template-reviews').length > 0) {
33        jQuery('.rplg-url').text('See More');
34    }
35    if(jQuery('#cookie-law-info-bar').is(":visible")) {
36        jQuery('body').addClass('cookie-bar-present');
37    }
38
39    jQuery(".comment-text .shortened-comment-text").each(function(){
40        if (jQuery(this).height() >= 199) { 
41            jQuery(this).addClass("minimized").after("<button class='view_more_button'>View More ▼</button>");
42        }
43    });
44
45    if(jQuery('.promo-sticker__wrapper--single-product').length > 0) {
46        promoSticker = jQuery('.promo-sticker__wrapper--single-product').prop('outerHTML');
47        jQuery(".woo-variation-gallery-slider-wrapper").prepend(promoSticker);
48        jQuery('.woo-variation-gallery-slider-wrapper .promo-sticker__wrapper--single-product').show();
49    }
50
51
52
53    jQuery(document).on('click', '.cr-show-more-reviews-prd', function(e){
54        setTimeout(function(){
55            jQuery(".comment-text .shortened-comment-text").each(function(){
56                if (jQuery(this).height() >= 199) {
57                    if(jQuery(this).siblings('.view_more_button').length){
58                        // do nothing
59                    } else {
60                        jQuery(this).addClass("minimized").after("<button class='view_more_button'>View More ▼</button>");
61                    }
62                }
63            }); 
64        },1500);
65    });
66   
67    
68
69    jQuery(document).on('click', '#cookie_action_close_header, #wt-cli-privacy-save-btn', function(e){
70        setTimeout(
71            function() 
72            {
73                if(jQuery('#cookie-law-info-bar').is(":hidden")) {
74                    jQuery('body').removeClass('cookie-bar-present');
75                } 
76            }, 1000);
77    });
78    jQuery("#credit_called").change(function() {
79        jQuery(this).val(parseFloat(jQuery(this).val()).toFixed(2));
80    });
81    jQuery(document)
82        .on('click', '.ny_form_populate', function(event){
83            event.preventDefault();
84            $urlValues = "/ny-support-contact/?";
85            var firstname = jQuery('#shipping_first_name').val();
86            if(firstname == ''){ jQuery('#billing_first_name').val(); }
87            if(firstname != ''){
88                $urlValues = $urlValues+"firstname=" + firstname + "&";
89            }
90            var lastname = jQuery('#shipping_last_name').val();
91            if(lastname == ''){ jQuery('#billing_last_name').val(); }
92            if(lastname != ''){
93                $urlValues = $urlValues+"lastname=" + lastname + "&";
94            }
95            var companyname = jQuery('#shipping_company').val();
96            if(companyname == ''){ jQuery('#billing_company').val(); }
97            if(companyname != ''){
98                $urlValues = $urlValues+"companyname=" + companyname + "&";
99            }
100            var streetaddress1 = jQuery('#shipping_address_1').val();
101            if(streetaddress1 == ''){ jQuery('#billing_address_1').val(); }
102            if(streetaddress1 != ''){
103                $urlValues = $urlValues+"streetaddress1=" + streetaddress1 + "&";
104            }
105            var streetaddress2 = jQuery('#shipping_address_2').val();
106            if(streetaddress2 == ''){ jQuery('#billing_address_2').val(); }
107            if(streetaddress2 != ''){
108                $urlValues = $urlValues+"streetaddress2=" + streetaddress2 + "&";
109            }
110            var city = jQuery('#shipping_city').val();
111            if(city == ''){ jQuery('#billing_city').val(); }
112            if(city != ''){
113                $urlValues = $urlValues+"city=" + city + "&";
114            }
115            var state = jQuery('#shipping_state').val();
116            if(state == ''){ jQuery('#billing_state').val(); }
117            if(state != ''){
118                $urlValues = $urlValues+"state=" + state + "&";
119            }
120            var zip = jQuery('#shipping_postcode').val();
121            if(zip == ''){ jQuery('#billing_postcode').val(); }
122            if(zip != ''){
123                $urlValues = $urlValues+"zip=" + zip + "&";
124            }
125            var phone = jQuery('#billing_phone').val();
126            if(phone != ''){
127                $urlValues = $urlValues+"phone=" + phone + "&";
128            }
129            var email = jQuery('#billing_email').val();
130            if(email != ''){
131                $urlValues = $urlValues+"email=" + email + "&";
132            }
133            location.href = $urlValues
134        })
135        .on('click', '.view_more_button', function(){
136            jQuery(this).prev().toggleClass('minimized').toggleClass('expanded');
137            var text = jQuery(this).text();
138            jQuery(this).text(text == "View Less ▲" ? "View More ▼" : "View Less ▲");
139        })
140        .on('click', '#convert_alt', function(e){
141            e.preventDefault();
142            jQuery(".small-col-item.contains-alt").each(function(){
143                var size = jQuery(this).find('.shown-value').html();
144                var altSize = jQuery(this).find('.hidden-value').html();
145                jQuery(this).find('.shown-value').html(altSize);
146                jQuery(this).find('.hidden-value').html(size);
147            });
148        })
149        .on('click', '.submenu-tabs-item', function (e) {
150            e.preventDefault();
151            if(jQuery(this).hasClass('active')) {
152                return;
153            }
154            var tab = jQuery(this).attr('data-tab');
155
156            jQuery('.submenu-tabs-item').removeClass('active');
157            jQuery(this).addClass('active');
158            jQuery('.submenu-tab-content').removeClass('active');
159            jQuery('.submenu-tab-content[data-tab='+tab+']').addClass('active');
160        })
161        .on('click', '.faq-item', function(e){
162            e.preventDefault();
163
164            if(jQuery(this).hasClass('opened')) {
165                jQuery(this).removeClass('opened').find('.faq-answer').slideUp();
166            } else {
167                jQuery('.faq-item').removeClass('opened');
168                jQuery('.faq-answer').slideUp();
169                jQuery(this).addClass('opened').find('.faq-answer').slideDown();
170            }
171        })
172        .on('click', '.home-products-item-size', function(e){
173            e.preventDefault();
174
175            jQuery('.home-products-item-size').removeClass('selected');
176            jQuery(this).addClass('selected');
177        })
178        .on('click', '.home-review-slider-arrows.reviews .home-review-slider-arrow.left', function(e){
179            e.preventDefault();
180            jQuery(this).parent().parent().find('rp-btn-prev').trigger('click');
181            jQuery(this).parent().parent().find('.rpi-slider-prev').trigger('click');
182            jQuery(this).parent().parent().find('.grw-slider-prev').trigger('click');
183        })
184        .on('click', '.home-review-slider-arrows.reviews .home-review-slider-arrow.right', function(e){
185            e.preventDefault();
186            jQuery(this).parent().parent().find('rp-btn-next').trigger('click');
187            jQuery(this).parent().parent().find('.rpi-slider-next').trigger('click');
188            jQuery(this).parent().parent().find('.grw-slider-next').trigger('click');
189        })
190        .on('click', '.home-products-item-color', function(e){
191            e.preventDefault();
192
193            jQuery('.home-products-item-color').removeClass('selected');
194            jQuery(this).addClass('selected');
195        })
196        .on('click', '.video-play', function(e){
197            e.preventDefault();
198            jQuery(this).parent().fadeOut();
199        })
200        .on('click', '.cr-reviews-show-form', function(e){
201            e.preventDefault();
202            jQuery('#comments').hide();
203            jQuery('#cr-ajax-reviews-review-form').show();
204        })
205        .on('click', '#cr-ajax-reviews-cancel', function(e){
206            e.preventDefault();
207            jQuery('#comments').show();
208            jQuery('#cr-ajax-reviews-review-form').hide();
209        })
210        .on('click', '.menu-hamburger', function(e){
211            e.preventDefault();
212            jQuery('.header-menu-holder').fadeIn();
213            jQuery('body').addClass('mobile-menu--open');
214        })
215        .on('click', '.custom-filter-current svg', function(e){
216            e.preventDefault();
217            if(jQuery(this).parent().hasClass('opened')) {
218                categoryBikesFilterClose();
219            } else {
220                categoryBikesFilterOpen();
221            }
222        })
223        .on('click', '.custom-filter-terms-item', function(e){
224            e.preventDefault();
225            categoryBikesFilterClose();
226            if(jQuery(this).hasClass('selected')) {
227                return;
228            }
229            jQuery('.custom-filter-terms-item').removeClass('selected')
230            jQuery(this).addClass('selected');
231            var slug = jQuery(this).attr('data-slug'),
232                text = jQuery(this).text();
233            jQuery('.custom-filter-current-val').text(text);
234            if(slug == 'all') {
235                jQuery('.custom-products-item').show();
236                return;
237            }
238
239            jQuery('.custom-products-item').each(function(index, item){
240                var terms = jQuery(this).attr('data-terms');
241                if(!terms.includes(slug)) {
242                    jQuery(this).hide();
243                } else {
244                    jQuery(this).show();
245                }
246            });
247        })
248        .on('click', '.menu-close-cross', function(e){
249            e.preventDefault();
250            jQuery('.header-menu-holder').fadeOut();
251            jQuery('body').removeClass('mobile-menu--open');
252        })
253        .on('click', '.measurement-frames-item', frameSwitch)
254        .on('click', '.measurement-heights-item', heightSwitch)
255        .on('mousedown', '.wvg-single-gallery-image-container a', function(){
256            if(jQuery(window).width() > 1200) {
257                var slideno = jQuery(this).closest('.slick-slide').data('slick-index');
258                // console.log(slideno);
259                jQuery('.woo-variation-gallery-slider').slick('slickGoTo', slideno);
260            }
261        })
262        .on('click', '.has-dropdown > a', function(e){
263            if(jQuery(window).width() < 992) {
264                e.preventDefault();
265                if(jQuery(this).next().hasClass('opened')) {
266                    jQuery(this).next().removeClass('opened').slideUp();
267                }
268                else {
269                    jQuery('.submenu').removeClass('opened').slideUp();
270                    jQuery(this).next().addClass('opened').slideDown();
271                }
272                if(jQuery(this).hasClass('active')) {
273                    jQuery(this).removeClass('active');
274                } else {
275                    jQuery('.has-dropdown > a').removeClass('active');
276                    jQuery(this).addClass('active');
277                }
278            }
279        })
280        .on('click', '.home-review-sliders-tab', function(e){
281            e.preventDefault();
282            if(jQuery(this).hasClass('active')) {
283                return;
284            }
285
286            var tab = jQuery(this).attr('data-tab');
287
288            jQuery('.home-review-sliders-tab').removeClass('active');
289            jQuery(this).addClass('active');
290            if(jQuery('.home-review-sliders-content[data-tab='+tab+']').find('.home-review-sliders-overlay').length > 0) {
291               jQuery('.home-review-sliders-content[data-tab='+tab+']').find('.home-review-sliders-overlay').attr('style', 'display: flex;');
292            }
293            jQuery('.home-review-sliders-content').removeClass('active');
294            jQuery('.home-review-sliders-content[data-tab='+tab+']').addClass('active');
295            
296            var slider = jQuery('.home-review-sliders-content[data-tab='+tab+']').find('.home-review-slider');
297            if(slider.hasClass('reviews')){
298                slider.slick('unslick');
299                slider.slick({
300                    slidesToShow: 2,
301                    slidesToScroll: 2,
302                    infinite: false,
303                    lazyLoad: 'ondemand',
304                    prevArrow: slider.closest('.home-review-sliders-content').find('.home-review-slider-arrow.left'),
305                    nextArrow: slider.closest('.home-review-sliders-content').find('.home-review-slider-arrow.right'),
306                     responsive: [
307                        {
308                          breakpoint: 992,
309                          settings: {
310                            slidesToShow: 1,
311                            slidesToScroll: 1
312                          }
313                        }
314                    ]
315                });
316            } else {
317                slider.slick('slickNext');
318            }
319            
320            setTimeout(function(){
321                if(jQuery('.home-review-sliders-content').find('.home-review-sliders-overlay').length > 0) {
322                    jQuery('.home-review-sliders-content').find('.home-review-sliders-overlay').fadeOut();
323                }
324            },2000);
325        })
326        .on('click', '.header-top-bar-cross', function(e){
327            e.preventDefault();
328
329            jQuery.ajax({
330                url: '/wp-admin/admin-ajax.php',
331                type: 'post',
332                data: {
333                    action: 'set_top_bar_cookie'
334                },
335                success: function(){
336                    jQuery('.header-top-bar').slideUp();
337                }
338            });
339        })
340        .on('click', '.search-popup-bar-close', function(e) {
341            e.preventDefault();
342            jQuery('.search-popup-bar').removeClass('opened');
343            jQuery('.main-overlay').fadeOut();
344            jQuery('#keyword').val('');
345            jQuery("#datafetch").hide();
346        })
347        .on('click', '.search-icon', function(e) {
348            e.preventDefault();
349            jQuery('.search-popup-bar').addClass('opened');
350            jQuery('.main-overlay').fadeIn();
351        })
352        /*.on('click', '.cart-icon', function(e) {
353            e.preventDefault();
354            jQuery('.side-cart').addClass('opened');
355            jQuery('.main-overlay').fadeIn();
356        })*/
357        .on('click', '.main-overlay', function(e) {
358            e.preventDefault();
359            jQuery('.side-cart, .search-popup-bar').removeClass('opened');
360            jQuery('.main-overlay').fadeOut();
361        })
362        .on('click', '.custom-cart-close', function(e) {
363            e.preventDefault();
364            jQuery('.side-cart').removeClass('opened');
365            jQuery('.main-overlay').fadeOut();
366        })
367        .on('click', '.tab-section-title', function(e) {
368            e.preventDefault();
369            if(jQuery(this).hasClass('opened')) {
370                jQuery(this).removeClass('opened').next().slideUp().removeClass('opened');
371            } else {
372               jQuery(this).addClass('opened').next().slideDown().addClass('opened');
373            }
374        })
375        .on('click', '.single-product-faqs-question', function(e) {
376            e.preventDefault();
377            if(jQuery(this).hasClass('opened')) {
378                jQuery(this).removeClass('opened').next().slideUp();
379            } else {
380               jQuery(this).addClass('opened').next().slideDown();
381            }
382        })
383        .on('click', '.woocommerce-cart #faqhead2 a', function(e) {
384            e.preventDefault();
385            if(jQuery(this).hasClass('opened')) {
386                jQuery(this).removeClass('opened').parent().next().slideUp();
387            } else {
388               jQuery(this).addClass('opened').parent().next().slideDown();
389            }
390        })
391        .on('keyup', '#keyword', rideup_search_fetch)
392        /*
393        .on('submit', '.search-popup-form', function(e){
394            e.preventDefault();
395        })
396        */
397        .on('click', '.quantity-input-plus', function(e){
398            e.preventDefault();
399
400            var qty_input = jQuery(this).parent().find('input');
401
402            var qty_input_max = qty_input.attr('max') ? parseInt(qty_input.attr('max')) : 9999;
403
404            if(qty_input_max > qty_input.val()) {
405               qty_input.val(parseInt(qty_input.val()) + 1);
406                qty_input.trigger('change');
407            }
408            if(jQuery('body').hasClass('woocommerce-cart')) {
409                jQuery('button[name=update_cart]').trigger('click');
410            }
411        })
412        .on('click', '.quantity-input-minus', function(e){
413            e.preventDefault();
414            var qty_input = jQuery(this).parent().find('input'),
415                qty_input_min = qty_input.attr('min') ? parseInt(qty_input.attr('min')) : 1;
416
417            if(qty_input_min < qty_input.val()) {
418               qty_input.val(parseInt(qty_input.val()) - 1);
419                qty_input.trigger('change');
420            }
421            if(jQuery('body').hasClass('woocommerce-cart')) {
422                jQuery('button[name=update_cart]').trigger('click');
423            }
424        })
425        .on('click', '.current-selected', function(e){
426            e.preventDefault();
427            jQuery('.bike-frame-custom-variations').slideToggle();
428            jQuery(this).toggleClass('opened');
429        })
430        /*
431        Pending change that closes drop-down frame selector when anywhere else is clicked
432        .on("click", function(e) {
433            if (jQuery(e.target).is(".current-selected.opened") === false) {
434                jQuery('.bike-frame-custom-variations').slideUp();
435                jQuery(".current-selected").removeClass("opened");
436            }
437        })
438        */
439       // Rv3 Staging Site
440        .on('click', '.post-506434 .swatch-chain-suspension.disabled', function(){
441            jQuery('div[data-attribute_name="attribute_pa_color"] .swatch.selected').click();
442            setTimeout(function(){
443                jQuery('.post-506434 .swatch-chain-suspension:not(.disabled)').click();
444            },200);
445            setTimeout(function(){
446                jQuery('.swatch-item-wrapper .swatch.swatch-white-gold').click();
447            },400);
448        })
449        .on('click', '.post-506434 .swatch-chain.disabled', function(){
450            jQuery('div[data-attribute_name="attribute_pa_color"] .swatch.selected').click();
451            setTimeout(function(){
452                jQuery('.post-506434 .swatch-chain:not(.disabled)').click();
453            },200);
454            setTimeout(function(){
455                jQuery('.swatch-item-wrapper .swatch.swatch-onyx-black').click();
456            },400);
457        })
458        .on('click', '.post-506434 .swatch-belt.disabled', function(){
459            jQuery('div[data-attribute_name="attribute_pa_color"] .swatch.selected').click();
460            setTimeout(function(){
461                jQuery('.post-506434 .swatch-belt:not(.disabled)').click();
462            },200);
463            setTimeout(function(){
464                jQuery('.swatch-item-wrapper .swatch.swatch-onyx-black').click();
465            },400);
466        })
467        .on('click', '.post-506434 .swatch-image', frameTypeSelectChange2)
468
469        
470        // Revv 1
471        /* Old code from when Revv1 was not split up, not used anymore
472        .on('click', '.post-321605 .bike-frame-custom-variations-item[data-val="ht"]', function(){
473            setTimeout(function(){
474                jQuery('.swatch-item-wrapper .swatch.swatch-moss-green:not(.selected)').click();
475                jQuery('.item-id_501842').show();
476                jQuery('.item-id_434386').show();
477                jQuery('.item-id_434387').show();
478            },500);
479        })
480        .on('click', '.post-321605 .bike-frame-custom-variations-item[data-val="fs"]', function(){
481            setTimeout(function(){
482                jQuery('.swatch-item-wrapper .swatch.swatch-moss-green:not(.selected)').click();
483                jQuery('.item-id_501842').show();
484                jQuery('.item-id_434386').show();
485                jQuery('.item-id_434387').show();
486            },500);
487            
488        })
489        .on('click', '.post-321605 .bike-frame-custom-variations-item[data-val="revv1-drt"]', function(){
490            setTimeout(function(){
491                jQuery('.swatch-item-wrapper .swatch.swatch-black-out:not(.selected)').click();
492                jQuery('.item-id_501842').hide();
493                jQuery('.item-id_434386').hide();
494                jQuery('.item-id_434387').hide();
495            },500);
496        })
497        .on('click', '.post-321605 .swatch-image', frameTypeSelectChange2)
498        */
499
500        .on('click', '.bike-frame-custom-variations-item', frameTypeSelectChange)
501        .on('click', '.swatch-image', function(){
502            setTimeout(initBikesColorSelect, 100);
503        })
504        
505
506        .on('click', '.social-reviews-tabs-item', function(e){
507            e.preventDefault();
508            if(jQuery(this).hasClass('active')) {
509                return;
510            }
511            var order = jQuery(this).attr('data-order');
512
513            jQuery('.social-reviews-tabs-item').removeClass('active');
514            jQuery('.social-review-content-item').removeClass('active');
515            jQuery(this).addClass('active');
516            jQuery('.social-review-content-item[data-order="'+order+'"]').addClass('active');
517        })
518        .on('click', '.show-more-faqs-btn', function(e){
519            e.preventDefault();
520            jQuery(this).hide().prev().addClass('opened');
521        })
522        .on( 'change', '.custom-cart-form input.qty', function() {
523            var item_hash = jQuery( this ).attr( 'name' ).replace(/cart\[([\w]+)\]\[qty\]/g, "$1");
524            var item_quantity = jQuery( this ).val();
525            var currentVal = parseFloat(item_quantity);
526            function qty_cart() {
527                jQuery.ajax({
528                    type: 'POST',
529                    url: '/wp-admin/admin-ajax.php',
530                    data: {
531                        action: 'rideup_qty_cart',
532                        hash: item_hash,
533                        quantity: currentVal
534                    },
535                    beforeSend: function(){
536                        jQuery('.side-cart-overlay').fadeIn();
537                    },
538                    success: function() {
539                        updateCart();
540                    }
541                });
542            }
543            qty_cart();
544        })
545        .on('click', '.social-review-content-arrow.down', function(e){
546            e.preventDefault();
547            var pixel = jQuery(window).scrollTop();
548            jQuery('.video-block-title').each(function(index, item){
549                if((jQuery(item).offset().top - 100) > pixel) {
550                    jQuery('body,html').animate({scrollTop: jQuery(item).offset().top}, 1000);
551                    return false;
552                }
553            });
554        })
555        .on('click', '.social-review-content-arrow.up', function(e){
556            e.preventDefault();
557            var pixel = jQuery(window).scrollTop();
558            jQuery('.video-block-title').each(function(index, item){
559                if(jQuery(item).offset().top > pixel) {
560                    jQuery('body,html').animate({scrollTop: jQuery(item).prev().prev().offset().top}, 1000);
561                    return false;
562                }
563            });
564        })
565        .on('click', '.tab-label-a', function(e){
566            e.preventDefault();
567            jQuery('.table-tab').removeClass('active');
568            jQuery(this).addClass('active');
569            jQuery('.tab-b').hide();
570            jQuery('.tab-a').show();
571        })
572        .on('click', '.tab-label-b', function(e){
573            e.preventDefault();
574            jQuery('.table-tab').removeClass('active');
575            jQuery(this).addClass('active');
576            jQuery('.tab-a').hide();
577            jQuery('.tab-b').show();
578        })
579        .on('click', '.single_add_to_cart_button', addToCartFromSingle)
580        .on('click', '.remove-link', removeProductFromCart)
581        .on('click', '.add-link', addProductFromCartUpsell)
582        .on('click', '.bike-gallery-sidebar-item', galleryImagesScrollHandle);
583
584    jQuery( '.variations_form' ).on( 'show_variation', function(event, variation_data) {
585        var currentColor = jQuery('.variation-row.pa_color').find('.swatch-image.selected').next().text();
586        jQuery('.variation-row.pa_color').find('label').text(currentColor);
587        console.log(currentColor);
588        setTimeout(function(){
589            if(jQuery('.back-in-stock-wrapper').is(":visible")) {
590                jQuery('.button-and-stock').addClass('back-in-stock-active');
591            } else {
592                jQuery('.button-and-stock').removeClass('back-in-stock-active');
593            }
594            if(jQuery('.wholesale_price_container--onsale').is(":visible")) {
595                jQuery('.wholesalesale-sticker--single-product').show();
596            } else {
597                jQuery('.wholesalesale-sticker--single-product').hide();
598            }
599        },500);
600        var stockMarkup = variation_data.availability_html;
601        setTimeout(function(){
602            jQuery('.single_add_to_cart_button').removeClass('added');
603            jQuery('.woocommerce-variation-availability').html(stockMarkup);
604            if(jQuery('.button-and-stock').find('.available-on-backorder').length > 0) {
605                jQuery('.single-product-status-holder').text('Available on backorder');
606                jQuery('.single_add_to_cart_button').text('Pre-order');
607            } else if(jQuery('.woocommerce-variation-availability').find('.out-of-stock').length > 0) {
608                jQuery('.single-product-status-holder').text('Out of Stock');
609                jQuery('.single_add_to_cart_button').text('Add To Cart');
610            } else {
611                jQuery('.single-product-status-holder').text('In Stock');
612                jQuery('.single_add_to_cart_button').text('Add To Cart');
613            }
614            jQuery('.promo-sticker').attr('class', 'promo-sticker');
615            var skuValue = 'sku-value-'+jQuery( "input.variation_id" ).val();
616            jQuery('.promo-sticker').addClass(skuValue);
617            var available = jQuery('#pa_frame-type').find('option');
618            var available_vals = [];
619            var custom_available = jQuery('.bike-frame-custom-variations-item');
620            available.each(function(){
621                available_vals.push(jQuery(this).val());
622                // console.log(available_vals);
623            });
624            custom_available.each(function(){
625                if(!available_vals.includes(jQuery(this).attr('data-val'))) {
626                    jQuery(this).hide();
627                } else {
628                    jQuery(this).show();
629                }
630            });
631            affirm.ui.refresh();
632        },1000);
633    });
634
635    jQuery(window).scroll(function() {
636      var pixel = jQuery(window).scrollTop();
637      if(pixel >jQuery('header').height()){
638        jQuery('header').addClass('fixed');
639        setTimeout(function(){
640            setSubmenuTop(jQuery('header.fixed').height());
641        },100);
642      } else {
643        jQuery('header').removeClass('fixed');
644        setTimeout(function(){
645            setSubmenuTop(jQuery('header').height());
646        },100);
647
648      }
649    });
650
651    
652    var home_reviews_sliders = jQuery('.home-review-slider');
653    home_reviews_sliders.each(function(){
654        jQuery(this).slick({
655            slidesToShow: 2,
656            slidesToScroll: 2,
657            infinite: false,
658            lazyLoad: 'ondemand',
659            prevArrow: jQuery(this).closest('.home-review-sliders-content').find('.home-review-slider-arrow.left'),
660            nextArrow: jQuery(this).closest('.home-review-sliders-content').find('.home-review-slider-arrow.right'),
661            responsive: [
662                {
663                  breakpoint: 992,
664                  settings: {
665                    slidesToShow: 1,
666                    slidesToScroll: 1
667                  }
668                }
669            ]
670        });
671    });
672
673    var product_reviews_sliders = jQuery('.product-review-slider.ebikes');
674    product_reviews_sliders.each(function(){
675        jQuery(this).slick({
676            slidesToShow: 3.5,
677            slidesToScroll: 1,
678            infinite: false,
679            dots: true,
680            rows: 1,
681            lazyLoad: 'ondemand',
682            prevArrow: jQuery(this).closest('.product-review-sliders-content').find('.product-review-slider-arrow.left'),
683            nextArrow: jQuery(this).closest('.product-review-sliders-content').find('.product-review-slider-arrow.right'),
684            responsive: [
685                {
686                  breakpoint: 992,
687                  settings: {
688                    slidesToShow: 2.5,
689                    slidesToScroll: 1
690                  }
691                },
692                {
693                    breakpoint: 550,
694                    settings: {
695                      slidesToShow: 1.25,
696                      slidesToScroll: 1
697                    }
698                  }
699            ]
700        });
701    });
702
703    var product_reviews_sliders_revv = jQuery('.product-review-slider.revv');
704    product_reviews_sliders_revv.each(function(){
705        jQuery(this).slick({
706            slidesToShow: 3,
707            slidesToScroll: 1,
708            infinite: true,
709            dots: false,
710            rows: 1,
711            centerMode: true,
712            lazyLoad: 'ondemand',
713            prevArrow: jQuery(this).closest('.product-review-sliders-content').find('.product-review-slider-arrow.left'),
714            nextArrow: jQuery(this).closest('.product-review-sliders-content').find('.product-review-slider-arrow.right'),
715            responsive: [
716                {
717                  breakpoint: 992,
718                  settings: {
719                    slidesToShow: 2,
720                    slidesToScroll: 1,
721                    centerMode: false
722                  }
723                },
724                {
725                    breakpoint: 550,
726                    settings: {
727                      slidesToShow: 1,
728                      slidesToScroll: 1,
729                      centerMode: false
730                    }
731                  }
732            ]
733        });
734    });
735
736    var product_reviews_sliders_revv = jQuery('.product-review-slider.revv-reviews');
737    product_reviews_sliders_revv.each(function(){
738        jQuery(this).slick({
739            slidesToShow: 4,
740            slidesToScroll: 1,
741            infinite: true,
742            dots: false,
743            rows: 1,
744            autoplay: true,
745            autoplaySpeed: 4000,
746            lazyLoad: 'ondemand',
747            prevArrow: jQuery(this).closest('.product-review-sliders-content').find('.product-review-slider-arrow.left'),
748            nextArrow: jQuery(this).closest('.product-review-sliders-content').find('.product-review-slider-arrow.right'),
749            responsive: [
750                {
751                  breakpoint: 992,
752                  settings: {
753                    slidesToShow: 2,
754                    slidesToScroll: 1,
755                    centerMode: false
756                  }
757                },
758                {
759                    breakpoint: 550,
760                    settings: {
761                      slidesToShow: 1,
762                      slidesToScroll: 1,
763                      centerMode: false
764                    }
765                  }
766            ]
767        });
768    });
769
770    var product_reviews_sliders_revv_social = jQuery('.product-review-slider.revv-social');
771    product_reviews_sliders_revv_social.each(function(){
772        jQuery(this).slick({
773            slidesToShow: 3,
774            slidesToScroll: 1,
775            infinite: true,
776            dots: false,
777            rows: 1,
778            centerMode: true,
779            lazyLoad: 'ondemand',
780            prevArrow: jQuery(this).closest('.product-review-sliders-content').find('.product-review-slider-arrow.left'),
781            nextArrow: jQuery(this).closest('.product-review-sliders-content').find('.product-review-slider-arrow.right'),
782            responsive: [
783                {
784                  breakpoint: 992,
785                  settings: {
786                    slidesToShow: 2,
787                    slidesToScroll: 1,
788                    centerMode: false
789                  }
790                },
791                {
792                    breakpoint: 550,
793                    settings: {
794                      slidesToShow: 1,
795                      slidesToScroll: 1,
796                      centerMode: false
797                    }
798                  }
799            ]
800        });
801    });
802
803
804    var logoSlider = jQuery('#logo-slider');
805    logoSlider.each(function(){
806        jQuery(this).slick({
807            slidesToShow: 4,
808            slidesToScroll: 1,
809            infinite: true,
810            autoplay: true,
811            autoplaySpeed: 2000,
812            // prevArrow: jQuery(this).closest('.home-review-sliders-content').find('.home-review-slider-arrow.left'),
813            // nextArrow: jQuery(this).closest('.home-review-sliders-content').find('.home-review-slider-arrow.right'),
814            responsive: [
815                {
816                  breakpoint: 992,
817                  settings: {
818                    slidesToShow: 2,
819                    slidesToScroll: 1
820                  }
821                },
822                {
823                    breakpoint: 550,
824                    settings: {
825                      slidesToShow: 1,
826                      slidesToScroll: 1
827                    }
828                  }
829            ]
830        });
831    });
832
833    var partnersSlider = jQuery('.partners-holder');
834    partnersSlider.each(function(){
835        jQuery(this).slick({
836            slidesToShow: 4,
837            slidesToScroll: 1,
838            infinite: true,
839            autoplay: true,
840            autoplaySpeed: 2000,
841            // prevArrow: jQuery(this).closest('.home-review-sliders-content').find('.home-review-slider-arrow.left'),
842            // nextArrow: jQuery(this).closest('.home-review-sliders-content').find('.home-review-slider-arrow.right'),
843            responsive: [
844                {
845                  breakpoint: 992,
846                  settings: {
847                    slidesToShow: 2,
848                    slidesToScroll: 1
849                  }
850                },
851                {
852                    breakpoint: 550,
853                    settings: {
854                      slidesToShow: 1,
855                      slidesToScroll: 1
856                    }
857                  }
858            ]
859        });
860    });
861    
862
863    jQuery('.product-upsells-slider').slick({
864        slidesToShow: 4,
865        slidesToScroll: 1,
866        infinite: false,
867        //prevArrow: jQuery(this).closest('.home-review-sliders-content').find('.home-review-slider-arrow.left'),
868        //nextArrow: jQuery(this).closest('.home-review-sliders-content').find('.home-review-slider-arrow.right'),
869        responsive: [
870            {
871               breakpoint: 1199,
872               settings: {
873                    slidesToShow: 3,
874                    slidesToScroll: 1
875               }
876            },
877            {
878               breakpoint: 992,
879               settings: {
880                    slidesToShow: 2
881               }
882            },
883            {
884               breakpoint: 767,
885               settings: {
886                    slidesToShow: 1
887               }
888            }
889        ]
890    });
891
892    jQuery('.whats-included-slider').slick({
893        slidesToShow: 3.5,
894        slidesToScroll: 1,
895        infinite: false,
896        dots: true,
897        prevArrow: jQuery('.whats-included-holder').find('.whats-included-slider-arrow.left'),
898        nextArrow: jQuery('.whats-included-holder').find('.whats-included-slider-arrow.right'),
899        responsive: [
900            {
901                breakpoint: 992,
902                settings: {
903                slidesToShow: 2.5,
904                slidesToScroll: 1
905                }
906            },
907            {
908                breakpoint: 550,
909                settings: {
910                    slidesToShow: 1.25,
911                    slidesToScroll: 1
912                }
913                }
914        ]
915    });
916
917    if(jQuery('#commentform').length > 0) {
918        jQuery('#commentform').validate({
919           rules: {
920              author: {
921                 required: true,
922                 minlength: 2
923              },
924              email: {
925                 required: true,
926                 email: true
927              },
928              comment: {
929                  required: true,
930                  minlength: 20
931              }
932        },
933       messages: {
934         author: "Please provide a name",
935         email: "Please enter a valid email address.",
936         comment: "Please fill the required field. Minimum legth of comment is 20 characters."
937       },
938       errorElement: "div",
939       errorPlacement: function(error, element) {
940         element.after(error);
941       }
942
943      })
944    }
945});
946
947function rideup_search_fetch() {
948    if (jQuery('#keyword').val().length > 2) {
949        jQuery.ajax({
950            url: '/wp-admin/admin-ajax.php',
951            type: 'post',
952            data: {action: 'search_data_fetch', keyword: jQuery('#keyword').val()},
953            success: function (data) {
954                jQuery('#datafetch').html(data);
955                jQuery("#datafetch").show();
956            }
957        });
958    } else {
959        jQuery("#datafetch").hide().html('');
960    }
961}
962
963function setSubmenuTop(top){
964    var submenus = jQuery('.submenu');
965
966    submenus.each(function(){
967       jQuery(this).attr('style', 'top:' + top + 'px;');
968    });
969}
970
971function updateCart() {
972    jQuery.ajax({
973        type: 'post',
974        url: '/wp-admin/admin-ajax.php',
975        data: {
976            action: 'rideup_update_cart'
977        },
978		beforeSend: function(){
979            jQuery('.side-cart-overlay').fadeIn();
980        },
981        success: function(data) {
982            if(data == 'cart') {
983                return;
984            }
985            var d = JSON.parse(data);
986            if(d.count > 0) {
987                jQuery('.cart-icon').html(`<img src="/wp-content/themes/ride1up-theme/assets/images/cart.svg" alt="cart-icon"><span class="mini-cart-count">${d.count}</span>`);
988            } else {
989                jQuery('.cart-icon').html(`<img src="/wp-content/themes/ride1up-theme/assets/images/cart.svg" alt="cart-icon">`);
990
991            }
992            jQuery( '.side-cart' ).html(d.cart);
993            jQuery('.side-cart-overlay').fadeOut();
994            initUpsellsSlider();
995        }
996    });
997}
998
999function addToCartFromShop(e) {
1000    e.preventDefault();
1001
1002    var button = jQuery(this),
1003    product_qty = button.attr('data-quantity') || 1,
1004    product_id = button.attr('data-product_id'),
1005    variation_id = 0;
1006    var data = {
1007        action: 'rideup_ajax_add_to_cart',
1008        product_id: product_id,
1009        quantity: product_qty,
1010        variation_id
1011    };
1012    jQuery.ajax({
1013        type: 'post',
1014        url: '/wp-admin/admin-ajax.php',
1015        data: data,
1016        beforeSend: function () {
1017            jQuery('.side-cart-overlay').fadeIn();
1018        },
1019        success: function (response) {
1020            if (response.error & response.product_url) {
1021                window.location = response.product_url;
1022                return;
1023            } else {
1024                    //jQuery(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash, button]);
1025                updateCart();
1026                setTimeout(function(){
1027                        jQuery('.side-cart').addClass('opened');
1028                        jQuery('.main-overlay').fadeIn();
1029                }, 500);
1030            }
1031        },
1032    });
1033}
1034
1035/* GATHER IDS FROM CHECKBOX UPSELL ITEMS INTO COMMA SEPARATED STRING */
1036
1037jQuery('.upsell_checkbox').change(function() {
1038    var product_ids_str = jQuery.map(jQuery(':checkbox[name=upsell_checkbox]:checked'), function(n, i){
1039        return n.value;
1040    }).join(',');
1041    // console.log(product_ids_str);
1042    jQuery('.upsell_ids').val(product_ids_str);
1043});
1044jQuery(document).ready(function(){
1045    /* Run once on single page load */
1046    var product_ids_str = jQuery.map(jQuery(':checkbox[name=upsell_checkbox]:checked'), function(n, i){
1047        return n.value;
1048    }).join(',');
1049    // console.log(product_ids_str);
1050    jQuery('.upsell_ids').val(product_ids_str);
1051    jQuery("input.upsell_checkbox.disabled").click(function() { return false; });
1052});
1053
1054function addToCartFromSingle(e) {
1055    if(jQuery('body.postid-318247').length){
1056        // Confirmed Gift Card Product, submit form
1057        // console.log("Gift card detected.");
1058        return;
1059    } else {
1060        e.preventDefault();
1061    }
1062    var button = jQuery(this),
1063        form = button.closest('form.cart'),
1064        id = button.val(),
1065        product_qty = form.find('input[name=quantity]').val() || 1,
1066        product_id = form.find('input[name=product_id]').val() || id,
1067        variation_id = form.find('input[name=variation_id]').val() || 0;
1068        upsell_ids = form.find('input[name=upsell_ids]').val() || 0;
1069        var recipient = jQuery('#pwgc-to').val();
1070        var sender = jQuery('#pwgc-from').val();
1071        var message = jQuery('#pwgc-message').val();
1072    var data = {
1073            action: 'rideup_ajax_add_to_cart',
1074            product_id: product_id,
1075            product_sku: '',
1076            quantity: product_qty,
1077            variation_id: variation_id,
1078            pw_gift_card_to: recipient,
1079            pw_gift_card_from: sender,
1080            pw_gift_card_message: message,
1081            upsell_ids: upsell_ids
1082        };
1083    jQuery.ajax({
1084            type: 'post',
1085            url: '/wp-admin/admin-ajax.php',
1086            data: data,
1087            beforeSend: function (response) {
1088                button.removeClass('added').addClass('loading');
1089            },
1090            complete: function (response) {
1091                button.addClass('added').removeClass('loading');
1092            },
1093            success: function (response) {
1094                if (response.error & response.product_url) {
1095                    window.location = response.product_url;
1096                    return;
1097                } else {
1098                    //jQuery(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash, button]);
1099                    updateCart();
1100                    setTimeout(function(){
1101                        jQuery('.side-cart').addClass('opened');
1102                        jQuery('.main-overlay').fadeIn();
1103                    }, 500);
1104                }
1105            },
1106    });
1107}
1108
1109function removeProductFromCart(e) {
1110    e.preventDefault();
1111    var id = jQuery(this).attr('data-product_id');
1112    var cart_item_key = jQuery(this).attr('data-cart-item-key');
1113    jQuery.ajax({
1114        type: "POST",
1115        url: '/wp-admin/admin-ajax.php',
1116        data: {
1117            action : 'rideup_remove_item_from_cart',
1118            product_id : id,
1119            cart_item_key
1120        },
1121        beforeSend: function(){
1122            jQuery('.side-cart-overlay').fadeIn();
1123        },
1124        success: function(data) {
1125            updateCart();
1126            jQuery('.side-cart-overlay').fadeOut();
1127        }
1128    });
1129}
1130function addProductFromCartUpsell(e) {
1131    e.preventDefault();
1132    var id = jQuery(this).attr('data-product_id');
1133    var cart_item_key = jQuery(this).attr('data-cart-item-key');
1134    jQuery.ajax({
1135        type: "POST",
1136        url: '/wp-admin/admin-ajax.php',
1137        data: {
1138            action : 'rideup_add_item_to_cart',
1139            product_id : id,
1140            cart_item_key
1141        },
1142        beforeSend: function(){
1143            jQuery('.side-cart-overlay').fadeIn();
1144        },
1145        success: function(data) {
1146            updateCart();
1147            jQuery('.side-cart-overlay').fadeOut();
1148        }
1149    });
1150}
1151
1152function initUpsellsSlider() {
1153    if(jQuery('.cart-upsells-wrapper').length > 0) {
1154        jQuery('.cart-upsells-holder').slick({
1155            slidesToShow: 3,
1156            slidesToScroll: 1,
1157            arrows: true,
1158            infinite: false,
1159            responsive: [
1160                {
1161                   breakpoint: 992,
1162                   settings: {
1163                        slidesToShow: 2
1164                   }
1165                },
1166                {
1167                   breakpoint: 767,
1168                   settings: {
1169                        slidesToShow: 1
1170                   }
1171                }
1172            ]
1173        });
1174    }
1175}
1176
1177function frameTypeSelectDropdown() {
1178
1179    if(jQuery('.current-selected').hasClass('opened')) {
1180        jQuery('.current-selected').removeClass('opened');
1181        jQuery('.bike-frame-custom-variations').slideUp();
1182    } else {
1183        jQuery('.current-selected').addClass('opened');
1184        jQuery('.bike-frame-custom-variations').slideDown();
1185    }
1186}
1187
1188function frameTypeSelectChange(e){
1189    e.preventDefault();
1190    frameTypeSelectDropdown();
1191    if(jQuery(this).hasClass('selected')) {
1192        return;
1193    }
1194    jQuery(this).addClass('selected');
1195    var value = jQuery(this).attr('data-val'),
1196        text = jQuery(this).text();
1197    jQuery(".selected-value").text(text);
1198    jQuery("#pa_frame-type").val(value).change();
1199    jQuery('.bike-frame-custom-variations-item').removeClass('selected');
1200    jQuery(this).addClass('selected');
1201}
1202
1203function frameTypeSelectChange2(e){
1204    e.preventDefault();
1205    // frameTypeSelectDropdown();
1206    jQuery('.bike-frame-custom-variations-item.selected').addClass('selected');
1207    var value = jQuery('.bike-frame-custom-variations-item.selected').attr('data-val'),
1208        text = jQuery('.bike-frame-custom-variations-item.selected').text();
1209    jQuery(".selected-value").text(text);
1210    jQuery("#pa_frame-type").val(value).change();
1211    // jQuery('.bike-frame-custom-variations-item').removeClass('selected');
1212    // jQuery(this).addClass('selected');
1213}
1214
1215function initBikeFrameSelect() {
1216    if(jQuery('#pa_frame-type').length > 0) {
1217         var current = jQuery('#pa_frame-type').val(),
1218             text = jQuery('.bike-frame-custom-variations-item[data-val='+current+']').text();
1219        jQuery('.selected-value').text(text);
1220        jQuery('.bike-frame-custom-variations-item[data-val='+current+']').addClass('selected');
1221    }
1222}
1223
1224function initBikesColorSelect() {
1225    var text = jQuery('.variation-row.pa_color').find('.swatch-image.selected').next().text();
1226    jQuery('.variation-row.pa_color').find('label').text(text);
1227}
1228
1229/*function initFixedBarData() {
1230    var img = jQuery('.woo-variation-gallery-slider-wrapper').find('.slick-current').find('img').attr('src'),
1231        frame = jQuery('#pa_frame-type').val(),
1232        frameText = jQuery('.bike-frame-custom-variations-item[data-val='+frame+']').text(),
1233        color = jQuery('.swatch-image.selected').attr('style');
1234        jQuery('.single_add_to_cart_button').removeClass('added');
1235        if(jQuery('.button-and-stock').find('.available-on-backorder').length > 0) {
1236            jQuery('.fixed-banner-status, .single-product-status-holder').text('Available on backorder');
1237            jQuery('.single_add_to_cart_button').text('Pre-order');
1238        } else {
1239            jQuery('.fixed-banner-status, .single-product-status-holder').text('In Stock');
1240            jQuery('.single_add_to_cart_button').text('Add To Cart');
1241        }
1242        jQuery('.fixed-banner-image').html(`<img src="${img}" alt="prod-img">`);
1243        jQuery('.fixed-banner-props-item-value.frame').text(frameText);
1244        jQuery('.fixed-banner-props-item-value.color').attr('style', color);
1245        setTimeout(function() {
1246            var price = jQuery('.woocommerce-variation-price.zz').html();
1247            jQuery('.fixed-banner-price').html(price);
1248        },500);
1249
1250}*/
1251
1252function reviewsButtonTextChange() {
1253    if(jQuery('.cr-tags-filter.cr-tag').length > 0) {
1254        jQuery('.cr-tags-filter.cr-tag').text('Show reviews with photo');
1255    }
1256}
1257function frameSwitch(e) {
1258    e.preventDefault();
1259    if(!jQuery(this).hasClass('active')) {
1260        var variations = [];
1261        var frame = jQuery(this).attr('data-frame');
1262        var height = jQuery('.measurement-heights-item.active').attr('data-height');
1263        jQuery('.measurement-variations-image img').each(function(){
1264            var frame = jQuery(this).attr('data-frame'),
1265                height = jQuery(this).attr('data-height'),
1266                item = {frame, height};
1267                variations.push(item);
1268        });
1269        if(!variations.some(variation => variation.height === height && variation.frame === frame)) {
1270            return;
1271        }
1272        jQuery('.measurement-frames-item').removeClass('active');
1273        jQuery(this).addClass('active');
1274        jQuery('.measurement-variations-image img').removeClass('active');
1275        jQuery('.measurement-variations-image img[data-frame='+frame+'][data-height='+height+']').addClass('active');
1276    }
1277}
1278function heightSwitch(e) {
1279    e.preventDefault();
1280    if(!jQuery(this).hasClass('active')) {
1281        var variations = [];
1282        var height = jQuery(this).attr('data-height');
1283        var frame = jQuery('.measurement-frames-item.active').attr('data-frame');
1284        jQuery('.measurement-variations-image img').each(function(){
1285            var frame = jQuery(this).attr('data-frame'),
1286                height = jQuery(this).attr('data-height'),
1287                item = {frame, height};
1288                variations.push(item);
1289        });
1290        if(!variations.some(variation => variation.height === height && variation.frame === frame)) {
1291            return;
1292        }
1293        jQuery('.measurement-heights-item').removeClass('active');
1294        jQuery(this).addClass('active');
1295        jQuery('.measurement-variations-image img, .measurements-descriptions-item').removeClass('active');
1296        jQuery('.measurement-variations-image img[data-frame='+frame+'][data-height='+height+']').addClass('active');
1297        jQuery('.measurements-descriptions-item[data-frame='+frame+'][data-height='+height+']').addClass('active');
1298    }
1299}
1300
1301function galleryImagesScrollHandle(e) {
1302    e.preventDefault();
1303    if(jQuery(this).hasClass('active')) {
1304        return;
1305    }
1306    var order = jQuery(this).attr('data-order');
1307    var scroll = jQuery('.bike-gallery-images-block[data-order="'+order+'"]').offset().top + 2;
1308    jQuery('body,html').animate({scrollTop: scroll}, 1000);
1309}
1310
1311function galleryImagesWaypointsInit() {
1312    jQuery('.bike-gallery-images-block').each(function(index, item){
1313        var waypoint = new Waypoint({
1314            element: jQuery(item),
1315            handler: function(direction) {
1316                var order = jQuery(item).attr('data-order');
1317                jQuery('.bike-gallery-sidebar-item').removeClass('active');
1318                jQuery('.bike-gallery-sidebar-item[data-order="'+order+'"]').addClass('active');
1319            }
1320        })
1321    })
1322}
1323
1324function categoryBikesFilterOpen() {
1325    jQuery('.custom-filter-current').addClass('opened').next().slideDown();
1326}
1327function categoryBikesFilterClose() {
1328    jQuery('.custom-filter-current').removeClass('opened').next().slideUp();
1329}
1330
1331// Function to get and auto play YouTube video from datatag
1332function autoPlayYouTubeModal(){
1333    var trigger = jQuery("body").find('[data-toggle="modal"]');
1334    jQuery('body').on('swipe', '[data-toggle="modal"]', function(event, slick, direction){
1335        event.stopPropagation();
1336    });
1337    jQuery('body').on('click', '[data-toggle="modal"]', function(event, slick, direction){
1338        event.preventDefault();
1339        jQuery("body").addClass("modal-open");
1340        var theModal = jQuery(this).data( "target" ),
1341        videoSRC = jQuery(this).attr( "data-src" ),
1342        videoSRCauto = videoSRC+"?autoplay=1" ;
1343        setTimeout(
1344            function() 
1345            {
1346                jQuery(theModal+' iframe').attr('src', videoSRCauto);
1347            }, 100);
1348        jQuery(theModal+' button.close').click(function () {
1349            jQuery(theModal+' iframe').attr('src', '');
1350            jQuery("body").removeClass("modal-open");
1351        });
1352    });
1353}
1354jQuery(document).ready(function(){
1355    autoPlayYouTubeModal();
1356});
1357
1358jQuery(function() {
1359    // Filter Components
1360    if(jQuery('.sub-tabs.components').length > 0){ // check for tab labels
1361        var divs = jQuery('.tab-section-item.components');
1362        jQuery('.components .tab-labels').on('click', function (e) {
1363            e.preventDefault();
1364            jQuery('.components .tab-labels').removeClass('active');
1365            var $this = jQuery(this);
1366            $this.addClass('active');
1367            var type = $this.data('tab-label');
1368            divs.show();
1369            // divs.filter('[data-category-type="'+cat+'"][data-category-name="'+nam+'"]').show();
1370            divs.filter(':not(".'+type+', .default")').hide();
1371        });
1372        jQuery('.components .tab-labels.active').click();
1373    }
1374    if(jQuery('.sub-tabs.assembly').length > 0){ // check for tab labels
1375        var assemblyDivs = jQuery('.assembly-inner');
1376        jQuery('.assembly .tab-labels').on('click', function (e) {
1377            e.preventDefault();
1378            jQuery('.assembly .tab-labels').removeClass('active');
1379            var $this = jQuery(this);
1380            $this.addClass('active');
1381            var type = $this.data('tab-label');
1382            assemblyDivs.show();
1383            // divs.filter('[data-category-type="'+cat+'"][data-category-name="'+nam+'"]').show();
1384            assemblyDivs.filter(':not(".'+type+'")').hide();
1385        });
1386        jQuery('.assembly .tab-labels.active').click();
1387    }
1388    jQuery(document).ready(function(){
1389       
1390        // Main Hero Slider - Homepage
1391        if(jQuery('.home_hero_slider').length){
1392            var owl = jQuery('.home_hero_slider').owlCarousel({
1393                loop:true,
1394                margin:0,
1395                nav:true,
1396                drag: false,
1397                autoplay:true,
1398                autoplayTimeout:5000,
1399                smartSpeed:1000,
1400                autoplayHoverPause:true,
1401                navText:["<div class='nav-btn prev-slide'></div>","<div class='nav-btn next-slide'></div>"],
1402                responsive:{
1403                    0:{
1404                        items:1
1405                    },
1406                    600:{
1407                        items:1
1408                    },
1409                    1200:{
1410                        items:1
1411                    }
1412                },
1413            })
1414        }
1415        // Influencer page slider
1416        if(jQuery('.list_slider > div').length){
1417            var owl = jQuery('.list_slider > div').owlCarousel({
1418                loop:false,
1419                margin:10,
1420                nav:true,
1421                drag: false,
1422                navText:["<div class='nav-btn prev-slide'></div>","<div class='nav-btn next-slide'></div>"],
1423                responsive:{
1424                    0:{
1425                        items:1
1426                    },
1427                    600:{
1428                        items:2
1429                    },
1430                    1200:{
1431                        items:4
1432                    }
1433                },
1434            })
1435        }
1436        // Main Product Slider - Homepage
1437        // OWL CAROUSEL 2 INIT
1438        if(jQuery('.ride1up-bikes-owlslider ul').length){
1439            var owl = jQuery('.ride1up-bikes-owlslider ul').owlCarousel({
1440                loop:false,
1441                margin:24,
1442                autoWidth:true,
1443                nav:true,
1444                drag: false,
1445                navText : [
1446                    '<svg class="home-products-slider-arrow left" width="50" height="50" viewB
1446ox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M30.0625 12.3541L42.7083 25L30.0625 37.6458" stroke="#C42624" stroke-width="2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.29199 25H42.3545" stroke="#C42624" stroke-width="2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg>',
1447                    '<svg class="home-products-slider-arrow right" width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M30.0625 12.3541L42.7083 25L30.0625 37.6458" stroke="#C42624" stroke-width="2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.29199 25H42.3545" stroke="#C42624" stroke-width="2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg>'
1448                ]
1449            })
1450        }
1451        jQuery( '.sub-tabs.bike-filters' ).on( 'click', '.tab-labels', function(e) {
1452            e.preventDefault();
1453            var $item = jQuery(this);
1454            var filter = $item.data( 'tab-label' );
1455            jQuery('.bike-filters .tab-labels').removeClass('active');
1456            $item.addClass('active');
1457            owl.owlcarousel2_filter( filter );
1458            var filterText = $item.text();
1459            jQuery('.dropdown .show-on-mobile').text(filterText);
1460
1461            let $frameSwatches        = jQuery('.woo-variation-gallery-product .frame-swatches');
1462		    let $frame_swatch = $frameSwatches.find('.swatch');
1463            if ( $frameSwatches.length ){
1464                // console.log("Frame swatch found.");
1465                $frame_swatch.click(function () {
1466                    // console.log("Frame clicked");
1467                    var currertColorObj = jQuery(this).closest('.product').find('.color-swatches').find('.selected');
1468                    var $currentFrame         = jQuery(this).attr('data-frame');
1469                    var $currentColor         = jQuery(this).closest('.product').find('.color-swatches').find('.selected').data('color');
1470                    var $currentPreviews      = jQuery(this).closest('.product').find('.hidden-preview-image');
1471                    var $currentPreviewImage  = jQuery(this).parent().parent().siblings("img:not(.promo-sticker__icon)");
1472                    var custom_arr1 = [];
1473                    // Run through possible 3rd options
1474                    var $currentThirdOption   = jQuery(this).closest('.product').find('.third-option-swatches').find('.selected').data('drivetrain');
1475                    var $thirdOptionType = 'drivetrain';
1476                    if (typeof $currentThirdOption === 'undefined') {
1477                        $currentThirdOption   = jQuery(this).closest('.product').find('.third-option-swatches').find('.selected').data('framesize');
1478                        $thirdOptionType = 'framesize';
1479                    }
1480                    if (typeof $currentThirdOption === 'undefined') {
1481                        $currentThirdOption   = jQuery(this).closest('.product').find('.third-option-swatches').find('.selected').data('variant');
1482                        $thirdOptionType = 'variant';
1483                    }
1484
1485                    if (typeof $currentThirdOption === 'undefined') {
1486                        // console.log("3rd option does not exist");
1487                        $currentPreviews.each(function() {
1488                            if ( $currentFrame == jQuery(this).attr('data-frame') && $currentColor == jQuery(this).attr('data-color') && jQuery(this).attr('data-image').length ) {
1489                                $currentPreviewImage.attr('src', jQuery(this).attr('data-image'));
1490                                var imageFound = jQuery(this).attr('data-availability');
1491                                if(imageFound == 'onbackorder') {
1492                                    jQuery(this).closest('.product').find('.home-products-item-status').text('Available on backorder');
1493                                } else if(imageFound == 'instock') {
1494                                    jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1495                                }
1496                                return false;
1497                            } else {
1498                                jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1499                            }
1500                            var fc=jQuery(this).attr('data-frame')+"+"+j
1500Query(this).attr('data-color');
1501                            custom_arr1.push(fc);
1502                        });
1503                        /* if(currertColorObj.hasClass('disabled') || jQuery(this).hasClass('disabled')) {
1504                            jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1505                        } else {
1506                            jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1507                        }*/
1508                        jQuery(this).closest('.woocommerce-loop-product__link').find('.price .pri').hide();
1509                        jQuery(this).closest('.woocommerce-loop-product__link').find('.pri.'+$currentFrame+'.'+$currentColor).show();
1510                        //frame loop
1511                        jQuery(this).closest('.product').find('.color-swatches').find('span.swatch-image').each(function() {
1512                            var frm = jQuery(this).attr('data-color');
1513                            if(frm != null){
1514                                //console.log("frm="+frm);
1515                                var chkmatch=$currentFrame+"+"+frm;
1516                                //console.log("matchthis="+chkmatch);
1517                                if(jQuery.inArray( chkmatch, custom_arr1 ) !== -1 ){
1518                                    //console.log("exist");
1519                                    jQuery(this).removeClass("disabled");
1520                                } else {
1521                                    //console.log("not exist");
1522                                    jQuery(this).addClass("disabled");
1523
1524                                }
1525                            }
1526                            //if($currentColor == frm){
1527                            //    console.log("1frm="+frm);
1528                            //    jQuery(this).click();
1529                            //    //jQuery(this).change();
1530                            //}
1531                        });
1532                    } else {
1533                        // console.log("3rd option exists");
1534                        $currentPreviews.each(function() {
1535                            if ( $currentFrame == jQuery(this).attr('data-frame') && $currentColor == jQuery(this).attr('data-color') && $currentThirdOption == jQuery(this).attr('data-'+$thirdOptionType) && jQuery(this).attr('data-image').length ) {
1536                                $currentPreviewImage.attr('src', jQuery(this).attr('data-image'));
1537                                var imageFound = jQuery(this).attr('data-availability');
1538                                if(imageFound == 'onbackorder') {
1539                                    jQuery(this).closest('.product').find('.home-products-item-status').text('Available on backorder');
1540                                } else if(imageFound == 'instock') {
1541                                    jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1542                                }
1543                                return false;
1544                            } else {
1545                                jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1546                            }
1547                            var fc=jQuery(this).attr('data-frame')+"+"+jQuery(this).attr('data-color')+"+"+jQuery(this).attr('data-'+$thirdOptionType);
1548                            custom_arr1.push(fc);
1549                        });
1550                        /* if(currertColorObj.hasClass('disabled') || jQuery(this).hasClass('disabled')) {
1551                            jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1552                        } else {
1553                            jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1554                        }*/
1555                        jQuery(this).closest('.woocommerce-loop-product__link').find('.price .pri').hide();
1556                        jQuery(this).closest('.woocommerce-loop-product__link').find('.pri.'+$currentFrame+'.'+$currentColor+'.'+$currentThirdOption).show();
1557                        //frame loop
1558                        jQuery(this).closest('.product').find('.color-swatches').find('span.swatch-image').each(function() {
1559                            var frm = jQuery(this).attr('data-color');
1560                            if(frm != null){
1561                                //console.log("frm="+frm);
1562                                var chkmatch=$currentFrame+"+"+frm;
1563                                //console.log("matchthis="+chkmatch);
1564                                if(jQuery.inArray( chkmatch, custom_arr1 ) !== -1 ){
1565                                    //console.log("exist");
1566                                    jQuery(this).removeClass("disabled");
1567                                } else {
1568                                    //console.log("not exist");
1569                                    jQuery(this).addClass("disable");
1570
1571                                }
1572                            }
1573                            //if($currentColor == frm){
1574                            //    console.log("1frm="+frm);
1575                            //    jQuery(this).click();
1576                            //    //jQuery(this).change();
1577                            //}
1578                        });
1579                    }
1580                    // console.log('Frames Frame:' + $currentFrame);
1581                    // console.log('Frames Color:' + $currentColor);
1582
1583                    jQuery(this).siblings().removeClass('selected');
1584                    jQuery(this).addClass('selected');
1585                    jQuery(this).closest('.product').find('.color-swatches').find('.selected').click();
1586                    if(jQuery(".swatch-fs").hasClass('selected')){
1587                        jQuery('.swatch-fs').closest('.custom-products-item').find('.promo-sticker').hide();
1588                        jQuery('.swatch-fs').closest('.home-products-item-top').find('.promo-sticker').hide();
1589                    } else {
1590                        jQuery('.swatch-fs').closest('.custom-products-item').find('.promo-sticker').show();
1591                        jQuery('.swatch-fs').closest('.home-products-item-top').find('.promo-sticker').show();
1592                    }
1593                    if(jQuery(".post-334654 .swatch-xr, .product-id-334654 .swatch-xr").hasClass('selected')){
1594                        jQuery('.post-334654 .swatch-xr, .product-id-334654 .swatch-xr').closest('.custom-products-item').find('.promo-sticker').hide();
1595                        jQuery('.post-334654 .swatch-xr, .product-id-334654 .swatch-xr').closest('.home-products-item-top').find('.promo-sticker').hide();
1596                    } else {
1597                        jQuery('.post-334654 .swatch-xr, .product-id-334654 .swatch-xr').closest('.custom-products-item').find('.promo-sticker').show();
1598                        jQuery('.post-334654 .swatch-xr, .product-id-334654 .swatch-xr').closest('.home-products-item-top').find('.promo-sticker').show();
1599                    }
1600                    if(jQuery(this).closest('.product').find(".wholesale-price:visible").hasClass('wholesale-sale')){
1601                        // console.log('this product has wholesale sales price');
1602                        jQuery(this).closest('.product').find(".wholesalesale-sticker").show();
1603                    } else {
1604                        // console.log('this product has no wholesale sales price');
1605                        jQuery(this).closest('.product').find(".wholesalesale-sticker").hide();
1606                        // jQuery('.swatch-fs').closest('.custom-products-item').find('.wholesalesale-sticker').show();
1607                        // jQuery('.swatch-fs').closest('.home-products-item-top').find('.wholesalesale-sticker').show();
1608                    }
1609                });
1610            }
1611            /**
1612             * Color Swatch Logic
1613             * @type {*|jQuery|HTMLElement}
1614             */
1615            var $colorSwatches        = jQuery('.woo-variation-gallery-product .color-swatches');
1616            if ( $colorSwatches.length ){
1617                const $color_swatch = $colorSwatches.find('.swatch');
1618                $color_swatch.click(function () {
1619                    var $currentColor         = jQuery(this).attr('data-color');
1620                    var $currentFrameObj      = jQuery(this).closest('.product').find('.frame-swatches').find('.selected');
1621                    var $currentFrame         = jQuery(this).closest('.product').find('.frame-swatches').find('.selected').attr('data-frame');
1622                    var $currentPreviews      = jQuery(this).closest('.product').find('.hidden-preview-image');
1623                    var $currentPreviewImage  = jQuery(this).parent().parent().siblings().find("img:not(.custom-product-props-item-img,.promo-sticker__icon)");
1624                    var custom_arr1 = [];
1625                    var $currentThirdOption   = jQuery(this).closest('.product').find('.third-option-swatches').find('.selected').data('drivetrain');
1626                    var $thirdOptionType = 'drivetrain';
1627                    if (typeof $currentThirdOption === 'undefined') {
1628                        $currentThirdOption   = jQuery(this).closest('.product').find('.third-option-swatches').find('.selected').data('framesize');
1629                        $thirdOptionType = 'framesize';
1630                    }
1631                    if (typeof $currentThirdOption === 'undefined') {
1632                        $currentThirdOption   = jQuery(this).closest('.product').find('.third-option-swatches').find('.selected').data('variant');
1633                        $thirdOptionType = 'variant';
1634                    }
1635                    if (typeof $currentThirdOption === 'undefined') {
1636                        $currentPreviews.each(function() {
1637                            if ( $currentFrame == jQuery(this).attr('data-frame') && $currentColor == jQuery(this).attr('data-color') && jQuery(this).attr('data-image').length ) {
1638                                $currentPreviewImage.attr('src', jQuery(this).attr('data-image'));
1639                                var imageFound = jQuery(this).attr('data-availability');
1640                                if(imageFound == 'onbackorder') {
1641                                    jQuery(this).closest('.product').find('.home-products-item-status').text('Available on backorder');
1642                                } else if(imageFound == 'instock') {
1643                                    jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1644                                }
1645                                return false;
1646                            } else {
1647                                jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1648                            }
1649                            var fc=jQuery(this).attr('data-frame')+"+"+jQuery(this).attr('data-color');
1650                            custom_arr1.push(fc);
1651                        });
1652                        /*if($currentFrameObj.hasClass('disabled') || jQuery(this).hasClass('disabled')) {
1653                            jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1654                        } else {
1655                            jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1656                        }*/
1657                        jQuery(this).closest('.product').find('.price .pri').hide();
1658                        jQuery(this).closest('.product').find('.pri.'+$currentFrame+'.'+$currentColor).show();
1659                        //frame loop
1660                        jQuery(this).parent().find('span.swatch-label').each(function() {
1661                            var frm = jQuery(this).attr('data-frame');
1662                            if(frm != null){
1663                                // console.log("frm="+frm);
1664                                var chkmatch=frm+"+"+$currentColor;
1665                                //console.log("matchthis="+chkmatch);
1666                                if(jQuery.inArray( chkmatch, custom_arr1 ) !== -1 ){
1667                                    //console.log("exist");
1668                                    jQuery(this).removeClass("disabled");
1669                                    //jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1670                                } else {
1671                                    //console.log("not exist");
1672                                    jQuery(this).addClass("disabled");
1673                                    //jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1674                                }
1675                            }
1676                        });
1677
1678                        // console.log('Colors Color:' + $currentColor);
1679                        // console.log('Colors Frame:' + $currentFrame);
1680
1681                        jQuery(this).siblings().removeClass('selected');
1682                        jQuery(this).addClass('selected');
1683                    } else {
1684                        // 3rd option exists
1685                        // console.log($currentThirdOption);
1686                        $currentPreviews.each(function() {
1687                            if ( $currentFrame == jQuery(this).attr('data-frame') && $currentColor == jQuery(this).attr('data-color') && $currentThirdOption == jQuery(this).attr('data-'+$thirdOptionType) && jQuery(this).attr('data-image').length ) {
1688                                $currentPreviewImage.attr('src', jQuery(this).attr('data-image'));
1689                                var imageFound = jQuery(this).attr('data-availability');
1690                                if(imageFound == 'onbackorder') {
1691                                    jQuery(this).closest('.product').find('.home-products-item-status').text('Available on backorder');
1692                                } else if(imageFound == 'instock') {
1693                                    jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1694                                }
1695                                return false;
1696                            } else {
1697                                jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1698                            }
1699                            var fc=jQuery(this).attr('data-frame')+"+"+j
1699Query(this).attr('data-color')+"+"+jQuery(this).attr('data-'+$thirdOptionType);
1700                            custom_arr1.push(fc);
1701                        });
1702                        /*if($currentFrameObj.hasClass('disabled') || jQuery(this).hasClass('disabled')) {
1703                            jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1704                        } else {
1705                            jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1706                        }*/
1707                        jQuery(this).closest('.product').find('.price .pri').hide();
1708                        jQuery(this).closest('.product').find('.pri.'+$currentFrame+'.'+$currentColor+'.'+$currentThirdOption).show();
1709                        //frame loop
1710                        jQuery(this).parent().find('span.swatch-label').each(function() {
1711                            var frm = jQuery(this).attr('data-frame');
1712                            if(frm != null){
1713                                //console.log("frm="+frm);
1714                                var chkmatch=frm+"+"+$currentColor+"+"+$currentThirdOption;
1715                                //console.log("matchthis="+chkmatch);
1716                                if(jQuery.inArray( chkmatch, custom_arr1 ) !== -1 ){
1717                                    //console.log("exist");
1718                                    jQuery(this).removeClass("disabled");
1719                                    //jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1720                                } else {
1721                                    //console.log("not exist");
1722                                    jQuery(this).addClass("disabled");
1723                                    //jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1724                                }
1725                            }
1726                        });
1727
1728                        // console.log('Colors Color:' + $currentColor);
1729                        // console.log('Colors Frame:' + $currentFrame);
1730
1731                        jQuery(this).siblings().removeClass('selected');
1732                        jQuery(this).addClass('selected');
1733                    }
1734                })
1735            }
1736
1737            /**
1738             * Third Option Swatch Logic
1739             * @type {*|jQuery|HTMLElement}
1740             */
1741            var $thirdOptionSwatches        = jQuery('.woo-variation-gallery-product .third-option-swatches');
1742            if ( $thirdOptionSwatches.length ){
1743                const $thirdoption_swatch = $thirdOptionSwatches.find('.swatch');
1744                $thirdoption_swatch.click(function () {
1745                    // console.log("Here!");
1746                    var $currentThirdOption   = jQuery(this).attr('data-drivetrain');
1747                    var $thirdOptionType = 'drivetrain';
1748                    if (typeof $currentThirdOption === 'undefined') {
1749                        $currentThirdOption   = jQuery(this).attr('data-framesize');
1750                        $thirdOptionType = 'framesize';
1751                    }
1752                    if (typeof $currentThirdOption === 'undefined') {
1753                        $currentThirdOption   = jQuery(this).attr('data-variant');
1754                        $thirdOptionType = 'variant';
1755                    }
1756                    // console.log($currentThirdOption);
1757                    // console.log($thirdOptionType);
1758                    var $currentColor         = jQuery(this).closest('.product').find('.color-swatches').find('.selected').data('color');
1759                    var $currentFrameObj      = jQuery(this).closest('.product').find('.frame-swatches').find('.selected');
1760                    var $currentFrame         = jQuery(this).closest('.product').find('.frame-swatches').find('.selected').attr('data-frame');
1761                    var $currentPreviews      = jQuery(this).closest('.product').find('.hidden-preview-image');
1762                    var $currentPreviewImage  = jQuery(this).parent().parent().siblings().find("img:not(.custom-product-props-item-img,.promo-sticker__icon)");
1763                    var custom_arr1 = [];
1764                    
1765                    // 3rd option exists
1766                    $currentPreviews.each(function() {
1767                        if ( $currentFrame == jQuery(this).attr('data-frame') && $currentColor == jQuery(this).attr('data-color') && $currentThirdOption == jQuery(this).attr('data-' + $thirdOptionType) && jQuery(this).attr('data-image').length ) {
1768                            $currentPreviewImage.attr('src', jQuery(this).attr('data-image'));
1769                            var imageFound = jQuery(this).attr('data-availability');
1770                            if(imageFound == 'onbackorder') {
1771                                jQuery(this).closest('.product').find('.home-products-item-status').text('Available on backorder');
1772                            } else if(imageFound == 'instock') {
1773                                jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1774                            }
1775                            return false;
1776                        } else {
1777                            jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1778                        }
1779                        var fc=jQuery(this).attr('data-frame')+"+"+jQuery(this).attr('data-color')+"+"+jQuery(this).attr('data-' + $thirdOptionType);
1780                        custom_arr1.push(fc);
1781                    });
1782                    /*if($currentFrameObj.hasClass('disabled') || jQuery(this).hasClass('disabled')) {
1783                        jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1784                    } else {
1785                        jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1786                    }*/
1787                    jQuery(this).closest('.product').find('.price .pri').hide();
1788                    jQuery(this).closest('.product').find('.pri.'+$currentFrame+'.'+$currentColor+'.'+$currentThirdOption).show();
1789                    //frame loop
1790                    jQuery(this).parent().find('span.swatch-label').each(function() {
1791                        var frm = jQuery(this).attr('data-frame');
1792                        if(frm != null){
1793                            //console.log("frm="+frm);
1794                            var chkmatch=frm+"+"+$currentColor+"+"+$currentThirdOption;
1795                            //console.log("matchthis="+chkmatch);
1796                            if(jQuery.inArray( chkmatch, custom_arr1 ) !== -1 ){
1797                                //console.log("exist");
1798                                jQuery(this).removeClass("disabled");
1799                                //jQuery(this).closest('.product').find('.home-products-item-status').text('In Stock');
1800                            } else {
1801                                //console.log("not exist");
1802                                jQuery(this).addClass("disabled");
1803                                //jQuery(this).closest('.product').find('.home-products-item-status').text('Out of Stock');
1804                            }
1805                        }
1806                    });
1807
1808                    // console.log('Colors Color:' + $currentColor);
1809                    // console.log('Colors Frame:' + $currentFrame);
1810
1811                    jQuery(this).siblings().removeClass('selected');
1812                    jQuery(this).addClass('selected');
1813                })
1814            }
1815        } )
1816    });
1817    /*
1818    jQuery(window).resize(function(){
1819        jQuery('.ride1up-bikes-slider ul').slick('reinit');
1820    });
1821    */
1822
1823    var dropdown = document.getElementsByClassName("dropdown");
1824    var attribute;
1825    var myFunction = function() {
1826        if (jQuery(window).width() < 600 ){
1827            attribute = this.getAttribute("data-target");
1828            var x = document.getElementById(attribute);
1829            jQuery('.sub-tabs.bike-filters').toggle();
1830        }
1831        
1832    };
1833    for (var i = 0; i < dropdown.length; i++) {
1834        dropdown[i].addEventListener('click', myFunction, false);
1835    }
1836})

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.