PageSourceSearch

https://periphery.net/js/main.js

js periphery.net collected 2026-10-02 11:08:56 UTC 11,057 bytes, 426 lines download raw bytes

1/* ===================================================================
2 * Infinity - Main JS
3 *
4 * ------------------------------------------------------------------- */ 
5
6(function($) {
7
8	"use strict";
9
10	var cfg = {		
11		defAnimation   : "fadeInUp",    // default css animation		
12		scrollDuration : 800,           // smoothscroll duration
13		mailChimpURL   : 'http://facebook.us8.list-manage.com/subscribe/post?u=cdb7b577e41181934ed6a6a44&id=e65110b38d'
14	},	
15
16	$WIN = $(window);
17	
18
19   // Add the User Agent to the <html>
20   // will be used for IE10 detection (Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0))
21	var doc = document.documentElement;
22	doc.setAttribute('data-useragent', navigator.userAgent);
23
24	
25	/* Preloader 
26	 * -------------------------------------------------- */
27	var ssPreloader = function() {
28
29		$WIN.on('load', function() {	
30
31			// force page scroll position to top at page refresh
32			$('html, body').animate({ scrollTop: 0 }, 'normal');
33
34	      // will first fade out the loading animation 
35	    	$("#loader").fadeOut("slow", function(){
36
37	        // will fade out the whole DIV that covers the website.
38	        $("#preloader").delay(300).fadeOut("slow");
39
40	      }); 
41	  	});
42	}; 
43
44
45	/* FitVids
46	------------------------------------------------------ */ 
47	var ssFitVids = function() {
48		$(".fluid-video-wrapper").fitVids();
49	}; 
50
51
52	/*	Masonry
53	------------------------------------------------------ */
54	var ssMasonryFolio = function() {
55
56		var containerBricks = $('.bricks-wrapper');
57
58		containerBricks.imagesLoaded( function() {
59			containerBricks.masonry( {	
60			  	itemSelector: '.brick',
61			  	resize: true
62			});
63		});
64	};
65
66
67	/*	Light Gallery
68	------------------------------------------------------- */
69	var ssLightGallery = function() {
70
71		$('#folio-wrap').lightGallery({  
72			showThumbByDefault: false,
73			hash: false,
74			selector: ".item-wrap"		
75		});
76	};
77
78
79	/* Flexslider
80  	* ------------------------------------------------------ */
81  	var ssFlexSlider = function() {
82
83  		$WIN.on('load', function() {
84
85		   $('#testimonial-slider').flexslider({
86		   	namespace: "flex-",
87		      controlsContainer: "",
88		      animation: 'slide',
89		      controlNav: true,
90		      directionNav: false,
91		      smoothHeight: true,
92		      slideshowSpeed: 7000,
93		      animationSpeed: 600,
94		      randomize: false,
95		      touch: true,
96		   });
97
98	   });
99
100  	};
101
102
103  	/* Carousel
104	* ------------------------------------------------------ */
105	var ssOwlCarousel = function() {
106
107		$(".owl-carousel").owlCarousel({		
108	      nav: false,
109			loop: true,
110	    	margin: 50,
111	    	responsiveClass:true,
112	    	responsive: {
113	         0:{
114	            items:2,
115	            margin: 20
116	         },
117	         400:{
118	            items:3,
119	            margin: 30
120	         },
121	         600:{
122	            items:4,
123	            margin: 40
124	         },
125	         1000:{
126	            items:6            
127	         }
128	    	}
129		});
130
131	};
132  	
133
134
135  	/* Menu on Scrolldown
136	 * ------------------------------------------------------ */
137	var ssMenuOnScrolldown = function() {
138
139		var menuTrigger = $('#header-menu-trigger');
140
141		$WIN.on('scroll', function() {
142
143			if ($WIN.scrollTop() > 150) {				
144				menuTrigger.addClass('opaque');
145			}
146			else {				
147				menuTrigger.removeClass('opaque');
148			}
149
150		}); 
151	};
152
153	
154  	/* OffCanvas Menu
155	 * ------------------------------------------------------ */
156   var ssOffCanvas = function() {
157
158	       var menuTrigger = $('#header-menu-trigger'),
159	       nav             = $('#menu-nav-wrap'),
160	       closeButton     = nav.find('.close-button'),
161	       siteBody        = $('body'),
162	       mainContents    = $('section, footer');
163
164		// open-close menu by clicking on the menu icon
165		menuTrigger.on('click', function(e){
166			e.preventDefault();
167			menuTrigger.toggleClass('is-clicked');
168			siteBody.toggleClass('menu-is-open');
169		});
170
171		// close menu by clicking the close button
172		closeButton.on('click', function(e){
173			e.preventDefault();
174			menuTrigger.trigger('click');	
175		});
176
177		// close menu clicking outside the menu itself
178		siteBody.on('click', function(e){		
179			if( !$(e.target).is('#menu-nav-wrap, #header-menu-trigger, #header-menu-trigger span') ) {
180				menuTrigger.removeClass('is-clicked');
181				siteBody.removeClass('menu-is-open');
182			}
183		});
184
185   };
186
187
188  /* Smooth Scrolling
189	* ------------------------------------------------------ */
190	var ssSmoothScroll = function() {
191
192		$('.smoothscroll').on('click', function (e) {
193			var target = this.hash,
194			$target    = $(target);
195	 	
196		 	e.preventDefault();
197		 	e.stopPropagation();	   	
198
199	    	$('html, body').stop().animate({
200	       	'scrollTop': $target.offset().top
201	      }, cfg.scrollDuration, 'swing').promise().done(function () {
202
203	      	// check if menu is open
204	      	if ($('body').hasClass('menu-is-open')) {
205					$('#header-menu-trigger').trigger('click');
206				}
207
208	      	window.location.hash = target;
209	      });
210	  	});
211
212	};
213
214
215  /* Placeholder Plugin Settings
216	* ------------------------------------------------------ */
217	var ssPlaceholder = function() {
218		$('input, textarea, select').placeholder();  
219	};
220
221
222  	/* Alert Boxes
223  	------------------------------------------------------- */
224  	var ssAlertBoxes = function() {
225
226  		$('.alert-box').on('click', '.close', function() {
227		  $(this).parent().fadeOut(500);
228		}); 
229
230  	};	  	
231	
232
233  /* Animations
234	* ------------------------------------------------------- */
235	var ssAnimations = function() {
236
237		if (!$("html").hasClass('no-cssanimations')) {
238			$('.animate-this').waypoint({
239				handler: function(direction) {
240
241					var defAnimationEfx = cfg.defAnimation;
242
243					if ( direction === 'down' && !$(this.element).hasClass('animated')) {
244						$(this.element).addClass('item-animate');
245
246						setTimeout(function() {
247							$('body .animate-this.item-animate').each(function(ctr) {
248								var el       = $(this),
249								animationEfx = el.data('animate') || null;	
250
251	                  	if (!animationEfx) {
252			                 	animationEfx = defAnimationEfx;	                 	
253			               }
254
255			              	setTimeout( function () {
256									el.addClass(animationEfx + ' animated');
257									el.removeClass('item-animate');
258								}, ctr * 30);
259
260							});								
261						}, 100);
262					}
263
264					// trigger once only
265	       		this.destroy(); 
266				}, 
267				offset: '95%'
268			}); 
269		}
270
271	};
272	
273
274  /* Intro Animation
275	* ------------------------------------------------------- */
276	var ssIntroAnimation = function() {
277
278		$WIN.on('load', function() {
279		
280	     	if (!$("html").hasClass('no-cssanimations')) {
281	     		setTimeout(function(){
282	    			$('.animate-intro').each(function(ctr) {
283						var el = $(this),
284	                   animationEfx = el.data('animate') || null;		                                      
285
286	               if (!animationEfx) {
287	                 	animationEfx = cfg.defAnimation;	                 	
288	               }
289
290	              	setTimeout( function () {
291							el.addClass(animationEfx + ' animated');
292						}, ctr * 300);
293					});						
294				}, 100);
295	     	} 
296		}); 
297
298	};
299
300
301  /* Contact Form
302   * ------------------------------------------------------ */
303   var ssContactForm = function() {   	
304
305   	/* local validation */   	
306		$('#contactForm').validate({
307
308			/* submit via ajax */
309			submitHandler: function(form) {				
310				var sLoader = $('#submit-loader');			
311
312				$.ajax({   	
313			      type: "POST",
314			      url: "inc/sendEmail.php",
315			      data: $(form).serialize(),
316
317			      beforeSend: function() { 
318			      	sLoader.fadeIn(); 
319			      },
320			      success: function(msg) {
321		            // Message was sent
322		            if (msg == 'OK') {
323		            	sLoader.fadeOut(); 
324		               $('#message-warning').hide();
325		               $('#contactForm').fadeOut();
326		               $('#message-success').fadeIn();   
327		            }
328		            // There was an error
329		            else {
330		            	sLoader.fadeOut(); 
331		               $('#message-warning').html(msg);
332			            $('#message-warning').fadeIn();
333		            }
334			      },
335			      error: function() {
336			      	sLoader.fadeOut(); 
337			      	$('#message-warning').html("Something went wrong. Please try again.");
338			         $('#message-warning').fadeIn();
339			      }
340		      });    		
341	  		}
342
343		});
344   };	
345
346
347  /* AjaxChimp
348	* ------------------------------------------------------ */
349	var ssAjaxChimp = function() {
350
351		$('#mc-form').ajaxChimp({
352			language: 'es',
353		   url: cfg.mailChimpURL
354		});
355
356		// Mailchimp translation
357		//
358		//  Defaults:
359		//	 'submit': 'Submitting...',
360		//  0: 'We have sent you a confirmation email',
361		//  1: 'Please enter a value',
362		//  2: 'An email address must contain a single @',
363		//  3: 'The domain portion of the email address is invalid (the portion after the @: )',
364		//  4: 'The username portion of the email address is invalid (the portion before the @: )',
365		//  5: 'This email address looks fake or invalid. Please enter a real email address'
366
367		$.ajaxChimp.translations.es = {
368		  'submit': 'Submitting...',
369		  0: '<i class="fa fa-check"></i> We have sent you a confirmation email',
370		  1: '<i class="fa fa-warning"></i> You must enter a valid e-mail address.',
371		  2: '<i class="fa fa-warning"></i> E-mail address is not valid.',
372		  3: '<i class="fa fa-warning"></i> E-mail address is not valid.',
373		  4: '<i class="fa fa-warning"></i> E-mail address is not valid.',
374		  5: '<i class="fa fa-warning"></i> E-mail address is not valid.'
375		} 
376
377	};
378
379 
380  /* Back to Top
381	* ------------------------------------------------------ */
382	var ssBackToTop = function() {
383
384		var pxShow  = 500,         // height on which the button will show
385		fadeInTime  = 400,         // how slow/fast you want the button to show
386		fadeOutTime = 400,         // how slow/fast you want the button to hide
387		scrollSpeed = 300,         // how slow/fast you want the button to scroll to top. can be a value, 'slow', 'normal' or 'fast'
388		goTopButton = $("#go-top")
389
390		// Show or hide the sticky footer button
391		$(window).on('scroll', function() {
392			if ($(window).scrollTop() >= pxShow) {
393				goTopButton.fadeIn(fadeInTime);
394			} else {
395				goTopButton.fadeOut(fadeOutTime);
396			}
397		});
398	};	
399
400
401  
402  /* Initialize
403	* ------------------------------------------------------ */
404	(function ssInit() {
405
406		ssPreloader();
407		ssFitVids();
408		ssMasonryFolio();
409		ssLightGallery();
410		ssFlexSlider();
411		ssOwlCarousel();
412		ssMenuOnScrolldown();
413		ssOffCanvas();
414		ssSmoothScroll();
415		ssPlaceholder();
416		ssAlertBoxes();
417		ssAnimations();
418		ssIntroAnimation();		
419		ssContactForm();
420		ssAjaxChimp();
421		ssBackToTop();
422
423	})();
424 
425
426})(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.