PageSourceSearch

https://www.sensoryapphouse.com/wp-content/themes/zerif-pro/js/zerif.js

js sensoryapphouse.com collected 2026-10-01 11:38:33 UTC 26,907 bytes, 943 lines download raw bytes

1/* LOADER */
2/* global Parallax */
3/* global zerifSettings */
4
5(function ( $ ) {
6	$.isMobile = {
7		Android: function () {
8			return navigator.userAgent.match( /Android/i );
9		},
10		BlackBerry: function () {
11			return navigator.userAgent.match( /BlackBerry/i );
12		},
13		iOS: function () {
14			return navigator.userAgent.match( /iPhone|iPad|iPod/i );
15		},
16		Opera: function () {
17			return navigator.userAgent.match( /Opera Mini/i );
18		},
19		Windows: function () {
20			return navigator.userAgent.match( /IEMobile/i );
21		},
22		any: function () {
23			return ($.isMobile.Android() || $.isMobile.BlackBerry() || $.isMobile.iOS() || $.isMobile.Opera() || $.isMobile.Windows());
24		}
25	};
26
27	$.generalActions = {
28		init: function () {
29			this.disablePreloader();
30			this.smoothScroll();
31			this.initMasonry();
32			this.focusTabs();
33			this.hideRecaptcha();
34		},
35
36		/**
37		 * Disable preloader after an amount of time.
38		 */
39		disablePreloader: function () {
40			jQuery( '.status' ).fadeOut();
41			jQuery( '.preloader' ).delay( 500 ).fadeOut( 'slow' );
42		},
43
44		/**
45		 * Smooth scroll when clicking on menu anchors.
46		 */
47		smoothScroll: function () {
48			var anchorSelector = $( '#site-navigation a[href*="#"]:not([href="#"]), .navbar.navbar-inverse .primary-menu a[href*="#"]:not([href="#"]), header.header a[href*="#"]:not([href="#"]), #focus .focus-box .service-icon a[href*="#"]:not([href="#"])' );
49			anchorSelector.addClass('page-anchor');
50			anchorSelector.bind(
51				'click', function () {
52					var headerHeight;
53
54					headerHeight = 0;
55					if ( $( window ).width() >= 751 ) {
56						headerHeight = $( '#main-nav' ).height();
57					}
58
59					if ( location.pathname.replace( /^\//, '' ) === this.pathname.replace( /^\//, '' ) && location.hostname === this.hostname ) {
60						var target = $( this.hash );
61						target = target.length ? target : $( '[name=' + this.hash.slice( 1 ) + ']' );
62						if ( target.length ) {
63							$( 'html,body' ).animate(
64								{
65									scrollTop: target.offset().top - headerHeight + 5
66								}, 1200
67							);
68
69							// Close dropdown menu on mobile, after an anchor is clicked
70							$( '.navbar .navbar-collapse.in' ).removeClass( 'in' );
71							$( '.navbar li.dropdown.open' ).removeClass( 'open' );
72
73							return false;
74						}
75					}
76				}
77			);
78		},
79
80		stickyFooter: function () {
81			var content = $( '.site-content > .container' );
82			var headerHeight = $( 'header.header' ).outerHeight();
83			var footerHeight = $( 'footer#footer' ).outerHeight();
84			var contentHeight = content.outerHeight();
85			var windowHeight = $( window ).height();
86			var topBar = $( '.zerif-top-bar' ).length > 0 ? 40 : 0;
87
88			var totalHeight = topBar + headerHeight + footerHeight + contentHeight;
89
90			if ( totalHeight < windowHeight ) {
91				content.css( 'min-height', windowHeight - headerHeight - footerHeight - topBar );
92			} else {
93				content.css( 'min-height', '1px' );
94			}
95		},
96
97		/**
98		 * Initiate Masonry.
99		 */
100		initMasonry: function () {
101			if ( typeof zerifSettings === 'undefined' ) {
102				return;
103			}
104
105			if ( !zerifSettings.masonry ) {
106				return;
107			}
108
109			if ( jQuery( '.masonry-card-style' ).length < 1 ) {
110				return;
111			}
112
113			var siteMain = jQuery( '.site-main' );
114
115			var containerStyle = {
116					position: 'relative'
117				},
118				pagination = siteMain.children( '.navigation.paging-navigation' );
119
120			// masonry will make the articles absolute so we need to re adjust the nav position.
121			if ( pagination.length > 0 ) {
122
123				var bottomSpace = parseInt( pagination.css( 'height' ) ) + 40;
124
125				containerStyle.marginBottom = bottomSpace + 'px';
126
127				pagination.css( 'bottom', '-' + bottomSpace + 'px' );
128				pagination.css( 'position', 'absolute' );
129				pagination.css( 'left', '0' );
130				pagination.css( 'right', '0' );
131			}
132
133			siteMain.masonry( {
134				// set itemSelector so .grid-sizer is not used in layout
135				itemSelector: '.masonry-card-style',
136				// use element for option
137				columnWidth: '.masonry-card-style',
138				percentPosition: true,
139				containerStyle: containerStyle
140			} );
141		},
142
143		/**
144		 * Focus customizer tabs.
145		 */
146		focusTabs: function () {
147			$( '.customize-partial-edit-shortcut' ).on( 'DOMNodeInserted', function () {
148				jQuery( this ).on( 'click', function () {
149					var parent = $( this ).parent();
150					var control_type = parent.data( 'customize-partial-type' );
151
152					if ( control_type === 'widget' ) {
153						wp.customize.preview.send( 'tab-previewer-edit', $( '.custom-customizer-tab>.widgets' ) );
154						return;
155					}
156
157					var control_id = $( this ).attr( 'class' ).replace( 'customize-partial-edit-shortcut customize-partial-edit-shortcut-', '' );
158					wp.customize.preview.send( 'tab-previewer-edit', $( '.custom-customizer-tab>.' + control_id ) );
159					wp.customize.preview.send( 'focus-control', control_id );
160
161				} );
162			} );
163		},
164
165		/**
166		 * Hide recaptcha
167		 */
168		hideRecaptcha: function () {
169			var thisOpen = false;
170			jQuery( '.contact-form .form-control' ).each(
171				function () {
172					if ( (typeof jQuery( this ).val() !== 'undefined') && (jQuery( this ).val().length > 0) ) {
173						thisOpen = true;
174						jQuery( '.zerif-g-recaptcha' ).css( 'display', 'block' ).delay( 1000 ).css( 'opacity', '1' );
175						return false;
176					}
177				}
178			);
179			if ( thisOpen === false && (typeof jQuery( '.contact-form textarea' ).val() !== 'undefined') && (jQuery( '.contact-form textarea' ).val().length > 0) ) {
180				thisOpen = true;
181				jQuery( '.zerif-g-recaptcha' ).css( 'display', 'block' ).delay( 1000 ).css( 'opacity', '1' );
182			}
183			jQuery( '.contact-form input, .contact-form textarea' ).focus(
184				function () {
185					if ( !jQuery( '.zerif-g-recaptcha' ).hasClass( 'recaptcha-display' ) ) {
186						jQuery( '.zerif-g-recaptcha' ).css( 'display', 'block' ).delay( 1000 ).css( 'opacity', '1' );
187					}
188				}
189			);
190		}
191	};
192
193	$.portfolioLightbox = {
194
195		init: function () {
196			this.openModal();
197			this.closeModal();
198		},
199
200		openModal: function () {
201			$( '.zerif-with-modal' ).on('click touchstart',
202				function () {
203					var modal = $( this ).parent().find( '.zerif-modal-wrap' );
204					$( 'html' ).css( 'overflow', 'hidden' );
205					modal.show();
206				}
207			);
208		},
209
210		closeModal: function () {
211			$( '.zerif-close-modal, .zerif-close-modal-button' ).click(
212				function () {
213					var modal = $( this ).closest( '.zerif-modal-wrap' );
214
215					/**
216					 * Stop the iframes and the videos from playing.
217					 */
218					var iframes = modal.find( 'iframe' );
219					$.each( iframes, function () {
220						var src = $( this ).attr( 'src' );
221						$( this ).attr( 'src', src );
222					} );
223
224					var videos = modal.find( 'video' );
225					$.each( videos, function () {
226						var src = $( $( this )[ 0 ] ).attr( 'src' );
227						$( $( this )[ 0 ] ).attr( 'src', src );
228					} );
229
230					/**
231					 * Hide modal and let body scroll
232					 */
233					$( 'html' ).css( 'overflow-y', 'scroll' );
234					modal.hide();
235				}
236			);
237		}
238	};
239
240	$.bigTitle = {
241		init: function () {
242			this.handleSliderTransition();
243			this.handleParallax();
244		},
245
246		handleSliderTransition: function () {
247			var slides = $( '.fadein-slider .slide-item' );
248			if ( slides.length <= 1 ) {
249				return;
250			}
251			slides.slice( 1 ).hide();
252			setInterval(
253				function () {
254					$( '.fadein-slider :first-child' ).fadeOut( 2000 ).next( '.slide-item' ).fadeIn( 2000 ).end().appendTo( '.fadein-slider' );
255				}, 10000
256			);
257		},
258
259		handleParallax: function () {
260			var parallaxItem = $( '#parallax_move' );
261			if ( parallaxItem.length <= 0 ) {
262				return;
263			}
264
265			var scene = document.getElementById( 'parallax_move' );
266			var window_width = jQuery( window ).outerWidth();
267			parallaxItem.css(
268				{
269					'width': window_width + 120,
270					'margin-left': -60,
271					'margin-top': -60,
272					'position': 'absolute',
273				}
274			);
275			var h = jQuery( 'header#home' ).outerHeight();
276			parallaxItem.children().each(
277				function () {
278					jQuery( this ).css(
279						{
280							'height': h + 100,
281						}
282					);
283				}
284			);
285			if ( !$.isMobile.any() ) {
286				new Parallax( scene );
287			} else {
288				parallaxItem.css(
289					{
290						'z-index': '0',
291					}
292				);
293				parallaxItem.find( '.layer' ).css(
294					{
295						'position': 'absolute',
296						'top': '0',
297						'left': '0',
298						'z-index': '1',
299					}
300				);
301			}
302		}
303	};
304
305	$.navMenu = {
306		init: function () {
307			this.handleMobileDropDown();
308			this.handleTopBar();
309			this.menuAlign();
310			this.menuOrientation();
311		},
312
313		handleMobileDropDown: function () {
314			/**
315			 * Do not execute this function if mega menu is active.
316			 */
317			if ( $( '.wr-megamenu-container' ).length > 0 || $( '.mega-menu-wrap' ).length > 0 ) {
318				return;
319			}
320			this.addMenuCaret();
321			this.handleMenuCaret();
322		},
323
324		addMenuCaret: function () {
325			var navLi = $( '#site-navigation li' );
326			navLi.each( function () {
327				if ( $( this ).find( 'ul' ).length > 0 && !$( this ).hasClass( 'has_children' ) ) {
328					$( this ).addClass( 'has_children' );
329					$( this ).find( 'a' ).first().after( '<p class="dropdownmenu"></p>' );
330				}
331			} );
332			navLi.find( 'a' ).on( 'click', function () {
333					$( '#site-navigation' ).parent().find( '.navbar-toggle' ).addClass( 'collapsed' );
334					$( '#site-navigation' ).parent().find( '.collapse' ).removeClass( 'in' );
335				}
336			);
337		},
338
339		handleMenuCaret: function () {
340			$( '.dropdownmenu' ).click( function () {
341				$( this ).parent( 'li' ).toggleClass( 'this-open' );
342			} );
343		},
344
345		handleTopBar: function () {
346			/* Handle the very top bar on scroll*/
347			var currentScrollPosition = window.pageYOffset,
348				topBar = $( '.zerif-top-bar' ),
349				nav = $( '#main-nav' );
350
351			if ( topBar.length === 0 ) {
352				return;
353			}
354			var margin = currentScrollPosition;
355			if ( margin < 0 ) {
356				margin = 0;
357			}
358			if ( margin > 40 ) {
359				margin = 40;
360			}
361
362			nav.css( 'margin-top', '-' + margin + 'px' );
363		},
364
365		/**
366		 * Add class current on nav anchor when section is in viewport
367		 */
368		sectionInViewport: function () {
369			if ( $( window ).width() < 751 ) {
370				return;
371			}
372			var zerif_scrollTop = $( window ).scrollTop();       // cursor position
373			var headerHeight = $( '#main-nav' ).outerHeight();   // header height
374			var isInOneSection = 'no';                              // used for checking if the cursor is in one section or not
375			// for all sections check if the cursor is inside a section
376			$( 'section, header' ).each(
377				function () {
378					var thisID = '#' + $( this ).attr( 'id' );           // section id
379					var zerif_offset = $( this ).offset().top;         // distance between top and our section
380					var thisHeight = $( this ).outerHeight();         // section height
381					var thisBegin = zerif_offset - headerHeight;                      // where the section begins
382					var thisEnd = zerif_offset + thisHeight - headerHeight;         // where the section ends
383					// if position of the cursor is inside of the this section
384					if ( zerif_scrollTop >= thisBegin && zerif_scrollTop <= thisEnd ) {
385						isInOneSection = 'yes';
386						$( '#site-navigation .current, .navbar.navbar-inverse .primary-menu .current' ).removeClass( 'current' );
387						$( '#site-navigation a[href$="' + thisID + '"], .navbar.navbar-inverse .primary-menu a[href$="' + thisID + '"]' ).parent( 'li' ).addClass( 'current' );    // find the menu button with the same ID section
388						return false;
389					}
390					if ( isInOneSection === 'no' ) {
391						$( '#site-navigation .current, .navbar.navbar-inverse .primary-menu .current' ).removeClass( 'current' );
392					}
393				}
394			);
395
396		},
397
398		/**
399		 * Align menu on center if its width is grater than nav.
400		 */
401		menuAlign: function () {
402			var headerWrap = jQuery( '.header' );
403			var navWrap = jQuery( '#site-navigation, .navbar.navbar-inverse .primary-menu nav' );
404			var maxMenuNavWrap = jQuery( ' #mega-menu-primary' );
405			var logoWrap = jQuery( '.responsive-logo' );
406			var containerWrap = jQuery( '.container' );
407			var classToAdd = 'menu-align-center';
408
409			if ( headerWrap.hasClass( classToAdd ) ) {
410				headerWrap.removeClass( classToAdd );
411			}
412			var logoWidth = logoWrap.outerWidth();
413			var menuWidth = navWrap.outerWidth() + maxMenuNavWrap.outerWidth();
414			var containerWidth = containerWrap.width();
415
416			if ( menuWidth + logoWidth > containerWidth ) {
417				headerWrap.addClass( classToAdd );
418			} else {
419				if ( headerWrap.hasClass( classToAdd ) ) {
420					headerWrap.removeClass( classToAdd );
421				}
422			}
423		},
424
425		/**
426		 * Menu orientation.
427		 */
428		menuOrientation: function () {
429			jQuery( '#site-navigation, .navbar.navbar-inverse .primary-menu' ).zerifsubmenuorientation();
430		}
431	};
432
433	$.frontpageSections = {
434		init: function () {
435			this.teamSection();
436			this.portfolioSection();
437			this.latestNewsSection();
438			this.testimonialsSection();
439		},
440
441		/**
442		 * JS for team section.
443		 */
444		teamSection: function () {
445			if ( $( 'section.our-team' ).length <= 0 ) {
446				return;
447			}
448			if ( !$.isMobile.any() ) {
449				return;
450			}
451
452			/**
453			 * Open team member description.
454			 */
455			$( '.team-member' ).on(
456				'click', function () {
457					$( '.team-member-open' ).removeClass( 'team-member-open' );
458					$( this ).addClass( 'team-member-open' );
459					event.stopPropagation();
460				}
461			);
462
463			/**
464			 * Close team member description on touch/click outside.
465			 */
466			$( 'html' ).on( 'touchstart click', function () {
467				jQuery( '.team-member-open' ).removeClass( 'team-member-open' );
468			} );
469
470		},
471
472		/**
473		 * JS for portfolio section.
474		 */
475		portfolioSection: function () {
476			if ( $( 'section.works' ).length <= 0 ) {
477				return;
478			}
479			if ( !$.isMobile.any() ) {
480				return;
481			}
482			var responsiveGrid = $( '.cbp-rfgrid li' );
483			responsiveGrid.prepend( '<p class="cbp-rfgrid-tr"></p>' );
484
485			responsiveGrid.on( 'click', function () {
486					if ( $( this ).hasClass( 'cbp-rfgrid-open' ) ) {
487						return;
488					}
489					$( '.cbp-rfgrid-tr' ).css( 'display', 'block' );
490					$( '.cbp-rfgrid-open' ).removeClass( 'cbp-rfgrid-open' );
491
492					$( this ).addClass( 'cbp-rfgrid-open' );
493					$( this ).find( '.cbp-rfgrid-tr' ).css( 'display', 'none' );
494					event.stopPropagation();
495				}
496			);
497
498			$( 'html' ).on( 'touchstart click', function () {
499				var responsiveGrid = $( '.cbp-rfgrid li' );
500				if ( $( responsiveGrid ).hasClass( 'cbp-rfgrid-open' ) ) {
501					$( '.cbp-rfgrid-tr' ).css( 'display', 'none' );
502				}else{
503					$( '.cbp-rfgrid-tr' ).css( 'display', 'block' );
504				}
505					$( '.cbp-rfgrid-open' ).removeClass( 'cbp-rfgrid-open' );
506				}
507			);
508		},
509
510		/**
511		 * JS for latest news section.
512		 */
513		latestNewsSection: function () {
514			if ( $( '#carousel-homepage-latestnews' ).length <= 0 ) {
515				return;
516			}
517			if ( !$.isMobile.any() ) {
518				return;
519			}
520
521			/**
522			 * Hide next and previous arrow
523			 */
524			if ( jQuery( '#carousel-homepage-latestnews div.item' ).length < 2 ) {
525				jQuery( '#carousel-homepage-latestnews > a' ).css( 'display', 'none' );
526			}
527
528			/**
529			 * Get the maximum height of a slide and set each slide to that height.
530			 */
531			var maxheight = 0;
532			jQuery( '#carousel-homepage-latestnews div.item' ).each(
533				function () {
534					if ( jQuery( this ).height() > maxheight ) {
535						maxheight = jQuery( this ).height();
536					}
537				}
538			);
539			jQuery( '#carousel-homepage-latestnews div.item' ).height( maxheight );
540		},
541
542		/**
543		 * JS for testimonials section.
544		 */
545		testimonialsSection: function () {
546			if ( jQuery( '.testimonial-masonry' ).length <= 0 ) {
547				return;
548			}
549
550			var window_width_old = jQuery( '.container' ).outerWidth();
551			if ( window_width_old < 970 ) {
552				jQuery( '.testimonial-masonry' ).zerifgridpinterest( { columns: 1, selector: '.feedback-box' } );
553			} else {
554				jQuery( '.testimonial-masonry' ).zerifgridpinterest( { columns: 3, selector: '.feedback-box' } );
555			}
556		}
557	};
558
559	var portraitViewInit = 0, resize = false; // Initial viewport orientation: Default Landscape
560	$.responsiveBackground = {
561		init: function () {
562			if ( $( '#mobile-bg-responsive' ).length <= 0 ) {
563				return;
564			}
565			if ( $( 'body.custom-background' ).length <= 0 ) {
566				return;
567			}
568			if ( !$.isMobile.any() ) {
569				return;
570			}
571
572			var windowWidth = window.innerWidth;
573			var windowHeight = window.innerHeight;
574			// Check if orientation is Portrait or Landscape: Default is Landscape
575			var portraitView = 0;
576			if ( windowHeight >= windowWidth ) {
577				portraitView = 1;
578			}
579			if ( jQuery.isMobile.iOS() ) {
580				windowHeight += 100;
581			}
582
583			if ( portraitViewInit === portraitView ) {
584				return;
585			}
586
587			var bgHelper = jQuery( '.zerif-mobile-bg-helper-bg' );
588			if ( !resize ) {
589				var imgURL = jQuery( 'body.custom-background' ).css( 'background-image' );
590				jQuery( '.zerif-mobile-bg-helper-bg-inside' ).css(
591					{
592						'background-image': imgURL,
593					}
594				).addClass( 'zerif-mobile-h-inside' );
595				jQuery( '.zerif-mobile-bg-helper-wrap-all' ).addClass( 'zerif-mobile-h-all' );
596				jQuery( '.zerif-mobile-bg-helper-content' ).addClass( 'zerif-mobile-h-content' );
597				bgHelper.css(
598					{
599						'width': windowWidth,
600						'height': windowHeight
601					}
602				).addClass( 'zerif-mobile-h-bg' );
603				portraitViewInit = portraitView;
604				resize = true;
605			} else {
606				// Resize window
607				bgHelper.css(
608					{
609						'width': windowWidth,
610						'height': windowHeight
611					}
612				);
613				portraitViewInit = portraitView;
614			}
615		}
616	};
617
618})( jQuery );
619
620jQuery( document ).ready(
621	function () {
622		jQuery.generalActions.init();
623		jQuery.portfolioLightbox.init();
624		jQuery.bigTitle.init();
625		jQuery.navMenu.init();
626		jQuery.frontpageSections.init();
627		jQuery.responsiveBackground.init();
628	}
629);
630
631jQuery( window ).on( 'load', function () {
632	jQuery.generalActions.stickyFooter();
633} );
634
635jQuery( window ).on( 'resize', function () {
636	jQuery.navMenu.menuAlign();
637	jQuery.bigTitle.handleParallax();
638	jQuery.frontpageSections.testimonialsSection();
639	jQuery.responsiveBackground.init();
640} );
641
642jQuery( window ).on( 'scroll', function () {
643	jQuery.navMenu.handleTopBar();
644	jQuery.navMenu.sectionInViewport();
645} );
646
647/**
648 * Masonry script.
649 */
650(function ( $ ) {
651	var defaults = {
652		columns: 3,
653		selector: 'div',
654		excludeParentClass: '',
655	};
656
657	function ZerifGridPinterest( element, options ) {
658		this.element = element;
659		this.options = $.extend( {}, defaults, options );
660		this.defaults = defaults;
661		this.init();
662	}
663
664	ZerifGridPinterest.prototype.init = function () {
665		var self = this,
666			$container = $( this.element ),
667			$select_options = $( this.element ).children();
668		self.make_magic( $container, $select_options );
669	};
670	ZerifGridPinterest.prototype.make_magic = function ( container ) {
671		var self = this,
672			$container = $( container ),
673			columns_height = [],
674			prefix = 'zerif',
675			unique_class = prefix + '_grid_' + self.make_unique(),
676			local_class = prefix + '_grid';
677		var classname;
678		var substr_index = this.element.className.indexOf( prefix + '_grid_' );
679		if ( substr_index > -1 ) {
680			classname = this.element.className.substr( 0, this.element.className.length - unique_class.length - local_class.length - 2 );
681		} else {
682			classname = this.element.className;
683		}
684		var my_id;
685		if ( this.element.id === '' ) {
686			my_id = prefix + '_id_' + self.make_unique();
687		} else {
688			my_id = this.element.id;
689		}
690		$container.after( '<div id="' + my_id + '" class="' + classname + ' ' + local_class + ' ' + unique_class + '"></div>' );
691		var i;
692		for ( i = 1; i <= this.options.columns; i++ ) {
693			columns_height.push( 0 );
694			var first_cols = '';
695			var last_cols = '';
696			if ( i % self.options.columns === 1 ) {
697				first_cols = prefix + '_grid_first';
698			}
699			if ( i % self.options.columns === 0 ) {
700				first_cols = prefix + '_grid_last';
701			}
702			$( '.' + unique_class ).append( '<div class="' + prefix + '_grid_col_' + this.options.columns + ' ' + prefix + '_grid_column_' + i + ' ' + first_cols + ' ' + last_cols + '"></div>' );
703		}
704		if ( this.element.className.indexOf( local_class ) < 0 ) {
705			$container.children( this.options.selector ).each(
706				function ( index ) {
707					var min = Math.min.apply( null, columns_height );
708					var this_index = columns_height.indexOf( min ) + 1;
709					$( this ).attr( prefix + 'grid-attr', 'this-' + index ).appendTo( '.' + unique_class + ' .' + prefix + '_grid_column_' + this_index );
710					columns_height[ this_index - 1 ] = $( '.' + unique_class + ' .' + prefix + '_grid_column_' + this_index ).height();
711				}
712			);
713		} else {
714			var no_boxes = $container.find( this.options.selector ).length;
715			for ( i = 0; i < no_boxes; i++ ) {
716				var min = Math.min.apply( null, columns_height );
717				var this_index = columns_height.indexOf( min ) + 1;
718				$( '#' + this.element.id ).find( '[' + prefix + 'grid-attr="this-' + i + '"]' ).appendTo( '.' + unique_class + ' .' + prefix + '_grid_column_' + this_index );
719				columns_height[ this_index - 1 ] = $( '.' + unique_class + ' .' + prefix + '_grid_column_' + this_index ).height();
720			}
721		}
722		$container.remove();
723	};
724	ZerifGridPinterest.prototype.make_unique = function () {
725		var text = '';
726		var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
727		for ( var i = 0; i < 10; i++ ) {
728			text += possible.charAt( Math.floor( Math.random() * possible.length ) );
729		}
730		return text;
731	};
732	$.fn.zerifgridpinterest = function ( options ) {
733		return this.each(
734			function () {
735				var value = '';
736				if ( !$.data( this, value ) ) {
737					$.data( this, value, new ZerifGridPinterest( this, options ) );
738				}
739			}
740		);
741	};
742})( jQuery );
743
744/**
745 * Accessibility menu.
746 */
747(function ( $ ) {
748	'use strict';
749	// make dropdowns functional on focus
750	$( '.primary-menu' ).find( 'a' ).on(
751		'focus blur', function () {
752			$( this ).parents( 'ul, li' ).toggleClass( 'acc-focus' );
753		}
754	);
755
756	$( '.primary-menu ul' ).find( '.dropdownmenu' ).remove();
757
758	// menu navigation with arrow keys
759	$( '.menu-item a' ).on(
760		'keydown', function ( e ) {
761
762			// left key
763			if ( e.which === 37 ) {
764				e.preventDefault();
765				$( this ).parent().prev().children( 'a' ).focus();
766			} // right key
767			else if ( e.which === 39 ) {
768				e.preventDefault();
769				$( this ).parent().next().children( 'a' ).focus();
770			} // down key
771			else if ( e.which === 40 ) {
772				e.preventDefault();
773				if ( $( this ).next().length ) {
774					$( this ).next().next().find( 'li:first-child a' ).first().focus();
775				} else {
776					$( this ).parent().next().children( 'a' ).focus();
777				}
778			} // up key
779			else if ( e.which === 38 ) {
780				e.preventDefault();
781				if ( $( this ).parent().prev().length ) {
782					$( this ).parent().prev().children( 'a' ).focus();
783				} else {
784					$( this ).parents( 'ul' ).first().prev().prev().focus();
785				}
786			}
787
788		}
789	);
790
791	$( '.navbar-toggle' ).click(
792		function () {
793
794			$( '.primary-menu' ).slideToggle(
795				'slow', function () {
796					$( this ).toggleClass( 'zerif-hide-on-mobile', $( this ).is( ':visible' ) );
797				}
798			);
799			$( this ).removeAttr( 'style' );
800		}
801	);
802
803	if ( jQuery( '.wr-megamenu-container' ).length === 0 && jQuery( '.mega-menu-wrap' ).length === 0 ) {
804
805		$( '.primary-menu ul:not(.zerif-nav-menu-callback) li.menu-item-has-children' ).children( 'a' ).after( '<button class="dropdownmenu dropdown-toggle"><span class="screen-reader-text">Submenu</span></button>' );
806		$( '.primary-menu ul:not(.zerif-nav-menu-callback) li.menu-item-has-children .dropdownmenu' ).click(
807			function () {
808				$( this ).parent().find( '.sub-menu' ).slideToggle();
809			}
810		);
811
812		$( '.primary-menu ul:not(.zerif-nav-menu-callback) li.page_item_has_children' ).children( 'a' ).after( '<button class="dropdownmenu dropdown-toggle"><span class="screen-reader-text">Submenu</span></button>' );
813		$( '.primary-menu ul:not(.zerif-nav-menu-callback) li.page_item_has_children .dropdownmenu' ).click(
814			function () {
815				$( this ).parent().find( '.sub-menu' ).slideToggle();
816			}
817		);
818
819	}
820
821})( jQuery );
822
823/**
824 * Sub-menu orientation.
825 */
826(function ( $, window ) {
827	var defaults = {
828		allItems: false,
829	};
830
831	function ZerifSubmenuOrientation( element, options ) {
832		this.element = element;
833		this.options = $.extend( {}, defaults, options );
834		this.defaults = defaults;
835		this.init();
836	}
837
838	ZerifSubmenuOrientation.prototype.init = function () {
839		var self = this,
840			$container = $( this.element ),
841			$select_options = $( this.element ).children();
842		var resize_finish;
843		if ( self.options.allItems !== true ) {
844			$( window ).resize(
845				function () {
846					clearTimeout( resize_finish );
847					resize_finish = setTimeout(
848						function () {
849							self.make_magic( $container, $select_options );
850						}, 11
851					);
852				}
853			);
854		}
855		self.make_magic( $container, $select_options );
856		if ( self.options.allItems !== true ) {
857			setTimeout(
858				function () {
859					$( window ).resize();
860				}, 500
861			);
862		}
863	};
864	ZerifSubmenuOrientation.prototype.make_magic = function ( container ) {
865		var self = this,
866			$container = $( container );
867		var itemWrap;
868		if ( $container[ 0 ].tagName === 'UL' ) {
869			itemWrap = $container[ 0 ];
870		} else {
871			itemWrap = $container.find( 'ul' )[ 0 ];
872		}
873		var windowsWidth = window.innerWidth;
874		if ( typeof itemWrap !== 'undefined' ) {
875
876			var itemId = '#' + itemWrap.id;
877
878			$( itemId ).children( 'li' ).each(
879				function () {
880					if ( this.id === '' ) {
881						return;
882					}
883					var max_deep = self.max_deep( '#' + this.id );
884					var offsetLeft = $( '#' + this.id ).offset().left;
885					var submenuWidthItem = $( '#' + this.id ).find( 'ul' ).width();
886					var submenuTotalWidth = max_deep * submenuWidthItem;
887					if ( submenuTotalWidth > 0 && windowsWidth < offsetLeft + submenuTotalWidth ) {
888						if ( self.options.allItems === true ) {
889							$( '#' + itemWrap.id ).addClass( 'menu-item-open-left-all' );
890							return false;
891						}
892						$( '#' + this.id ).addClass( 'menu-item-open-left' );
893					} else if ( $( '#' + this.id ).hasClass( 'menu-item-open-left' ) ) {
894						$( '#' + this.id ).removeClass( 'menu-item-open-left' );
895					}
896				}
897			);
898		}
899	};
900	ZerifSubmenuOrientation.prototype.max_deep = function ( item ) {
901		var maxDepth = -1,
902			currentDepth = -1;
903		$( item + ' li:not(:has(ul))' ).each(
904			function () {
905				currentDepth = $( this ).parents( 'ul' ).length;
906				if ( currentDepth > maxDepth ) {
907					maxDepth = currentDepth;
908				}
909			}
910		);
911		return maxDepth - 1;
912	};
913	$.fn.zerifsubmenuorientation = function ( options ) {
914		return this.each(
915			function () {
916				var value = '';
917				if ( !$.data( this, value ) ) {
918					$.data( this, value, new ZerifSubmenuOrientation( this, options ) );
919				}
920			}
921		);
922	};
923})( jQuery, window );
924
925/* Menu levels */
926jQuery( document ).ready(
927	function () {
928		jQuery( '#site-navigation, .navbar.navbar-inverse .primary-menu' ).zerifsubmenuorientation();
929		// Form submit event.
930		jQuery( document ).on( 'submit', '.contact-form', function() {
931			var currentForm = jQuery( this );
932			var recaptchaField = currentForm.find( '#g-recaptcha-response' );
933			if ( '' === recaptchaField.val() ) {
934				grecaptcha.execute( zerifRecaptcha.sitekey )
935					.then(function( token ) {
936					recaptchaField.val( token );
937					currentForm.submit();
938				});
939			}
940			return '' !== recaptchaField.val();
941		} );
942	}
943);

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.