PageSourceSearch

https://dystrybucja.pl/wp-content/themes/shapely/js/shapely-scripts.js?ver=20160115

js dystrybucja.pl collected 2026-10-08 06:01:18 UTC 10,316 bytes, 381 lines download raw bytes

1;(function ($) {
2
3	var cl_nav,
4			cl_navOuterHeight;
5
6	jQuery(document).ready(function ($) {
7		//"use strict";
8
9		// Smooth scroll to inner links
10
11		jQuery('.inner-link').each(function () {
12			var href = jQuery(this).attr('href');
13			if ( href.charAt(0) !== "#" ) {
14				jQuery(this).removeClass('inner-link');
15			}
16		});
17
18		jQuery('.inner-link').click(function () {
19			jQuery('html, body').animate({
20				scrollTop: 0
21			}, 1000);
22			return false;
23		});
24
25		// Append .background-image-holder <img>'s as CSS backgrounds
26
27		jQuery('.background-image-holder').each(function () {
28			var imgSrc = jQuery(this).children('img').attr('src');
29			jQuery(this).css('background', 'url("' + imgSrc + '")');
30			jQuery(this).children('img').hide();
31			jQuery(this).css('background-position', 'initial');
32		});
33
34		// Fade in background images
35
36		setTimeout(function () {
37			jQuery('.background-image-holder').each(function () {
38				jQuery(this).addClass('fadeIn');
39			});
40		}, 200);
41
42
43		// Fix nav to top while scrolling
44
45		cl_nav = $('body .nav-container nav:first');
46		cl_navOuterHeight = $('body .nav-container nav:first').outerHeight();
47		var window_w = jQuery(window).width();
48		if ( window_w > 991 ) {
49			window.addEventListener("scroll", updateNav, false);
50			updateNav();
51		}
52
53		$(window).resize(function () {
54			window_w = $(window).width();
55			if ( window_w < 992 ) {
56				cl_nav.removeClass('fixed scrolled outOfSight');
57			} else {
58				window.addEventListener("scroll", updateNav, false);
59				updateNav();
60			}
61		});
62
63		// Menu dropdown positioning
64
65		$('.menu > li > ul').each(function () {
66			var menu = $(this).offset();
67			var farRight = menu.left + $(this).outerWidth(true);
68			if ( farRight > $(window).width() && !$(this).hasClass('mega-menu') ) {
69				$(this).addClass('make-right');
70			} else if ( farRight > $(window).width() && $(this).hasClass('mega-menu') ) {
71				var isOnScreen = $(window).width() - menu.left;
72				var difference = $(this).outerWidth(true) - isOnScreen;
73				$(this).css('margin-left', -(difference));
74			}
75		});
76
77		// Mobile Menu
78
79		$('.mobile-toggle').click(function () {
80			$('.nav-bar').toggleClass('nav-open');
81			$(this).toggleClass('active');
82			$('.search-widget-handle').toggleClass('hidden-xs hidden-sm');
83		});
84
85		$('.menu li').click(function (e) {
86			if ( !e ) e = window.event;
87			e.stopPropagation();
88			if ( $(this).find('ul').length ) {
89				$(this).toggleClass('toggle-sub');
90			} else {
91				$(this).parents('.toggle-sub').removeClass('toggle-sub');
92			}
93		});
94
95		$('.menu li a').click(function () {
96			if ( $(this).hasClass('inner-link') ) {
97				$(this).closest('.nav-bar').removeClass('nav-open');
98			}
99		});
100
101		$('.module.widget-handle').click(function () {
102			$(this).toggleClass('toggle-search');
103		});
104
105		$('.search-widget-handle .search-form input').click(function (e) {
106			if ( !e ) e = window.event;
107			e.stopPropagation();
108		});
109
110		// Image Sliders
111		$('.slider-all-controls').flexslider({
112			start: function (slider) {
113				if ( slider.find('.slides li:first-child').find('.fs-vid-background video').length ) {
114					slider.find('.slides li:first-child').find('.fs-vid-background video').get(0).play();
115				}
116			},
117			after: function (slider) {
118				if ( slider.find('.fs-vid-background video').length ) {
119					if ( slider.find('li:not(.flex-active-slide)').find('.fs-vid-background video').length ) {
120						slider.find('li:not(.flex-active-slide)').find('.fs-vid-background video').get(0).pause();
121					}
122					if ( slider.find('.flex-active-slide').find('.fs-vid-background video').length ) {
123						slider.find('.flex-active-slide').find('.fs-vid-background video').get(0).play();
124					}
125				}
126			}
127		});
128		$('.slider-paging-controls').flexslider({
129			animation   : "slide",
130			directionNav: false
131		});
132		$('.slider-arrow-controls').flexslider({
133			controlNav: false
134		});
135		$('.slider-thumb-controls .slides li').each(function () {
136			var imgSrc = $(this).find('img').attr('src');
137			$(this).attr('data-thumb', imgSrc);
138		});
139		$('.slider-thumb-controls').flexslider({
140			animation   : "slide",
141			controlNav  : "thumbnails",
142			directionNav: true
143		});
144		$('.logo-carousel').flexslider({
145			minItems      : 1,
146			maxItems      : 4,
147			move          : 1,
148			itemWidth     : 200,
149			itemMargin    : 0,
150			animation     : "slide",
151			slideshow     : true,
152			slideshowSpeed: 3000,
153			directionNav  : false,
154			controlNav    : false
155		});
156
157		// Lightbox gallery titles
158		$('.lightbox-grid li a').each(function () {
159			var galleryTitle = $(this).closest('.lightbox-grid').attr('data-gallery-title');
160			$(this).attr('data-lightbox', galleryTitle);
161		});
162
163
164		var videos = $('.video-widget');
165		if ( videos.length ) {
166			$.each(videos, function () {
167				var play = $(this).find('.play-button'),
168						pause = $(this).find('.pause-button'),
169						isYoutube = $(this).hasClass('youtube');
170
171				if ( isYoutube ) {
172					var videoId = $(this).attr('data-video-id'),
173							autoplay = parseInt($(this).attr('data-autoplay')),
174							instance = $(this).YTPlayer({
175								fitToBackground: true,
176								videoId        : videoId,
177								playerVars     : {
178									modestbranding: 0,
179									autoplay      : autoplay,
180									controls      : 0,
181									showinfo      : 0,
182									branding      : 0,
183									rel           : 0,
184									autohide      : 0
185								}
186							}),
187							self = $(this);
188
189
190					$(document).on('YTBGREADY', function () {
191						var iframe = self.find('iframe'),
192								height = iframe.height();
193
194						if ( self.height() == 0 ) {
195							//self.height(height);
196						}
197					});
198
199
200					$(play).on('click', function (e) {
201						e.preventDefault();
202						var parent = $(this).parents('.video-widget'),
203								instance = $(parent).data('ytPlayer').player;
204						instance.playVideo();
205					});
206
207					$(pause).on('click', function (e) {
208						e.preventDefault();
209						var parent = $(this).parents('.video-widget'),
210								instance = $(parent).data('ytPlayer').player;
211						instance.pauseVideo();
212					});
213
214				} else {
215					$(play).on('click', function (e) {
216						e.preventDefault();
217						var parent = $(this).parents('.video-widget'),
218								instance = $(parent).data('vide'),
219								video = instance.getVideoObject();
220
221						video.play();
222					});
223
224					$(pause).on('click', function (e) {
225						e.preventDefault();
226						var parent = $(this).parents('.video-widget'),
227								instance = $(parent).data('vide'),
228								video = instance.getVideoObject();
229
230						video.pause();
231					});
232				}
233			});
234		}
235
236		var recent_entries = $('.widget_recent_entries').find('li');
237		$.each(recent_entries, function () {
238			$(this).find('a').insertAfter($(this).find('.post-date'));
239		});
240
241		$('.comment-form').find('textarea').insertAfter($('.comment-form > #url'));
242
243		if ( typeof $.fn.owlCarousel !== 'undefined' ) {
244
245			$('.owlCarousel').each(function (index) {
246
247				var sliderSelector = '#owlCarousel-' + $(this).data('slider-id'); // this is the slider selector
248				var sliderItems = $(this).data('slider-items');
249				var sliderSpeed = $(this).data('slider-speed');
250				var sliderAutoPlay = $(this).data('slider-auto-play');
251				var sliderSingleItem = $(this).data('slider-single-item');
252
253				//conversion of 1 to true & 0 to false
254
255
256				// auto play
257				sliderAutoPlay = !(sliderAutoPlay == 0 || sliderAutoPlay == 'false');
258				// Custom Navigation events outside of the owlCarousel mark-up
259				$(".shapely-owl-next").on('click', function (event) {
260					event.preventDefault();
261					$(sliderSelector).trigger('next.owl.carousel');
262				});
263				$(".shapely-owl-prev").on('click', function (event) {
264					event.preventDefault();
265					$(sliderSelector).trigger('prev.owl.carousel');
266				});
267
268
269				// instantiate the slider with all the options
270				$(sliderSelector).owlCarousel({
271					items          : sliderItems,
272					loop           : false,
273					margin         : 2,
274					autoplay       : sliderAutoPlay,
275					dots           : false,
276					autoplayTimeout: sliderSpeed * 10,
277					responsive     : {
278						0  : {
279							items: 1
280						},
281						768: {
282							items: sliderItems
283						}
284					}
285				});
286			});
287		} // end
288	});
289
290	jQuery(window).load(function ($) {
291		// "use strict";
292
293		// Resetting testimonial parallax height
294		if ( jQuery('.testimonial-section').length != 0 ) {
295			testimonialHeight();
296			setTimeout(function () {
297				testimonialHeight();
298			}, 3000);
299		}
300
301		// Initialize Masonry
302
303		if ( jQuery('.masonry').length && typeof Masonry != 'undefined' ) {
304			var container = document.querySelector('.masonry');
305			var msnry = new Masonry(container, {
306				itemSelector: '.masonry-item'
307			});
308
309			msnry.on('layoutComplete', function ($) {
310
311				cl_firstSectionHeight = jQuery('.main-container section:nth-of-type(1)').outerHeight(true);
312
313				// Fix floating project filters to bottom of projects container
314
315				if ( jQuery('.filters.floating').length ) {
316					setupFloatingProjectFilters();
317					updateFloatingFilters();
318					window.addEventListener("scroll", updateFloatingFilters, false);
319				}
320
321				jQuery('.masonry').addClass('fadeIn');
322				jQuery('.masonry-loader').addClass('fadeOut');
323				if ( jQuery('.masonryFlyIn').length ) {
324					masonryFlyIn();
325				}
326			});
327
328			msnry.layout();
329		}
330		// Navigation height
331		cl_firstSectionHeight = jQuery('.main-container section:nth-of-type(1)').outerHeight(true);
332
333
334	});
335
336	/* Function To
337	 * keep menu fixed
338	 **/
339	function updateNav() {
340		var scroll = $(window).scrollTop();
341		var window_w = jQuery(window).width();
342
343		if ( window_w < 992 ) {
344			return;
345		}
346
347		if ( scroll > cl_navOuterHeight ) {
348			cl_nav.addClass('outOfSight');
349		}
350
351		if ( $(window).scrollTop() > (cl_navOuterHeight + 65) ) {//if href = #element id
352			cl_nav.addClass('fixed scrolled');
353		}
354
355		if ( $(window).scrollTop() == 0 ) {
356			cl_nav.removeClass('fixed scrolled outOfSight');
357		}
358	}
359
360	function masonryFlyIn() {
361		var $items = jQuery('.masonryFlyIn .masonry-item');
362		var time = 0;
363
364		$items.each(function () {
365			var item = jQuery(this);
366			setTimeout(function () {
367				item.addClass('fadeIn');
368			}, time);
369			time += 170;
370		});
371	}
372})(jQuery);
373
374/*
375 * Resetting testimonial parallax height
376 */
377function testimonialHeight() {
378	jQuery('.testimonial-section .parallax-window').css('height', jQuery('.testimonial-section .parallax-window .container').outerHeight() + 150);
379	jQuery(window).trigger('resize').trigger('scroll');
380}
381

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.