PageSourceSearch

https://vinarstvi-vaclav.cz/wp-content/themes/villenoir/js/custom.js?ver=5.1

js vinarstvi-vaclav.cz collected 2026-10-06 12:44:03 UTC 11,213 bytes, 385 lines download raw bytes

1(function ($) {
2"use strict";
3
4function gg_isotope_init() {
5
6	if($('.el-grid:not(.gg-slick-carousel)').length > 0){
7	    var layout_modes = {
8	        fitrows: 'fitRows',
9	        masonry: 'masonry'
10	    }
11	    jQuery('.gg_posts_grid').each(function(){
12	        var $container = jQuery(this);
13	        var $thumbs = $container.find('.el-grid:not(.gg-slick-carousel):not([data-layout-mode="list"])');
14	        var layout_mode = $thumbs.attr('data-layout-mode');
15	        
16	        $thumbs.isotope({
17	            // options
18	            itemSelector : '.isotope-item',
19	            layoutMode : (layout_modes[layout_mode]==undefined ? 'fitRows' : layout_modes[layout_mode]),
20	        });
21
22
23			//Isotope filter
24	        if($container.find('.gg_filter:not(.gg-slick-carousel)').length > 0){
25		        $container.find('.gg_filter:not(.gg-slick-carousel) a').data('isotope', $thumbs).on('click', function(e) {
26		            e.preventDefault();
27		            var $thumbs = jQuery(this).data('isotope');
28		            jQuery(this).parent().parent().find('.active').removeClass('active');
29		            jQuery(this).parent().addClass('active');
30		            $thumbs.isotope({filter: jQuery(this).attr('data-filter')});
31		        });
32	    	}
33
34	        jQuery(window).on('load resize', function() {
35				$thumbs.imagesLoaded( function() {
36				 	$thumbs.isotope('layout');
37				});
38	        });
39
40	    });
41	}
42}
43
44/* Magnific */
45function gg_magnific_init() {
46	if($('.el-grid:not(.no_magnific), .gg-slick-carousel.has_magnific, .wpb_image_grid.has_magnific, .wpb_single_image.has_magnific, .post-thumbnail.has_magnific, .size-guide-wrapper.has_magnific').length > 0){
47		$( '.el-grid:not(.no_magnific), .gg-slick-carousel.has_magnific, .wpb_image_grid.has_magnific, .wpb_single_image.has_magnific, .post-thumbnail.has_magnific, .size-guide-wrapper.has_magnific' ).each(function(){
48			$(this).magnificPopup({
49				delegate: 'a.lightbox-el',
50				type: 'image',
51				gallery: {
52		            enabled: true
53		        },
54				callbacks: {
55				    elementParse: function(item) {
56				    	if(item.el[0].className == 'lightbox-el link-wrapper lightbox-video') {
57				        	item.type = 'iframe';
58				    	} else if(item.el[0].className == 'lightbox-el gg-popup') {
59				        	item.type = 'inline';
60				        } else {
61				        	item.type = 'image';
62				      	}
63				    }
64				}
65			});
66		});
67	}
68}
69
70/* SlickCarousel */
71function gg_slickcarousel_init() {
72	if($('.gg-slick-carousel:not(.gg_filter)').length > 0){
73		$( '.gg-slick-carousel:not(.gg_filter)' ).each(function(){
74
75			var $this = $(this);
76
77			//Initialize slick
78			//$this.slick();
79			
80			var filtered = false;
81
82			$('.gg_filter.gg-slick-carousel a').on('click', function(e){
83				e.preventDefault();
84				$(this).parent().parent().find('.active').removeClass('active');
85				$(this).parent().addClass('active');
86
87		        var gg_filter = $(this).parent().parent().parent().parent().find('.el-grid.gg-slick-carousel');
88
89		        console.log(gg_filter);
90
91		        if ($(this).attr('data-filter') == '*') {
92			      	gg_filter.slick('slickUnfilter');
93			      	gg_filter.slick('slickGoTo',0);
94				    filtered = false;
95			    } else {
96				  	gg_filter.slick('slickFilter',$(this).attr('data-filter'));
97				  	gg_filter.slick('slickGoTo',0);
98				    filtered = true;
99			    } 
100			});
101
102			//Refresh and animate the carousel from the megamenu
103			$( ".navbar-default .navbar-nav > li.is-megamenu > a" ).on( "click", function() {
104				var cur_slider = $(this).parent().find('.gg-slick-carousel');
105				cur_slider.css({"opacity": 0});
106				cur_slider.resize().animate({opacity: 1}, 1000);
107			});
108
109		});
110
111	}
112}
113
114
115
116/* Counter */
117function gg_counter_init(){
118	if($('.counter').length > 0){
119		jQuery('.counter-holder').waypoint(function() {
120			$('.counter').each(function() {
121				if(!$(this).hasClass('initialized')){
122					$(this).addClass('initialized');
123					var $this = $(this),
124					countToNumber = $this.attr('data-number'),
125					refreshInt = $this.attr('data-interval'),
126					speedInt = $this.attr('data-speed');
127
128					$(this).countTo({
129						from: 0,
130						to: countToNumber,
131						speed: speedInt,
132						refreshInterval: refreshInt
133					});
134				}
135			});
136		}, { offset: '85%' });
137	}
138}
139
140/* VC is RTL */
141function gg_vc_is_rtl() {
142	if(jQuery('body.rtl').length > 0){
143		jQuery( '.vc_row[data-vc-full-width="true"]' ).each(function(){
144		  //VC Row RTL
145		  var jQuerythis = jQuery(this);
146		  var vc_row = jQuerythis.offset().left;
147		  jQuerythis.css('right', - vc_row)
148		});
149 	}
150}
151
152
153/* Infinite scroll */
154function gg_infinite_scroll() {
155	if(jQuery('.el-grid[data-pagination="ajax_load"]').length > 0) {
156
157		var container = jQuery('ul.el-grid');
158		var infinite_scroll = {
159		  loading: {
160			selector: '.load-more-anim',
161			img: villenoir_custom_object.infinite_scroll_img,
162			msgText: villenoir_custom_object.infinite_scroll_msg_text,
163			finishedMsg: villenoir_custom_object.infinite_scroll_finished_msg_text
164		  },
165		  bufferPx     : 140,
166		  behavior: "twitter",
167		  nextSelector:".pagination-span a",
168		  navSelector:".pagination-load-more",
169		  itemSelector:"ul.el-grid li",
170		  contentSelector:"ul.el-grid",
171		  animate: false,
172		  debug: false,
173
174		};
175
176		jQuery( infinite_scroll.contentSelector ).infinitescroll( 
177		  	infinite_scroll,
178		  	// Infinite Scroll Callback
179		  	function( newElements ) {
180				var newElems = jQuery( newElements ).hide();
181				newElems.imagesLoaded(function(){
182			  		newElems.fadeIn();
183
184			 		if(jQuery('.el-grid[data-layout-mode="masonry"], .el-grid[data-layout-mode="fitRows"]').length > 0) {
185						container.isotope( 'appended', newElems );
186					}  
187				});
188		  	}
189		);
190  	}
191}
192
193$(document).ready(function () {
194
195	gg_slickcarousel_init();
196    gg_magnific_init();
197    gg_counter_init();
198    gg_isotope_init();
199    gg_vc_is_rtl();
200    gg_infinite_scroll();
201
202
203    $('.lightbox-el.gg-popup').magnificPopup({
204        items: {
205            src: 'https://www.google.com/maps/d/embed?mid=19xaj6AmVJihFfzIbp5R1OBbwlblPqjrK',
206            type: 'iframe',
207        },
208        callbacks: {
209            open: function() {
210                var container = $(this.container);
211                container.find(".mfp-content").css({'max-width': 'inherit', height: "70vh"});
212            }
213        }
214    });
215
216
217
218    //WPML menu
219    if ($('.sub-menu.submenu-languages').length > 0)  {
220    	var submenu = $('.sub-menu.submenu-languages');
221    	var menu = submenu.parent();
222
223    	menu.addClass('gg-wpml-menu');
224    	menu.find('a').addClass('dropdown-toggle').attr('data-toggle', 'dropdown');
225    	submenu.addClass('dropdown-menu noclose');
226    }
227
228    //Hover navbar
229	function hoverNavbar() {
230		if ( $(window).width() > 992 && !$('body').hasClass('gg-theme-is-mobile') ) {
231			
232			$('.navbar-default .dropdown, .navbar-default .dropdown-submenu').on('mouseover', function(){
233                $(this).addClass('open');
234
235			}).on('mouseout', function(){
236				$(this).removeClass('open');
237			});
238			
239			$('.dropdown-toggle').on('click', function() {
240				if ($(this).next('.dropdown-menu').is(':visible')) {
241					window.location = $(this).attr('href');
242				}
243			});
244		}
245		else {
246			$('.navbar-default .dropdown').off('mouseover').off('mouseout');
247			
248			$('.dropdown-toggle').parent().append("<span class='mobile-caret'></span>");
249
250			$('.dropdown-toggle').on('click', function(e) {
251				e.preventDefault();
252				e.stopPropagation();
253				window.location = $(this).attr('href');
254			});
255			
256			$('.mobile-caret').on('click', function() {
257				$(this).parent().toggleClass('open');
258			});
259
260		}
261	}
262	//Load, resize, added to cart
263	$(window).bind("load resize added_to_cart",function(e){
264	 	hoverNavbar();
265	});
266
267	/* Slider under header */
268	function gg_slider_position() {
269		var header_nav = $('header nav.navbar');
270		if( $('body').hasClass('gg-slider-is-beneath_header') ) {
271			var headerHeight = header_nav.height();
272			var revSlider = $('header .subheader-slider').first();
273			revSlider.css({
274				'marginTop' : - headerHeight
275			});
276		}
277	}
278
279	//Load, resize, added to cart
280	$(window).bind("load resize",function(e){
281	 	gg_slider_position();
282	});
283    
284
285    //Sticky menu
286    function gg_sticky_menu() {
287		if($('body.gg-has-stiky-menu').length > 0) {
288			var main_menu = $('header.site-header .navbar');
289			var main_menu_height = main_menu.outerHeight();
290
291			if($('body.admin-bar').length > 0) {
292				var admin_bar = 31;
293			} else {
294				var admin_bar = 0;
295			}
296
297
298       		$(window).on('scroll', function () {
299
300       			if ($(this).scrollTop() > main_menu_height) {
301
302       				main_menu.addClass('navbar-fixed-top');
303       				//$('body.gg-has-stiky-menu').css('padding-top', main_menu_height +'px');
304
305       				setTimeout(function() {
306					    $('header.site-header .navbar.navbar-fixed-top').css('top', admin_bar +'px');
307					}, 500);
308
309       			} else {
310
311       				main_menu.removeClass('navbar-fixed-top');
312       				$('body.gg-has-stiky-menu').css('padding-top', '0');
313       				main_menu.css('top', '');
314
315       			}
316
317// Switch off added .gg-shrink
318/*
319       			//Second animation
320       			if ($(this).scrollTop() > main_menu_height + 800) {
321       				main_menu.addClass('gg-shrink');
322       			} else {
323       				main_menu.removeClass('gg-shrink');
324       			}
325*/
326       			
327
328       		});
329		}
330	}
331
332    //Load, resize, added to cart
333	$(window).bind("load resize",function(e){
334	 	gg_sticky_menu();
335	});
336
337        
338	// here for the submit button of the comment reply form
339	$( '#submit, input[type="button"], input[type="reset"], input[type="submit"], a.checkout-button' ).addClass( 'btn btn-primary' );	
340	
341	$( 'table' ).not('.variations, .cart').addClass( 'table');
342
343	$( 'form' ).not('.header-search form, .variations_form').addClass( 'table');
344
345	$('form').attr('role', 'form');
346
347	var inputs = $('input, textarea')
348            .not(':input[type=button], :input[type=submit], :input[type=reset]');
349
350	$(inputs).each(function() {
351	    $(this).addClass('form-control');
352	});
353
354	if($('body.gg-theme-is-mobile').length > 0) {
355		$("a.product-image-overlay").on('click', function(event) {
356		    event.preventDefault();
357		});
358	}
359
360	//Fullscreen search form
361	if($('li.gg-header-search').length > 0) {
362	    $('a[href="#fullscreen-searchform"]').on('click', function(event) {
363	        event.preventDefault();
364	        $('#fullscreen-searchform').addClass('open');
365	        $('#fullscreen-searchform > form > input[type="search"]').focus();
366	    });
367	    
368	    $('#fullscreen-searchform, #fullscreen-searchform button.close').on('click keyup', function(event) {
369	        if (event.target == this || event.target.className == 'close' || event.keyCode == 27) {
370	            $(this).removeClass('open');
371	        }
372	    });
373    }
374
375    //Currency switcher
376	if($('.site-header .gg-currency-switcher').length > 0) {
377	    $('.gg-currency-switcher ul.wcml_currency_switcher').addClass('dropdown-menu noclose');
378    }
379
380    
381
382});
383
384	
385})(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.