PageSourceSearch

https://www.cil.org/js/main.js?v=0.07

js cil.org collected 2026-09-29 15:10:54 UTC 24,146 bytes, 638 lines download raw bytes

1/* ----------------------------------------------------------------------------------------------------------------------- */
2/* Header style change on scroll ----------------------------------------------------------------------------------------- */
3/* ----------------------------------------------------------------------------------------------------------------------- */
4$(window).scroll(function() {
5	if($(this).scrollTop()<121) {
6		$(".header").removeClass("follow");
7	} else {
8		$(".header").addClass("follow");
9	}
10});
11
12
13/* ----------------------------------------------------------------------------------------------------------------------- */
14/* HOMEPAGE -------------------------------------------------------------------------------------------------------------- */
15/* ----------------------------------------------------------------------------------------------------------------------- */
16//move homepage-banner-box above rest of content
17/*
18if($('.homepage-rollover-buttons').length) {
19	$('.homepage-rollover-buttons a').each(function() {
20		$(this).wrapInner('<span class="text"></span>').prepend('<span class="icon"></span>');
21	});
22	$('.homepage-rollover-buttons').append($('#lottie'));
23}
24*/
25
26/* Homepage Banner Height ---------------------------------------------------------- */
27/*
28if($('.homepage-banner-box').length) {
29	$(window).scroll(function() {
30		if($(window).scrollTop() > 100) {
31			$('body').addClass('away-from-top');
32		} else {
33			$('body').removeClass('away-from-top');
34		}
35	});
36}
37*/
38if($('.new-homepage-banner-box').length) {
39	$(window).resize(function() {
40		$('.new-homepage-banner-box, .new-homepage-banner-box .ss-content-block, .new-homepage-banner-box .slide, .new-homepage-banner-box .image').css({'height':$(window).height()+'px'});
41
42		if($('.new-homepage-banner-box .gallery-footer').length) {
43			$('.new-homepage-banner-box .caption').css({'bottom':$('.new-homepage-banner-box .gallery-footer').height()+'px'});
44		}
45	}).resize();
46
47	$(window).scroll(function() {
48		if($(window).scrollTop() > 100) {
49			$('body').addClass('away-from-top');
50		} else {
51			$('body').removeClass('away-from-top');
52		}
53	});
54}
55
56if($('body').hasClass('page-homepage') && $('#top-bar-alert-content').length) {
57	$(window).scroll(function() {
58		do_homepage_header_offset();
59	}).scroll();
60	$(window).resize(function() {
61		do_homepage_header_offset();
62	}).resize();
63
64	function do_homepage_header_offset() {
65		if($('#header').hasClass('follow')) {
66			$('#header').css({'top':'0px'}).removeClass('at-top');
67		} else {
68			$('#header').css({'top':$('#top-bar-alert-content').outerHeight()+'px'}).addClass('at-top');
69		}
70	}
71}
72
73
74/* Auto-scroll (Homepage Solutions) ---------------------------------------------------- */
75if($('.page-id-616933').length) {
76	$('.slider > .ss-section-wrap-inner').addClass('auto-scroll');
77
78	if($(".auto-scroll").length) {
79		$.when(add_js('//clients.sosimplecms.com/js/jquery/jquery.slick/slick.min.js')).done(function() {
80			$(".auto-scroll").slick({
81				infinite: true,
82				slidesToShow: 1,
83				slidesToScroll: 1,
84				dots: true,
85				arrows: true,
86				autoplay: true,
87				autoplaySpeed: 7000,
88				speed: 1000
89			});
90
91			$('.auto-scroll .slick-dots').clone().addClass('homepage-slick-dots').appendTo($('.slider').closest('.ss-section-wrap').prev('.ss-section-wrap').find('.ss-section-wrap-inner'));
92
93			$(".auto-scroll").on('beforeChange', function(event, slick, currentSlide, nextSlide){
94				do_nav_sync(nextSlide);
95			});
96
97			function do_nav_sync(new_idx) {
98				if($('.homepage-slick-dots').length) {
99					var cur_slide_idx = (new_idx >= 0?new_idx:$('.slick-dots').not('.homepage-slick-dots').find('.slick-active').index());
100					$('.homepage-slick-dots li').removeClass('slick-active');
101					$('.homepage-slick-dots li').eq(cur_slide_idx).addClass('slick-active');
102				}
103			}
104
105			$('.slick-dots.homepage-slick-dots button').click(function() {
106				var idx = $(this).closest('li').index();
107				$(".auto-scroll").slick('slickGoTo',idx);
108				do_nav_sync();
109				return false;
110			});
111		});
112	}
113}
114
115
116/* Arrow Down (homepage) ------------------------------------------------------------- */
117if($('.new-homepage-banner-box').length) {
118	$('.new-homepage-banner-box').append($('<a href="#" class="arrow-down" id="arrow-down"></a>'));
119
120	if($('.new-homepage-banner-box .gallery-footer').length) {
121		$(window).resize(function() {
122			$('#arrow-down').css({'margin-bottom':$('.new-homepage-banner-box .gallery-footer').height()+'px'});
123		}).resize();
124	}
125
126	$('#arrow-down').click(function(e) {
127		$('body,html').animate({'scrollTop':($('.new-homepage-banner-box').height()-$('#header').height())+'px'},1000,'easeInOutCirc',function() {
128
129		});
130		$(this).fadeOut('fast');
131		e.preventDefault();
132		e.stopPropagation();
133		return false;
134	});
135}
136
137
138/* ----------------------------------------------------------------------------------------------------------------------- */
139/* Add BG Color Box Class to Purple/Blue Boxes --------------------------------------------------------------------------- */
140/* ----------------------------------------------------------------------------------------------------------------------- */
141if($('.blue-box').length || $('.purple-box').length) {
142	$('.blue-box, .purple-box').each(function() {
143		$(this).addClass('bg-color-box');
144	});
145}
146
147
148/* ----------------------------------------------------------------------------------------------------------------------- */
149/* Team Page Handling ---------------------------------------------------------------------------------------------------- */
150/* ----------------------------------------------------------------------------------------------------------------------- */
151$('.page-team .image-wrap, .page-id-1202210 .image-wrap, .page-id-1224663 .image-wrap').each(function() {
152	$(this).css({'background-image':'url("'+$(this).find('img').attr('src')+'")'});
153});
154
155
156/* ---------------------------------------------------------------------------------------------------------------------- */
157/* Misc ----------------------------------------------------------------------------------------------------------------- */
158/* ---------------------------------------------------------------------------------------------------------------------- */
159// add .last class to all last lis
160$("ul > li:first-child").addClass("first");
161$("ul > li:last-child").addClass("last");
162
163// replace hrs with wraps
164$("hr").each(function() {
165	if(!$(this).closest(".hr").length) {
166		$(this).wrap('<div class="hr"></div>');
167	}
168});
169
170// detect negative margin images
171$('img').each(function() {
172	var ml = $(this).css('margin-left').replace('px','');
173	var mr = $(this).css('margin-right').replace('px','');
174	if(ml < 0 || mr < 0) $(this).addClass('negative-margin-left-or-right');
175});
176
177
178/* ----------------------------------------------------------------------------------------------------------------------- */
179/* Toggle More ----------------------------------------------------------------------------------------------------------- */
180/* ----------------------------------------------------------------------------------------------------------------------- */
181$(".toggle-more-link a").click(function() {
182	if($(this).closest(".toggle-more-link").hasClass("selected")) {
183		$(this).closest(".toggle-more-link").removeClass("selected").next(".toggle-more-content").slideUp("fast");
184
185	} else {
186		$(this).closest(".toggle-more-link").addClass("selected").next(".toggle-more-content").slideDown("fast");
187	}
188	return false;
189});
190
191
192/* ----------------------------------------------------------------------------------------------------------------------- */
193/* Flyout Menu Handling ---------------------------------------------------------------------------------------------- */
194/* ----------------------------------------------------------------------------------------------------------------------- */
195$('#nav-toggle').click(function() {
196	$('body').toggleClass('nav-active');
197	return false;
198});
199
200$('.middle-content').click(function() {
201	if($('body').hasClass('nav-active')) $('body').removeClass('nav-active');
202});
203
204
205/* ----------------------------------------------------------------------------------------------------------------------- */
206/* Responsive iFrame Handling -------------------------------------------------------------------------------------------- */
207/* ----------------------------------------------------------------------------------------------------------------------- */
208$('iframe').each(function() {
209	$(this).attr('orig-width',$(this).attr('width'));
210	$(this).attr('orig-height',$(this).attr('height'));
211});
212$(window).resize(function() {
213	$('iframe').each(function() {
214		var ratio = $(this).attr('orig-height') / $(this).attr('orig-width');
215		var width = $(this).width();
216		$(this).css({'height':(width*ratio)+'px'});
217	});
218}).resize();
219
220
221/* ----------------------------------------------------------------------------------------------------------------------- */
222/* Arrow Down (Inside pages) --------------------------------------------------------------------------------------------- */
223/* ----------------------------------------------------------------------------------------------------------------------- */
224if(!$('body').hasClass('page-id-616933')) {
225	if($('.arrow-box').length) {
226		$('.arrow-box').append($('<a href="#" class="arrow-down" id="arrow-down"></a>'));
227	}
228
229	$('#arrow-down').click(function(e) {
230		$('body,html').animate({'scrollTop':'400px'},1000,'easeInOutCirc',function() {
231
232		});
233		$(this).fadeOut('fast');
234		e.preventDefault();
235		e.stopPropagation();
236		return false;
237	});
238}
239
240
241/* ----------------------------------------------------------------------------------------------------------------------- */
242/* Photo Gallery --------------------------------------------------------------------------------------------------------- */
243/* ----------------------------------------------------------------------------------------------------------------------- */
244if($('.page-type-4').length) {
245	//move sidebox into footer-text if it exists
246	if($('.side-boxes').length) {
247		$('.content-footer-text').wrap('<div class="photo-gallery-footer-text-wrap"></div>');
248		$('.photo-gallery-footer-text-wrap').append($('.side-boxes'));
249	}
250
251	//move back button
252	if($('.button-wrap').length) {
253		$('.button-wrap').removeClass('fr');
254		$('.photo-gallery-wrapper').append($('.button-wrap'));
255		$('.button-wrap').wrapInner('<div class="wrapper"></div>');
256	}
257}
258
259
260/* ----------------------------------------------------------------------------------------------------------------------- */
261/* Galleries ------------------------------------------------------------------------------------------------------------- */
262/* ----------------------------------------------------------------------------------------------------------------------- */
263if($('.embedded-gallery').length) {
264	$('.embedded-gallery .slide').each(function() {
265		$(this).css({'background-image':'url('+$(this).find('img').attr('src')+')'});
266	});
267
268	$(window).resize(function() {
269		var stage_height = $(window).height()-$('#header').height();
270		$('.embedded-gallery, .embedded-gallery div').css({'max-height':stage_height+'px'});
271	});
272
273	//move 'back' button and change text
274	if($('.button-wrap').length) {
275		$('.photo-gallery-wrapper').append($('.button-wrap'));
276		$('.button-wrap a').html('Back to Portfolio');
277	}
278}
279
280
281/* ----------------------------------------------------------------------------------------------------------------------- */
282/* Anchor Animation/Scrolling -------------------------------------------------------------------------------------------- */
283/* ----------------------------------------------------------------------------------------------------------------------- */
284var curhash;
285var newhash;
286var hash_animating = 0;
287
288// force scroll top if anchor already set
289if(window.location.hash) {
290	setTimeout(function() {
291		$(window).scrollTop(0);
292	},10);
293}
294
295// setup listener
296setTimeout(function() {
297	setInterval(function() {
298		if(!hash_animating) {
299			newhash = window.location.hash.replace('#','');
300
301			if(newhash != curhash && $('#'+newhash).length) {
302				do_scroll_anim(newhash);
303			}
304		}
305	}
305,150);
306},25);
307
308function do_scroll_anim(id) {
309	if(hash_animating) return false;
310
311	var el_top = $('#'+id).closest('.ss-section-wrap').offset().top;
312	var header_height = $('#header').height() + $('.sub-nav').height();
313	var padding = 0;
314	var amount = el_top - header_height - padding;
315
316	curhash = id;
317
318	if($("#primary-navigation-wrap a[href*=#"+id+"]").length) {
319		$('#primary-navigation-wrap ul li').removeClass('selected');
320		$('#primary-navigation-wrap a[href*=#'+id+']').closest('li').addClass('selected');
321	}
322
323	if($(".sub-nav a[href*=#"+id+"]").length) {
324		$('.sub-nav li').removeClass('selected');
325		$('.sub-nav a[href*=#'+id+']').closest('li').addClass('selected');
326	}
327
328	hash_animating = 1;
329	$('body,html').stop(1,1).animate({'scrollTop':amount+'px'},'slow','easeOutQuad',function() {
330		window.location.hash = id;
331		$(window).scrollTop(amount);
332		hash_animating = 0;
333	});
334}
335
336$("a[href*=#]").click(function(e) {
337	var tmp = $(this).attr('href').split('#');
338	var id = tmp[1];
339	if($('#'+id).length) {
340		do_scroll_anim(id);
341		return false;
342	}
343});
344
345$('.primary-nav-title').click(function() {
346	hash_animating = 1;
347	$('body,html').stop(1,1).animate({'scrollTop':'0px'},'slow','easeOutQuad',function() {
348		window.location.hash = '';
349		hash_animating = 0;
350	});
351	return false;
352});
353
354
355/* ----------------------------------------------------------------------------------------------------------------------- */
356/* Sticky Sub Nav -------------------------------------------------------------------------------------------------------- */
357/* ----------------------------------------------------------------------------------------------------------------------- */
358if ($('.sub-nav').length > 0) {
359	$(window).resize(function() {
360		var purple_box_height = $('.ss-section-wrap:nth-child(1)').height();
361		do_sub_nav_padding();
362	});
363
364	$(window).scroll(function() {
365		if($(this).scrollTop()> 325) {
366			$(".sub-nav").addClass("fixed");
367			do_sub_nav_padding();
368		} else {
369			$(".sub-nav").removeClass("fixed");
370			do_sub_nav_padding();
371		}
372	}).scroll();
373
374	function do_sub_nav_padding() {
375		if($('.sub-nav').hasClass('fixed') && $('.sub-nav').css('display') == 'block') {
376			var sn_height = $('.sub-nav').outerHeight();
377			$('.middle-content').css({'padding-top':sn_height+'px'});
378
379		} else {
380			$('.middle-content').css({'padding-top':0});
381		}
382	}
383}
384
385
386/* ---------------------------------------------------------------------------------------------------------------- */
387/* Lets Chat button ----------------------------------------------------------------------------------------------- */
388/* ---------------------------------------------------------------------------------------------------------------- */
389//close on click
390$('.lets-chat-button a span').on('click', function(event){
391    $(this).closest("a").remove();
392    event.preventDefault();
393});
394
395
396/* ---------------------------------------------------------------------------------------------------------------- */
397/* Popup JS Stuff ------------------------------------------------------------------------------------------------- */
398/* ---------------------------------------------------------------------------------------------------------------- */
399var ajax_engaged = false;
400
401
402/* ---------------------------------------------------------------------------------------------------------------- */
403/* Add Container to End of Body that will Hold AJAX-loaded Content ------------------------------------------------ */
404/* ---------------------------------------------------------------------------------------------------------------- */
405$('body').append('<div id="tmp-ajax-gallery-contents" style="position: absolute; opacity: 0; height: 1px; width: 1px; overflow: hidden;"></div>');
406$('body').append('<div id="final-ajax-gallery-contents" style="position: absolute; opacity: 0; height: 1px; width: 1px; overflow: hidden;"></div>');
407var $tmp_content_holder = $('#tmp-ajax-gallery-contents');
408var $final_content_holder = $('#final-ajax-gallery-contents');
409
410// ---------
411// recaptcha
412// ---------
413function do_modal_captcha() {
414	if($('.recaptcha_widget').length) {
415		$.when(add_js('//www.google.com/recaptcha/api.js')).done(function() {
416			setTimeout(function() {
417				if($('.recaptcha_widget').length) {
418					var i = 1;
419					$('.recaptcha_widget').each(function() {
420						$(this).attr('id','recaptcha_widget_'+i);
421						grecaptcha.render('recaptcha_widget_'+i, {
422							'sitekey' : '6Lf6AyITAAAAAF-Co3ite5MrAMEu7f8jQnlihhf8',
423							'callback' : function(response) {
424							}
425						});
426
427						i++;
428					});
429				}
430			},1000);
431		});
432	}
433}
434
435
436/* ---------------------------------------------------------------------------------------------------------------------- */
437/* Custom Approach Box (Impact Page) Handling for Mobile ---------------------------------------------------------------- */
438/* ---------------------------------------------------------------------------------------------------------------------- */
439if($('#approach-box').length) {
440	$('#approach-box').addClass('desktop-only');
441
442	mobile_content = '';
443	$('#approach-box .caption').each(function() {
444		mobile_content += '<div class="mobile-slide">'+$(this).html()+'</div>';
445	});
446
447	$('#approach-box').after('<div class="mobile-only" id="approach-box-mobile">'+mobile_content+'</div>');
448
449	if($('#approach-box-mobile').find('h6').index() == 0 && $('#approach-box-mobile').find('p').first().index() == 1) {
450		$('#approach-box-mobile .mobile-slide').not(':eq(0)').each(function() {
451			$(this).find('h6').eq(0).remove();
452			$(this).find('p').eq(0).remove();
453		});
454	}
455}
456
457
458/* ---------------------------------------------------------------------------------------------------------------------- */
459/* Make 1/3 Boxes Equal Height ------------------------------------------------------------------------------------------ */
460/* ---------------------------------------------------------------------------------------------------------------------- */
461if($('.ss-section-wrap').length && $('.col-3').length) {
462	$('.ss-section-wrap').each(function() {
463		if($(this).find('.col-3').length == 3) {
464			$(this).find('.col-3').each(function() {
465				$(this).addClass('has-inner-wrap').wrapInner('<div class="equal-height-inner-wrap"></div>');
466			});
467		}
468	});
469
470	$(window).resize(function() {
471		$('.ss-section-wrap').each(function() {
472			if($(this).find('.col-3').length == 3) {
473				var tallest = 0;
474				$(this).find('.col-3').each(function() {
475					var height = $(this).find('.equal-height-inner-wrap').outerHeight();
476					if(height > tallest) tallest = height;
477				});
478				if(tallest) $(this).find('.col-3').css({'min-height':tallest+'px'});
479			}
480		});
481	}).resize();
482}
483
484
485/* ---------------------------------------------------------------------------------------------------------------- */
486/* Click Handling for Submission Form popup links ----------------------------------------------------------------- */
487/* ---------------------------------------------------------------------------------------------------------------- */
488$('.popup-link').click(function() {
489	var url = $(this).attr('href');
490	url = url.replace('http://cil.sosimplecms.com','');
491	url = url.replace('http://cil.org','');
492	url = url.replace('http://www.cil.org','');
493	if(url && url != '/') {
494		$.ajax({
495			type: "GET",
496			url: url,
497			success: function(response){
498				var html = $(response).find('.main-content').html();
499				showSoSimpleOverlay(html);
500				var imgsrc = $('.sosimple-overlay .col.first img').attr('src');
501				$('.sosimple-overlay .col.first').css({'background-image':'url("'+imgsrc+'")'});
502				var col2html = $('.sosimple-overlay .col.last').html();
503				$('.sosimple-overlay .col.last').html('<div class="inner-col-wrap">'+col2html+'</div>');
504				$('.sosimple-overlay').addClass('popup-box');
505				$(window).resize();
506
507				if($('.sosimple-overlay').find('.submission-form').length) {
508					$('.sosimple-overlay .submission-form').attr('action',url);
509				}
510
511				do_modal_captcha();
512			}
513		});
514	}
515
516	return false;
517});
518
519
520/* ----------------------------------------------------------------------------------------------------------------------- */
521/* Portfolio Builder Images / Filters ------------------------------------------------------------------------------------ */
522/* ----------------------------------------------------------------------------------------------------------------------- */
523if($('#inspiration-gallery-masonry .masonry-item').length) {
524	$('#inspiration-gallery-masonry .masonry-item').each(function() {
525		var src = $(this).find('img').attr('src');
526		$(this).find('.image').css({'background-image':"url('"+src+"')"});
527	});
528}
529
530if($('#inspiration-gallery-filters .select-option-drop').length) {
531	$('.select-option-drop').each(function() {
532		var cat_name = '';
533		$(this).find('option').each(function() {
534			if($(this).val().indexOf('c-') >= 0) {
535				cat_name = $(this).text();
536				return false;
537			}
538		});
539
540		$(this).find('option').each(function() {
541			if($(this).val().indexOf('c-') >= 0 || $(this).val().indexOf('fg-') >= 0) {
542				$(this).remove();
543			} else {
544				$(this).text($.trim($(this).text()));
545				if(cat_name && $(this).text() == '--Select--') $(this).text('--'+cat_name+'--');
546			}
547		});
548	});
549}
550
551
552// ---------------------------------------------------------------------------------------------------------------- */
553// Solutions Section Link Toggles --------------------------------------------------------------------------------- */
554// ---------------------------------------------------------------------------------------------------------------- */
555$(".solutions-link").click(function() {
556	$(".solutions-link").removeClass("selected");
557	$(".solutions-box").removeClass("selected");
558
559	if(!$(this).hasClass("selected")) {
560		$(this).addClass("selected");
561
562		if($(window).width() < 550) {
563			$('body,html').stop(1,1).animate({'scrollTop':($('.solutions-boxes').offset().top-60)+'px'});
564		}
565
566		var selected_box = $(this).attr("id");
567		selected_box = "." + selected_box;
568
569		$(this).closest(".solutions-wrap").find(selected_box).addClass("selected");
570
571	}
572	return false;
573});
574
575$(".solutions-link").hover(
576	function() {
577		if($(window).width() > 550) {
578			$(".solutions-link").removeClass("selected");
579			$(".solutions-box").removeClass("selected");
580
581			if(!$(this).hasClass("selected")) {
582				$(this).addClass("selected");
583
584				var selected_box = $(this).attr("id");
585				selected_box = "." + selected_box;
586
587				$(this).closest(".solutions-wrap").find(selected_box).addClass("selected");
588
589			}
590		}
591	},
592	function() {
593
594	}
595);
596
597
598if($('#lottie').length) {
599	$(window).resize(function() {
600		if($(window).width() <= 1470) {
601			$('#lottie').css({'height':($(window).width() * .5625)+'px'});
602		} else {
603			$('#lottie').css({'height':'auto'});
604		}
605	}).resize();
606}
607
608
609/* ----------------------------------------------------------------------------------------------------------------------- */
610/* Scroll Reveal Animations ---------------------------------------------------------------------------------------------- */
611/* ----------------------------------------------------------------------------------------------------------------------- */
612window.sr = ScrollReveal();
613var anim_settings = {
614	origin   : "top",
615	distance : "-40px",
616	duration : 1000,
617	scale    : 1,
618	viewFactor : .1,
619	mobile: true,
620	reset: false
621}
622
623$('.ss-content-block').each(function() {
624	if(!$(this).closest('.ss-section-wrap').hasClass('slider')) {
625		$(this).addClass('do-slide-in');
626	} else {
627		$(this).closest('.ss-section-wrap').addClass('do-slide-in');
628	}
629});
630sr.reveal('.do-slide-in', anim_settings);
631
632
633/* ----------------------------------------------------------------------------------------------------------------------- */
634/* Force Body Load after 3 seconds --------------------------------------------------------------------------------------- */
635/* ----------------------------------------------------------------------------------------------------------------------- */
636setTimeout(function() {
637	$('body').addClass('loaded');
638},3);

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.