PageSourceSearch

https://www.anchin.com/wp-content/themes/ace/js/main.js?ver=7.1.2

js anchin.com collected 2026-10-03 19:50:31 UTC 29,374 bytes, 998 lines download raw bytes

1var $ = jQuery;
2
3$(document).ready(function(){
4	pathwayListUnderline();	
5	initSearchAndFilterSelect();
6	$(window).on('scroll resize', function() {
7		$('.select-container.open').each(function() {
8			repositionSelectboxOverflow($(this).find('.options-container'));
9		});
10	});
11	$(window).trigger('resize');
12
13	$('.team-member strong').matchHeight({
14		property: 'min-height',
15    });
16
17
18	/*==================================================================
19	=           WYSIWYG YouTube Button - WP Editor                     =
20	==================================================================*/
21
22	const youTubeWraps = document.querySelectorAll('.ytvideo');
23
24	if (youTubeWraps.length > 0) {
25
26		function loadAndPlayYouTube(e) {
27			e.preventDefault;
28			const id = this.getAttribute('id');
29			this.classList.add('clicked');
30			if (this.classList.contains('custom-placeholder')) {
31				//Add responsive iframe styles
32				this.classList.add('ytvideo');
33			}
34
35			this.innerHTML = '<iframe width="560" height="315" src="https://www.youtube.com/embed/' + id + '?rel=0&autoplay=1" frameborder="0" allow="autoplay; accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
36		}
37
38		youTubeWraps.forEach(function (youTubeWrap) {
39			const ytId = youTubeWrap.getAttribute('id');
40			
41			if (youTubeWrap.innerHTML.includes('<img') === false) {
42				youTubeWrap.innerText = '';
43				youTubeWrap.style.backgroundImage = 'url(https://i3.ytimg.com/vi/' + ytId + '/maxresdefault.jpg)';
44			} else {
45				youTubeWrap.classList.remove('ytvideo');
46				youTubeWrap.classList.add('custom-placeholder');
47			}
48
49			youTubeWrap.addEventListener('click', loadAndPlayYouTube);
50		});
51
52	}
53
54	/*=====  End of Add YouTube Button to WP Dashboard WYSIWYG  ======*/
55
56
57	var config = {
58		sensitivity: 9, // number = sensitivity threshold (must be 1 or higher)
59		interval: 0,  // number = milliseconds for onMouseOver polling interval
60		over: doOpen,   // function = onMouseOver callback (REQUIRED)
61		timeout: 100,   // number = milliseconds delay before onMouseOut
62		out: doClose    // function = onMouseOut callback (REQUIRED)
63	};
64	function doOpen() {
65		$(this).addClass('hover');
66	}
67	function doClose() {
68		$(this).removeClass('hover');
69	}
70	$('.site-nav .nav-element.has-sub').hoverIntent(config);
71
72	$('.homepage-hero .overlay').hover(function(){
73		var isLeft = $(this).hasClass('left');
74		if(isLeft) {
75			$('.homepage-hero .button.left').addClass('hover');
76			playVideo($('.homepage-hero .mask.left video'));
77		} else {
78			$('.homepage-hero .button.right').addClass('hover');
79			playVideo($('.homepage-hero .mask.right video'));
80		}
81	}, function(){
82		var isLeft = $(this).hasClass('left');
83		if(isLeft) {
84			$('.homepage-hero .button.left').removeClass('hover');
85			pauseVideo($('.homepage-hero .mask.left video'));
86		} else {
87			$('.homepage-hero .button.right').removeClass('hover');
88			pauseVideo($('.homepage-hero .mask.right video'));
89		}
90	});
91
92	$('.pathway-list .show-on-large ul li a').hover(function() {
93		var li = $(this).parent(),
94			parent = $(this).closest('.show-on-large'),
95			bg = li.data('bg');
96		$('li.active', parent).removeClass('active');
97		li.addClass('active');
98		$('.background-image', parent).css('background-image', 'url('+bg+')');
99	});
100
101	$('.pathway-list .show-on-large ul li:first-child a').trigger('mouseenter');
102
103	$('.logo-carousel .carousel').slick({
104		arrows: true,
105		dots: false,
106		autoplay: false,
107		infinite: true,
108		slidesToShow: 4,
109		slidesToScroll: 4,
110		speed: 1000,
111		prevArrow:"<span class='slick-prev icon-arrow-prev'></span>",
112        nextArrow:"<span class='slick-next icon-arrow-next'></span>",
113		rows: 0,
114		responsive: [
115			{
116			  breakpoint: 1024,
117			  settings: {
118				slidesToShow: 3,
119				slidesToScroll: 3,
120			  }
121			},
122			{
123				breakpoint: 768,
124				settings: {
125					slidesToShow: 2,
126					slidesToScroll: 2,
127				}
128			}
129		]
130	});
131
132	$('.pathway-list .carousel').slick({
133		arrows: true,
134		dots: false,
135		variableWidth: true,	
136		infinite: false,
137		prevArrow:'<span class="slick-prev material-icons">arrow_left</span>',
138        nextArrow:'<span class="slick-next material-icons">arrow_right</span>',
139		rows: 0
140	});
141
142	$(window).on('load resize orientationchange', function() {
143        $('.pathway-cards-image .grid').each(function(){
144            var $carousel = $(this);
145            // slick on mobile
146            if ($(window).width() > 768) {
147                if ($carousel.hasClass('slick-initialized')) {
148                    $carousel.slick('unslick');
149                }
150            }
151            else{
152                if (!$carousel.hasClass('slick-initialized')) {
153                    $carousel.slick({
154											arrows: false,
155											dots: false,
156											variableWidth: true,
157											mobileFirst: true,
158											rows: 0,
159											infinite: false,
160                    });
161                }
162            }
163        });
164    });
165
166	$('.image-video-carousel .carousel').slick({
167		slidesToShow: 1,
168		slidesToScroll: 1,
169		arrows: false,
170		dots: false,
171		fade: true,
172		asNavFor: '.image-video-carousel .carousel-nav',
173		rows: 0,
174	});
175	
176	$('.image-video-carousel .carousel-nav').slick({
177		slidesToShow: 4,
178		slidesToScroll: 1,
179		asNavFor: '.image-video-carousel .carousel',
180		prevArrow:'<span class="slick-prev material-icons">arrow_left</span>',
181        nextArrow:'<span class="slick-next material-icons">arrow_right</span>',
182		dots: false,
183		arrows: true,
184		focusOnSelect: true,
185		centerMode: false,
186		rows: 0,
187		responsive: [
188			{
189			  breakpoint: 768,
190			  settings: {
191				slidesToShow: 3,
192			  }
193			},
194			{
195				breakpoint: 576,
196				settings: {
197					slidesToShow: 2,
198				}
199			}
200		]
201	});
202
203	$('.team-carousel .carousel').slick({
204		arrows: false,
205		dots: true,
206		adaptiveHeight: true,
207		rows: 0
208	});
209
210	$('.image-carousel .carousel').slick({
211		autoplay: false,
212		speed: 3000,
213    	arrows: true,
214		dots: false,
215		slidesToShow: 1,
216		centerMode: true,
217		variableWidth: true,
218		infinite: true,	
219		prevArrow:"<span class='slick-prev icon-arrow-prev'></span>",
220        nextArrow:"<span class='slick-next icon-arrow-next'></span>",
221		rows: 0,
222		responsive: [
223			{
224			  breakpoint: 768,
225			  settings: {
226				centerMode: false,
227				slidesToScroll: 2,
228				// infinite: false,	
229			  }
230			},
231		],	
232	});
233
234	$('.testimonials-carousel-full-image .carousel').slick({
235		autoplay: false,
236		speed: 3000,
237    	arrows: false,
238		dots: true,
239		slidesToShow: 1,
240		infinite: true,	
241		prevArrow:"<span class='slick-prev icon-arrow-prev'></span>",
242        nextArrow:"<span class='slick-next icon-arrow-next'></span>",
243		rows: 0,
244		responsive: [
245			{
246			  breakpoint: 768,
247			  settings: {
248				arrows: true,
249				dots: false,
250				infinite: true,
251			  }
252			},
253		],	
254	}).on('afterChange',function(event){
255		fixVerticalArrows(this);
256	}).trigger('afterChange');;
257
258	$('.testimonials-carousel-small-image .carousel').slick({
259		autoplay: false,
260		speed: 3000,
261    	arrows: false,
262		dots: true,
263		slidesToShow: 1,
264		infinite: true,	
265		prevArrow:"<span class='slick-prev icon-arrow-prev'></span>",
266        nextArrow:"<span class='slick-next icon-arrow-next'></span>",
267		rows: 0,
268		responsive: [
269			{
270			  breakpoint: 768,
271			  settings: {
272				arrows: true,
273				dots: false,
274				infinite: false,
275			  }
276			},
277		],	
278	}).on('afterChange',function(event){
279		fixVerticalArrows($(this));
280	}).trigger('afterChange');
281
282	// Team Carousel
283	$('.single-team .featured-insights-carousel .carousel').slick({
284		autoplay: false,
285		speed: 2000,
286		arrows: false,
287		dots: true,
288		slidesToScroll: 3,
289		slidesToShow: 3,
290		infinite: true,
291		rows: 0,
292		responsive: [
293			{
294				breakpoint: 1200,
295				settings: {
296					slidesToScroll: 2,
297					slidesToShow: 2,
298				}
299			},
300			{
301				breakpoint: 768,
302				settings: {
303					slidesToScroll: 1,
304					slidesToShow: 1,
305				}
306			}
307		],	
308	});
309
310	$(window).on('resize', function(){
311		$('.testimonials-carousel-full-image .carousel, .testimonials-carousel-small-image .carousel').each(function(){
312			fixVerticalArrows($(this));
313		});
314		pathwayListUnderline();
315
316		var teamFilter = $('#search-filter-form-665');
317		if (window.innerWidth < 1024 && teamFilter.length) {
318			$('.team-archive-template .template-side.show-on-mobile').append(teamFilter);
319		} else {
320			$('.team-archive-template .template-side .show-on-large').append(teamFilter);
321		}
322
323	}).trigger('resize');
324
325	$(window).on('DOMContentLoaded load resize scroll', function(){
326		var carousel = $('.logo-carousel .carousel');
327		if(carousel.length && isElementPartiallyInViewport(carousel)) {
328			if(!carousel.get(0).slick.options.autoplay) {
329				carousel.slick('slickSetOption', 'autoplay', true, true);
330			}
331		}
332
333		// Testimonials Carousel - full
334		var testimonialCarouselFull = $('.testimonials-carousel-full-image .carousel');
335		if(testimonialCarouselFull.length && isElementPartiallyInViewport(testimonialCarouselFull)) {
336			if(!testimonialCarouselFull.get(0).slick.options.autoplay) {
337				testimonialCarouselFull.slick('slickSetOption', 'autoplay', true, true);
338			}
339		}
340
341		// Testimonials Carousel - small
342		var testimonialCarouselSmall = $('.testimonials-carousel-small-image .carousel');
343		if(testimonialCarouselSmall.length && isElementPartiallyInViewport(testimonialCarouselSmall)) {
344			if(!testimonialCarouselSmall.get(0).slick.options.autoplay) {
345				testimonialCarouselSmall.slick('slickSetOption', 'autoplay', true, true);
346			}
347		}
348
349		// Image Carousel
350		var imgCarousel = $('.image-carousel .carousel');
351		if(imgCarousel.length && isElementPartiallyInViewport(imgCarousel)) {
352			if(!imgCarousel.get(0).slick.options.autoplay) {
353				imgCarousel.slick('slickSetOption', 'autoplay', true, true);
354			}
355		}
356	});
357
358	/* --------------------------------------------------
359			Smooth Anchor Scrolling
360		-------------------------------------------------- */
361
362		function smoothScrolling(target, animationTime) {
363
364			// var headerHeight = $(".site-header .wrapper").height(); // set to 0 if nav is not fixed.
365			// console.log(headerHeight);
366			var headerHeight = 90; // set to 0 if nav is not fixed.
367			$('html, body').animate({
368			  scrollTop: target.offset().top - headerHeight
369
370			}, animationTime, function() {
371			  // Callback after animation
372			  // Must change focus!
373			  var $target = $(target);
374			  $target.focus();
375			  // if ($target.is(":focus")) { // Checking if the target was focused
376			  //   return false;
377			  // } else {
378			  //   $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
379			  //   $target.focus(); // Set focus again
380			  // };
381			});
382		}
383
384    // Click of anchor on same page as target
385		$('a[href*="#"]')
386		  // Remove links that don't actually link to anything
387		  .not('[href="#"]')
388		  .not('[href="#0"]')
389		  .click(function(event) {
390		    // On-page links
391		    if (
392		      location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
393		      &&
394		      location.hostname == this.hostname
395		    ) {
396		      // Figure out element to scroll to
397		      var target = $(this.hash);
398		      target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
399
400		      // Does a scroll target exist?
401		      if (target.length) {
402		        // Only prevent default if animation is actually gonna happen
403		        event.preventDefault();
404		        smoothScrolling(target, 500);
405		      }
406		    }
407
408		});
409
410		// On page load check
411		var pageLoadTargetHash = location.hash;
412
413		// If url has # is not just a # and first char is not a number
414		if (pageLoadTargetHash.length > 1 && !/\d/.test(pageLoadTargetHash.charAt(1))) {
415			const targetExists = document.querySelector(pageLoadTargetHash);
416			if(targetExists) {
417				var $pageTarget = $(pageLoadTargetHash);
418				smoothScrolling($pageTarget, 0);
419			}
420		}
421		// End  On page load if there is a #
422
423		/* --------------------------------------------------
424			End Smooth Anchor Scrolling
425		-------------------------------------------------- */
426
427
428	// Text Standard Subpage mobile sidebar
429	var textModuleWithSidebar = $('.page-module.text');
430	textModuleWithSidebar.each(function () {
431		if ($(this).find('.split > .sidebar').length) {
432			var clonedTextModule = $(this).clone();
433			clonedTextModule.find('.split > .content').remove();
434			clonedTextModule.addClass('cloned-text-module');
435			clonedTextModule.insertBefore('.site-footer');
436		}
437	});
438	
439	
440	jQuery('.pathway-cards-blue-icon i img').each(function(){
441		var $img = jQuery(this);
442		var imgID = $img.attr('id');
443		var imgClass = $img.attr('class');
444		var imgURL = $img.attr('src');
445	
446		jQuery.get(imgURL, function(data) {
447			// Get the SVG tag, ignore the rest
448			var $svg = jQuery(data).find('svg');
449	
450			// Add replaced image's ID to the new SVG
451			if(typeof imgID !== 'undefined') {
452				$svg = $svg.attr('id', imgID);
453			}
454			// Add replaced image's classes to the new SVG
455			if(typeof imgClass !== 'undefined') {
456				$svg = $svg.attr('class', imgClass+' replaced-svg');
457			}
458	
459			// Remove any invalid XML tags as per http://validator.w3.org
460			$svg = $svg.removeAttr('xmlns:a');
461	
462			// Replace image with new SVG
463			$img.replaceWith($svg);
464	
465		}, 'xml');
466	
467	});
468
469    // Attache GA cookia variale to Ninja Form hidden field
470    if ($('#nf-form-2-cont').length > 0) {
471        var name = "_ga=";
472        var decodedCookie = decodeURIComponent(document.cookie);
473        var cookies = decodedCookie.split(";");
474        var ga_cookie = null;
475
476        for (var i = 0; i < cookies.length; i++) {
477            var cookie = cookies[i].trim();
478            if (cookie.indexOf(name) === 0) {
479                ga_cookie = cookie.substring(name.length, cookie.length);
480            }
481        }
482
483        var existCondition = setInterval(function() {
484            if ($('#nf-form-2-cont #nf-field-87').length > 0) {
485                clearInterval(existCondition);
486				//set timeout of 100ms to make sure the html is rendered
487				setTimeout(function() {
488                    $('#nf-field-87').val(ga_cookie);
489				}, 200);
490            }
491        }, 100);
492    }
493
494    // alert bar and site content margin
495    handleAlertBar();
496	
497}).on('scroll', $(window), function() {
498	var header = $('.site-header'),
499		body = $('body');
500	if($(window).scrollTop() > 0 && !header.hasClass('sticky')) {
501		header.toggleClass('sticky');
502		body.css({ 'padding-top': header.outerHeight() + 'px' });
503	} else if($(window).scrollTop() <= 0 && header.hasClass('sticky')) {
504		header.toggleClass('sticky');
505		body.css({ 'padding-top': 0 });
506	}
507}).on('click', '.search-toggle', function() {
508	$('.site-header .search-form').toggleClass('on');
509}).on('click', '.site-header .search-form .icon-close', function() {
510	$('.site-header .search-form').removeClass('on');
511}).on('click', '.nav-toggle', function(){
512	$('html').toggleClass('nav-on');
513}).on('click', '.site-nav .nav-close', function(){
514	$('html').removeClass('nav-on');
515}).on('click', '.nav-on', function(e){
516	if(!$(e.target).closest('.nav-element').length && !$(e.target).closest('.mobile').length) {
517		$('html').removeClass('nav-on');
518	}
519}).on('click', '.site-nav nav > .nav-element.has-sub > a', function(e){
520	if(isMobileMenu()) {		
521		e.preventDefault();
522		$('.site-nav').addClass('sub-on');
523		$(this).closest('.nav-element').addClass('on');
524	}
525
526}).on('click', '.site-nav .mobile-back-button', function(e){
527	e.preventDefault();
528	$('.site-nav').removeClass('sub-on');
529	$(this).closest('.nav-element').removeClass('on');
530
531}).on('click', '.site-nav .sub-menu .nav-element.has-sub > a', function (e) {
532	if (isMobileMenu()) { 
533		if ($(this).hasClass('on')) {
534			// go to link
535			// console.log('on');
536			
537		} else {
538			e.preventDefault();
539			$('.site-nav .sub-menu .nav-element.has-sub a.on').not($(this)).removeClass('on').next('.sub-menu').slideUp();
540			$(this).toggleClass('on').next('.sub-menu').slideToggle();
541			// $(this).css({ 'text-decoration': 'underline', 'color': '#00add9' });
542		}
543	}
544}).on('click', '.accordion dt', function() {
545	var $accordionIcon = $(this).children('i'),
546		$accordionContent = $(this).next('dd'),
547		$accordionContainer = $(this).closest('.accordion');
548
549	$('dt.on', $accordionContainer)
550		.not(this)
551		.removeClass('on')
552		.children('i').text('add')
553		.parent().next('dd')
554		.slideToggle();
555	$(this).toggleClass('on');
556	if($(this).hasClass('on')) {
557		$accordionIcon.text('remove');
558	} else {
559		$accordionIcon.text('add');
560	}
561	$accordionContent.slideToggle();
562	if($accordionContainer.hasClass('news-accordion')) {
563		var sh = $('.site-header').innerHeight();
564		window.setTimeout(function(){
565			var offset = $accordionContainer.find('dt.on').offset().top - sh;
566			$('body,html').animate({ scrollTop: offset }, 500);
567		},500);
568	}
569	return false;
570}).on('sf:ajaxfinish', '.searchandfilter', function(){
571	$('.accordion dt:first-child').trigger('click');
572	initSearchAndFilterSelect();
573}).on('open-selectbox', '.select-container', function(e) {
574	$('.select-container.open').not(this).trigger('close-selectbox');
575
576	var select_container = $(this);
577	var select = select_container.find('select');
578	select_container.trigger('reset-selectbox');
579
580	select_container.find('.selectbox').remove();
581	var new_select = $('<div />', {
582		class: 'selectbox ' + (select.hasClass('fluid') ? 'fluid' : ''),
583	});
584	
585	var select_value = select.val();
586	function renderOption(option) {
587		var is_selected = false, val = select_value, myValue = option.getAttribute('value');
588
589		if(typeof val === 'object' && $.inArray(myValue, val) > -1) {
590			is_selected = true;			
591		} else {
592			is_selected = (myValue == val);
593		}
594		if(!option.hasAttribute('hidden')) {
595			var dataHTML = option.getAttribute('data-html');
596			var new_option = document.createElement('div');
597			new_option.setAttribute('class', 'option ' + (is_selected ? 'selected' : ''));
598			new_option.innerHTML = dataHTML ? dataHTML : option.innerHTML;
599			new_option.setAttribute('data-value', myValue);
600			new_option.setAttribute('title', option.innerText);
601			options_div.append(new_option);
602		}
603	}
604	var options_container = document.createElement('div');
605	options_container.classList.add('options-container');
606	var options_div = document.createElement('div');
607	options_div.classList.add('options');
608	select.children().each(function() {
609		var item = $(this);
610		if (item.is('option')) {
611			renderOption(this);
612		} else if (item.is('optgroup')) {
613			var new_group = $('<div />', {
614				class: 'group',
615				html: item.attr('label'),
616			});
617			new_group.appendTo(options_div);
618			item.find('option').each(function() {
619				renderOption(this);
620			});
621		}
622	});
623	options_container.append(options_div);
624
625	// if (!select_container.hasClass('no-search')) {
626	// 	var search_container = $('<div />', {
627	// 		class: 'select-search-container',
628	// 	});
629	// 	var search_input = $('<input />', {
630	// 		class: 'select-search',
631	// 		type: 'text',
632	// 		placeholder: 'Type to search...',
633	// 		tabindex: '-1',
634	// 	});
635	// 	search_input.appendTo(search_container);
636	// 	search_container.prependTo(options_container);
637	// }
638
639	$(options_container).prependTo(new_select);
640	new_select.appendTo(select_container);
641
642	setTimeout(function() {
643		
644		select_container.addClass('open');
645		var options_div = $(options_div), selected = options_div.find('.option.selected');
646		if (selected.length > 0) {
647			var selected_option = $(selected.get(0));
648			var position_top = selected_option.position().top;
649			var position_middle = options_div.outerHeight() / 2;
650			var option_middle = selected_option.outerHeight() / 2;
651			var position = position_top - position_middle + option_middle;
652			options_div.animate({
653				scrollTop: position + 'px'
654			}, 400, 'easeOutExpo');
655		}
656		if (typeof search_input != 'undefined') search_input.focus();
657		repositionSelectboxOverflow($(options_container));
658	}, 0);
659})
660.on('close-selectbox', '.select-container', function(e) {
661	var select_container = $(this);
662	select_container.removeClass('open').trigger('reset-selectbox');
663
664})
665.on('toggle-selectbox', '.select-container', function(e) {
666	var select_container = $(this);
667	if (select_container.hasClass('open')) {
668		select_container.trigger('close-selectbox');
669	} else {
670		select_container.trigger('open-selectbox');
671	}
672
673})
674.on('click', '.select-container .faux-select', function(e) {
675	e.preventDefault();
676	e.stopImmediatePropagation();
677	var select_container = $(this).closest('.select-container');
678	select_container.trigger('toggle-selectbox');
679
680})
681.on('reset-selectbox', '.select-container', function() {
682	var select_container = $(this);
683	var select = select_container.find('select');
684	var option = select.find('option:selected');
685	var selected_options = '';
686
687	option.each(function(index){
688		var dataHTML = $(this).attr('data-html');
689		if(index > 0) selected_options += ', ';
690		selected_options += dataHTML ? dataHTML : $(this).html();
691	});
692	
693	var attrValue = option.attr('value');
694	if(attrValue && attrValue != '0') {
695		select_container.addClass('fancy-selected');
696	} else {
697		select_container.removeClass('fancy-selected');
698	}
699
700	select_container.find('.faux-select').html(selected_options);
701
702})
703.on('focus', '.select-container select', function(e) {
704	$(this).closest('.select-container').trigger('click');
705
706})
707.on('change', '.select-container select', function(e) {
708	$(this).closest('.select-container').trigger('reset-selectbox');
709
710})
711.on('click', '.selectbox .option', function(e) {
712	e.preventDefault();
713	e.stopImmediatePropagation();
714	var option = $(this);
715	var select_container = option.closest('.select-container');
716	var select = select_container.find('select');
717	select.trigger('last_selection', [option.attr('data-value')]);
718	
719	if(select.prop('multiple')) {
720		//handle select multiple
721		var selected = select.find('option[value="' + option.attr('data-value') + '"]');
722		selected.prop('selected', !selected.prop('selected'));
723
724		if(option.attr('data-value') == '' && selected.prop('selected', true)) {
725			select.find('option[value!=""]').prop('selected', false);	 
726		} else {
727			select.find('option[value=""]').prop('selected', false);
728		}
729		if (!$('option:selected', select).length) { 
730			// select default option if nothing is selected
731			select.find('option[value=""]').prop('selected', true);
732		}
733
734		select.trigger('change');
735
736		select_container.trigger('open-selectbox');
737	
738	} else {
739		//handle normal select 
740		select.find('option[value="' + option.attr('data-value') + '"]').prop('selected', true);
741
742		select.trigger('change');
743
744		select_container.trigger('close-selectbox');
745	}
746
747})
748.on('keyup', '.select-search', function(e) {
749	e.preventDefault();
750	e.stopImmediatePropagation();
751	var input = $(this);
752	var query = $.trim(input.val());
753	var options = input.closest('.options-container');
754	var select_container = input.closest('.select-container');
755
756	if (e.which == 27) {
757		// Escape
758		select_container.trigger('close-selectbox');
759	} else if (e.which == 13) {
760		// Enter
761		options.find('.option:visible:first').trigger('click');
762	}
763
764	if (options.length > 0) {
765		options.find('.options').scrollTop(0);
766		if (query != '') {
767			options.find('.group').hide();
768			options.find('.option').each(function() {
769				var option = $(this);
770				var searchable = option.text();
771				if (searchable.toString().toLowerCase().indexOf(query.toLowerCase()) < 0) {
772					option.hide();
773				} else {
774					option.show();
775				}
776			});
777		} else {
778			options.find('.group, .option').show();
779		}
780	}
781
782})
783.on('change', '.select-search', function(e) {
784	e.stopImmediatePropagation();
785})
786.on('keyup', '.faux-select', function(e) {
787	e.preventDefault();
788	e.stopImmediatePropagation();
789	var input = $(this);
790	var select_container = input.closest('.select-container');
791	if (e.which == 13) {
792		// Enter
793		select_container.trigger('open-selectbox');
794	}
795
796})
797.on('click', function(e) {
798
799	// close select box on click outside
800	var container = $('.select-container');
801	if (!container.is(e.target) && container.has(e.target).length === 0) {
802		$('.select-container').trigger('close-selectbox');
803	}
804	
805})
806.on('click', '.template-side #search-filter-form-811 h4', function(){
807	$(this).toggleClass('on').next('ul').slideToggle();
808})
809.on('click', '.sf-field-taxonomy-news-press-type li', function(){
810	$(this).closest('.sf-field-taxonomy-news-press-type').find('h4.on').trigger('click');
811})
812.on('click', '.template-alert-bar .close', function(e) {
813    e.preventDefault();
814
815    var alertBar = $('.template-alert-bar');
816    if(alertBar.is(":visible")) {
817        handleAlertBar('close');
818        alertBar.removeClass('active');
819        sessionStorage.setItem('anchin-alert-bar', 'closed');
820    }
821});
822
823function isElementPartiallyInViewport(el) {
824    if (typeof jQuery !== 'undefined' && el instanceof jQuery) 
825        el = el[0];
826
827    var rect = el.getBoundingClientRect();
828    var windowHeight = (window.innerHeight || document.documentElement.clientHeight);
829    var windowWidth = (window.innerWidth || document.documentElement.clientWidth);
830
831    var vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);
832    var horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);
833
834    return (vertInView && horInView);
835}
836function isElementInViewport (el) {
837    if (typeof jQuery === "function" && el instanceof jQuery) {
838        el = el[0];
839    }
840    var rect = el.getBoundingClientRect();
841    return (
842        rect.top >= 0 &&
843        rect.left >= 0 &&
844        rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /* or $(window).height() */
845        rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */
846    );
847}
848
849// Check elements when they're created on the page (via AJAX, js, etc.)
850var observer = new MutationObserver(function(mutations) {
851	mutations.forEach(function(mutation) {
852		var newNodes = mutation.addedNodes;
853		if (newNodes !== null) {
854			var nodes = $(newNodes);
855			nodes.each(function() {
856				var node = $(this);
857				var q = '.select-container:not(.fancy-initialized)';
858				if (node.is(q)) {
859					initFancySelect(node);
860				} else {
861					$(q, node).each(function() {
862						initFancySelect($(this));
863					});
864				}
865			});
866		}
867	});
868});
869observer.observe(document, {
870	childList: true,
871	subtree: true
872});
873
874function repositionSelectboxOverflow(options_container) {
875	options_container.css('margin-left', 0);
876	if ((options_container.offset().left + options_container.width() + 8) > $(window).width()) {
877		var offset = ((options_container.offset().left + options_container.width()) 
877- $(window).width());
878		options_container.css('margin-left', ((offset * -1) - 8) + 'px');
879	}
880}
881
882function initFancySelect(container) {
883	container.addClass('fancy-initialized');
884	var select = container.find('select:first');
885	var option = select.find('option:selected');
886	var selected_options = '';
887
888	option.each(function(index){
889		if(index > 0) selected_options += ', ';
890		selected_options += $(this).is('[data-html]') ? $(this).attr('data-html') : $(this).html();
891	});
892
893	var faux = $('<div />', {
894		class: 'faux-select ' + (select.hasClass('fluid') ? 'fluid' : ''),
895		html: selected_options,
896		tabindex: 0,
897	});
898	
899	if(option.attr('value') && option.attr('value') != '0') {
900		container.addClass('fancy-selected');
901	} else {
902		container.removeClass('fancy-selected');
903	}
904
905	if(select.prop('multiple')) {
906		container.addClass('fancy-multiple');
907	}
908
909	select.before(faux);
910}
911
912function fixVerticalArrows(container){
913	if(container.length) {
914		var blockquote = $('.slick-active', container).find('blockquote'),
915			h = blockquote.find('p:first').height()/2,
916			posTop = blockquote.position().top;
917			marginTop = parseInt(blockquote.css('marginTop'));
918		$('.slick-arrow', container).css('top',(h+posTop+marginTop)+'px');
919	}
920}
921
922function pathwayListUnderline() {
923	if($('.pathway-list .show-on-large').length) {
924		$('.pathway-list .show-on-large aside ul li a').each(function(){
925			var linkOffset = $(this).offset().left,
926				endLinkOffset = $('.end', this).offset().left,
927				width = parseInt(endLinkOffset - linkOffset) + 20;
928
929				$('.underline', this).css('width', width+'px');
930		});
931	}
932}
933
934function initSearchAndFilterSelect () {
935	$('#search-filter-form-665 select, #search-filter-form-711 select, #search-filter-form-1215 select, .template-filters select').each(function(){
936		if(!$(this).parent().hasClass('select-container')) {
937			$(this).wrap( '<div class="select-container"></div>' );
938			if($(this).prop('multiple')) {
939				if($(':selected', this).val()) {
940					$(this).prepend($('<option>', {
941						value: '',
942						text: 'ALL'
943					}));
944				} else {
945					$(this).prepend($('<option>', {
946						value: '',
947						text: 'ALL',
948						selected: true
949					}));
950				}
951			}
952		}
953	});
954	$('.select-container:not(.fancy-initialized)').each(function() {
955		initFancySelect($(this));
956	});
957}
958
959function isMobileMenu() {
960	var ww = $(window).width(),
961		wh = $(window).height();
962	if(ww<1024 || wh <700) return true;
963	else return false;
964}
965
966function playVideo(video) { 
967	video.css('opacity', 1); 
968		video.get(0).currentTime = 0;
969    video.get(0).play(); 
970}
971
972function pauseVideo(video) {
973	video.css('opacity', 0);
974    video.get(0).pause(); 
975}
976
977function handleAlertBar(action='open') {
978    if (sessionStorage.getItem('anchin-alert-bar') === 'closed') return;
979
980    var alertBar = $('.template-alert-bar');
981    var header = $('.site-header');
982
983    if (alertBar.length === 0) return;
984
985    var alertBarHeight = alertBar.innerHeight();
986
987    if ($('#wpadminbar').length > 0) {
988        var adminBarHeight = $('#wpadminbar').innerHeight();
989        alertBar.css('margin-top', adminBarHeight);
990    }
991
992    if (action === 'close') {
993        alertBarHeight = 0;
994    }
995    
996    header.css('margin-top', alertBarHeight);
997    alertBar.addClass('active');
998}

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.