PageSourceSearch

https://brainbehaviorclinic.com/wp-content/themes/uncode/library/js/woocommerce-uncode.js?ver=1278032763

js brainbehaviorclinic.com collected 2026-10-10 02:37:48 UTC 39,465 bytes, 1,230 lines download raw bytes

1(function($) {
2	"use strict";
3
4	var UNCODE_WC = window.UNCODE_WC || {};
5	window.UNCODE_WC = UNCODE_WC;
6
7	function get_cart() {
8		var ajaxurl = '';
9
10		if (window.wc_add_to_cart_params != undefined) {
11			ajaxurl = wc_add_to_cart_params.ajax_url
12		}
13
14		if (window.woocommerce_params != undefined) {
15			ajaxurl = woocommerce_params.ajax_url
16		}
17
18		if (ajaxurl) {
19			$.post({
20				url: ajaxurl,
21				dataType: 'JSON',
22				data: {
23					action: 'woomenucart_ajax'
24				},
25				success: function(data, textStatus, XMLHttpRequest) {
26					$('.uncode-cart-dropdown').html(data.cart);
27					if (data != '') {
28						if ( SiteParameters.uncode_wc_popup_cart_qty ) {
29							if ($('.uncode-cart .badge, .mobile-shopping-cart .badge').length) {
30								$('.uncode-cart .badge, .mobile-shopping-cart .badge').html(data.articles);
31							} else {
32								$('.uncode-cart .cart-icon-container').append('<span class="badge init-product-counter">' + data.articles + '</span>'); //$('.uncode-cart .badge').html(data.articles);
33							}
34							$(document.body).trigger('uncode_get_cart', [data.articles]);
35						} else {
36							if ($('.uncode-cart .badge, .mobile-shopping-cart .badge').length) {
37								if (data.articles > 0) {
38									$('.uncode-cart .badge, .mobile-shopping-cart .badge').html(data.articles);
39									$('.uncode-cart .badge, .mobile-shopping-cart .badge').show();
40								} else {
41									$('.uncode-cart .badge, .mobile-shopping-cart .badge').hide();
42								}
43							} else {
44								$('.uncode-cart .cart-icon-container').append('<span class="badge">' + data.articles + '</span>'); //$('.uncode-cart .badge').html(data.articles);
45							}
46						}
47					}
48				}
49			});
50		}
51
52	}
53
54	function remove_from_cart() {
55		$(document).on('click', '.uncode-cart-dropdown a.remove', function(e){
56
57			var $remove = $(this),
58				product_id = $remove.attr("data-product_id"),
59				item_key = $remove.attr("data-item_key"),
60				$li = $remove.parents('.cart-item-list').eq(0).addClass('removing-item').animate({
61					opacity: .5
62				},150);
63
64			$.post({
65				dataType: 'json',
66				url: wc_add_to_cart_params.ajax_url,
67				data: {
68					action: "woomenucart_remove_ajax",
69					item_key: item_key
70				},
71				success: function(html){
72					$li.slideUp(200, function(){
73						get_cart();
74					});
75				}
76			});
77
78			return false;
79		});
80	}
81
82	function reset_product_image(event, variation) {
83		var $target = event.target,
84			$row = $target.closest('.row-parent', $row),
85			get_href = $('a.woocommerce-main-image', $row),
86			image_variable = $('> img', get_href),
87			getLightbox = typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced ? UNCODE.lightboxArray[get_href.data('lbox')] : false;
88
89		if (SiteParameters.uncode_adaptive == true) {
90			image_variable.removeClass(['async-done', 'woocommerce-product-gallery__image-first__img']).addClass('adaptive-async');
91			image_variable.wc_reset_variation_attr( 'src' );
92			image_variable.wc_reset_variation_attr( 'data-path' );
93			image_variable.wc_reset_variation_attr( 'data-guid' );
94			UNCODE.adaptive();
95		}
96
97		if (getLightbox != undefined && getLightbox !== false) {
98			getLightbox.refresh();
99		} else if ( SiteParameters.lbox_enhanced ) {
100			get_href.closest('.woocommerce-product-gallery').trigger('more-items-loaded');
101		}
102	}
103
104	function change_images(event, variation) {
105		if ($(this).closest('.tmb-woocommerce').length > 0) {
106			return;
107		}
108
109		UNCODE.single_product_variation_already_changed = true;
110		if (variation.image_src !== '') {
111			var $target = event.target,
112				$row = $target.closest('.row-parent', $row),
113				get_href = $('a.woocommerce-main-image', $row),
114				$col_bg = $('.uncol-featured-image .background-inner', $row),
115				image_variable = $('> img', get_href),
116				image_thumb = variation.image.thumb_src,
117				gallery_thumb = variation.image.gallery_thumbnail_src,
118				image_srcset = variation.image.thumb_srcset,
119				getLightbox = typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced ? UNCODE.lightboxArray[get_href.data('lbox')] : false;
120			get_href.data('options', "thumbnail: '" + variation.image_src + "'");
121			if (SiteParameters.uncode_adaptive == true) {
122				image_variable.wc_set_variation_attr( 'src', variation.image_src );
123				image_variable.wc_set_variation_attr( 'data-path', variation.uncode_image_path );
124				image_variable.wc_set_variation_attr( 'data-guid', variation.uncode_image_guid );
125				image_variable.removeClass(['async-done', 'woocommerce-product-gallery__image-first__img']).addClass('adaptive-async');
126				UNCODE.adaptive();
127			}
128			if (getLightbox != undefined && getLightbox !== false) {
129				getLightbox.refresh();
130			} else if ( SiteParameters.lbox_enhanced ) {
131				get_href.closest('.woocommerce-product-gallery').trigger('more-items-loaded');
132			}
133			$(window).trigger('focus');
134
135			var $woocommerce_product_gallery_nav = $('.woocommerce-product-gallery-nav');
136
137			if ($woocommerce_product_gallery_nav.length) {
138				var $first_thumb = $woocommerce_product_gallery_nav.find('.woocommerce-product-gallery__wrapper-nav li.woocommerce-product-gallery__first-thumb img', $row);
139				if ( SiteParameters.uncode_adaptive == true ) {
140					var data_crop = $first_thumb.attr('data-crop'),
141						data_singlew = $first_thumb.attr('data-singlew'),
142						data_singleh = $first_thumb.attr('data-singleh');
143
144					$first_thumb
145						.attr('src', gallery_thumb)
146						.attr('data-path', variation.uncode_image_path)
147						.attr('data-guid', variation.uncode_image_guid)
148						.attr('data-uniqueid', variation.data_uniqueid)
149						.attr('data-width', variation.data_width)
150						.attr('data-height', variation.data_height)
151						.attr('data-singlew', variation.data_singlew)
152						.attr('data-singleh', variation.data_singleh)
153						.attr('data-crop', variation.data_crop);
154
155					if (!$woocommerce_product_gallery_nav.hasClass('lateral-nav-wrapper')) {
156						$first_thumb.removeClass(['async-done', 'adaptive-fetching']).addClass('adaptive-async');
157						UNCODE.adaptive();
158					}
159				} else {
160					$first_thumb
161						.attr('src', gallery_thumb);
162					if ( image_srcset ) {
163						$first_thumb.attr('srcset', image_srcset);
164					}
165					$(window).trigger('woocommerce_variation_has_loaded');
166				}
167			}
168
169			if ( $col_bg.length ) {
170				var objImg = new Image(),
171					bg_img_src;
172				if ( $col_bg.hasClass( 'async-done') ) {
173					bg_img_src = variation.image_link;
174				} else {
175					bg_img_src = variation.image_src;
176				}
177				objImg.src = bg_img_src;
178				objImg.onload = function() {
179					$col_bg.animate({ opacity: 0 }, 100, function(){
180						$col_bg.css({'background-image':'url('+bg_img_src+')'});
181						$col_bg.animate({ opacity: 1 }, 250);
182					});
183				}
184			}
185		}
186	}
187
188	function reset_data(event) {
189		if ( UNCODE.single_product_variation_already_changed ) {
190			var $col_bg = $('.uncol-featured-image .background-inner'),
191				$first_thumb = $('.woocommerce-product-gallery__first-thumb img'),
192				bg_img_src,
193				bg_img_srcset,
194				objImg = new Image();
195
196			if ( $col_bg.length ) {
197				bg_img_src = $col_bg.attr('data-o_src');
198				objImg = new Image();
199				objImg.src = bg_img_src;
200				objImg.onload = function() {
201					$col_bg.animate({ opacity: 0 }, 100, function(){
202						$col_bg.css({'background-image':'url('+bg_img_src+')'});
203						$col_bg.animate({ opacity: 1 }, 250);
204					});
205				}
206			} else if ( $first_thumb.length ) {
207				bg_img_src = $first_thumb.attr('data-o_src');
208				bg_img_srcset = $first_thumb.attr('data-o_srcset');
209				objImg = new Image();
210				objImg.src = bg_img_src;
211				objImg.onload = function() {
212					$first_thumb
213						.attr('src', bg_img_src)
214						.attr('srcset', bg_img_srcset);
215					$(window).trigger('woocommerce_variation_has_loaded');
216				}
217			}
218		}
219	}
220
221	function check_variation_values(event) {
222		var $selects = $(event.currentTarget).find('select'),
223			checkSelectValues = false;
224		$selects.each(function(){
225			var $select = $(this);
226			if ( $select.val() !== '' ) {
227				checkSelectValues = true;
228			}
229		});
230
231		if ( checkSelectValues ) {
232			$(event.currentTarget).removeClass('hide-clear');
233		} else {
234			$(event.currentTarget).addClass('hide-clear');
235		}
236
237		setTimeout(function(){
238			$(window).trigger('woocommerce_variation_has_loaded');
239		}, 1250);
240	}
241
242	function reloadVariations() {
243		remove_from_cart();
244		$('body').on("added_to_cart wc_fragments_refreshed removed_from_cart", get_cart);
245		if (!$('body').hasClass('uncode-default-product-gallery')) {
246			$('.variations_form')
247				.on("show_variation", change_images)
248				.on("reset_data", reset_data)
249				.on("check_variations", check_variation_values)
250				.on('reset_image', reset_product_image);
251		}
252	}
253
254	$(document).ready(reloadVariations);
255
256	function handleRatings() {
257		if ( $('#rating').length ) {
258			setTimeout(function(){
259				$('.comment-form-rating').each(function(){
260					var $wrap = $(this),
261						$stars = $('p.stars', $wrap).remove();
262					$( 'select[name="rating"]', $wrap ).hide().before( '<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>' );
263				});
264			}, 10);
265		}
266	}
267
268	$(document).ready(handleRatings);
269	$(document).on('vc-uncode_single_product_reviews', handleRatings);
270
271	$(document).on('vc-uncode_single_product_reviews', function(e, el) {
272		if ( el !== 'undefined' ) {
273			var $tabContainer = $(el).closest('.tab-container');
274			$tabContainer.addClass('wootabs');
275		}
276	} );
277
278	var scrollToReviews = function(){
279		if ( $('.wootabs, .wpb_accordion').length ) {
280
281			var hash = window.location.hash,
282				url = window.location.href,
283				$tabs = $( this ).find( 'ul.nav-tabs' ).first(),
284				$accordion = $( this ).find('.panel-group').first(),
285				scrollAction = false,
286				$tabs_wrapper = $tabs.closest('.wootabs'),
287				$both_wrapper,
288				$li, $panel, $click_trigger = false;
289
290			var scrollToReviewsInside = function( clicked ){
291
292				if ( $tabs.length && $('#reviews', $tabs_wrapper).length ) {
293					var tab_reviews = $('#reviews', $tabs_wrapper).first().closest('.tab-pane').attr('id');
294					$('[data-tab-id="' + tab_reviews + '"]', $tabs).addClass('reviews_tab');
295					$li = $('.reviews_tab', $tabs);
296					$both_wrapper = $tabs_wrapper;
297					$click_trigger = true;
298				} else if ( $accordion.length && $('#reviews', $accordion).length ) {
299					var tab_reviews = $('#reviews', $accordion).first().closest('.tab-pane').attr('id');
300					$panel = $('#reviews', $accordion).first().closest('.panel');
301					$li = $('.panel-title', $panel);
302					$both_wrapper = $accordion;
303					$click_trigger = true;
304				} else if ( $('div#reviews').length && clicked ) {
305					$both_wrapper = $('div#reviews');
306					scrollAction = true;
307				} else {
308					return false;
309				}
310
311				if ( $click_trigger && ( hash.toLowerCase().indexOf( 'comment-' ) >= 0 || hash === '#reviews' || hash === '#tab-reviews' ) ) {
312					$( 'a', $li ).click();
313					scrollAction = true;
314				} else if ( $click_trigger && ( url.indexOf( 'comment-page-' ) > 0 || url.indexOf( 'cpage=' ) > 0 ) ) {
315					$( 'a', $li ).click();
316					scrollAction = true;
317				}
318
319				if ( scrollAction ) {
320					var body = $("html, body"),
321						bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
322						delta = bodyTop - ($both_wrapper.length ? $both_wrapper.offset().top : 0),
323						getOffset = UNCODE.get_scroll_offset();
324					if ( typeof $both_wrapper.offset() === 'undefined' )
325						return;
326					scrollTo = $both_wrapper.offset().top - 27;
327					scrollTo -= getOffset;
328
329					var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
330					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
331
332					if (scrollSpeed == 0) {
333						body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
334					} else {
335						body.animate({
336							scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
337						}, scrollSpeed, 'easeInOutQuad');
338					}
339				} else {
340					return false;
341				}
342			};
343
344			scrollToReviewsInside( false );
345
346			$('a.woocommerce-review-link').on('click', function(e) {
347				e.preventDefault();
348				hash = '#reviews';
349				scrollToReviewsInside( true );
350			});
351
352		}
353	}
354	$(document).ready(scrollToReviews);
355
356	var qtyPlusMinus = function(){
357		$('.qty-inset:not(.qty-inset-active)').each(function(){
358			var $qtyInsets = $(this).addClass('qty-inset-active'),
359				$input = $('input.qty', $qtyInsets),
360				$minus = $('.qty-minus', $qtyInsets),
361				$plus = $('.qty-plus', $qtyInsets),
362				step = parseFloat( $input.attr('step') ),
363				min = parseFloat( $input.attr('min') ),
364				max = parseFloat( $input.attr('max') ),
365				value = parseFloat($input.val());
366
367			if ( isNaN(step) ) {
368				step = 1;
369			}
370
371			if ( isNaN(min) ) {
372				min = 1;
373			}
374
375			if ( isNaN(value) ) {
376				value = 0;
377				$input.val( value );
378			}
379
380			$minus.on('click', function () {
381				if (UncodeWCParameters.activate_input_check_on_click) {
382					step = parseFloat( $input.attr('step') );
383					min = parseFloat( $input.attr('min') );
384					max = parseFloat( $input.attr('max') );
385					if ( isNaN(step) ) {
386						step = 1;
387					}
388					if ( isNaN(min) ) {
389						min = 1;
390					}
391				}
392
393				value = parseFloat( $input.val() ) - step;
394				if ( value < min ) {
395					value = min;
396				}
397				$input.val( value ).trigger( 'change' );
398			});
399
400			$plus.on('click', function () {
401				if (UncodeWCParameters.activate_input_check_on_click) {
402					step = parseFloat( $input.attr('step') );
403					min = parseFloat( $input.attr('min') );
404					max = parseFloat( $input.attr('max') );
405					if ( isNaN(step) ) {
406						step = 1;
407					}
408					if ( isNaN(min) ) {
409						min = 1;
410					}
411				}
412
413				value = parseFloat( $input.val() ) + step;
414				if ( !isNaN(max) && value > max ) {
415					value = max;
416				}
417				$input.val( value ).trigger( 'change' );
418			});
419		});
420	};
421
422	var resizeCartRow = function(){
423		if ($('form.woocommerce-cart-form').length > 0) {
424			window.dispatchEvent(new CustomEvent('vc-resize'));
425		}
426	};
427
428	$(document.body).on('updated_cart_totals', qtyPlusMinus);
429	$(document.body).on('updated_cart_totals', resizeCartRow);
430	$(document).ready(qtyPlusMinus);
431	$(document).on('vc-frontend:vc_button', qtyPlusMinus);
432
433	var woocommerce_product_gallery = function() {
434		$( 'body:not(.single-uncodeblock) .woocommerce-product-gallery' ).each( function() {
435			if ($('body').hasClass('uncode-default-product-gallery')) {
436				return;
437			}
438
439			var $slider = $(this);
440
441			UNCODE_WC.product_gallery($slider);
442		});
443	}
444
445	UNCODE_WC.product_gallery = function($slider) {
446		var $parent = $slider.closest('.uncode-wrapper').length ? $slider.closest('.uncode-wrapper') : $slider.closest('.uncont'),
447			cols = parseFloat( $slider.attr('data-columns') ),
448			dots = $parent.attr('data-dots') == 'true',
449			gutter = $parent.length && typeof $parent.attr('data-gutter') !== 'undefined' ? parseFloat( $parent.attr('data-gutter') ) : 18,
450			$main = $('.woocommerce-product-gallery__wrapper.owl-carousel', $parent),
451			$stack = $('.woocommerce-layout-images-stack-lateral .woocommerce-product-gallery__wrapper', $parent),
452			mainL = $main.find('.woocommerce-product-gallery__image').length,
453			$thumbs = $('.woocommerce-product-gallery__wrapper-nav:not(.lateral-nav)', $parent),
454			$thumbs_nav = $('.woocommerce-product-gallery__wrapper-nav', $parent),
455			$navTh = $('.woocommerce-product-gallery__thumb', $thumbs_nav).attr('tabindex', 0),
456			thumbsL = $thumbs.find('li').length;
457
458		$navTh.each(function(key, val){
459			$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
460		});
461
462		if ($.fn.owlCarousel) {
463			if ( mainL > 1 && $slider.hasClass('owl-carousel-wrapper') ) {
464				$main.owlCarousel({
465					items: 1,
466					autoHeight: true,
467					rtl: $('body').hasClass('rtl') ? true : false,
468					responsiveRefreshRate: 200,
469					responsive: {
470						0: {
471							dots: $('.woocommerce-product-gallery__wrapper-nav.lateral-nav', $parent).length || dots === true
472						},
473						960: {
474							dots: dots
475						}
476					}
477				}).on('changed.owl.carousel', function(event) {
478					if (event.namespace && event.property.name === 'position') {
479						var target = event.relatedTarget.relative(event.property.value, true);
480						var data = $thumbs.data('owl.carousel');
481						if ( ! $('.owl-item', $thumbs).eq( target ).hasClass('active') ) {
482							$thumbs.owlCarousel( 'to', target, 300, true );
483						}
484					}
485				});
486				$main.on('translate.owl.carousel', function(event) {
487					$(event.currentTarget).addClass('owl-translating');
488				});
489				$main.on('translated.owl.carousel', function(event) {
490					$(event.currentTarget).removeClass('owl-translating');
491				});
492				$thumbs.on('initialized.owl.carousel', function(event) {
493					$thumbs.closest('.woocommerce-product-gallery-nav-wrapper').css({
494						opacity: 1
495					});
496				}).owlCarousel({
497					items: cols,
498					margin: gutter,
499					autoHeight: true,
500					nav: true,
501					rtl: $('body').hasClass('rtl') ? true : false,
502					mouseDrag: cols < thumbsL,
503					navText: ['<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-right"></i></div>'],
504					responsiveRefreshRate: 100,
505				})
506				$(window).on('resize load uncode-quick-view-first-hover woocommerce_variation_has_loaded', function () {
507					setTimeout(function(){
508						$main.trigger('refresh.owl.carousel');
509						$thumbs.trigger('refresh.owl.carousel');
510
511						var product_div = $main.closest('div.woocommerce-product-gallery--with-variation-gallery');
512
513						if (!product_div.length > 0) {
514							if (!$('.owl-item', $main).eq(0).hasClass('active')) {
515								$main.owlCarousel( 'to', 0, 300, true );
516							}
517							if (!$('.owl-item', $thumbs).eq(0).hasClass('active')) {
518								$thumbs.owlCarousel( 'to', 0, 300, true );
519							}
520						}
521
522						$('.owl-dot', $main).each(function(key, val){
523							$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
524						});
525						$('.owl-dot', $thumbs).each(function(key, val){
526							$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
527						});
528					}, 300);
529				});
530			}
531		}
532
533		var scrollBody = function(index) {
534			$('.woocommerce-product-gallery__thumb', $thumbs_nav).removeClass('is-selected');
535			$('.woocommerce-product-gallery__thumb', $thumbs_nav).eq(index).addClass('is-selected');
536
537			var top_gutter = parseInt($stack.closest('.row').css('padding-top'));
538
539			var getSection = $('.woocommerce-product-gallery__image', $stack).eq(index),
540				scrollTo;
541
542			if (getSection == undefined) return;
543
544			var body = $("html, body"),
545				bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
546				delta = bodyTop - ($('.woocommerce-product-gallery__image', $stack).eq(index).length ? $('.woocommerce-product-gallery__image', $stack).eq(index).offset().top : 0),
547				getOffset = UNCODE.get_scroll_offset(index);
548			if ( typeof getSection.offset() === 'undefined' ) {
549				return;
550			}
551			scrollTo = getSection.offset().top;
552
553			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
554				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
555				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
556					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
557				}
558
559				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
560					if ( index === 0 ) {
561						scrollTo = 0;
562					} else {
563						scrollTo -= $('.menu-sticky .menu-container').outerHeight();
564					}
565				} else {
566					scrollTo -= getOffset;
567				}
568			}
569
570			scrollTo -= top_gutter;
571
572			var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
573			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
574
575			if (index != 0) {
576				UNCODE.scrolling = true;
577			}
578
579			if (scrollSpeed == 0) {
580				body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
581				UNCODE.scrolling = false;
582			} else {
583				body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
584					$(this).stop();
585				}).stop(true,false).animate({
586					scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
587				}, scrollSpeed, 'easeInOutCubic', function(){
588					UNCODE.scrolling = false;
589				});
590			}
591
592		};
593
594		var changeThumbActive = function(section, index) {
595			var newSection = $('.woocommerce-product-gallery__thumb', $thumbs_nav).eq(index);
596			if (newSection.length) {
597				$('.woocommerce-product-gallery__thumb', $thumbs_nav).removeClass('is-selected');
598				newSection.addClass('is-selected');
599			}
600		}
601
602		$('.woocommerce-product-gallery__image', $stack).each(function(index, val) {
603			new Waypoint({
604				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
605				element: val,
606				handler: function(direction) {
607					changeThumbActive(this.element, index);
608				},
609			});
610		});
611
612		$thumbs_nav.on( 'click', '.woocommerce-product-gallery__thumb', function(e){
613			e.preventDefault();
614			var number = $(this).index();
615			if ( $main.length ) {
616				number = $(this).closest('.owl-item').index();
617				if ( number < 0 ) {
618					number = $(this).index();
619				}
620				$main.owlCarousel( 'to', number, 300, true );
621			} else if ( $stack.length ) {
622				scrollBody( number );
623			}
624		});
625
626		var uncodeZoom = function(){
627			if ($.fn.zoom && $('body').hasClass('wc-zoom-enabled') ) {
628				var $zoomTrgt = $('.woocommerce-product-gallery__image', $slider);
629
630				if ( $('.thumbnails', $slider).length )
631					$zoomTrgt = $zoomTrgt.first();
632
633				$zoomTrgt.trigger( 'zoom.destroy' );
634				$zoomTrgt.zoom();
635
636				var checkForZoom = function(){
637
638					if ( $parent.hasClass( 'no-zoom-mobile' ) && UNCODE.wwidth < 960 ) {
639						$zoomTrgt.trigger( 'zoom.destroy' ).addClass('mouse-moving');
640						$('.zoom-overlay', $zoomTrgt).remove();
641						return false;
642					}
643					$('.woocommerce-product-gallery__image').each(function(){
644						var $wrap = $(this),
645							$zoomImg = $('.zoomImg', $wrap);
646
647						if (UNCODE.isMobile || !$zoomImg.length) {
648							$wrap.addClass('mouse-moving');
649						}
650					});
651
652					var galleryWidth = $zoomTrgt.width(),
653						zoom_options = {
654							touch: true,
655							callback: function(){
656								$('.woocommerce-product-gallery__image').each(function(){
657									var $wrap = $(this),
658										$zoomImg = $('.zoomImg', $wrap),
659										$overZoom = $('.zoom-overlay', $wrap),
660										$imageIL = $('a[data-lbox]', $wrap),
661										$carousel = $wrap.closest('.owl-carousel');
662
663									$wrap.prepend($zoomImg);
664									if (UNCODE.isMobile || !$zoomImg.length) {
665										$wrap.addClass('mouse-moving');
666										$zoomImg.css({
667											'visibility':'hidden'
668										});
669									}
670
671									/* Make work everything on touch events */
672									var onlongtouch,
673										timer,
674										now,
675										touchduration = 500,
676										startX = 0, startY, newX, newY;
677
678									$wrap.parent().on('mousemove.zoom', function(){
679										if ( ! $wrap.hasClass('mouse-moving') ) {
680											if ( startX == 0 ) {
681												startX = event.clientX;
682												startY = event.clientY;
683											}
684											newX = event.clientX;
685											newY = event.clientY;
686											if ( Math.abs( newX - startX ) > 50 && Math.abs( newY - startY ) > 50 ) {
687												$wrap.addClass('mouse-moving');
688											}
689										}
690									});
691
692									$overZoom.on('touchstart.zoom', function (e) {
693										now = new Date().getTime();
694									}).on('touchmove.zoom', function (e) {
695										setTimeout(function(){
696											$zoomImg.css({
697												'visibility':'visible'
698											});
699										}, 100);
700									}).on('touchend.zoom', function (e) {
701										var newTap = new Date().getTime();
702										if ( newTap - now < 75 && ! $('body').hasClass('ilightbox-noscroll') ) {
703											$imageIL.trigger('itap.iL');
704										}
705										if (UNCODE.isMobile) {
706											$zoomImg.css({
707												'visibility':'hidden'
708											});
709										}
710									});
711
712								});
713							}
714						};
715
716					if ( 'ontouchstart' in window ) {
717						zoom_options.on = 'click';
718					}
719
720					$zoomTrgt.trigger( 'zoom.destroy' );
721					$zoomTrgt.each(function(){
722						var $thisTrgt = $(this),
723							$img = $('img', $thisTrgt);
724
725						if ( $img.data( 'large_image_width' ) > galleryWidth ) {
726							$thisTrgt.zoom(zoom_options);
727						} else {
728							$thisTrgt.trigger( 'zoom.destroy' );
729						}
730
731					});
732
733				};
734				checkForZoom();
735
736				var setCheckForZoom;
737				$(window).on( 'resize', function(){
738					clearTimeout(setCheckForZoom);
739					setCheckForZoom = setTimeout( checkForZoom, 500 );
740				});
741			}
742		};
743		uncodeZoom();
744		window.addEventListener('load', uncodeZoom);
745	}
746
747	woocommerce_product_gallery();
748
749	$(window).on('unmodal-open', function(){
750		$('#unmodal-content .woocommerce-product-gallery__image').removeClass('mouse-moving');
751	})
752	$(document).on('unmodal-close', function(){
753		$('#unmodal-content .woocommerce-product-gallery__image').removeClass('mouse-moving');
754	})
755
756	/************************************************************
757	 * Redirect to custom empty cart page
758	 ************************************************************/
759
760	$(document.body).on('wc_cart_emptied', redirect_to_custom_empty_cart);
761
762	function redirect_to_custom_empty_cart() {
763		if (UncodeWCParameters.empty_cart_url !== '') {
764			window.location.replace(UncodeWCParameters.empty_cart_url);
765		}
766	}
767
768	/************************************************************
769	 * Make the variation price inherit the font family from main price
770	************************************************************/
771
772	function variation_price_font() {
773
774		var $forms = $('form.variations_form');
775
776		$forms.each(function(){
777			var $form = $(this);
778
779			$form.on('woocommerce_variation_has_changed wc_variation_form', function(){
780				var $var_price = $('.woocommerce-variation-price .woocommerce-Price-amount'),
781					$row = $form.closest('.vc_row'),
782					$main_price = $('.heading-text .woocommerce-Price-amount', $row);
783
784				if ( $main_price.length ) {
785					var $price_wrap = $main_price.closest('.heading-text'),
786						$price_nest = $('> *:first-child', $price_wrap),
787						font_class = $price_nest.attr('class').split(' '),
788						i;
789
790					for ( i = 0; i < font_class.length; i++ ) {
791						if ( font_class[i].indexOf('font') !== -1 && font_class[i].indexOf('fontsize') === -1 ) {
792							$var_price.addClass( font_class[i] );
793						}
794					}
795				}
796			});
797		});
798	}
799
800	$(document).ready(function() {
801		variation_price_font();
802	});
803
804	/************************************************************
805	 * Show minicart when adding something
806	************************************************************/
807
808	var cartShow, cartHover,
809		sideCart_scrollTop = $('html, body').scrollTop();;
810
811	var minicart_notify = function(){
812		var $body = $('body');
813
814		if ( ! $body.hasClass('minicart-notification') ) {
815			return false;
816		}
817
818		var $sidecart = $('#uncode_sidecart'),
819			$miniCart = $('.menu-smart .uncode-cart-dropdown'),
820			$smartMenu = $miniCart.closest('.menu-smart');
821
822		$miniCart.on('hover', function(){
823			clearTimeout(cartHover);
824		});
825
826		var show_added_to_cart = function(e){
827
828			clearTimeout(cartShow);
829			clearTimeout(cartHover);
830
831			if ( $sidecart.length && ( ! ( $body.hasClass('uncode-sidecart-mobile-disabled') && UNCODE.wwidth <= UNCODE.mediaQuery ) ) ) {
832				$sidecart.imagesLoaded().done( function( instance ) {
833					setTimeout(function(){
834						sideCart_scrollTop = $('html, body').scrollTop();
835						$body.addClass('uncode-sidecart-open');
836						$(window).trigger('uncode-sidecart-open');
837						$('html, body').scrollTop(sideCart_scrollTop);
838					}, 500);
839				});
840			}
841
842			var show_added_to_cart_timeout = function(){
843				cartShow = setTimeout(function(){
844					$miniCart.imagesLoaded().done( function( instance ) {
845						$smartMenu.smartmenus('itemActivate', $('.uncode-cart > a'));
846						cartHover = setTimeout(function(){
847							$smartMenu.smartmenus('menuHideAll');
848						}, 4000);
849					});
850				}, 500);
851			};
852
853			if ( UNCODE.wwidth >= 960 ) {
854				if ( e == 'uncode-wc-added-to-cart' ) {
855					show_added_to_cart_timeout();
856				} else {
857					$( document.body ).on( 'wc_fragments_loaded', function(){
858						show_added_to_cart_timeout();
859					});
860				}
861			}
862		};
863
864		if ( $('body').hasClass('uncode-wc-disable-added-to-cart-trigger')) {
865			$( document.body ).on( 'added_to_cart', function() {
866				setTimeout(function(){
867					$(document.body).trigger('wc_fragment_refresh');
868				}, 500);
869			} );
870		} else {
871			$( document.body ).on( 'added_to_cart', show_added_to_cart );
872		}
873
874		$(document).ready(function() {
875			if ( $('body').hasClass('uncode-wc-added-to-cart')) {
876				show_added_to_cart('uncode-wc-added-to-cart');
877			}
878		});
879
880	};
881
882	minicart_notify();
883
884	/************************************************************
885	 * View Cart Button
886	************************************************************/
887	$( document.body ).on( 'wc_cart_button_updated', function(e, $button){
888		if ( $(document.body).hasClass('minicart-notification') || wc_add_to_cart_params == undefined ) {
889			return false;
890		}
891
892		$button
893			.addClass('added_and_noted')
894			.removeClass('ajax_add_to_cart')
895			.find('.added_to_cart')
896			.text( wc_add_to_cart_params.i18n_view_cart )
897			.on('click', function(e){
898				e.preventDefault();
899				window.location.href = wc_add_to_cart_params.cart_url;
900				return false;
901			});
902	});
903
904	/************************************************************
905	 * Side Cart
906	************************************************************/
907	var init_sidecart = function(){
908		var $body = $('body.uncode-sidecart-enabled');
909		if ( ! $body.length ) {
910			return false;
911		}
912
913		var $cart_icon = $('.mobile-shopping-cart, .uncode-cart.menu-item-link > a'),
914			$sidecart = $('#uncode_sidecart'),
915			$view_cart = $('a.wc-forward:not(.checkout)', $sidecart).removeClass('btn-sm'),
916			$checkout = $('a.checkout', $sidecart).removeClass('btn-sm').addClass('btn-flat'),
917			$overlay = $('#uncode_sidecart_overlay'),
918			$close_cart = $('.close-mini-cart', $sidecart),
919			sidecart_hover = false;
920
921		$cart_icon.off('click').on('click', function( e ){
922			if ( $sidecart.length && ! ( $(this).closest('.overlay').length && UNCODE.wwidth > UNCODE.mediaQuery ) && ( ! ( $body.hasClass('uncode-sidecart-mobile-disabled') && UNCODE.wwidth <= UNCODE.mediaQuery ) ) ) {
923				e.preventDefault();
924				e.stopPropagation();
925				sideCart_scrollTop = $('html, body').scrollTop();
926				$body.addClass('uncode-sidecart-open');
927				$(window).trigger('uncode-sidecart-open');
928				$('html, body').scrollTop(sideCart_scrollTop);
929			}
930		});
931
932		$sidecart.on('mouseover',function(){
933			sidecart_hover = true;
934		}).on('mouseout', function(){
935			sidecart_hover = false;
936		});
937
938		$body.on('click', function( e ){
939			if ( $body.hasClass('uncode-sidecart-open') && !sidecart_hover ) {
940				$body.removeClass('uncode-sidecart-open');
941				$(window).trigger('uncode-sidecart-closed');
942				$('html, body').scrollTop(sideCart_scrollTop);
943			}
944		});
945
946		$close_cart.on('click', function( e ){
947			e.preventDefault();
948			$body.removeClass('uncode-sidecart-open');
949			$(window).trigger('uncode-sidecart-closed');
950			$('html, body').scrollTop(sideCart_scrollTop);
951		});
952	};
953	$(document).ready(function(){
954		init_sidecart();
955	});
956	$( document.body ).on("wc_fragments_refreshed added_to_cart removed_from_cart", function(){
957		init_sidecart();
958		requestTimeout( init_sidecart, 1 );
959	});
960
961	var sidecart_size = function(){
962		var $body = $('body.uncode-sidecart-enabled'),
963			$widget_cart = $('.widget_shopping_cart_content'),
964			$mini_cart_item = $('.mini_cart_item', $widget_cart);
965
966		if ( $widget_cart.length ) {
967			$mini_cart_item.each(function(){
968				var $this = $(this),
969 					$img_product = $('.attachment-woocommerce_thumbnail', $this),
970 					imgH = $img_product.height();
971
972 				$this.css({
973 					'min-height': imgH+6
974 				})
975
976			});
977		}
978		if ( $body.length ) {
979
980			var $sidecart = $('#uncode_sidecart'),
981				$cart_header = $('.woocommerce-mini-cart-header', $sidecart),
982				headerH = $cart_header.outerHeight(),
983				$cart_footer = $('.woocommerce-mini-cart-footer', $sidecart),
984				footerH = $cart_footer.outerHeight(),
985				$cart_body = $('.woocommerce-mini-cart-body', $sidecart);
986
987			$cart_body.css({
988				'padding-top':headerH,
989				'padding-bottom':footerH
990			});
991
992		}
993	};
994	$(document).ready(function(){
995		var setCTA;
996		sidecart_size();
997		requestTimeout(function(){
998			$(window).on( 'resize', function(){
999				clearRequestTimeout(setCTA);
1000				setCTA = requestTimeout( sidecart_size, 100 );
1001			});
1002		}, 400);
1003	});
1004	$( document.body ).on("wc_fragments_refreshed added_to_cart removed_from_cart", function(){
1005		sidecart_size();
1006		requestTimeout( sidecart_size, 1 );
1007	});
1008
1009	/************************************************************
1010	 * Quick view
1011	 ************************************************************/
1012
1013	var modal_quick_view_content = $('.quick-view-content');
1014	var last_viewed_product_id;
1015
1016	$(document).off('click', '.quick-view-button').on('click', '.quick-view-button', function() {
1017		var _this = $(this);
1018		var product_id = _this.data('post-id');
1019		var post_type = _this.data('post-type');
1020		var post_url = _this.attr('data-post-url');
1021		var single_variation_atts = _this.attr('data-single-variation');
1022
1023		// Empty modal
1024		if (modal_quick_view_content.length > 0) {
1025			modal_quick_view_content.html('');
1026		}
1027
1028		var data = {
1029			action: 'uncode_load_ajax_quick_view',
1030			post_id: product_id,
1031			post_type: post_type,
1032			post_url: post_url,
1033		};
1034
1035		if (single_variation_atts) {
1036			var variation_atts_obj = JSON.parse(single_variation_atts)
1037
1038			for (var att_key in variation_atts_obj) {
1039				if (variation_atts_obj[att_key]) {
1040					data['attribute_' + att_key] = variation_atts_obj[att_key];
1041				}
1042			}
1043		}
1044
1045		// Get quick view content via AJAX
1046		$.ajax({
1047			url: woocommerce_params.ajax_url,
1048			data: data,
1049			type: 'post',
1050			error: function(data) {
1051				if (SiteParameters.enable_debug == true) {
1052					// This console log is disabled by default
1053					// So nothing is printed in a typical installation
1054					//
1055					// It can be enabled for debugging purposes setting
1056					// the 'uncode_enable_debug_on_js_scripts' filter to true
1057					console.log('AJAX error on quick view response');
1058				}
1059			},
1060			success: function(response) {
1061				if (response && response.success === false) {
1062					if (SiteParameters.enable_debug == true) {
1063						// This console log is disabled by default
1064						// So nothing is printed in a typical installation
1065						//
1066						// It can be enabled for debugging purposes setting
1067						// the 'uncode_enable_debug_on_js_scripts' filter to true
1068						if (response.data.error) {
1069							console.log(response.data.error);
1070						} else {
1071							console.log('Unknown error on quick view response');
1072						}
1073					}
1074				} else {
1075					var html = response.data.html;
1076
1077					if (modal_quick_view_content.length > 0) {
1078						modal_quick_view_content.html(html);
1079					}
1080
1081					last_viewed_product_id = product_id;
1082
1083					modal_quick_view_content.imagesLoaded().done( function( instance ) {
1084						$(document).trigger('uncode-unmodal-show-content');
1085						$(document).trigger('uncode-quick-view-loaded');
1086						window.dispatchEvent(new CustomEvent('uncode-quick-view-loaded'));
1087
1088						setTimeout(function(){
1089							modal_quick_view_content.one('mousemove', function(){
1090								window.dispatchEvent(new CustomEvent('uncode-quick-view-first-hover'));
1091							});
1092						}, 10);
1093					});
1094				}
1095			}
1096		});
1097
1098		return false;
1099	});
1100
1101	$(document).on('uncode-quick-view-loaded', function() {
1102		var form_variation = modal_quick_view_content.find('.variations_form');
1103
1104		form_variation.each(function() {
1105			$(this).wc_variation_form();
1106		});
1107
1108		form_variation.trigger('check_variations');
1109		form_variation.trigger('reset_image');
1110
1111		if( typeof $.fn.wc_product_gallery !== 'undefined' ) {
1112			modal_quick_view_content.find('.woocommerce-product-gallery').each(function(){
1113				$(this).wc_product_gallery();
1114			});
1115		}
1116
1117		$( '#unmodal-content' ).on( 'change', '.quantity .qty', function() {
1118			jQuery( this ).closest('form.cart').find('.add_to_cart_button').attr( 'data-quantity', jQuery( this ).val() );
1119		});
1120
1121		woocommerce_product_gallery();
1122		variation_price_font();
1123		qtyPlusMinus();
1124
1125		UNCODE.preventDoubleTransition();
1126		UNCODE.utils();
1127		if (typeof UNCODE.share !== 'undefined') {
1128			UNCODE.share();
1129		}
1130		if (typeof UNCODE.tooltip !== 'undefined') {
1131			UNCODE.tooltip();
1132		}
1133		if (typeof UNCODE.counters !== 'undefined') {
1134			UNCODE.counters();
1135		}
1136		if (typeof UNCODE.countdowns !== 'undefined') {
1137			UNCODE.countdowns();
1138		}
1139		if (typeof UNCODE.tabs !== 'undefined') {
1140			UNCODE.tabs();
1141		}
1142		if (typeof UNCODE.collapse !== 'undefined') {
1143			UNCODE.collapse();
1144		}
1145		if (typeof UNCODE.okvideo !== 'undefined') {
1146			UNCODE.okvideo();
1147		}
1148		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
1149			UNCODE.backgroundSelfVideos();
1150		}
1151		UNCODE.tapHover();
1152		if (typeof UNCODE.isotopeLayout !== 'undefined') {
1153			UNCODE.isotopeLayout();
1154		}
1155		if (typeof UNCODE.justifiedGallery !== 'undefined') {
1156			UNCODE.justifiedGallery();
1157		}
1158		if (typeof UNCODE.cssGrid !== 'undefined') {
1159			UNCODE.cssGrid();
1160		}
1161		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
1162			UNCODE.lightbox();
1163		}
1164		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
1165			UNCODE.lightgallery();
1166		}
1167		if (typeof UNCODE.carousel !== 'undefined') {
1168			UNCODE.carousel($('body'));
1169		}
1170		UNCODE.lettering();
1171		UNCODE.animations();
1172		UNCODE.stickyElements();
1173		if (typeof UNCODE.twentytwenty !== 'undefined') {
1174			UNCODE.twentytwenty();
1175		}
1176		UNCODE.disableHoverScroll();
1177		if (typeof uncode_progress_bar !== 'undefined') {
1178			uncode_progress_bar();
1179		}
1180		if (typeof UNCODE.filters !== 'undefined') {
1181			UNCODE.filters();
1182		}
1183		if (typeof UNCODE.ajax_filters !== 'undefined') {
1184			UNCODE.ajax_filters();
1185		}
1186		if (typeof UNCODE.widgets !== 'undefined') {
1187			UNCODE.widgets();
1188		}
1189
1190		$(document).trigger('yith_wcwl_init');
1191	});
1192
1193	/************************************************************
1194	 * Trigger fragments
1195	 ************************************************************/
1196	if ( SiteParameters.update_wc_fragments == true ) {
1197		$(document).ready(function() {
1198			$(document.body).trigger('wc_fragment_refresh');
1199		});
1200	}
1201
1202	/************************************************************
1203	 * Cart badge
1204	 ************************************************************/
1205	$(document).ready(function() {
1206		if ( SiteParameters.uncode_wc_popup_cart_qty ) {
1207			$(document.body).on('wc_fragments_loaded', function(){
1208				$('.cart-icon-container .badge').removeClass('init-product-counter');
1209			})
1210			.on('uncode_get_cart', function(e, data){
1211				if ( $('.cart-icon-container .badge').text() !== '' || ( data > 0 ) ) {
1212					$('.cart-icon-container .badge').addClass('init-product-counter');
1213				} else {
1214					$('.cart-icon-container .badge').removeClass('init-product-counter');
1215				}
1216			});
1217		}
1218	});
1219
1220	var clearZoomSet;
1221	$(window).on('load', function(){
1222		clearTimeout(clearZoomSet);
1223		clearZoomSet = setTimeout(function(){
1224			$('.zoomImg').each(function(){
1225				$(this).removeAttr('role');
1226			});
1227		}, 1);
1228	});
1229
1230})(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.