PageSourceSearch

https://www.leadershipandthechurch.com/wp-content/themes/zerif-pro/js/zerif.js?ver=20120206

js leadershipandthechurch.com collected 2026-10-04 06:12:49 UTC 28,208 bytes, 828 lines download raw bytes

1/* LOADER */
2jQuery(document).ready(function(){
3
4	var zerif_frame = jQuery('iframe.zerif_google_map');
5	var zerif_frameSrc = new Array();
6
7    if( zerif_frame.length ){
8		jQuery.each( zerif_frame, function(i, f){
9			zerif_frameSrc[i] = jQuery(f).attr('src');
10            /*remove the src attribute so window will ignore these iframes*/
11            jQuery(f).attr('src', '');
12        }); 
13	}
14	
15	function zerif_display_iframe_map() {
16		if( zerif_frame.length ){
17			jQuery.each( zerif_frame, function(a, x){
18				/*put the src attribute value back*/
19				jQuery(x).attr('src', zerif_frameSrc[a]);
20			});
21		}	
22	}
23	
24	jQuery(".status").fadeOut();
25	jQuery(".preloader").delay(1000).fadeOut("slow");
26	setTimeout(zerif_display_iframe_map, 500);
27
28    var modalClick, iframe, video;
29    jQuery( '.zerif-with-modal' ).click( function() {
30        modalClick = jQuery( this );
31        jQuery( 'html' ).css( 'overflow', 'hidden' );
32        modalClick.parent().find( '.zerif-modal-wrap' ).css( 'display', 'block' );
33        if( modalClick.parent().find( '.zerif-modal-wrap iframe' ).length > 0 ) {
34            iframe = modalClick.parent().find('.zerif-modal-wrap iframe');
35        } else {
36            iframe = undefined;
37        }
38        if( modalClick.parent().find( '.zerif-modal-wrap video' ).length > 0 ) {
39            video = modalClick.parent().find('.zerif-modal-wrap video' );
40        } else {
41            video = undefined;
42        }
43        if( iframe != undefined && iframe.attr( 'src' ) == '' ) {
44            iframe.attr('src', iframe.attr('data-src'));
45        }
46    } );
47
48    jQuery( '.zerif-close-modal, .zerif-close-modal-button' ).click( function() {
49        jQuery( 'html' ).css( 'overflow-y', 'scroll' );
50        jQuery( '.zerif-modal-wrap' ).css( 'display', 'none' );
51        if( video != undefined ) {
52            video.get(0).stop();
53            video.get(0).currentTime = 0;
54        }
55        if( iframe != undefined ) {
56            iframe.attr('data-src', iframe.attr('src')).attr('src', '');
57        }
58    } );
59
60
61});
62
63/** BACKGROUND SLIDER ***/
64jQuery(document).ready(function(){
65	if ( jQuery('.fadein-slider .slide-item').length > 1 ) {
66		jQuery('.fadein-slider .slide-item:gt(0)').hide();
67		setInterval(function(){
68			jQuery('.fadein-slider :first-child').fadeOut(2000).next('.slide-item').fadeIn(2000).end().appendTo('.fadein-slider');
69		}, 10000);
70	}
71});
72
73
74/* RESPONSIVE BACKGROUND ON MOBILE */
75var portraitViewInit = 0, // Initial viewport orientation: Default Landscape
76    resize = false;
77jQuery( document ).ready( zerif_bg_responsive );
78jQuery( window ).resize( zerif_bg_responsive );
79function zerif_bg_responsive() {
80  if( jQuery( '#mobile-bg-responsive' ).length > 0 && jQuery( 'body.custom-background' ).length > 0 && isMobile.any() ) {
81    // There is background image
82    var windowWidth   = window.innerWidth;
83    var windowHeight  = window.innerHeight;
84    // Check if orientation is Portrait or Landscape: Default is Landscape
85    portraitView = 0;
86    if( windowHeight >= windowWidth ) {
87      portraitView = 1;
88    }
89    if( isMobile.iOS() ) {
90      windowHeight+=100;
91    }
92    if( portraitViewInit != portraitView ) {
93      var bgHelper = jQuery( '.zerif-mobile-bg-helper-bg' );
94      if( !resize ) {
95        var imgURL = jQuery( 'body.custom-background' ).css( 'background-image' );
96        jQuery( '.zerif-mobile-bg-helper-bg-inside' ).css( { 
97          'background-image': imgURL,
98        } ).addClass( 'zerif-mobile-h-inside' );
99        jQuery( '.zerif-mobile-bg-helper-wrap-all' ).addClass( 'zerif-mobile-h-all' );
100        jQuery( '.zerif-mobile-bg-helper-content' ).addClass( 'zerif-mobile-h-content' );
101        bgHelper.css( {
102          'width':      windowWidth,
103          'height':     windowHeight
104        } ).addClass( 'zerif-mobile-h-bg' );
105        portraitViewInit = portraitView;
106        resize = true;
107      } else {
108        // Resize window
109        bgHelper.css( {
110          'width':      windowWidth,
111          'height':     windowHeight
112        } );
113        portraitViewInit = portraitView;
114      }
115    }
116  }
117}
118
119
120/*** DROPDOWN FOR MOBILE MENU */
121var zerif_callback_mobile_dropdown = function () {
122
123  if( jQuery( '.wr-megamenu-container' ).length <= 0 && jQuery( '.mega-menu-wrap' ).length <= 0 ) {
124    var navLi = jQuery('#site-navigation li');
125    navLi.each(function(){
126        if ( jQuery(this).find('ul').length > 0 && !jQuery(this).hasClass('has_children') ){
127            jQuery(this).addClass('has_children');
128            jQuery(this).find('a').first().after('<p class="dropdownmenu"></p>');
129        }
130    });
131    jQuery('.dropdownmenu').click(function(){
132        if( jQuery(this).parent('li').hasClass('this-open') ){
133            jQuery(this).parent('li').removeClass('this-open');
134        }else{
135            jQuery(this).parent('li').addClass('this-open');
136        }
137    });
138
139    navLi.find('a').click(function(){
140        jQuery('#site-navigation').parent().find('.navbar-toggle').addClass('collapsed');
141        jQuery('#site-navigation').parent().find('.collapse').removeClass('in');
142    });
143  }
144
145};
146jQuery(document).ready(zerif_callback_mobile_dropdown);
147
148
149/* show/hide reCaptcha */
150jQuery(document).ready(function() {
151
152  var thisOpen = false;
153  jQuery('.contact-form .form-control').each(function(){
154    if ( (typeof jQuery(this).val() != 'undefined') && (jQuery(this).val().length > 0) ){
155      thisOpen = true;
156      jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1');
157      return false;
158    }
159  });
160  if ( thisOpen == false && (typeof jQuery('.contact-form textarea').val() != 'undefined') && (jQuery('.contact-form textarea').val().length > 0) ) {
161    thisOpen = true;
162    jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1');
163  }
164  jQuery('.contact-form input, .contact-form textarea').focus(function(){
165    if ( !jQuery('.zerif-g-recaptcha').hasClass('recaptcha-display') ) {
166        jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1');
167    }
168  });
169
170});
171
172/* Bootstrap Fix */
173if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
174	
175	var msViewportStyle = document.createElement('style')
176
177	msViewportStyle.appendChild(
178
179		document.createTextNode(
180
181			'@-ms-viewport{width:auto!important}'
182
183		)
184
185	)
186
187	document.querySelector('head').appendChild(msViewportStyle);
188
189}
190
191jQuery(document).ready(function() {
192	
193	/* PARALLAX */
194	var jQuerywindow = jQuery(window);
195
196	jQuery('div[data-type="background"], header[data-type="background"], section[data-type="background"]').each(function(){
197
198		var jQuerybgobj = jQuery(this);
199
200		jQuery(window).scroll(function() {
201
202			var yPos = -(jQuerywindow.scrollTop() / jQuerybgobj.data('speed'));
203
204			var coords = '50% '+ yPos + 'px';
205
206			jQuerybgobj.css({ 
207
208				backgroundPosition: coords 
209
210			});
211
212		});
213
214	});
215	
216});
217
218
219/*=================================
220===  SMOOTH SCROLL             ====
221=================================== */
222
223jQuery(document).ready(function(){
224  jQuery('#site-navigation a[href*="#"]:not([href="#"]), header.header a[href*="#"]:not([href="#"])').bind('click',function () {
225    var headerHeight;
226    var hash    = this.hash;
227    var idName  = hash.substring(1);    // get id name
228    var alink   = this;                 // this button pressed
229    // check if there is a section that had same id as the button pressed
230    if ( jQuery('section [id*=' + idName + ']').length > 0 && jQuery(window).width() >= 751 ){
231      jQuery('#site-navigation .current').removeClass('current');
232      jQuery(alink).parent('li').addClass('current');
233    }else{
234      jQuery('#site-navigation .current').removeClass('current');
235    }
236    if ( jQuery(window).width() >= 751 ) {
237      headerHeight = jQuery('#main-nav').height();
238    } else {
239      headerHeight = 0;
240    }
241    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
242      var target = jQuery(this.hash);
243      target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
244      if (target.length) {
245        jQuery('html,body').animate({
246          scrollTop: target.offset().top - headerHeight + 5
247        }, 1200);
248        return false;
249      }
250    }
251  });
252});
253
254jQuery(document).ready(function(){
255    var headerHeight;
256    jQuery('#site-navigation .current').removeClass('current');
257    jQuery('#site-navigation a[href$="' + window.location.hash + '"]').parent('li').addClass('current');
258    if ( jQuery(window).width() >= 751 ) {
259      headerHeight = jQuery('#main-nav').height();
260    } else {
261      headerHeight = 0;
262    }
263    if (location.pathname.replace(/^\//,'') == window.location.pathname.replace(/^\//,'') && location.hostname == window.location.hostname) {
264      var target = jQuery(window.location.hash);
265      if (target.length) {
266        jQuery('html,body').animate({
267          scrollTop: target.offset().top - headerHeight + 5
268        }, 1200);
269        return false;
270      }
271    }
272});
273
274/* TOP NAVIGATION MENU SELECTED ITEMS */
275function zerif_scrolled() {
276    
277      if ( jQuery(window).width() >= 751 ) {
278          var zerif_scrollTop = jQuery(window).scrollTop();       // cursor position
279          var headerHeight = jQuery('#main-nav').outerHeight();   // header height
280          var isInOneSection = 'no';                              // used for checking if the cursor is in one section or not
281          // for all sections check if the cursor is inside a section
282          jQuery("section, header").each( function() {
283            var thisID = '#' + jQuery(this).attr('id');           // section id
284            var zerif_offset = jQuery(this).offset().top;         // distance between top and our section
285            var thisHeight  = jQuery(this).outerHeight();         // section height
286            var thisBegin   = zerif_offset - headerHeight;                      // where the section begins
287            var thisEnd     = zerif_offset + thisHeight - headerHeight;         // where the section ends  
288            // if position of the cursor is inside of the this section
289            if ( zerif_scrollTop >= thisBegin && zerif_scrollTop <= thisEnd ) {
290              isInOneSection = 'yes';
291              jQuery('#site-navigation .current').removeClass('current');
292              jQuery('#site-navigation a[href$="' + thisID + '"]').parent('li').addClass('current');    // find the menu button with the same ID section
293              return false;
294            }
295            if (isInOneSection == 'no') {
296              jQuery('#site-navigation .current').removeClass('current');
297            }
298          });
299      }
300}
301jQuery(window).on('scroll',zerif_scrolled);
302
303
304
305jQuery(window).load(function() {
306
307    jQuery('header.header').css('opacity', '1');
308
309	/* SUBSCRIBE  */
310	jQuery("form :input").each(function(index, elem) {
311	
312		var eId = jQuery(elem).attr("class");
313	
314		if( (eId == "sib-email-area") || (eId == "sib-NAME-area") ) {
315		
316			var label = null;
317			if (eId && (label = jQuery(elem).parents("form").find("label."+eId)).length == 1) {
318				jQuery(elem).attr("placeholder", jQuery(label).html());
319				jQuery(label).remove();
320			}
321		}
322	});
323});	
324
325
326/* TOP NAVIGATION MENU SELECTED ITEMS */
327jQuery(window).scroll(function(){
328	
329	var zerif_scrollTop = jQuery(window).scrollTop();
330	var zerif_windowHeight = jQuery(window).height();
331	
332	jQuery("section").each( function() {
333		
334		var zerif_offset = jQuery(this).offset();
335		
336		if (zerif_scrollTop <= zerif_offset.top && (jQuery(this).height() + zerif_offset.top) < (zerif_scrollTop + zerif_windowHeight) ) {
337				
338			jQuery('ul.nav > li a').each( function() {
339				jQuery(this).removeClass('nav-active');
340			});
341			
342			var zerif_current_id_visible = jQuery(this).attr('id');
343			
344			jQuery('ul.nav > li a').each( function() {
345				if( jQuery(this).attr('href') ) {
346					if( jQuery(this).attr('href').indexOf(zerif_current_id_visible) >= 0 ) {
347						jQuery('ul.nav > li a').each( function() {
348							jQuery(this).removeClass('nav-active');
349						});
350						jQuery(this).addClass('nav-active');
351					}
352				}	
353				
354			});
355		}
356		
357	});
358
359});
360
361
362/* SETS THE HEIGHT OF THE HEADER */
363jQuery(window).load(function(){
364  setminHeightHeader();
365});
366jQuery(window).resize(function() {
367  setminHeightHeader();
368});
369function setminHeightHeader() {
370  if ( jQuery('#main-nav').css('min-height') != 75 || jQuery('.header').css('min-height') != 75 ) {
371    jQuery('#main-nav').css('min-height',75);
372    jQuery('.header').css('min-height',75);
373  }
374  if ( jQuery(window).width() > 750 ) {
375      var minHeight = parseInt( jQuery('#main-nav').height() );
376      jQuery('#main-nav').css('min-height',minHeight);
377      jQuery('.header').css('min-height',minHeight);
378  }
379}
380/* - */
381
382
383/* STICKY FOOTER */
384jQuery(window).load(function(){
385  fixFooterBottom();
386});
387jQuery(window).resize(function() {
388  fixFooterBottom();
389});
390
391function fixFooterBottom(){
392
393	var header      = jQuery('header.header');
394	var footer      = jQuery('footer#footer');
395	var content     = jQuery('.site-content > .container');
396
397	content.css('min-height', '1px');
398
399	var headerHeight  = header.outerHeight();
400	var footerHeight  = footer.outerHeight();
401	var contentHeight = content.outerHeight();
402	var windowHeight  = jQuery(window).height();
403
404	var totalHeight = headerHeight + footerHeight + contentHeight;
405
406	if (totalHeight<windowHeight){
407	  content.css('min-height', windowHeight - headerHeight - footerHeight );
408	}else{
409	  content.css('min-height','1px');
410	}
411}
412
413
414/*** CENTERED MENU */
415var zerif_callback_menu_align = function () {
416
417	var headerWrap 		= jQuery('.header');
418	var navWrap 		= jQuery('#site-navigation');
419	var logoWrap 		= jQuery('.responsive-logo');
420	var containerWrap 	= jQuery('.container');
421	var classToAdd		= 'menu-align-center';
422
423	if ( headerWrap.hasClass(classToAdd) ) 
424	{
425        headerWrap.removeClass(classToAdd);
426	}
427    var logoWidth 		= logoWrap.outerWidth();
428    var menuWidth 		= navWrap.outerWidth();
429    var containerWidth 	= containerWrap.width();
430
431    if ( menuWidth + logoWidth > containerWidth ) {
432        headerWrap.addClass(classToAdd);
433    }
434    else
435    {
436        if ( headerWrap.hasClass(classToAdd) )
437        {
438            headerWrap.removeClass(classToAdd);
439        }
440    }
441}
442jQuery(window).load(zerif_callback_menu_align);
443jQuery(window).resize(zerif_callback_menu_align);
444
445var isMobile = {
446    Android: function() {
447        return navigator.userAgent.match(/Android/i);
448    },
449    BlackBerry: function() {
450        return navigator.userAgent.match(/BlackBerry/i);
451    },
452    iOS: function() {
453        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
454    },
455    Opera: function() {
456        return navigator.userAgent.match(/Opera Mini/i);
457    },
458    Windows: function() {
459        return navigator.userAgent.match(/IEMobile/i);
460    },
461    any: function() {
462        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
463    }
464};
465
466/* Rollover on mobile devices */
467if( isMobile.any() ) {
468
469  /* Our team section */
470    jQuery('.team-member').on('click', function(){
471        jQuery('.team-member-open').removeClass('team-member-open');
472        jQuery(this).addClass('team-member-open');
473        event.stopPropagation();
474    });    
475    jQuery("html").click(function() {
476      jQuery('.team-member-open').removeClass('team-member-open');
477  });
478  
479  /* Portfolio section */
480  jQuery(document).ready(function(){
481      jQuery('.cbp-rfgrid li').prepend('<p class="cbp-rfgrid-tr"></p>');
482  });
483    jQuery('.cbp-rfgrid li').on('click', function(){
484        if ( !jQuery(this).hasClass('cbp-rfgrid-open') ){
485            jQuery('.cbp-rfgrid-tr').css('display','block');
486            jQuery('.cbp-rfgrid-open').removeClass('cbp-rfgrid-open');
487            
488            jQuery(this).addClass('cbp-rfgrid-open');
489            jQuery(this).find('.cbp-rfgrid-tr').css('display','none');
490            event.stopPropagation();            
491        }
492    });
493    jQuery("html").click(function() {
494        jQuery('.cbp-rfgrid-tr').css('display','block');
495        jQuery('.cbp-rfgrid-open').removeClass('cbp-rfgrid-open');
496  });
497    
498}
499
500/* latest news */
501jQuery(window).load(function(){
502
503  if( jQuery( '#carousel-homepage-latestnews').length > 0 && isMobile.any() ) {
504    if( jQuery( '#carousel-homepage-latestnews div.item' ).length < 2 ) {
505      jQuery( '#carousel-homepage-latestnews > a' ).css('display','none');
506    }
507    var maxheight = 0;
508    jQuery( '#carousel-homepage-latestnews div.item' ).each(function(){
509      if( jQuery(this).height() > maxheight ) {
510        maxheight = jQuery(this).height();
511      }
512    });
513    jQuery( '#carousel-homepage-latestnews div.item' ).height(maxheight);
514  }
515
516});
517
518
519/* testimonial Masonry style */
520var window_width_old;
521var exist_class = false;
522jQuery(document).ready(function(){
523  if( jQuery('.testimonial-masonry').length>0 ){
524    exist_class = true;
525    window_width_old = jQuery('.container').outerWidth();
526    if( window_width_old < 970 ) {
527        jQuery('.testimonial-masonry').zerifgridpinterest({columns: 1,selector: '.feedback-box'});
528    } else {
529        jQuery('.testimonial-masonry').zerifgridpinterest({columns: 3,selector: '.feedback-box'});
530    }
531  }
532});
533
534jQuery(window).resize(function() {
535    if( window_width_old != jQuery('.container').outerWidth() && exist_class === true ){
536        window_width_old = jQuery('.container').outerWidth();
537        if( window_width_old < 970 ) {
538            jQuery('.testimonial-masonry').zerifgridpinterest({columns: 1,selector: '.feedback-box'});
539        } else {
540            jQuery('.testimonial-masonry').zerifgridpinterest({columns: 3,selector: '.feedback-box'});
541        }
542    }
543});
544
545
546(function ($, window, document, undefined) {
547    var defaults = {
548            columns:                3,
549            selector:               'div',
550            excludeParentClass:     '',
551        };
552    function ZerifGridPinterest(element, options) {
553        this.element    = element;
554        this.options    = $.extend({}, defaults, options);
555        this.defaults   = defaults;
556        this.init();
557    }
558    ZerifGridPinterest.prototype.init = function () {
559        var self            = this,
560            $container      = $(this.element);
561            $select_options = $(this.element).children();
562        self.make_magic( $container, $select_options );
563    };
564    ZerifGridPinterest.prototype.make_magic = function (container) {
565        var self            = this;
566            $container      = $(container),
567            columns_height  = [],
568            prefix          = 'zerif',
569            unique_class    = prefix + '_grid_' + self.make_unique();
570            local_class     = prefix + '_grid';
571        var classname;
572        var substr_index    = this.element.className.indexOf(prefix+'_grid_');
573        if( substr_index>-1 ) {
574            classname = this.element.className.substr( 0, this.element.className.length-unique_class.length-local_class.length-2 );
575        } else {
576            classname = this.element.className;
577        }
578        var my_id;
579        if( this.element.id == '' ) {
580            my_id = prefix+'_id_' + self.make_unique();
581        } else {
582            my_id = this.element.id;
583        }
584        $container.after('<div id="' + my_id + '" class="' + classname + ' ' + local_class + ' ' + unique_class + '"></div>');
585        var i;
586        for(i=1; i<=this.options.columns; i++){
587            columns_height.push(0);
588            var first_cols = '';
589            var last_cols = '';
590            if( i%self.options.columns == 1 ) { first_cols = prefix + '_grid_first'; }
591            if( i%self.options.columns == 0 ) { first_cols = prefix + '_grid_last'; }
592            $('.'+unique_class).append('<div class="' + prefix + '_grid_col_' + this.options.columns +' ' + prefix + '_grid_column_' + i +' ' + first_cols + ' ' + last_cols + '"></div>');
593        }
594        if( this.element.className.indexOf(local_class)<0 ){
595            $container.children(this.options.selector).each(function(index){
596                var min = Math.min.apply(null,columns_height);
597                var this_index = columns_height.indexOf(min)+1;
598                $(this).attr(prefix+'grid-attr','this-'+index).appendTo('.'+unique_class +' .' + prefix + '_grid_column_'+this_index);
599                columns_height[this_index-1] = $('.'+unique_class +' .' + prefix + '_grid_column_'+this_index).height();
600            });
601        } else {
602            var no_boxes = $container.find(this.options.selector).length;
603            var i;
604            for( i=0; i<no_boxes; i++ ){
605                var min = Math.min.apply(null,columns_height);
606                var this_index = columns_height.indexOf(min)+1;
607                $('#'+this.element.id).find('['+prefix+'grid-attr="this-'+i+'"]').appendTo('.'+unique_class +' .' + prefix + '_grid_column_'+this_index);
608                columns_height[this_index-1] = $('.'+unique_class +' .' + prefix + '_grid_column_'+this_index).height();
609            }
610        }
611        $container.remove();
612    }
613    ZerifGridPinterest.prototype.make_unique = function () {
614        var text = "";
615        var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
616        for( var i=0; i<10; i++ )
617            text += possible.charAt(Math.floor(Math.random() * possible.length));
618        return text;
619    }
620    $.fn.zerifgridpinterest = function (options) {
621        return this.each(function () {
622            var value = '';
623            if (!$.data(this, value)) {
624                $.data(this, value, new ZerifGridPinterest(this, options) );
625            }
626        });
627    }
628})(jQuery);
629/* Header section */
630jQuery(window).load(zerif_parallax_effect);
631jQuery(window).resize(zerif_parallax_effect);
632
633function zerif_parallax_effect(){
634
635    if( jQuery('#parallax_move').length>0 ) {
636      var scene = document.getElementById('parallax_move');
637      var window_width = jQuery(window).outerWidth();
638      jQuery('#parallax_move').css({
639        'width':            window_width + 120,
640        'margin-left':      -60,
641        'margin-top':       -60,
642        'position':         'absolute',
643      });
644      var h = jQuery('header#home').outerHeight();
645      jQuery('#parallax_move').children().each(function(){
646        jQuery(this).css({
647            'height': h+100,
648        });
649      });
650      if( !isMobile.any() ) {
651        var parallax = new Parallax(scene);
652      } else {
653        jQuery('#parallax_move').css({
654          'z-index': '0',
655        });
656        jQuery('#parallax_move .layer').css({
657          'position': 'absolute',
658          'top': '0',
659          'left': '0',
660          'z-index': '1',
661        });
662      }
663    }
664
665}
666
667
668/* Menu levels */
669jQuery( document ).ready( function() {
670  jQuery( '#site-navigation' ).zerifsubmenuorientation();
671} );
672;(function ($, window) {
673    var defaults = {
674        // 'true'   -> if there is a big submenu all submenu will be aligned to the right
675        // 'false'  -> Only big submenu will be aligned to the right
676        allItems: false,
677      };
678    function ZerifSubmenuOrientation(element, options) {
679      this.element  = element;
680      this.options  = $.extend({}, defaults, options);
681      this.defaults = defaults;
682      this.init();
683    }
684    ZerifSubmenuOrientation.prototype.init = function () {
685      var self            = this,
686          $container      = $(this.element),
687          $select_options = $(this.element).children();
688      var resize_finish;
689      if( self.options.allItems !== true ) {
690        $(window).resize(function() {
691            clearTimeout(resize_finish);
692            resize_finish = setTimeout( function () {
693                self.make_magic($container, $select_options);
694            }, 11);
695        });
696      }
697      self.make_magic($container, $select_options);
698      if( self.options.allItems !== true ) {
699        setTimeout(function() {
700            $(window).resize();
701        }, 500);
702      }
703    };
704    ZerifSubmenuOrientation.prototype.make_magic = function (container, select_options) {
705      var self            = this,
706          $container      = $(container),
707          $select_options = $(select_options);
708      var itemWrap;
709      if( $container[0].tagName == 'UL' ) {
710        itemWrap = $container[0];
711      } else {
712        itemWrap = $container.find( 'ul' )[0];
713      }
714      var windowsWidth = window.innerWidth;
715	  if( typeof itemWrap != 'undefined' ) {
716		
717		var itemId = '#' + itemWrap.id;
718	  
719		  $( itemId ).children( 'li' ).each( function() {
720			if ( this.id == '' ) { return; }
721			var max_deep = self.max_deep( '#'+this.id );
722			var offsetLeft        = $( "#"+this.id ).offset().left;
723			var submenuWidthItem  = $( "#"+this.id ).find( 'ul' ).width();
724			var submenuTotalWidth = max_deep * submenuWidthItem;
725			if( submenuTotalWidth > 0 && windowsWidth < offsetLeft + submenuTotalWidth ) {
726			  if( self.options.allItems === true ) {
727				$( '#'+itemWrap.id ).addClass( 'menu-item-open-left-all' );
728				return false;
729			  }
730			  $( '#'+this.id ).addClass( 'menu-item-open-left' );
731			} else if( $( '#'+this.id ).hasClass( 'menu-item-open-left' ) ) {
732			  $( '#'+this.id ).removeClass( 'menu-item-open-left' );
733			}
734		  } );
735	  }  
736    };
737    ZerifSubmenuOrientation.prototype.max_deep = function ( item ) {
738      var maxDepth      = -1, 
739          currentDepth  = -1;
740      $( item + " li:not(:has(ul))").each(function() {
741        currentDepth = $(this).parents("ul").length;
742        if (currentDepth > maxDepth) {
743           maxDepth = currentDepth;
744        }
745      });
746      return maxDepth - 1;
747    }
748    $.fn.zerifsubmenuorientation = function (options) {
749      return this.each(function () {
750        var value = '';
751          if (!$.data(this, value)) {
752              $.data(this, value, new ZerifSubmenuOrientation(this, options) );
753          }
754      });
755    }
756})(jQuery,window);
757
758/************************************/
759/*********Accessibility Menu*********/
760/************************************/
761(function( $ ) { 'use strict';
762    // make dropdowns functional on focus
763    $( '.primary-menu' ).find( 'a' ).on( 'focus blur', function() {
764        $( this ).parents( 'ul, li' ).toggleClass( 'acc-focus' );
765    } );
766
767    $(".primary-menu ul").find('.dropdownmenu').remove();
768
769
770    // menu navigation with arrow keys
771    $('.menu-item a').on('keydown', function(e) {
772
773        // left key
774        if(e.which === 37) {
775            e.preventDefault();
776            $(this).parent().prev().children('a').focus();
777        }
778        // right key
779        else if(e.which === 39) {
780            e.preventDefault();
781            $(this).parent().next().children('a').focus();
782        }
783        // down key
784        else if(e.which === 40) {
785            e.preventDefault();
786            if($(this).next().length){
787                $(this).next().next().find('li:first-child a').first().focus();
788            }
789            else {
790                $(this).parent().next().children('a').focus();
791            }
792        }
793        // up key
794        else if(e.which === 38) {
795            e.preventDefault();
796            if($(this).parent().prev().length){
797                $(this).parent().prev().children('a').focus();
798            }
799            else {
800                $(this).parents('ul').first().prev().prev().focus();
801            }
802        }
803
804    });
805
806    $('.navbar-toggle').click(function(){
807
808        $('.primary-menu').slideToggle('slow', function() {
809           $(this).toggleClass('zerif-hide-on-mobile', $(this).is(':visible'));
810        });
811        $(this).removeAttr('style');
812    });
813
814    if( jQuery( '.wr-megamenu-container' ).length === 0 && jQuery( '.mega-menu-wrap' ).length === 0 ) {
815
816        $('.primary-menu ul li.menu-item-has-children').children('a').after('<button class="dropdownmenu dropdown-toggle"><span class="screen-reader-text">Submenu</span></button>');
817        $('.primary-menu ul li.menu-item-has-children .dropdownmenu').click(function () {
818            $(this).parent().find('.sub-menu').slideToggle();
819        });
820
821        $('.primary-menu ul li.page_item_has_children').children('a').after('<button class="dropdownmenu dropdown-toggle"><span class="screen-reader-text">Submenu</span></button>');
822        $('.primary-menu ul li.page_item_has_children .dropdownmenu').click(function () {
823            $(this).parent().find('.sub-menu').slideToggle();
824        });
825
826    }
827
828} )( 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.