PageSourceSearch

http://genealogiemedicale.com/wp-content/themes/esotera/resources/js/frontend.js?ver=1.3.0

js genealogiemedicale.com collected 2026-10-02 00:31:07 UTC 29,827 bytes, 900 lines download raw bytes

1/*
2 * Frontend JS
3 *
4 * @package Esotera
5 */
6
7jQuery( document ).ready( function() {
8	cryoutLpBoxesRatios();
9	cryoutMobileMenuInit();
10	cryoutFixedMobileMenu();
11	cryoutInitNav( '#mobile-menu' );
12	cryoutMenuAnimate();
13	cryoutBackToTop();
14	cryoutSearchFormAnimation();
15	cryoutSocialTitles();
16	cryoutBodyClasses();
17	cryoutTabsWidget();
18	cryoutPortfolioFilter();
19	cryoutHeaderParallax();
20	cryoutBurgerMenu();
21	cryoutRemoveFocus();
22	cryoutSliderTitleBreakUp();
23	cryoutAnimateLazyImages();
24
25	if ( typeof cryout_theme_settings !== 'undefined' ) {
26
27		if ( ( ( cryout_theme_settings.fitvids == 2 ) && ( cryout_theme_settings.is_mobile == 1 ) ) ||
28			( cryout_theme_settings.fitvids == 1 )
29		) {
30			jQuery( '.entry-content' ).fitVids();
31		}
32
33		if ( cryout_theme_settings.autoscroll == 1 ) {
34			cryoutAutoScroll();
35		}
36
37		/* Animate articles */
38		if ( cryout_theme_settings.articleanimation ) {
39			animateScroll( '#content-masonry > article', 'animated-onscroll' );
40
41			/* Animate landing page elements */
42			animateScroll( '.lp-block, .lp-box, .lp-text, .lp-port, .lp-tt, ' +
43				'.lp-section-title, .lp-section-desc', 'animated-onscroll-lp' );
44		}
45	} /* typeof cryout_theme_settings check */
46
47	jQuery( window ).on( 'scroll', function() {
48
49		if ( jQuery( this ).scrollTop() > 30 ) {
50			jQuery( '#nav-fixed' ).addClass( 'nav-fixed-show' );
51		} else {
52			jQuery( '#nav-fixed' ).removeClass( 'nav-fixed-show' );
53		}
54
55		if ( jQuery( this ).scrollTop() > 100 &&
56			( ! jQuery( '.site-header-top' ).hasClass( 'is-active' ) )
57		) {
58			jQuery( '.esotera-fixed-menu .site-header-bottom' ).addClass( 'header-fixed' );
59		} else {
60			jQuery( '.esotera-fixed-menu .site-header-bottom' ).removeClass( 'header-fixed' );
61		}
62
63	} );
64} ); /* document.ready */
65
66
67jQuery( window ).on( 'load', function() {
68	cryoutPreloader();
69	jQuery( window ).trigger( 'scroll' );
70	cryoutMasonry();
71	cryoutPortfolioMasonry();
72} ); /* window.load */
73
74
75/*
76 * Functions
77**/
78
79/* Animate images with the [loading="lazy"] attribute */
80function cryoutAnimateLazyImages() {
81	jQuery( 'body:not(.esotera-lazy-noanimation) #content img[loading="lazy"]' ).on( 'load', function() {
82		jQuery( this ).addClass( 'animate-lazy' );
83	}).each( function() {
84		if ( this.complete ) {
85			jQuery( this ).trigger( 'load' );
86		}
87	} );
88} /* cryoutAnimateLazyImages() */
89
90/* Site preloader */
91function cryoutPreloader() {
92	if ( ! jQuery( '.cryout-preloader' ).length ) return;
93
94	/* Remove preloader backup animation */
95	if ( jQuery( '.cryout-preloader' ).length ) jQuery( '.cryout-preloader' ).css( 'animation', 'none' );
96
97	jQuery( '.cryout-preloader' ).fadeOut( 700, function() {
98		jQuery( this ).remove();
99	} );
100} /* cryoutPreloader() */
101
102/* Burger menu */
103function cryoutBurgerMenu() {
104	if ( ! jQuery( '.hamburger' ).length ) return;
105
106	/* First and last elements in the menu */
107	var firstTab = jQuery( '[id^=top-section] a' ).first(),
108		lastTab  = jQuery( '.top-section-close' ),
109		$activeElements = jQuery( '.hamburger, #site-wrapper, .site-header-bottom-fixed, #mobile-menu' ),
110		/* Check to see if header menu was fixed so we know to put it back later */
111		fixedHeader = false;
112
113	jQuery( '.hamburger' ).on( 'click', function( e ) {
114		$activeElements.toggleClass( 'is-active' );
115		jQuery( '.site-header-top' ).prepareTransition().toggleClass( 'is-active' );
116		e.stopPropagation();
117		firstTab.trigger( 'focus' );
118	} );
119
120	jQuery( '.top-section-close' ).on( 'click', function( e ) {
121		$activeElements.toggleClass( 'is-active' );
122		jQuery( '.site-header-top' ).prepareTransition().toggleClass( 'is-active' );
123		e.stopPropagation();
124		jQuery( '.hamburger' ).trigger( 'focus' );
125	} );
126
127	/* Redirect last tab to first input */
128	lastTab.on( 'keydown', function ( e ) {
129		if ( ( e.which === 9 && ( ! e.shiftKey ) ) ) {
130			e.preventDefault();
131			firstTab.trigger( 'focus' );
132		}
133	} );
134
135	/* Redirect first shift+tab to last input*/
136	firstTab.on( 'keydown', function ( e ) {
137		if ( ( e.which === 9 && e.shiftKey ) ) {
138			e.preventDefault();
139			lastTab.trigger( 'focus' );
140		}
141	} );
142
143	jQuery( document ).on( 'click', function( e ) {
144		if ( ! jQuery( '.site-header-top' ).is( e.target ) && jQuery( '.site-header-top' ).has( e.target ).length === 0 && jQuery( '#site-wrapper' ).hasClass( 'is-active' ) ) {
145			$activeElements.removeClass( 'is-active' );
146			jQuery( '.site-header-top' ).prepareTransition().removeClass( 'is-active' );
147			if ( true === fixedHeader ) {
148				jQuery( '.site-header-bottom' ).addClass( 'header-fixed' );
149				fixedHeader = false;
150			}
151		}
152	} );
153
154} /* cryoutBurgerMenu() */
155
156/* Force LP boxes images ratios */
157function cryoutLpBoxesRatios() {
158	for ( var index = 1; index <= cryout_theme_settings.lpboxratios.length; ++index ) {
159		jQuery( '.lp-boxes-' + index + ' .lp-box-image, .lp-boxes-static:not(.lp-boxes-static2).lp-boxes-' + index + ' .lp-box-content' ).keepRatio( cryout_theme_settings.lpboxratios[index-1] );
160	}
161} /* cryoutLpBoxesRatios() */
162
163/* Menu animation */
164function cryoutMenuAnimate() {
165	jQuery( '#access > .menu ul li > a:not(:only-child)' ).attr( 'aria-haspopup', 'true' );/* IE10 mobile Fix */
166
167	jQuery( '#access li' ).on( 'mouseenter', function() {
168		jQuery( this ).addClass( 'menu-hover' );
169	} ).on( 'mouseleave', function() {
170		jQuery( this ).removeClass( 'menu-hover' );
171	} );
172
173	jQuery( '#access ul' ).find( 'a' ).on( 'focus', function() {
174		jQuery( this ).parents( '.menu-item, .page_item' ).addClass( 'menu-hover' );
175	} );
176
177	jQuery( '#access ul' ).find( 'a' ).on( 'blur', function() {
178		jQuery( this ).parents( '.menu-item, .page_item' ).removeClass( 'menu-hover' );
179	} );
180} /* cryoutMenuAnimate() */
181
182/* Static Slider Title Letter break */
183function cryoutSliderTitleBreakUp() {
184
185	/* If not landing page or static slider not active - exit */
186	if ( ( ! jQuery( 'body' ).hasClass( 'esotera-landing-page' ) ) ||
187		( ! jQuery( '.lp-staticslider.animated-title' ).length ) ) return;
188
189	/* And for improved performance, if static slider not in view - no animation */
190	jQuery( window ).on( 'scroll', function() {
191		var el = jQuery( '.lp-staticslider.animated-title .staticslider-caption' );
192		if ( ! isInViewport( el ) ) {
193			el.hide();
194		} else {
195			el.show();
196		}
197	} );
198
199	var $location = jQuery( '.staticslider-caption-title > span' ),
200	oldStr = $location.html(), /* new string for processing, complete with HTML tags */
201	clearStr = $location.text().split( ' ' ).join(''), /* text only string for keys */
202	newStr = '<em class="caption-title-word">',
203	delay = 0.2,
204	nrOfAnimatedLetters = ( Math.floor( clearStr.length / 8 ) > 2) ?
205		Math.floor( clearStr.length / 8) :
206		2,
207	interval = 3000 + nrOfAnimatedLetters * 200,
208	animatedLetters = []; /* array for the random letters that are going to be animated */
209
210	for ( var i = 0; i < oldStr.length; i++ ) {
211
212		/* If tag starts skip everything until tag ends */
213		if ( oldStr[i] == '<') {
214			var substring = oldStr.substring( i );
215			substring = substring.match( /(.*?)(<([^>]+)>)/ig );
216			substring = substring[0];
217			newStr += substring;
218			i+= substring.length - 1;
219
220		/* If entity starts skip everything until entity ends */
221		} else if ( oldStr[i] == '&' ) {
222			var substring = oldStr.substring( i );
223			substring = substring.match( /(.*?);/ig );
224			substring = substring[0];
225			newStr += '<span><span class="cry-single">' + substring +
226				'</span><span class="cry-double">' +  substring + '</span></span>';
227			i+= substring.length - 1;
228
229		/* Any plain old single character */
230		} else if ( oldStr[i] != ' ' ) {
231			newStr += '<span><span class="cry-single">' + oldStr[i] +
232				'</span><span class="cry-double">' +  oldStr[i] + '</span></span>';
233
234		/* Spaces must be inside words for proper flow on new lines */
235		} else {
236			newStr += '<span>&nbsp;</span></em><em class="caption-title-word">';
237		}
238	}
239	newStr += '</em>';
240
241	/* Out with the old, in with the new... string */
242	$location.html( newStr );
243
244	function titleAnimation() {
245		jQuery( '.staticslider-caption-title > span .cry-single, .staticslider-caption-title > span .cry-double' )
246			.removeClass( 'animated-letter' )
247			.css( 'animation-delay', '0' );
248		for ( var i = 0; i < nrOfAnimatedLetters; i++ ) {
249
250			/* Get a random key from the new array of letters*/
251			animatedLetters[i] = Math.floor( Math.random() * clearStr.length );
252			jQuery( '.staticslider-caption-title > span .cry-single' )
253				.eq( animatedLetters[i] )
254				.addClass( 'animated-letter' )
255				.css( 'animation-delay', i * delay + 's' );
256			jQuery( '.staticslider-caption-title > span .cry-double' )
257				.eq( animatedLetters[i] )
258				.addClass( 'animated-letter' )
259				.css( 'animation-delay', i * delay + 's' );
260		}
261	}
262
263	setTimeout( titleAnimation, 1000 ); /* run once after one second */
264	window.setInterval( titleAnimation, interval); /* run forever with set interval */
265
266} /* cryoutSliderTitleBreakUp() */
267
268/* Back to top button animation */
269function cryoutBackToTop() {
270	jQuery( window ).on( 'scroll', function() {
271		if ( jQuery( this ).scrollTop() > 500 ) {
272			jQuery( '#toTop' ).addClass( 'toTop-show' );
273		} else {
274			jQuery( '#toTop' ).removeClass( 'toTop-show' );
275		}
276	} );
277
278	jQuery( '#toTop' ).on( 'click', function( event ) {
279		event.preventDefault();
280		jQuery( 'html, body' ).animate( { scrollTop: 0 }, 500 );
281		return false;
282	} );
283
284} /* cryoutBackToTop() */
285
286/* Search form animation */
287function cryoutSearchFormAnimation() {
288	var searchIcon = jQuery( '#access .menu-search-animated > button' ),
289		searchForm = jQuery( '.menu-search-animated .searchform, .menu-main-search .icon-cancel' ),
290		searchInput = jQuery( '#access .menu-search-animated .s' );
291
292	searchIcon.on( 'click', function( event ) { /* never on focus! */
293		event.preventDefault();
294		searchForm.fadeIn( 200, function() {
295			searchInput.trigger( 'focus' );
296			searchInput.css( 'outline', 'none' );
297		} );
298		searchInput.addClass( 'is-active' );
299		event.stopPropagation();
300	} );
301
302	searchForm.on( 'click', function( event ) {
303		event.stopPropagation();
304	} );
305
306	searchInput.on( 'blur', function() {
307		searchInput.removeClass( 'is-active' );
308		searchForm.fadeOut( 200 );
309	} );
310} /* cryoutSearchFormAnimation() */
311
312/* Mobile Menu */
313function cryoutMobileMenuInit() {
314
315	/* First and last elements in the menu */
316	var firstTab = jQuery( 'nav#mobile-menu #mobile-nav > li:first-child a' ),
317		lastTab  = jQuery( '#nav-cancel' );
318
319	jQuery( '#nav-toggle' ).on( 'click', function( e ) {
320		e.preventDefault();
321		e.stopPropagation();
322		jQuery( '#site-wrapper' ).addClass( 'is-active' );
323		jQuery( '#mobile-menu' ).show( 0 ).addClass( 'mobile-show' );
324		jQuery( 'body' ).addClass( 'noscroll' );
325		firstTab.trigger( 'focus' );
326	} );
327
328	jQuery( '#nav-cancel' ).on( 'click', function( e ) {
329		e.preventDefault();
330		e.stopPropagation();
331		jQuery( '#mobile-menu' ).removeClass( 'mobile-show' ).hide( 500 );
332		jQuery( '#site-wrapper' ).removeClass( 'is-active' );
333		jQuery( 'body' ).removeClass( 'noscroll' );
334		jQuery( '#nav-toggle' ).trigger( 'focus' );
335	} );
336
337	/* Redirect last tab to first input */
338	lastTab.on( 'keydown', function ( e ) {
339		if ( jQuery( 'body' ).hasClass( 'noscroll' ) )
340		if ( ( e.which === 9 && ( ! e.shiftKey ) ) ) {
341			e.preventDefault();
342			firstTab.trigger( 'focus' );
343		}
344	} );
345
346	/* Redirect first shift+tab to last input*/
347	firstTab.on( 'keydown', function ( e ) {
348		if ( jQuery( 'body' ).hasClass( 'noscroll' ) )
349		if ( ( e.which === 9 && e.shiftKey ) ) {
350			e.preventDefault();
351			lastTab.trigger( 'focus' );
352		}
353	} );
354
355	/* Allow escape key to close menu */
356	jQuery( 'nav#mobile-menu' ).on( 'keyup', function( e ){
357		if ( jQuery( 'body' ).hasClass( 'noscroll' ) )
358		if ( e.keyCode === 27 ) {
359			jQuery( 'body' ).removeClass( 'noscroll' );
360			lastTab.trigger( 'focus' );
361		}
362	} );
363
364	/* Remove animated class from mobile menu */
365	jQuery( '#mobile-menu .menu-main-search' ).removeClass( 'menu-search-animated' );
366
367	jQuery( '#mobile-menu > div' ).append( jQuery( '#branding' ).clone() );
368	jQuery( '#mobile-menu #branding' ).attr( 'id', 'bmobile');
369
370} /* cryoutMobileMenuInit() */
371
372/* Add fixed mobile menu functionality */
373function cryoutFixedMobileMenu() {
374
375	/* Only run if fixed menu is enabled */
376	if ( cryout_theme_settings.menustyle != 1 ) return;
377
378	var c, currentScrollTop = 0, currentScrollBottom,
379	navbar = jQuery( '.site-header-bottom' ),
380	body = jQuery( 'body' );
381
382	jQuery( window ).on( 'scroll', function () {
383		var a = jQuery( window ).scrollTop();
384		var b = jQuery( document ).height();
385		var viewport = jQuery( window ).height();
386		var navbarHeight = navbar.height();
387
388		currentScrollTop = a;
389		currentScrollBottom = b;
390
391		if ( c < currentScrollTop && a > navbarHeight + navbarHeight ) {
392			/* Scrolling down */
393			body.removeClass( 'mobile-fixed' );
394		} else if ( ( currentScrollTop > viewport ) &&
395			( currentScrollTop < currentScrollBottom - viewport * 2 ) &&
396			( c > currentScrollTop ) && ( ! ( a <= navbarHeight ) )
397		) {
398
399			/* Scrolling up */
400			body.addClass( 'mobile-fixed' );
401		}
402
403		c = currentScrollTop;
404
405		/* Always clear fixed class when returning to the top */
406		if ( currentScrollTop <= navbarHeight ) {
407			body.removeClass( 'mobile-fixed' );
408		}
409	} );
410} /* cryoutFixedMobileMenu() */
411
412/* Add submenus toggles to the primary navigation */
413function cryoutInitNav( selector ) {
414	var container = jQuery( selector );
415
416	/* Add dropdown toggle that display child menu items. */
417	container.find( '.menu-item-has-children > a' )
418		.after( '<button class="dropdown-toggle" aria-expanded="false"></button>' );
419	container.find( '.page_item_has_children > a' )
420		.after( '<button class="dropdown-toggle" aria-expanded="false"></button>' );
421
422	/* Toggle buttons and submenu items with active children menu items. */
423	container.find( '.current-menu-ancestor > button, .current-page-ancestor > button' )
424		.addClass( 'toggle-on' );
425	container.find( '.current-menu-ancestor > .sub-menu, .current-page-ancestor > .sub-menu,' +
426		' .current-menu-ancestor .children, .current-page-ancestor .children' )
427		.show( 0 ).addClass( 'toggled-on' );
428
429	container.find( '.dropdown-toggle' ).on( 'click', function( e ) {
430		var _this = jQuery( this );
431		e.preventDefault();
432		_this.toggleClass( 'toggle-on' );
433		if ( _this.hasClass( 'toggle-on') ) {
434			_this.next( '.children, .sub-menu' ).show( 0 ).addClass( 'toggled-on' );
435			_this.prev( 'a' ).addClass( 'toggled-on' );
436		}
437		else {
438			_this.next( '.children, .sub-menu' ).removeClass( 'toggled-on' );
439			_this.next( '.children, .sub-menu' ).find( '.children, .sub-menu' ).removeClass( 'toggled-on' );
440			_this.next( '.children, .sub-menu' ).find( 'a' ).removeClass( 'toggled-on' );
441			_this.next( '.children, .sub-menu' ).find( '.dropdown-toggle' ).removeClass( 'toggled-on' );
442			_this.prev( 'a' ).removeClass( 'toggled-on' );
443
444			setTimeout( function() {
445				_this.next( '.children, .sub-menu' ).hide( 0 );
446				_this.next( '.children, .sub-menu' ).find( '.children, .sub-menu' ).hide( 0 );
447			}, 600 );
448		}
449
450		/* _this.parent().find( 'a' ).toggleClass( 'toggled-on' ); */
451		_this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
452	} );
453
454	/* Close mobile menu on click/tap */
455	jQuery( 'body' ).on( 'click', '#mobile-nav a', function() {
456		jQuery( '#nav-cancel i' ).trigger( 'click' );
457	} );
458
459} /* cryoutInitNav() */
460
461/* LP Boxes Keep aspect ratio*/
462jQuery.fn.keepRatio = function( ratio ) {
463
464	var $this = jQuery( this );
465	var nh = $this.width() / ratio;
466	$this.css( 'height', nh + 'px' );
467
468	jQuery( window ).on( 'resize', function() {
469		var nh = $this.width() / ratio;
470		$this.css( 'height', nh + 'px' );
471	} );
472
473}; /* keepRatio() */
474
475/* LP Box Mouse direction overlay animation */
476jQuery.fn.mousedir = function( el ) {
477	if ( ! jQuery( 'body' ).hasClass( 'esotera-landing-page' ) ) return;
478
479	var $this = jQuery( this ),
480		$el = jQuery( el ),
481		last_position = {},
482		$output = 'direction-down';
483
484	jQuery( document ).on( 'mousemove', function ( event ) {
485		if ( typeof( last_position.x ) !== 'undefined' ) {
486			var deltaX = last_position.x - event.offsetX,
487			deltaY = last_position.y - event.offsetY;
488			if ( ( Math.abs( deltaX ) > Math.abs( deltaY ) ) && ( deltaX > 0 ) ) {
489				$output = 'direction-left';
490			} else if ( ( Math.abs( deltaX ) > Math.abs( deltaY ) ) && ( deltaX < 0 ) ) {
491				$output = 'direction-right';
492			} else if ( ( Math.abs( deltaY ) > Math.abs( deltaX ) ) && ( deltaY > 0 ) ) {
493				$output = 'direction-up';
494			} else if ( ( Math.abs( deltaY ) > Math.abs( deltaX ) ) && ( deltaY < 0 ) ) {
495				$output = 'direction-down';
496			} else {
497				$output = 'direction-down';
498			}
499		}
500		last_position = {
501        	x : event.offsetX,
502        	y : event.offsetY
503		};
504	} );
505
506	$el.on( 'mouseenter', function() {
507		jQuery( this ).removeClass( 'in-direction-left in-direction-right in-direction-up in-direction-down' +
508			' out-direction-left out-direction-right out-direction-up out-direction-down' );
509		jQuery( this ).addClass( 'in-' + $output );
510		return;
511	} );
512
513	$el.on( 'mouseleave', function() {
514		jQuery( this ).removeClass( 'in-direction-left in-direction-right in-direction-up in-direction-down ' +
515			' out-direction-left out-direction-right out-direction-up out-direction-down' );
516		jQuery( this ).addClass( 'out-' + $output );
517		return;
518	} );
519
520}; /* mouseDir() */
521
522/* Check if element is visible in browser window */
523function isInViewport( el ) {
524	if ( ! jQuery( el ).length ) return;
525
526	var adminHeight = ( jQuery( '#wpadminbar' ).length ) ? jQuery( '#wpadminbar' ).height() : 0;
527
528	var elementTop = jQuery( el ).offset().top;
529	var elementBottom = elementTop + jQuery( el ).outerHeight();
530
531	var viewportTop = jQuery( window ).scrollTop();
532	var viewportBottom = viewportTop + jQuery( window ).height() - adminHeight;
533
534	return ( elementBottom > viewportTop ) && ( elementTop < viewportBottom );
535} /* isInViewport() */
536
537/* Animate on scroll */
538function animateScroll( $articles, $class ) {
539	var $articles = jQuery( $articles );
540
541	$articles.each( function( i, el ) {
542		jQuery( el ).addClass( $class );
543	} );
544
545	jQuery( window ).on( 'scroll', function() {
546		$articles.each( function( i, el ) {
547			if ( isInViewport( el ) ) {
548				jQuery( el ).removeClass( $class );
549			}
550		} );
551	} );
552
553	jQuery( window ).trigger( 'scroll' );
554} /* animateScroll() */
555
556/* Header image paralax effect and opacity, animate header titles */
557function cryoutHeaderParallax() {
558	var cur_op = parseFloat( jQuery( '#header-overlay' ).css( 'opacity' ) );
559
560	/* Parallax on scroll */
561	jQuery( window ).on( 'scroll', function() {
562		var scrolled = jQuery( window ).scrollTop();
563
564		jQuery( '#masthead .header-image' ).each( function( index, element ) {
565
566			/* Skip animations if element is not currently visible */
567			if ( jQuery( element ).css( 'display' ) === 'none' ) return true;
568
569		    var initY = jQuery( element ).offset().top,
570			height = jQuery( element ).height(),
571			visible = isInViewport( jQuery( element ) );
572
573		    if( visible ) {
574				var diff = scrolled - initY;
575				var ratio = Math.round( ( diff / height ) * 100 );
576				jQuery( element ).css( 'opacity', 1);
577				jQuery( element ).css( 'background-position', 'center ' + ( 50 + parseInt( ratio ) ) + '%' );
578				if ( parseInt( ratio ) > 0 ) {
579					jQuery( '#header-overlay' )
580						.css( 'opacity', ( cur_op - ( parseInt( ratio ) * cur_op / 100 ) ) );
581				}
582			}
583		} );
584	} );
585} /* cryoutHeaderParallax()
586
587/* Add Social Icons titles */
588function cryoutSocialTitles() {
589	jQuery( '.socials a' ).each( function() {
590		jQuery( this ).attr( 'title', jQuery( this ).children().html() );
591		jQuery( this ).html( '' );
592	} );
593} /* cryoutSocialTitles() */
594
595/* Add body classes */
596function cryoutBodyClasses() {
597
598	/* Detect and apply custom class for Safari */
599	if ( ( ( navigator.userAgent.indexOf( 'Safari' ) !== -1 ) || ( navigator.userAgent.indexOf( 'iPhone' ) !== -1 ) || ( navigator.userAgent.indexOf( 'iPad' ) !== -1 ) ) && ( navigator.userAgent.indexOf( 'Chrome' ) === -1 ) ) {
600		jQuery( 'body' ).addClass( 'safari' );
601	}
602
603	/* Add body class if masonry is used on page */
604	if ( jQuery( '#content-masonry' ).length > 0 ) {
605		jQuery( 'body' ).addClass( 'esotera-with-masonry' );
606	}
607} /* cryoutBodyClasses() */
608
609/* Remove all off-canvas states */
610function cryoutRemoveFocus() {
611	jQuery( 'input, textarea, select, a' ).on( 'focus', function() {
612		if (jQuery( this ).data( 'mousedown' ) || jQuery( this ).data( 'mouseup' ) ) {
613			jQuery( this ).css( 'outline', 'none' );
614		}
615	} );
616} /* cryoutRemoveFocus() */
617
618/*  Tabs widget */
619function cryoutTabsWidget() {
620		var tabsNav = jQuery( '.cryout-wtabs-nav' ),
621			tabsNavLis = tabsNav.children( 'li' );
622
623		tabsNav.each( function() {
624			var localthis = jQuery( this );
625			localthis.next().children( '.cryout-wtab' ).stop( true, true )
626				.children( 'li' ).hide()
627				.parent().siblings( localthis.find( 'a' ).attr( 'href' ) )
628				.children( 'li' ).show();
629			localthis.children( 'li' ).first()
630				.addClass( 'active' ).stop( true, true ).show();
631		} );
632
633		tabsNavLis.on( 'click', function( e ) {
634			var localthis = jQuery( this ),
635				tabs_duration = 200;
636
637			localthis.siblings().removeClass( 'active' ).end().addClass( 'active' );
638			localthis.parent().next().children( '.cryout-wtab' ).stop( true, true )
639				.children( 'li' ).hide()
640				.parent().siblings( localthis.find( 'a' ).attr( 'href' ) )
641				.children( 'li' ).each( function( index ) {
642					jQuery( this ).fadeIn( tabs_duration * ( index + 1 ) );
643			} );
644			e.preventDefault();
645		} ).children( window.location.hash ? 'a[href="' + window.location.hash + '"]' : 'a:first' )
646			.trigger( 'click' );
647
648} /* cryoutTabsWidget() */
649
650/* Blog Masonry */
651function cryoutMasonry() {
652	if ( ( cryout_theme_settings.masonry == 1 ) &&
653		( cryout_theme_settings.magazine != 1 ) &&
654		( typeof jQuery.fn.masonry !== 'undefined' )
655	) {
656		jQuery( '#content-masonry' ).masonry( {
657			itemSelector: 'article',
658			columnWidth: 'article',
659			percentPosition: true,
660			isRTL: cryout_theme_settings.rtl,
661		} );
662	}
663} /* cryoutMasonry() */
664
665/* Jetpack Portfolio Masonry */
666function cryoutPortfolioMasonry() {
667	if ( ( cryout_theme_settings.masonry == 1 ) && ( typeof jQuery.fn.masonry !== 'undefined' ) ) {
668		jQuery( '#lp-portfolio .jetpack-portfolio-shortcode' ).masonry( {
669			itemSelector: '.portfolio-entry',
670			columnWidth: '.portfolio-entry:not(.hidey)',
671			percentPosition: true,
672			isRTL: cryout_theme_settings.rtl,
673		} );
674	}
675} /* cryoutPortfolioMasonry() */
676
677/* Portfolio filtering */
678function cryoutPortfolioFilter() {
679	jQuery( 'body' ).on( 'click', '#portfolio-filter > a', function( e ) {
680		e.preventDefault();
681		jQuery( '#portfolio-filter > a' ).removeClass( 'active' );
682		jQuery( this ).addClass( 'active' );
683		var filter = jQuery( this ).attr( 'data-slug' );
684		jQuery( '#portfolio-masonry .portfolio-entry' ).each( function( i, elm ) {
685			if ( filter == 'all' ) {
686				jQuery( elm ).removeClass( 'hidey' ).fadeIn( 'fast' );
687			} else {
688				if ( ! jQuery( elm ).hasClass( 'type-' + filter ) ) {
689					jQuery( elm ).addClass( 'hidey' ).fadeOut( 'fast' );
690				} else {
691					jQuery( elm ).removeClass( 'hidey' ).fadeIn( 'fast' );
692				}
693			}
694		} ).promise().done( function() {
695				cryoutPortfolioMasonry();
696				/*jQuery('.jetpack-portfolio-shortcode').masonry();*/
697		} );
698		return false;
699	} );
700} /* cryoutPortfolioFilter() */
701
702/**
703 *  prepareTransition jQuery Plugin
704 */
705;( function( $ ){
706	$.fn.prepareTransition = function() {
707	    return this.each( function() {
708	        var el = $( this );
709
710	        /* Remove the transition class upon completion */
711	        el.one( 'TransitionEnd webkitTransitionEnd transitionend oTransitionEnd', function() {
712	            el.removeClass( 'is-transitioning' );
713	        } );
714
715	        /* Check the various CSS properties to see if a duration has been set */
716	        var cl = ["transition-duration", "-moz-transition-duration",
717				"-webkit-transition-duration", "-o-transition-duration"];
718	        var duration = 0;
719	        $.each( cl, function( idx, itm ) {
720	            duration || ( duration = parseFloat( el.css( itm ) ) );
721	        } );
722
723	        /* if I have a duration then add the class */
724	        if ( duration != 0 ) {
725	            el.addClass( 'is-transitioning' );
726	            el[0].offsetWidth; /* check offsetWidth to force the style rendering */
727	        }
728	    } );
729	};
730}( jQuery ) );
731
732/**
733 * Scroll to anchors
734 */
735function cryoutAutoScroll(document, history, location) {
736	document = window.document;
737	history = window.history;
738	location = window.location;
739	var HISTORY_SUPPORT = !! ( history && history.pushState );
740	var anchorScrolls = {
741		ANCHOR_REGEX: /^#[^ ]+$/,
742		OFFSET_HEIGHT_PX: jQuery( '.esotera-fixed-menu #site-header-main' ).height(),
743
744		/* Establish events, and fix initial scroll position if a hash is provided. */
745		init: function() {
746			this.scrollToCurrent();
747			jQuery( window ).on(
748				'hashchange',
749				jQuery.proxy( this, 'scrollToCurrent' )
750			);
751			jQuery( 'body' ).on(
752				'click',
753				'.main a, nav ul li a, .meta-arrow',
754				jQuery.proxy( this, 'delegateAnchors' )
755			);
756		},
757
758		/*  Return the offset amount to deduct from the normal scroll position.
759			Modify as appropriate to allow for dynamic calculations. */
760		getFixedOffset: function() {
761			return ( this.OFFSET_HEIGHT_PX ) ? this.OFFSET_HEIGHT_PX : 0;
762		},
763
764		/* If the provided href is an anchor which resolves to an element on the page, scroll to it. */
765		scrollIfAnchor: function( href, pushToHistory ) {
766			var match, anchorOffset;
767
768			if ( ! this.ANCHOR_REGEX.test( href ) ) {
769				return false;
770			}
771
772			match = document.getElementById(href.slice(1));
773
774			if ( match && ( ! isInViewport( match ) ) && jQuery( match ).offset().top ) {
775				anchorOffset = jQuery( match ).offset().top - this.getFixedOffset();
776				jQuery( 'html, body' ).animate( { scrollTop: anchorOffset} );
777
778				/* Add the state to history as-per normal anchor links */
779				if ( HISTORY_SUPPORT && pushToHistory ) {
780					history.pushState( {}, document.title, location.pathname + href );
781				}
782			}
783
784			return !!match;
785		},
786
787		/* Attempt to scroll to the current location's hash */
788		scrollToCurrent: function(e) {
789			if (this.scrollIfAnchor(window.location.hash) && e) {
790				e.preventDefault();
791			}
792		},
793
794		/* If the click event's target was an anchor, fix the scroll position */
795		delegateAnchors: function( e ) {
796			var elem = e.target.closest( 'a' );
797
798			if ( this.scrollIfAnchor( elem.getAttribute( 'href' ), true ) ) {
799				e.preventDefault();
800			}
801		}
802	};
803
804	jQuery( document ).ready( jQuery.proxy( anchorScrolls, 'init' ) );
805}
806
807/* FitVids 1.1*/
808;(function( $ ){
809
810  'use strict';
811
812  $.fn.fitVids = function( options ) {
813    var settings = {
814      customSelector: null,
815      ignore: null
816    };
817
818    if(!document.getElementById('fit-vids-style')) {
819      /* appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js */
820      var head = document.head || document.getElementsByTagName('head')[0];
821      var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
822      var div = document.createElement("div");
823      div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
824      head.appendChild(div.childNodes[1]);
825    }
826
827    if ( options ) {
828      $.extend( settings, options );
829    }
830
831    return this.each(function(){
832      var selectors = [
833        'iframe[src*="player.vimeo.com"]',
834        'iframe[src*="youtube.com"]',
835        'iframe[src*="youtube-nocookie.com"]',
836        'iframe[src*="kickstarter.com"][src*="video.html"]',
837        'object',
838        'embed'
839      ];
840
841      if (settings.customSelector) {
842        selectors.push(settings.customSelector);
843      }
844
845      var ignoreList = '.fitvidsignore, .wp-block-embed__wrapper';
846
847      if(settings.ignore) {
848        ignoreList = ignoreList + ', ' + settings.ignore;
849      }
850
851      var $allVideos = $(this).find(selectors.join(','));
852      $allVideos = $allVideos.not('object object'); /* SwfObj conflict patch */
853      $allVideos = $allVideos.not(ignoreList); /* Disable FitVids on this video. */
854
855      $allVideos.each(function(){
856        var $this = $(this);
857        if($this.parents(ignoreList).length > 0) {
858          return; /* Disable FitVids on this video. */
859        }
860        if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
861        if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
862        {
863          $this.attr('height', 9);
864          $this.attr('width', 16);
865        }
866        var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
867            width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
868            aspectRatio = height / width;
869        if(!$this.attr('name')){
870          var videoName = 'fitvid' + $.fn.fitVids._count;
871          $this.attr('name', videoName);
872          $.fn.fitVids._count++;
873        }
874        $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
875        $this.removeAttr('height').removeAttr('width');
876      } );
877    } );
878  };
879
880  /* Internal counter for unique video names. */
881  $.fn.fitVids._count = 0;
882
883/* Works with either jQuery or Zepto */
884})( window.jQuery || window.Zepto );
885
886/* IE .closest() fix */
887if ( window.Element && ( ! Element.prototype.closest ) ) {
888    Element.prototype.closest = function( s ) {
889        var matches = ( this.document || this.ownerDocument ).querySelectorAll( s ),
890            i,
891            el = this;
892        do {
893            i = matches.length;
894            while (--i >= 0 && matches.item( i ) !== el) {}
895        } while ( (i < 0) && ( el = el.parentElement ) );
896        return el;
897    };
898}
899
900/* FIN */

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.