PageSourceSearch

https://www.grepixit.com/assets/js/global.js

js grepixit.com collected 2026-09-24 10:27:33 UTC 18,766 bytes, 482 lines download raw bytes

1/*-------------------------------------------------------------------------------------------------------------------------------*/
2/*This is main JS file that contains custom style rules used in this template*/
3/*-------------------------------------------------------------------------------------------------------------------------------*/
4/* Template Name: omni*/
5/* Version: 1.0 Initial Release*/
6/* Build Date: 25-02-2015*/
7/* Author: Unbranded*/
8/* Website: 
9/* Copyright: (C) 2015 */
10/*-------------------------------------------------------------------------------------------------------------------------------*/
11
12/*--------------------------------------------------------*/
13/* TABLE OF CONTENTS: */
14/*--------------------------------------------------------*/
15/* 01 - VARIABLES */
16/* 02 - page calculations */
17/* 03 - function on document ready */
18/* 04 - function on page load */
19/* 05 - function on page resize */
20/* 06 - function on page scroll */
21/* 07 - swiper sliders */
22/* 08 - buttons, clicks, hovers */
23/*-------------------------------------------------------------------------------------------------------------------------------*/
24
25$(function() {
26
27
28	"use strict";
29
30	/*================*/
31	/* 01 - VARIABLES */
32	/*================*/
33	var swipers = [], winW, winH, _isresponsive, xsPoint = 767, smPoint = 991, mdPoint = 1199, enableScroll = 0;
34	var isSafari = /constructor/i.test(window.HTMLElement);
35	if(isSafari) $('body').addClass('safari');
36
37
38	/*========================*/
39	/* 02 - page calculations */
40	/*========================*/
41	function pageCalculations(){
42		winW = $(window).width();
43		winH = $(window).height();
44		if($('.mob-icon').is(':visible')) _isresponsive = true;
45		else _isresponsive = false;
46        $('.block.type-2 .col-md-6.col-md-push-6').height($('.block.type-2 .col-md-4.col-md-pull-6').height());
47
48        if(winH<700 && $('.bottom-fixed-control-class').length) $('header').removeClass('bottom-fixed-control-class bottom-fixed');
49        $('.teaser-container').css({'height':winH});
50	}
51
52
53	/*=================================*/
54	/* 03 - function on document ready */
55	/*=================================*/
56	pageCalculations();
57
58	//center all images inside containers
59	$('.center-image').each(function(){
60		var bgSrc = $(this).attr('src');
61		$(this).parent().css({'background-image':'url('+bgSrc+')'});
62		$(this).hide();
63	});
64
65
66	/*============================*/
67	/* 04 - function on page load */
68	/*============================*/
69	/* Was $(window).load(...), which jQuery 3 REMOVED - it throws, aborting the
70	   rest of this ready handler, which is where .tabs-switch gets bound. That is
71	   the only reason pages loaded a second copy of jQuery (2.1.3, 82 KB) on top
72	   of the 3.6.0 they already had. $(window).on('load', ...) is identical in
73	   behaviour and works on jQuery 1.7 through 4, so the duplicate can go. */
74	$(window).on('load', function(){
75		//$('body, html').animate({'scrollTop':'0'}, 0);
76		
77		//window.scrollTo(0, 0);
78		$('#loader-wrapper').delay(300).fadeOut(300, function(){enableScroll = 1; scrollCall();});
79		initSwiper();
80		if(window.location.hash) {
81			setTimeout(function(){
82				$('body, html').animate({'scrollTop':$('.scroll-to-block[data-id="'+window.location.hash.substr(1)+'"]').offset().top - (($('.sidebar-menu-added').length)?0:$('header').height()) + 1}, 10);
83
84				//window.scrollTo(0, $('.scroll-to-block').eq(index).offset().top - $('header').height() + 1);
85			}, 100);
86		}else{
87			$('body, html').animate({'scrollTop':0}, 10);
88		}
89		
90		$('body').addClass('loaded');
91	});
92
93
94	/*==============================*/
95	/* 05 - function on page resize */
96	/*==============================*/
97	function resizeCall(){
98		pageCalculations();
99		$('.swiper-container.initialized[data-slides-per-view="responsive"]').each(function(){
100			var thisSwiper = swipers['swiper-'+$(this).attr('id')], $t = $(this), slidesPerViewVar = updateSlidesPerView($t);
101			thisSwiper.params.slidesPerView = slidesPerViewVar;
102			thisSwiper.reInit();
103			var paginationSpan = $t.find('.pagination span');
104			paginationSpan.hide().slice(0,(paginationSpan.length+1-slidesPerViewVar)).show();
105		});
106	}
107	$(window).resize(function(){
108		resizeCall();
109	});
110	window.addEventListener("orientationchange", function() {
111		resizeCall();
112	}, false);
113
114
115	/*==============================*/
116	/* 06 - function on page scroll */
117	/*==============================*/
118	var _buffer = null;
119	$(window).scroll(function(){
120        scrollCall();
121	});
122
123	function scrollCall(){
124		var winScroll = $(window).scrollTop();
125		if(!_isresponsive && !$('header').hasClass('default-act') && !$('.sidebar-menu-added').length) {
126        	if($(window).scrollTop()>=25) $('header').addClass('act');
127			else $('header').removeClass('act');
128		}
129
130		if($('header').hasClass('bottom-fixed-control-class')){
131			if(winScroll>=(winH-75)) $('header').removeClass('bottom-fixed');
132			else $('header').addClass('bottom-fixed');
133		}
134
135 		if($('.scroll-to-block').length && enableScroll){
136 			var headerHeight = ($('.sidebar-menu-added').length)?0:75;
137         	$('.scroll-to-block').each(function( index, element ) {
138				if($(element).offset().top<=(winScroll+headerHeight) && ($(element).offset().top+$(element).height()) > (winScroll+headerHeight) ){
139					$('.scroll-to-link.act').removeClass('act');
140					$('.scroll-to-link[href="#'+$(element).attr('data-id')+'"]').addClass('act');
141					if(window.location.hash!='#'+$(element).attr('data-id')) window.location.hash = '#'+$(element).attr('data-id');
142					return false;
143				}
144			});
145		}
146
147	}
148
149	//scrolling to some block
150	$('.scroll-to-link').on('click', function(){
151		var headerHeight = ($('.sidebar-menu-added').length)?0:75;
152		var index = $(this).attr('href').substr(1);
153		$('body, html').animate({'scrollTop':$('.scroll-to-block[data-id="'+index+'"]').offset().top - headerHeight + 1}, 500);
154		$('header').removeClass('act-mob');
155		$('.mob-icon').removeClass('act');
156		return false;
157	});
158
159
160	/*=====================*/
161	/* 07 - swiper sliders */
162	/*=====================*/
163	function initSwiper(){
164		var initIterator = 0;
165		$('.swiper-container').each(function(){								  
166			var $t = $(this);								  
167
168			var index = 'swiper-unique-id-'+initIterator;
169
170			$t.addClass('swiper-'+index + ' initialized').attr('id', index);
171			$t.find('.pagination').addClass('pagination-'+index);
172
173			var autoPlayVar = parseInt($t.attr('data-autoplay'), 10);
174			var centerVar = parseInt($t.attr('data-center'), 10);
175			var simVar = ($t.closest('.circle-description-slide-box').length || $t.closest('.screens-custom-slider-box').length)?false:true;
176
177			var slidesPerViewVar = $t.attr('data-slides-per-view');
178			if(slidesPerViewVar == 'responsive'){
179				slidesPerViewVar = updateSlidesPerView($t);
180			}
181			else if(slidesPerViewVar != 'auto'){
182				slidesPerViewVar = parseInt(slidesPerViewVar, 10);
183			}
184			var loopVar = parseInt($t.attr('data-loop'), 10);
185			var speedVar = parseInt($t.attr('data-speed'), 10);
186
187
188			swipers['swiper-'+index] = new Swiper('.swiper-'+index,{
189				speed: speedVar,
190				pagination: '.pagination-'+index,
191				loop: loopVar,
192				paginationClickable: true,
193				autoplay: autoPlayVar,
194				slidesPerView: slidesPerViewVar,
195				keyboardControl: true,
196				calculateHeight: true, 
197				simulateTouch: simVar,
198				centeredSlides: centerVar,
199				roundLengths: true,
200				onInit: function(swiper){
201					//if($t.attr('data-slides-per-view')=='responsive') updateSlidesPerView(xsValue, smValue, mdValue, lgValue, swiper);	
202					//if($t.find('.swiper-slide').length>swiper.params.slidesPerView) $t.removeClass('hide-pagination');
203					//else $t.addClass('hide-pagination');
204				},
205				onSlideChangeStart: function(swiper){
206					var activeIndex = (loopVar===true)?swiper.activeIndex:swiper.activeLoopIndex;
207					if($t.closest('.register-login').length){
208                        $('.block.type-5 .img-wrap-move').css({'margin-top':700*swiper.activeLoopIndex*(-1)});
209                        $t.closest('.testimonials-wrapper').find('.testimonials-icons .entry div.active').removeClass('active');
210                        $t.closest('.testimonials-wrapper').find('.testimonials-icons .entry div').eq(activeIndex).addClass('active');
211                    }
212                    if($t.find('.banner-tabs').length){
213                    	$t.find('.banner-tabs .active').removeClass('active');
214                    	$t.find('.banner-tabs .entry').eq(activeIndex).addClass('active');
215                    }
216                    if($t.find('.thumbnails').length){
217                    	$t.find('.thumbnails .active').removeClass('active');
218                    	$t.find('.thumbnails .entry').eq(activeIndex).addClass('active');
219                    }
220				},
221				onSlideClick: function(swiper){
222					//if($t.closest('.circle-slide-box').length) swiper.swipeTo(swiper.clickedSlideIndex);
223					if($t.closest('.screens-custom-slider-box').length){
224						swiper.swipeTo(swiper.clickedSlideIndex);
225					}
226				}
227			});
228			swipers['swiper-'+index].reInit();
229			if($t.attr('data-slides-per-view')=='responsive'){
230				var paginationSpan = $t.find('.pagination span');
231				paginationSpan.hide().slice(0,(paginationSpan.length+1-slidesPerViewVar)).show();
232			}
233			if($t.closest('.screens-custom-slider-box').length) swipers['swiper-'+index].swipeTo(1, 0);
234			//swipers['swiper-'+index].resizeFix();
235			//if($t.find('.default-active').length) swipers['swiper-'+index].swipeTo($t.find('.swiper-slide').index($t.find('.default-active')), 0);
236
237			initIterator++;
238		});
239
240	}
241
242	function updateSlidesPerView(swiperContainer){
243		if(winW>mdPoint) return parseInt(swiperContainer.attr('data-lg-slides'), 10);
244		else if(winW>smPoint) return parseInt(swiperContainer.attr('data-md-slides'), 10);
245		else if(winW>xsPoint) return parseInt(swiperContainer.attr('data-sm-slides'), 10);
246		else return parseInt(swiperContainer.attr('data-xs-slides'), 10);
247	}
248
249	//swiper arrows
250	$('.swiper-arrow.left').on('click', function(){
251		swipers['swiper-'+$(this).parent().attr('id')].swipePrev();
252	});
253
254	$('.swiper-arrow.right').on('click', function(){
255		swipers['swiper-'+$(this).parent().attr('id')].swipeNext();
256	});
257
258	$('.swiper-arrow-gallery.left').on('click', function(){
259		swipers['swiper-'+$(this).closest('.gallery-popup').find('.swiper-container').attr('id')].swipePrev();
260	});
261
262	$('.swiper-arrow-gallery.right').on('click', function(){
263		swipers['swiper-'+$(this).closest('.gallery-popup').find('.swiper-container').attr('id')].swipeNext();
264	});
265
266	//swiper tabs
267	$('.banner-tabs .entry, .thumbnails .entry').on('click', function(){
268		if($(this).hasClass('active')) return false;
269		var activeIndex = $(this).parent().find('.entry').index(this);
270		swipers['swiper-'+$(this).closest('.swiper-container').attr('id')].swipeTo(activeIndex);
271		$(this).parent().find('.active').removeClass('active');
272		$(this).addClass('active');
273	});
274
275    
276	/*==============================*/
277	/* 08 - buttons, clicks, hovers */
278	/*==============================*/
279
280	//menu click in responsive
281    $('.mob-icon').on('click', function(){
282        if($(this).hasClass('act')){
283            $('.mob-icon').removeClass('act');
284            $('header').removeClass('act-mob');
285        }else{
286            $('.mob-icon').addClass('act');
287            $('header').addClass('act-mob');
288        }   
289    });
290    
291    var obj;
292	$('.play, .open-video-popup').on('click', function(){
293        obj = $(this);
294        $('.video-popup').addClass('act-act'); 
295        $('.video-popup').addClass('act'); 
296        setTimeout(function(){
297            $('.video-popup iframe').attr('src',obj.attr('data-src'));
298            setTimeout(function(){
299                $('.video-popup iframe').addClass('act'); 
300                $('.video-popup a').addClass('act');    
301            },350);    
302        },710);
303        return false;
304    });
305    
306    $('.video-popup a').on('click', function(){
307        $('.video-popup iframe').removeClass('act'); 
308        $('.video-popup a').removeClass('act');
309        setTimeout(function(){
310            $('.video-popup iframe').attr('src','');
311            $('.video-popup').removeClass('act'); 
312            setTimeout(function(){
313                $('.video-popup').removeClass('act-act');    
314            },500);
315        },500);
316        return false;
317    });
318
319	//theme config - changing color scheme
320	$('.theme-config .open').on('click', function(){
321		$('.theme-config').toggleClass('active');
322	});
323
324	$('.theme-config .colours-wrapper .entry').on('click', function(){
325		var prevTheme = $('body').attr('data-theme');
326		var newTheme = $(this).attr('data-theme');
327		if($(this).hasClass('active')) return false;
328		$(this).parent().find('.active').removeClass('active');
329		$(this).addClass('active');
330		$('body').attr('data-theme', newTheme);
331		$('img').each(function() {
332			$(this).attr("src", $(this).attr("src").replace(prevTheme+'/', newTheme+'/'));
333		});
334		localStorage.setItem("theme", newTheme);
335	});
336
337	var localStorageThemeVar = localStorage.getItem('theme');
338    if (name !== null && name !== 'null') {
339    	$('.theme-config .colours-wrapper .entry[data-theme="'+localStorageThemeVar+'"]').click();
340    }
341
342	//tabs
343	var tabsFinish = 0;
344	$('.tabs-switch').on('click', function(){
345		if($(this).hasClass('active') || tabsFinish) return false;
346		tabsFinish = 1;
347		$(this).parent().find('.active').removeClass('active');
348		$(this).addClass('active');
349		var tabIndex = $(this).parent().find('.tabs-switch').index(this);
350		var tabsContainer = $(this).closest('.tabs-switch-container');
351		tabsContainer.find('.tabs-entry:visible').fadeOut('fast', function(){
352			tabsContainer.find('.tabs-entry').eq(tabIndex).fadeIn('fast', function(){tabsFinish = 0;});
353		});
354	});
355
356	//accordeon
357	$('.accordeon .entry .title').on('click', function(){
358		$(this).parent().toggleClass('active');
359		$(this).parent().find('.text').slideToggle('fast');
360	});
361
362	$('.categories-wrapper .entry.toggle').on('click', function(){
363		$(this).toggleClass('active');
364		$(this).next('.sub-wrapper').slideToggle('fast');
365	});
366
367	//gallery detail popup
368	$('.sorting-item.open-popup').on('click', function(){
369		$('.gallery-popup').addClass('active');
370		var index = $(this).parent().find('.open-popup').index(this);
371		swipers['swiper-'+$('.gallery-popup').find('.swiper-container').attr('id')].swipeTo(index, 0);
372		$('body, html').toggleClass('overflow-hidden');
373	});
374
375	$('.gallery-popup .close-popup').on('click', function(){
376		$('.gallery-popup').removeClass('active');	
377		$('body, html').toggleClass('overflow-hidden');	
378	});
379
380	//open fullscreen preview popup
381	$('.open-fullscreen').on('click', function(){
382		$('.screen-preview-popup').addClass('active').find('.overflow img').attr('src', $(this).data('fullscreen'));
383		$('body, html').toggleClass('overflow-hidden');
384	});
385
386	$('.screen-preview-popup .close-popup').on('click', function(){
387		$('.screen-preview-popup').removeClass('active');	
388		$('body, html').toggleClass('overflow-hidden');	
389	});
390
391	//checkbox
392	$('.checkbox-entry.checkbox label').on('click', function(){
393		$(this).parent().toggleClass('active');
394		$(this).parent().find('input').click();
395	});
396
397	$('.checkbox-entry.radio label').on('click', function(){
398		$(this).parent().find('input').click();
399		if(!$(this).parent().hasClass('active')){
400			var nameVar = $(this).parent().find('input').attr('name');
401			$('.checkbox-entry.radio input[name="'+nameVar+'"]').parent().removeClass('active');
402			$(this).parent().addClass('active');
403		}
404	});
405
406	//responsive drop-down in gallery
407	$('.responsive-filtration-title').on('click', function(){
408		$(this).closest('.sorting-menu').toggleClass('active');
409	});
410
411	//mousehover on phone-icons block
412	$('.phone-icons-description .entry').on('mouseover', function(){
413		var thisWrapper = $(this).closest('.phone-icons-box'), val = thisWrapper.find('.phone-icons-description .entry').index(this)+1;
414		thisWrapper.find('.phone-icons-image').eq(val).addClass('visible');
415	});
416
417	$('.phone-icons-description .entry').on('mouseleave', function(){
418		$('.phone-icons-image').removeClass('visible');
419	});
420
421
422	/*==========================*/
423	/* 09 - contact form submit */
424	/*==========================*/
425	var formPopupTimeout;
426	$('.contact-form').on("submit", function(){
427		clearTimeout(formPopupTimeout);
428						   
429		$('.error-class').removeClass('error-class');						   
430		var msg = 'The following fields should be filled:',
431			error = 0,
432			pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
433
434
435		if ($.trim($('.contact-form input[name="name"]').val()) === '') {error = 1; $('.contact-form input[name="name"]').addClass('error-class'); msg = msg +  '\n - Name';}
436        if (!pattern.test($.trim($('.contact-form input[name="email"]').val()))) {error = 1; $('.contact-form input[name="email"]').addClass('error-class'); msg = msg +  '\n - Email';}
437		if ($.trim($('.contact-form textarea[name="text"]').val()) === '') {error = 1; $('.contact-form textarea[name="text"]').addClass('error-class'); msg = msg +  '\n - Your Message';}
438
439        if (error){
440			$('.form-popup .text').text(msg);
441			$('.form-popup').fadeIn(300);
442			formPopupTimeout = setTimeout(function(){$('.form-popup').fadeOut(300);}, 3000);
443        }else{
444            var url = 'send_mail.php',
445            	name = $.trim($('.contact-form input[name="name"]').val()),
446            	email = $.trim($('.contact-form input[name="email"]').val()),
447            	subject = $.trim($('.contact-form input[name="subject"]').val()),
448            	department = $.trim($('.contact-form select[name="department"]').val()),
449            	text = $.trim($('.contact-form textarea[name="text"]').val()),
450            	mailto = $.trim($('.contact-form input[name="mailto"]').val());
451
452            $.post(url,{'name':name,'email':email,'subject':subject,'department':department,'text':text,'mailto':mailto},function(data){
453	        	$('.form-popup .text').text('Thank You for contacting us!');
454				$('.form-popup').fadeIn(300);
455				formPopupTimeout = setTimeout(function(){$('.form-popup').fadeOut(300);}, 3000);
456
457	        	$('.contact-form').append('<input type="reset" class="reset-button"/>');
458	        	$('.reset-button').click().remove();
459			});
460        }
461	  	return false;
462	});
463
464	$(document).on('focus', '.error-class', function(){
465		$(this).removeClass('error-class');
466	});
467
468	$('.form-popup-close-layer').on('click', function(){
469		clearTimeout(formPopupTimeout);
470		$('.form-popup').fadeOut(300);
471	});
472
473	$('.mouse-icon').on('click', function(){
474		$('body, html').animate({'scroll-top':winH});
475	});
476
477	$('.back-to-top').on('click', function(){
478		$('body, html').animate({'scroll-top':0});
479	});
480
481});
482

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.