PageSourceSearch

https://mohagan.com/wp-content/themes/snsvicky/assets/js/sns-woocommerce.js?ver=6.5.3

js mohagan.com collected 2026-10-02 06:30:16 UTC 43,460 bytes, 945 lines download raw bytes

1(function ($) {
2	"use strict";
3	$(document).ready(function() {
4		// Filter hoz
5		if ( $('.toolbar .filter-hoz').length ){
6			$('.toolbar .filter-hoz').click(function(){
7				if ( $(this).hasClass('active') ){
8					$(this).removeClass('active');
9					if ( $('.horizontal-filter').length ) {
10						$('.horizontal-filter').slideUp(300);
11					}
12				}else{
13					$(this).addClass('active');
14					if ( $('.horizontal-filter').length ) {
15						$('.horizontal-filter').slideDown(300);
16					}
17				}
18			});
19		}
20		// Product image, gallery, zoom
21		if( $('body.single-product .product.type-product > .gallery_type_h').length ){
22			SnsSinglePrdIHG.init('.gallery_type_h');
23		}
24		if( $('body.single-product .product.type-product > .gallery_type_v').length ){
25			SnsSinglePrdIVG.init('.gallery_type_v');
26		}
27		if( $('body.single-product .product.type-product > .gallery_type_none').length ){
28			SnsSinglePrdING.init('.gallery_type_none');
29			//var sns_sticky = new Sticky('body.single-product .product.type-product > .gallery_type_none .sticky-content');
30			var sidebar_sticky = new StickySidebar('body.single-product .product.type-product > .gallery_type_none .entry-summary .sticky-content', {
31		        containerSelector: 'body.single-product .product.type-product > .gallery_type_none',
32		        innerWrapperSelector: 'body.single-product .product.type-product > .gallery_type_none .entry-summary .sticky-content .inner',
33		        topSpacing: 30,
34		        bottomSpacing: 30
35		    });
36		}
37		// Variations for Variable Product
38		SnsVariationForm.reDesignVariationForm();
39		SnsVariationForm.init();
40		// Shortcode: SNS Products
41		$('.sns-products').each(function(){
42			if ( $(this).length > 0 && $(this).find('div.product_list').find('> *').length > 0 ){
43				var wrapc = $(this).find('div.product_list');
44				var c_param = {
45					loop: ( $(this).find('div.product_list').find('> *').length > $(this).data('desktop')) ? true : false,
46					dots: false,
47					nav: ( $(this).data('usenav')=='1' ) ? true : false,
48	                items : $(this).data('desktop'),
49	                responsive : {
50	                    0 : { items: $(this).data('mobilep') },
51	                    480 : { items: $(this).data('mobilel') },
52	                    768 : { items: $(this).data('tabletp') },
53	                    992 : { items: $(this).data('tabletl') },
54	                    1200 : { items: $(this).data('desktop') }
55	                },
56				}
57				if ( $(this).hasClass('special-carousel') ) {
58					var carousel_p = setTimeout(function(){
59						wrapc.owlCarousel(c_param);
60					}, 600);
61				}else{
62					wrapc.owlCarousel(c_param);
63				}
64			}
65		});
66		// Shortcode: SNS Custom Deal
67		$('.sns-custom-deal').each(function(){
68			if ( $(this).length > 0 && $(this).find('div.product_list').find('> *').length > 0 ){
69				var wrapc = $(this).find('div.product_list');
70				wrapc.owlCarousel({
71					loop: ( $(this).find('div.product_list').find('> *').length > $(this).attr('data-desktop')) ? true : false,
72					dots: false,
73					nav: true,
74	                items : $(this).attr('data-desktop'),
75	                responsive : {
76	                    0 : { items: $(this).attr('data-mobilep')},
77	                    480 : { items: $(this).attr('data-mobilel') },
78	                    768 : { items: $(this).attr('data-tablet') },
79	                    992 : { items: $(this).attr('data-tablet') },
80	                    1200 : { items: $(this).attr('data-desktop') }
81	                },
82				});
83			}
84		});
85		// sns-sale-count-downt
86		$('.sns-sale-count-down').each(function(){
87			if ( $(this).length > 0 && $(this).find('div.owl-carousel').find('> *').length > 0 ){
88				var wrapc = $(this).find('div.owl-carousel');
89				wrapc.owlCarousel({
90					loop: ( $(this).find('div.owl-carousel').find('> *').length > $(this).data('desktop')) ? true : false,
91					dots: false,
92					nav: false,
93					autoplay: true, 
94	                items : $(this).data('desktop'),
95	                responsive : {
96	                    0 : { items: $(this).data('mobilep') },
97	                    480 : { items: $(this).data('mobilel') },
98	                    768 : { items: $(this).data('tabletp') },
99	                    992 : { items: $(this).data('tabletl') },
100	                    1200 : { items: $(this).data('desktop') }
101	                },
102				});
103			}
104		});
105		// Move Compare & Wishlist in Product Page
106		if ( $('body.single-product .entry-summary form.variations_form').length || $('body.single-product .entry-summary form.cart table.group_table').length ) {
107			var wl_c_el = 'body.single-product .entry-summary .yith-wcwl-add-to-wishlist, body.single-product .entry-summary .compare';
108			$(wl_c_el).each(function(){
109				if ( $(this).length ) {
110					$('body.single-product .entry-summary form.cart').append($(this).clone());
111					$(this).remove();
112				}
113			});
114		}
115		// Carousel Related Product
116		if ( $('.related.products .product_list').length ) {
117			var number_lg = 4;
118			if ( !$('body').hasClass('layout-type-m') ){
119				number_lg = 3;
120			}
121			$('.related.products .product_list').addClass('owl-carousel');
122			$('.related.products .product_list').owlCarousel({
123                loop: ( $('.related.products .product_list').find('> *').length > number_lg ) ? true : false, 
124                autoplay : false, dots: false, nav: true,items : number_lg,
125                responsive : {
126                    0 : { items: 1},
127                    480 : { items: 2 },
128                    768 : { items: 3 },
129                    992 : { items: number_lg },
130                    1200 : { items: number_lg }
131                },
132            });
133		}
134		
135		// Carousel Upsell Product
136		if ( $('.sns-main .upsells.products .product_list').length ) {
137			$('.sns-main .upsells.products .product_list').addClass('owl-carousel');
138			$('.sns-main .upsells.products .product_list').owlCarousel({
139                loop: ( $('.sns-main .upsells.products .product_list').find('> *').length > 4 ) ? true : false, 
140                autoplay : false, dots: false, nav: true, items : 4,
141                responsive : {
142                    0 : { items: 1},
143                    480 : { items: 2 },
144                    768 : { items: 3 },
145                    992 : { items: 4 },
146                    1200 : { items: 4 }
147                },
148            });
149		}
150		// Carousel Cross sell Product
151		if ( $('.cross-sells .products.product_list').length ) {
152			$('.cross-sells .products.product_list').addClass('owl-carousel');
153			$('.cross-sells .products.product_list').owlCarousel({
154                loop: ( $('.cross-sells .products.product_list').find('> *').length > 4 ) ? true : false, 
155                autoplay : false, dots: false, nav: true, items : 4,
156                responsive : {
157                    0 : { items: 1},
158                    480 : { items: 2 },
159                    768 : { items: 2 },
160                    992 : { items: 3 },
161                    1200 : { items: 3 }
162                },
163            });
164		}
165		// lazyload for woo product
166		if( $('body').hasClass('use_lazyload') ){
167			$('.product_list, .sns-products-list, .special-product').each(function(){
168				if( $(this).length > 0 ){
169					$(this).find('img.lazy').lazyload();
170				}
171			})
172		}
173		// Click mode view
174		$('.mode-view a').click(function(){
175            var mode = $(this).data('mode');
176            if(!$(this).hasClass('active')){
177	            $.ajax({
178	                url: ajaxurl,
179	                data:{
180	                	action : 'sns_setmodeview',
181	                	mode : mode
182	                },
183	                type: 'POST'
184	            });
185	        }else{
186	        	return false;
187	        }
188	        $('.mode-view a').removeClass('active');
189            $('.mode-view a').each(function(){
190            	if ( $(this).hasClass(mode) ) $(this).addClass('active');
191            })   
192            return false;
193        });
194		$('.mode-view .list').click(function(){         
195        	$('#sns_woo_list.product_list').removeClass('grid');
196        	$('#sns_woo_list.product_list').addClass('list');
197            return false;
198        });
199		$('.mode-view .grid').click(function(){
200        	$('#sns_woo_list.product_list').removeClass('list');
201        	$('#sns_woo_list.product_list').addClass('grid');
202          
203            return false;
204        });
205		// YITH Filter
206        $(document).off('click', '.yith-wcan a').on('click', '.yith-wcan a', function (e) {
207        	e.preventDefault();
208        	$('html, body').stop().animate({
209                scrollTop: $(yith_wcan.scroll_top).offset().top - 20
210            }, 600);
211            $(this).yith_wcan_ajax_filters(e, this);
212        });
213		// Rating
214		$('.star-rating .value').each(function(){
215			if( typeof $(this).attr('data-width') !== typeof undefined ){
216				$(this).css('width', $(this).attr('data-width'));
217			}
218		})
219        // Accordion for category
220		$('.product-categories').SnsAccordion({
221			btn_open: '<span class="ac-tongle open">+</span>',
222			btn_close: '<span class="ac-tongle close">-</span>',
223		});
224		// Click add to cart
225		$('.grid-view a.add_to_cart_button.product_type_simple').click(function(e) {
226			var $this = $(this);
227		});
228		$('.list-view a.add_to_cart_button.product_type_simple').each(function() {
229		});
230		// Added Wishlist
231		$('.block-product-inner .yith-wcwl-wishlistaddedbrowse a, .block-product-inner .yith-wcwl-wishlistexistsbrowse a').each(function(){
232			$(this).attr('data-toggle', 'tooltip').attr('data-original-title', $(this).text().trim());
233		});
234	    // Tab information
235	    if ( $('#sns_tab_informations').length ) {
236		    if (window.location.href.indexOf('#comments') > 0 ) {
237				$('#sns_tab_informations .nav-tabs').find("li.reviews_tab").addClass("active");
238	    		$('#sns_tab_informations .tab-content').find("#tab-reviews").addClass("active in");
239			}else{
240	    		$('#sns_tab_informations .nav-tabs').find("li").first().addClass("active");
241	    		$('#sns_tab_informations .tab-content').find(".tab-pane").first().addClass("active in");
242	    	}
243	    	$('#sns_tab_informations .nav-tabs').tabdrop();
244	    }
245	    // Click next/prev show lazyload
246	    $('.owl-carousel .owl-nav div').each(function(){
247			$(this).on('click', function(){
248				if( $('body').hasClass('use_lazyload') ){
249					var parent_owl = $(this).parents('.owl-carousel');
250					var timeout = setTimeout(function() {
251				        parent_owl.find("img.lazy:not(.loaded)").trigger("appear")
252				    }, 1000);
253				}
254			});
255		});
256	    // Click filter on handle device
257	    $('.yith-wcan a').on('click', function (e) {
258	        $('.sns-icon-nav .btn2').each(function(){
259	        	if( $(this).hasClass('active') ){
260	        		$('#sns_content .sns-left, #sns_content .sns-right').removeClass('active');
261	        		$(this).find('.overlay').fadeOut(250); $(this).removeClass('active');
262	        	}
263	        })
264	    });
265	    // Product Tabs Naviation
266		if( $('#sns-producttabs-navigation').length && $('.sns-ajaxtab').length ){
267			$('#sns-producttabs-navigation ul.product-tab-nav-list').html('');
268			var len = $('.sns-ajaxtab').length;
269			$('.sns-ajaxtab').each(function(index, value){
270				// Check is first and last element
271				if(index == 0){
272					$(this).addClass('first');
273				}else if(index == len - 1){
274					$(this).addClass('last');
275				}
276				var $_this_id, $_this_iconnav, $content_li = '';
277
278				$_this_id = $(this).attr('id');
279				$_this_iconnav = $(this).attr('data-iconnav');
280				// append nav list
281				if( $_this_iconnav !== undefined ){
282					$content_li = '<li>'
283								+ '<a href="#'+ $_this_id +'" title="" data-id="'+ $_this_id +'" style="background:'+ $(this).attr('data-color') +'; color:'+ $(this).attr('data-color') +'">'
284								+ '<span class="icon-nav"><img src="'+ $_this_iconnav +'" alt=""/></span>'
285								+ '</a>'
286								+ '</li>';
287					$('#sns-producttabs-navigation ul.product-tab-nav-list').append($content_li);
288				}
289			});
290			// Detect scroll
291			$(window).scroll(function() {
292				var scrollTop = $(this).scrollTop();
293				$('.sns-ajaxtab').each(function(){
294					var topDistance = $(this).offset().top;
295					// Display #sns-producttabs-navigation
296					if ( (topDistance - 200) < scrollTop) {
297						if( $(this).hasClass('first') ){
298			        		$('#sns-producttabs-navigation').removeClass('active').addClass('active');
299			        	}
300					}else if((topDistance - 200) > scrollTop){
301						if( $(this).hasClass('first') ){
302			        		$('#sns-producttabs-navigation').removeClass('active');
303			        	}
304					}
305					if((topDistance + 100) < scrollTop){
306						if( $(this).hasClass('last') ){
307			        		$('#sns-producttabs-navigation').removeClass('active');
308			        	}
309					}
310					//
311			        if ( (topDistance - 40) < scrollTop) {
312			            var $_this_id = $(this).attr('id');
313						$('#sns-producttabs-navigation ul.product-tab-nav-list li').each(function(){
314							// remove class active
315							$(this).find('a').removeClass('active');
316							if( $_this_id == $(this).find('a').attr('data-id') ){
317								$(this).find('a').addClass('active');
318							}
319						});
320			        }
321				});
322			});
323			//
324			$('#sns-producttabs-navigation ul.product-tab-nav-list li').each(function(){
325				var $this = $(this);
326				$this.find('a').click(function(){
327					// remove class active
328					$this.find('a').removeClass('active');
329					var $_id = $(this).attr('href');
330					$("html, body").animate({ scrollTop: $($_id).offset().top - 20}, 800);
331					// $(this).addClass('active');
332					return false;
333				});
334			});
335		}
336
337		//
338		$('.variations-product-wrap .variable-item a.option').each(function(){
339			if ( !$(this).length ) return;
340			var $img_src = '';
341			var $variable_prd = $(this).parents('.product-inner');
342			var $product_image = $variable_prd.find('a.product-image img');
343			if ( $product_image.hasClass('lazy') ) {
344				$img_src = $product_image.data('original');
345			}else{
346				$img_src = $product_image.attr('src');
347			}
348			if ( $img_src == $(this).attr('data-image-src') ) {
349				$(this).addClass('active');
350			}
351			$(this).on('click', function(e){
352				e.preventDefault();
353				if ($(this).hasClass('active') ) return false;
354				$variable_prd.find('.variations-product-wrap .variable-item a.option').removeClass('active');
355				var $data_image_src = $(this).attr('data-image-src');
356				if( $data_image_src != ''){
357					$variable_prd.find('.product-image img').attr('src', $data_image_src);
358					$variable_prd.find('.product-image img').attr('srcset', '');
359					$variable_prd.find('.product-image img').attr('sizes', '');
360				}else{
361				 	$variable_prd.find('.product-image img').attr('src', $img_src);
362				}
363				$(this).addClass('active');
364				return false;
365			});
366		});
367	   	
368		// Ajax complete
369		jQuery(document).ajaxComplete(function(e, xhr, settings) {
370			// Click Quick View
371			if ( typeof settings.data != 'undefined' && settings.data.match(/yith_load_product_quick_view/i) ) {
372				if( $('#yith-quick-view-modal .product.type-product > .gallery_type_h').length ){
373					SnsSinglePrdIHG.init('#yith-quick-view-modal .gallery_type_h');
374				}
375				if( $('#yith-quick-view-modal .product.type-product > .gallery_type_v').length ){
376					SnsSinglePrdIVG.init('#yith-quick-view-modal .gallery_type_v');
377				}
378				SnsVariationForm.init();
379			}
380			// Click Wishlist
381			if ( typeof settings.data != 'undefined' && settings.data.match(/add_to_wishlist/i) ) {
382				if ( $('.mini-wishlist .tongle .number').length ) {
383					var num_wl = $('.mini-wishlist .tongle .number').html() - 1;
384					if ( $('body').hasClass('header-style2') ) {
385						$('.mini-wishlist .tongle .number').html('('+ num_wl +')');
386					}else{
387						$('.mini-wishlist .tongle .number').html(num_wl);
388					}
389				}
390			}
391			// lazyload for woo product
392			if( $('body').hasClass('use_lazyload') ){
393				var timeout = setTimeout(function() {
394					$(".sns-main img.lazy:not(.loaded)").lazyload();
395				}, 1000);
396			}
397			// Wishlist & compare
398			$('.block-product-inner .yith-wcwl-wishlistaddedbrowse a, .block-product-inner .yith-wcwl-wishlistexistsbrowse a').each(function(){
399				$(this).attr('data-toggle', 'tooltip').attr('data-original-title', $(this).text().trim());
400			});
401			// View cart
402			$('.products .added_to_cart').each(function(){
403				if( $(this).text().trim() != '') $(this).attr('data-toggle', 'tooltip').attr('data-original-title', $(this).text().trim());
404			});
405			// Mini cart number
406			if ( $('.sns-ajaxcart .sns-cart-number').length ) {
407				if ( $('body').hasClass('header-style2') ) {
408					$('.sns-ajaxcart .tongle .number').html('('+$('.sns-ajaxcart .sns-cart-number').html().trim()+')');
409				}else{
410					$('.sns-ajaxcart .tongle .number').html($('.sns-ajaxcart .sns-cart-number').html().trim());
411				}
412			}
413			// Click filter on handle device
414		    $('.yith-wcan a').on('click', function (e) {
415		        $('.sns-icon-nav .btn2').each(function(){
416		        	if( $(this).hasClass('active') ){
417		        		$('#sns_content .sns-left, #sns_content .sns-right').removeClass('active');
418		        		$(this).find('.overlay').fadeOut(250); $(this).removeClass('active');
419		        	}
420		        })
421		    });
422			//
423			$('.variations-product-wrap .variable-item a.option').each(function(){
424				if ( !$(this).length ) return;
425				var $img_src = '';
426				var $variable_prd = $(this).parents('.product-inner');
427				var $product_image = $variable_prd.find('a.product-image img');
428				if ( $product_image.hasClass('lazy') ) {
429					$img_src = $product_image.data('original');
430				}else{
431					$img_src = $product_image.attr('src');
432				}
433				if ( $img_src == $(this).attr('data-image-src') ) {
434					$(this).addClass('active');
435				}
436				$(this).on('click', function(e){
437					e.preventDefault();
438					if ($(this).hasClass('active') ) return false;
439					$variable_prd.find('.variations-product-wrap .variable-item a.option').removeClass('active');
440					var $data_image_src = $(this).attr('data-image-src');
441					if( $data_image_src != ''){
442						$variable_prd.find('.product-image img').attr('src', $data_image_src);
443						$variable_prd.find('.product-image img').attr('srcset', '');
444						$variable_prd.find('.product-image img').attr('sizes', '');
445					}else{
446					 	$variable_prd.find('.product-image img').attr('src', $img_src);
447					}
448					$(this).addClass('active');
449					return false;
450				});
451			});
452		});
453	});
454    
455	// Begin Class: SnsVariationForm
456	var SnsVariationForm = {
457        init: function() {
458            var self = this;
459            //
460            if ( $('form.variations_form').length ) {
461	            var $product        = $('.variations_form').closest( '.product' );
462	            var $product_img    = $product.find( 'div.product-images .woocommerce-main-image' );
463	            $product.data('img-osrc', $product_img.attr('src'));
464	            $product.data('img-title', $product_img.attr('title'));
465	            $product.data('img-src', $product_img.attr('data-src'));
466	        }
467            $( document ).on( 'reset_image', '.variations_form', function(event) { // alert('dddd');
468                var $product        = $(this).closest( '.product' );
469                var $product_images = $product.find('.product-images');
470                var $product_thumbs = $product.find('.product-thumbs');
471                // Begin: Switch to first Image
472                if ($product_images.length) {
473                    $product_images.trigger('to.owl.carousel', [0, 300, true]);
474                }
475                // Swap Image Zoom
476                var $product_img    = $product.find( 'div.product-images .woocommerce-main-image' );
477                var o_src           = $product_img.attr('data-o_src');
478                var o_title         = $product_img.attr('data-o_title');
479                var src          = $product_img.attr('data-src');
480                if ( o_src && o_title && src ) {
481                    $product_img.each(function() {
482                    	var elevateZoom = $(this).data('elevateZoom');
483                    	if (typeof elevateZoom != 'undefined') {
484                        	elevateZoom.swaptheimage($(this).attr( 'src' ), $(this).attr( 'data-src' ));
485                        }
486                    });
487                    // Switch Button Popup to first Image
488                	var imgsrc = $product_images.data('imgsrc'), imgtitle = $product_images.data('imgtitle');
489                    if (typeof imgsrc != 'undefined' && typeof imgtitle != 'undefined') {
490                        imgsrc[0] = src; imgtitle[0] = o_title;
491                    }
492                    $product_images.data('imgsrc', imgsrc); $product_images.data('imgtitle', imgtitle);
493                }
494                // Begin: Switch to first Thumb
495                if ($product_thumbs.length) {
496                    $product_thumbs.trigger('to.owl.carousel', [0, 300, true]);
497                    $product_thumbs.find('.owl-item:eq(0)').click();
498                }
499                // Replace first thumb src
500                var $thumb_img      = $product.find( '.woocommerce-main-thumb' );
501                var o_thumb_src     = $thumb_img.attr('data-o_src');
502                if (o_thumb_src) {
503                    $thumb_img.attr( 'src', o_thumb_src ).attr( 'srcset', '' );
504                }
505            });
506            $( document ).on( 'click', '.variations_form .reset_variations', function(event) {
507            	var $product 			= $(this).closest( '.product' );
508            	var $product_images 	= $product.find('.product-images');
509                var $product_img     	= $product.find( 'div.product-images .woocommerce-main-image' );
510                // var $thumb_img 			= $product.find( '.woocommerce-main-thumb');
511                $product_img.each(function() {
512                	$product_img.attr( 'src', $product.data('img-osrc') )
513                				.attr( 'data-o_src', $product.data('img-osrc') )
514                				.attr( 'srcset', '' )
515                				.attr( 'alt', $product.data('img-title') )
516                				.attr( 'data-src', $product.data('img-src') );
517                	var elevateZoom = $(this).data('elevateZoom');
518                	if (typeof elevateZoom != 'undefined') {
519                    	elevateZoom.swaptheimage($(this).attr( 'src' ), $(this).attr( 'data-src' ));
520                    }
521                });
522                var imgsrc = $product_images.data('imgsrc'), imgtitle = $product_images.data('imgtitle');
523                imgsrc[0] = $product.data('img-src'); imgtitle[0] = $product.data('img-title');
524                $product_images.data('imgsrc', imgsrc); $product_images.data('imgtitle', imgtitle);
525            });
526            $( document ).on( 'found_variation', '.variations_form', function(event, variation) {
527                if (typeof variation == 'undefined') {
528                    return;
529                }
530                var $product 			= $(this).closest( '.product' );
531                var $product_images 	= $product.find('.product-images');
532                var $product_thumbs 	= $product.find('.product-thumbs');
533                // Begin: Switch to first Image
534                if ($product_images.length) {
535                    $product_images.trigger('to.owl.carousel', [0, 300, true]);
536                }
537                // Begin: Switch to first Thumb
538                if ($product_thumbs.length) {
539                    $product_thumbs.trigger('to.owl.carousel', [0, 300, true]);
540                    $product_thumbs.find('.owl-item:eq(0)').click();
541                }
542                var $product_img     		= $product.find( 'div.product-images .woocommerce-main-image' );
543                var $thumb_img 				= $product.find( '.woocommerce-main-thumb');
544                var variation_image 		= variation.image.full_src; //alert(variation.image.full_src); console.log(variation);
545                var variation_link 			= variation.image.src;
546                var variation_title 		= variation.image.caption;
547                var variation_thumb 		= ( typeof variation.image.thumb_src != 'undefined' ) ? variation.image.thumb_src : variation.image.src ;
548                
549                // Replace Image & Thumb Src
550                var o_src = $product_img.attr('data-o_src');
551                if ( ! o_src ) {
552                    o_src = ( ! $product_img.attr('src') ) ? '' : $product_img.attr('src');
553                    $product_img.attr('data-o_src', o_src );
554                }
555                var src = $product_img.attr('data-src');
556                if ( ! src ) {
557                    src = ( ! $product_img.attr('data-src') ) ? '' : $product_img.attr('data-src');
558                    $product_img.attr('data-src', src );
559                }
560                var o_title = $product_img.attr('data-o_title');
561                if ( ! o_title ) {
562                    o_title = ( ! $product_img.attr('alt') ) ? '' : $product_img.attr('alt');
563                    $product_img.attr('data-o_title', o_title );
564                }
565                var o_thumb_src = $thumb_img.attr('data-o_src');
566                if ( ! o_thumb_src ) {
567                    o_thumb_src = ( ! $thumb_img.attr('src') ) ? '' : $thumb_img.attr('src');
568                    $thumb_img.attr('data-o_src', o_thumb_src );
569                }
570                var imgsrc = $product_images.data('imgsrc'), imgtitle = $product_images.data('imgtitle');
571                if ( variation_link ) {
572                    $product_img.attr( 'src', variation_link ).attr( 'data-o_src', variation_link ).attr( 'srcset', '' ).attr( 'alt', variation_title ).attr( 'data-src', variation_image );
573                    $thumb_img.attr( 'src', variation_thumb ).attr( 'srcset', '' );
574                    if (typeof imgsrc != 'undefined' && typeof imgtitle != 'undefined') {
575                        imgsrc[0] = variation_image; imgtitle[0] = variation_title;
576                    }
577                } else {
578                    $product_img.attr( 'src', o_src ).attr( 'data-o_src', o_src ).attr( 'srcset', '' ).attr( 'alt', o_title ).attr( 'data-src', src );
579                    $thumb_img.attr( 'src', o_thumb_src ).attr( 'srcset', '' );
580                    if (typeof imgsrc != 'undefined' && typeof imgtitle != 'undefined') {
581                        imgsrc[0] = src; imgtitle[0] = o_title;
582                    }
583                }
584                // Switch Button Popup to first Image
585                $product_images.data('imgsrc', imgsrc); $product_images.data('imgtitle', imgtitle);
586                // Swap Image Zoom
587                $product_img.each(function() {
588                	var elevateZoom = $(this).data('elevateZoom');
589                	if (typeof elevateZoom != 'undefined') {
590                    	elevateZoom.swaptheimage($(this).attr( 'src' ), $(this).attr( 'data-src' ));
591                    }
592                });
593            });
594        },
595        reDesignVariationForm: function( $wrap ) {
596        	if ( typeof $wrap == 'undefined') var $wrap = '';
597        	if ( $wrap != '' ) {
598	    		$wrap = $wrap+' .type-product.product-type-variable';
599	    	}else{
600	    		$wrap = '.type-product.product-type-variable';
601	    	}
602			if ( $($wrap).length  && typeof sns_arr_attr !== 'undefined' ) { 
603				$($wrap).find('.variations select').each(function(){
604					var select = $(this), select_div, var_attr = sns_arr_attr[select.attr('name')];
605					if ( typeof var_attr == 'undefined' ) { return false; } 
606					select_div = $('<div />', {
607				                	'class': 'sellect-wrap'
608				            	}).insertAfter(select);
609					select.hide();
610					select.find( 'option' ).each(function (){
611						var option_old = $(this), option;
612						if ( option_old.attr('value')!='' ) {
613							var inner_opt, class_sellect, val_opt = var_attr.key_val[option_old.attr('value')];
614							if (var_attr.type == 'color') {
615								if (val_opt.indexOf("http:") == 0 || val_opt.indexOf("https:") == 0) {
616									inner_opt = $('<span/>', {
617												'style':'background-image:url("' + val_opt + '")'
618											});
619									class_sellect = ' image';
620								}else if (val_opt.indexOf("#") == 0 ){
621				                    inner_opt = $('<span/>', {
622													'style':'background:' + val_opt
623												});
624									class_sellect = ' color';
625								}else{
626									inner_opt = $('<span/>', {
627												'html': val_opt
628											});
629									class_sellect = ' text';
630								}
631			                }else if (var_attr.type == 'text') {
632			                    inner_opt = $('<span/>', {
633												'html': val_opt
634											});
635								class_sellect = ' text';
636			                }
637			                option = $('<div/>', {
638				                        'class': 'option'+class_sellect,
639				                        'data-toggle':'tooltip',
640				                        'data-original-title':option_old.text(),
641				                        'data-value': option_old.attr('value')
642				                    }).appendTo(select_div);
643		                    inner_opt.appendTo(option);
644							if ( option_old.val() == select.val() ){
645								option.addClass('selected');
646							}
647		                    option.on('click', function () {
648		                    	// Update variation values
649		                        if ( $(this).hasClass('selected') ) {
650		                            select.val('').change();
651		                        } else {
652		                            select.val( option_old.val() ).change();
653		                        }
654		                        SnsVariationForm.setSelectedOpt( $(this) );
655		                    });
656		                }
657					});
658				});
659				$( document ).on( 'click', '.variations_form .reset_variations', function(event) {
660					$('.variations_form .sellect-wrap .option').removeClass('selected');
661				});
662			}
663		},
664		setSelectedOpt: function( option ) {
665	        option.toggleClass('selected');
666	        option.siblings().removeClass('selected');
667	    },
668    }
669    // End Class: SnsVariationForm
670    // Begin Class: SnsSinglePrdING
671    var SnsSinglePrdING = {
672		init: function( $wrap ) {
673			var self = this, flag_switch = false;
674			if ( typeof sns_sp_var == 'undefined' ) return false;
675	    	//if ( sns_sp_var['zoom'] == '1' && ( !('ontouchstart' in document) || ( ('ontouchstart' in document) && sns_sp_var['zoommobile'] == '1' ) ) ) {
676	    		var zoomcfg = {
677		            responsive: true, zoomType: sns_sp_var['zoomtype'], cursor: 'grab'
678		        };
679		        if ( sns_sp_var['zoomtype'] == 'inner' ) {
680		        	zoomcfg.borderSize = 0;
681		        }else if ( sns_sp_var['zoomtype'] == 'lens' ) {
682		        	zoomcfg.lensSize = sns_sp_var['lenssize']; zoomcfg.lensShape = sns_sp_var['lensshape'];
683		        }
684	    	//}
685	    	if ( typeof $wrap == 'undefined') var $wrap = '';
686	    	if ( $wrap != '' ) {
687	    		$wrap = $wrap+' .product-images';
688	    	}else{
689	    		$wrap = '.product-images';
690	    	}
691	        $($wrap).each(function() {
692	            var $this = $(this),
693	                $product = $this.closest('.product'),
694	                image_active = 0;
695	                // Button click to popup Images
696	                if ( sns_sp_var['poup'] == '1' ) {
697	                    var imgsrc = [], imgtitle = [], i = 0;
698	                    var $popup_btn = $product.find('.popup-image');
699	                    var $popup_video_btn = $product.find('.popup-video');
700	                    $this.find('img').each(function() {
701	                        imgsrc[i] = $(this).attr('data-src'); imgtitle[i] = $(this).attr('alt');
702	                        i++;
703	                    });
704	                    $this.data('imgsrc', imgsrc); $this.data('imgtitle', imgtitle);
705	                    if (typeof $.fn.prettyPhoto !== 'undefined') {
706		                    $($popup_btn).off('click').on('click', function(e) {
707		                        e.preventDefault();
708		                        $.prettyPhoto.open($this.data('imgsrc'), [], $this.data('imgtitle'), image_active);
709		                    });
710		                    $popup_video_btn.prettyPhoto({
711								hook: 'data-rel', default_width: 750, default_height: 600, social_tools: false, theme: 'pp_woocommerce', horizontal_padding: 20, opacity: 0.8, deeplinking: false
712							});
713		                }
714	                }
715	            //if ( sns_sp_var['zoom'] == '1' && ( !('ontouchstart' in document) || ( ('ontouchstart' in document) && sns_sp_var['zoommobile'] == '1' ) ) ) {
716	                $this.find('img').each(function() {
717                    	zoomcfg.zoomContainer = $(this).parent();
718    					$(this).elevateZoom(zoomcfg);
719    					$(window).on('resize', function () {
720	                            $this.find('img').each(function() {
721	                                var elevateZoom = $(this).data('elevateZoom');
722	                                if (typeof elevateZoom != 'undefined') {
723	                                    elevateZoom.startZoom();
724	                                    elevateZoom.swaptheimage($(this).attr('src'), $(this).attr('data-src'));
725	                                }
726	                            });
727	                    });
728	                });
729	            //}
730	        });
731	    },
732	};
733    // End Class: SnsSinglePrdING
734    // Begin Class: SnsSinglePrdIHG
735	var SnsSinglePrdIHG = {
736		init: function( $wrap ) {
737			var self = this, flag_switch = false;
738			if ( typeof sns_sp_var == 'undefined' ) return false;
739	    	if ( sns_sp_var['zoom'] == '1' && ( !('ontouchstart' in document) || ( ('ontouchstart' in document) && sns_sp_var['zoommobile'] == '1' ) ) ) {
740	    		var zoomcfg = {
741		            responsive: true, zoomType: sns_sp_var['zoomtype'], cursor: 'grab'
742		        };
743		        if ( sns_sp_var['zoomtype'] == 'inner' ) {
744		        	zoomcfg.borderSize = 0;
745		        }else if ( sns_sp_var['zoomtype'] == 'lens' ) {
746		        	zoomcfg.lensSize = sns_sp_var['lenssize']; zoomcfg.lensShape = sns_sp_var['lensshape'];
747		        }
748	    	}
749	    	if ( typeof $wrap == 'undefined') var $wrap = '';
750	    	if ( $wrap != '' ) {
751	    		$wrap = $wrap+' .product-images';
752	    	}else{
753	    		$wrap = '.product-images';
754	    	}
755	        $($wrap).each(function() {
756	            var $this = $(this),
757	                $product = $this.closest('.product'),
758	                $product_thumbs = $product.find('.product-thumbs'),
759	                image_active = 0;
760	            $this.find('img:first-child').waitForImages(true).done(function() {
761		            // Carousel for Thumbs
762	                $product_thumbs.owlCarousel({
763	                    loop: false, autoplay : false, rewind: true, dots: false, nav: true,
764	                    items : sns_sp_var['thumbnum'],
765	                    responsive : {
766		                    0 : { items: sns_sp_var['thumbnum']-1},
767		                    480 : { items: sns_sp_var['thumbnum']-1 },
768		                    768 : { items: sns_sp_var['thumbnum']-1 },
769		                    992 : { items: sns_sp_var['thumbnum'] },
770		                    1200 : { items: sns_sp_var['thumbnum'] }
771		                },
772	                    onInitialized: function() {
773	                        self.switchImageThumb(null, $product_thumbs, 0);
774	                        if ($product_thumbs.find('.owl-item').length < sns_sp_var['thumbnum']) {
775	                        	$product_thumbs.find('.owl-nav').hide();
776	                        }	
777	                    }
778	                }).on('click', '.owl-item', function() {
779	                    self.switchImageThumb($this, $product_thumbs, $(this).index());
780	                });
781	                $product_thumbs.on('click', '.owl-prev', function(e) {
782	                    self.switchImageThumb($this, $product_thumbs, $product_thumbs.data('thumbselected') - 1);
783	                });
784	                $product_thumbs.on('click', '.owl-next', function(e) {
785	                    self.switchImageThumb($this, $product_thumbs, $product_thumbs.data('thumbselected') + 1);
786	                });
787	                // Button click to popup Images
788	                if ( sns_sp_var['poup'] == '1' ) {
789	                    var imgsrc = [], imgtitle = [], i = 0;
790	                    var $popup_btn = $product.find('.popup-image');
791	                    var $popup_video_btn = $product.find('.popup-video');
792	                    $this.find('img').each(function() {
793	                        imgsrc[i] = $(this).attr('data-src'); imgtitle[i] = $(this).attr('alt');
794	                        i++;
795	                    });
796	                    $this.data('imgsrc', imgsrc); $this.data('imgtitle', imgtitle);
797	                    if (typeof $.fn.prettyPhoto !== 'undefined') {
798		                    $($popup_btn).off('click').on('click', function(e) {
799		                        e.preventDefault();
800		                        $.prettyPhoto.open($this.data('imgsrc'), [], $this.data('imgtitle'), image_active);
801		                    });
802		                    $popup_video_btn.prettyPhoto({
803								hook: 'data-rel', default_width: 750, default_height: 600, social_tools: false, theme: 'pp_woocommerce', horizontal_padding: 20, opacity: 0.8, deeplinking: false
804							});
805		                }
806	                }
807	                // Carousel for Images
808	                $this.owlCarousel({
809	                    autoplay : false, items : 1, rewind: true, nav: true, navText: ["", ""], dots: false, loop : false,
810	                    onInitialized : function() {
811	                        if ( sns_sp_var['zoom'] == '1' && ( !('ontouchstart' in document) || ( ('ontouchstart' in document) && sns_sp_var['zoommobile'] == '1' ) ) ) {
812	                            $this.find('img').each(function() {
813	                                var $this = $(this);
814	                                zoomcfg.zoomContainer = $this.parent();
815	                                $this.elevateZoom(zoomcfg);
816	                            });
817	                        }
818	                    },
819	                    onTranslate : function(e) {
820	                        image_active = this._current - $this.find('.cloned').length / 2;
821	                        self.switchImageThumb(null, $product_thumbs, image_active);
822	                    },
823	                    onRefreshed: function() {
824	                        if ( sns_sp_var['zoom'] == '1' && ( !('ontouchstart' in document) || ( ('ontouchstart' in document) && sns_sp_var['zoommobile'] == '1' ) ) ) {
825	                            $this.find('img').each(function() {
826	                                var elevateZoom = $(this).data('elevateZoom');
827	                                if (typeof elevateZoom != 'undefined') {
828	                                    elevateZoom.startZoom();
829	                                    elevateZoom.swaptheimage($(this).attr('src'), $(this).attr('data-src'));
830	                                }
831	                            });
832	                        }
833	                    }
834	                });
835	            });
836	        });
837	    },
838	    switchImageThumb: function($product_images, $product_thumbs, index) {
839	        if (self.flag_switch) return;
840	        self.flag_switch = true;
841	        var thumb_leng = $product_thumbs.find('.owl-item').length, thumbs_active = [], i = 0;
842	        index = (index + thumb_leng) % thumb_leng;
843	        $product_thumbs.find('.owl-item').removeClass('selected');
844	        $product_thumbs.find('.owl-item:eq(' + index + ')').addClass('selected');
845	        $product_thumbs.data('thumbselected', index);
846	        $product_thumbs.find('.owl-item.active').each(function() {
847	            thumbs_active[i++] = $(this).index();
848	        });
849	        // Switch Thumb
850	        if ($.inArray(index, thumbs_active) == -1) {
851	            if (Math.abs(index - thumbs_active[0]) > Math.abs(index - thumbs_active[thumbs_active.length - 1])) {
852	                $product_thumbs.trigger('to.owl.carousel', [(index - thumbs_active.length + 1) % thumb_leng, 300, true]);
853	            } else {
854	                $product_thumbs.trigger('to.owl.carousel', [index % thumb_leng, 300, true]);
855	            }
856	        }
857	        // Switch Image
858	        if ($product_images) {
859	            $product_images.trigger('to.owl.carousel', [index, 300, true]);
860	        }
861	        self.flag_switch = false;
862	    }
863	};
864	// End Class: SnsSinglePrdIHG
865	// Begin Class: SnsSinglePrdIVG
866	var SnsSinglePrdIVG = {
867		init: function( $wrap ) {
868			if ( typeof sns_sp_var == 'undefined' ) return false;
869	    	if ( sns_sp_var['zoom'] == '1' && ( !('ontouchstart' in document) || ( ('ontouchstart' in document) && sns_sp_var['zoommobile'] == '1' ) ) ) {
870	    		var zoomcfg = {
871		            responsive: true, zoomType: sns_sp_var['zoomtype'], cursor: 'grab'
872		        };
873		        if ( sns_sp_var['zoomtype'] == 'inner' ) {
874		        	zoomcfg.borderSize = 0;
875		        }else if ( sns_sp_var['zoomtype'] == 'lens' ) {
876		        	zoomcfg.lensSize = sns_sp_var['lenssize']; zoomcfg.lensShape = sns_sp_var['lensshape'];
877		        }
878	    	}
879	    	if ( typeof $wrap == 'undefined') var $wrap = '';
880	    	if ( $wrap != '' ) {
881	    		$wrap = $wrap+' .product-images';
882	    	}else{
883	    		$wrap = '.product-images';
884	    	}
885	        $($wrap).each(function() {
886	            var $this = $(this),
887	                $product = $this.closest('.product'),
888	                $product_thumbs = $product.find('.product-thumbs'),
889	                image_active = 0;
890	            $this.find('img:first-child').waitForImages(true).done(function() {
891		            // Slider for Thumbs
892	                $product_thumbs.slick({
893						vertical: true,
894						asNavFor: '.entry-img .images .product-images',
895						focusOnSelect: true,
896						infinite: false,
897						arrows: true,
898						slidesToScroll: 1,
899						slidesToShow: ($product_thumbs.find('.img').size()>=4) ? 4 : $product_thumbs.find('.img').size() ,
900					});
901	                // Button click to popup Images
902	                if ( sns_sp_var['poup'] == '1' ) {
903	                    var imgsrc = [], imgtitle = [], i = 0;
904	                    var $popup_btn = $product.find('.popup-image');
905	                    var $popup_video_btn = $product.find('.popup-video');
906	                    $this.find('img').each(function() {
907	                        imgsrc[i] = $(this).attr('data-src'); imgtitle[i] = $(this).attr('alt'); i++;
908	                    });
909	                    $this.data('imgsrc', imgsrc); $this.data('imgtitle', imgtitle);
910	                    if (typeof $.fn.prettyPhoto !== 'undefined') {
911		                    $($popup_btn).off('click').on('click', function(e) {
912		                        e.preventDefault();
913		                        $.prettyPhoto.open($this.data('imgsrc'), [], $this.data('imgtitle'), image_active);
914		                    });
915		                    $popup_video_btn.prettyPhoto({
916								hook: 'data-rel', default_width: 750, default_height: 600, social_tools: false, theme: 'pp_woocommerce', horizontal_padding: 20, opacity: 0.8, deeplinking: false
917							});
918		                }
919	                }
920	                // Zoom for image
921	                if ( sns_sp_var['zoom'] == '1' && ( !('ontouchstart' in document) || ( ('ontouchstart' in document) && sns_sp_var['zoommobile'] == '1' ) ) ) {
922                        $this.find('img').each(function() {
923                            var $this = $(this);
924                            zoomcfg.zoomContainer = $this.parent();
925                            $this.elevateZoom(zoomcfg);
926                        });
927                    }
928                    // Slider for Images
929	                $this.slick({
930						vertical: false,
931						asNavFor: '.entry-img .thumbnails .product-thumbs',
932						focusOnSelect: true,
933						infinite: false,
934						slidesToScroll: 1,
935						slidesToShow: 1,
936						arrows: false
937					}).on('afterChange', function(event, slick, currentSlide){
938						image_active = $this.slick('slickCurrentSlide');
939					});
940	            });
941	        });
942	    }
943	};
944	// End Class: SnsSinglePrdIVG
945})(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.