PageSourceSearch

https://bialik.ca/js/global.js?v=3.1

js bialik.ca collected 2026-10-02 23:30:52 UTC 30,912 bytes, 1,188 lines download raw bytes

1//-----------------------------------------------------------------------------------------
2//
3//
4// Variables
5//
6//
7//-----------------------------------------------------------------------------------------
8//
9//-----------------------------------------------------------
10//
11// SVG
12//
13//-----------------------------------------------------------
14//
15var SVG = {
16	'arrow-left-1':  '<svg xmlns="http://www.w3.org/2000/svg" width="27" height="48" viewBox="0 0 27 48"><path id="Polygon_41" data-name="Polygon 41" d="M24,0,48,27H0Z" transform="translate(0 48) rotate(-90)" fill="#a84c9f"/></svg>',
17	'arrow-right-1': '<svg xmlns="http://www.w3.org/2000/svg" width="27" height="48" viewBox="0 0 27 48"><path id="Polygon_42" data-name="Polygon 42" d="M24,0,48,27H0Z" transform="translate(27) rotate(90)" fill="#a84c9f"/></svg>',
18	'arrow-left-2':  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 27"><g stroke="#666" fill="none"><path d="M26.5 26.5H.5V.5h26z"/><path d="M17.5 20.5l-8-7.03 8-6.97"/></g></svg>',
19	'arrow-right-2': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 27"><g stroke="#666" fill="none"><path d="M26.5 26.5H.5V.5h26z"/><path d="M9.5 20.5l8-7.03-8-6.97"/></g></svg>',
20	'arrow-left-3':  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M0 0v50h50V0zm2 48V2h46v22.005H13.448l8.215-7.252-1.322-1.5-10.834 9.559 10.819 9.928 1.352-1.473-7.916-7.265H48v21.995z" fill="#666"/></svg>',
21	'arrow-right-3': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M0 0v50h50V0zm48 48H2V25.995h34.552l-8.215 7.249 1.322 1.5 10.834-9.559-10.819-9.928-1.352 1.473 7.916 7.265H2V2h46z" fill="#666"/></svg>',
22	'arrow-left-4':  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16.193 34.011"><path d="M14.779 32.597L2.462 20.28a4.991 4.991 0 010-7.059L7.81 7.873l6.458-6.459" fill="none" stroke="#000" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/></svg>',
23	'arrow-right-4': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16.193 34.011"><path d="M1.414 1.414l12.317 12.317a4.991 4.991 0 010 7.059l-5.348 5.348-6.458 6.459" fill="none" stroke="#000" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/></svg>',
24	'arrow-left-5':  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.451 22.439"><g fill="none" stroke="#000" stroke-linecap="round" stroke-width="2"><path d="M29.451 11.184h-27"/><path d="M10.655 21.025L1 11.234l9.655-9.82" stroke-linejoin="round"/></g></svg>',
25	'arrow-right-5': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.451 22.439"><g fill="none" stroke="#000" stroke-linecap="round" stroke-width="2"><path d="M1 11.255h27"/><path d="M19.796 1.414l9.655 9.791-9.655 9.82" stroke-linejoin="round"/></g></svg>',
26	'arrow-left-6':  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><circle cx="15" cy="15" r="14.5" fill="none" stroke="#000"/><path d="M16.854 10.56l-4.51 4.509 4.51 4.509" fill="none" stroke="#000"/></svg>',
27	'arrow-right-6': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><circle cx="15" cy="15" r="14.5" fill="none" stroke="#000"/><path d="M13.146 19.44l4.51-4.509-4.51-4.509" fill="none" stroke="#000"/></svg>'
28};
29
30
31//-----------------------------------------------------------------------------------------
32//
33//
34// Helper Functions
35//
36//
37//-----------------------------------------------------------------------------------------
38//
39//-----------------------------------------------------------
40//
41// Debounce
42//
43//-----------------------------------------------------------
44//
45function _debounce(func, wait, immediate) {
46	var timeout;
47	return function () {
48		var context = this, args = arguments;
49		var later = function () {
50			timeout = null;
51			if (!immediate) func.apply(context, args);
52		};
53		var callNow = immediate && !timeout;
54		clearTimeout(timeout);
55		timeout = setTimeout(later, wait);
56		if (callNow) func.apply(context, args);
57	};
58}
59
60//-----------------------------------------------------------
61//
62// Is IE Version
63//
64//-----------------------------------------------------------
65//
66function _isIEVersion() {
67	var ua = window.navigator.userAgent;
68	var msie = ua.indexOf('MSIE ');
69	var trident = ua.indexOf('Trident/');
70
71	if (msie > 0) {
72		// IE 10 or older => return version number
73		return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
74	}
75
76	if (trident > 0) {
77		// IE 11 => return version number
78		var rv = ua.indexOf('rv:');
79		return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
80	}
81
82	return false;
83}
84
85//-----------------------------------------------------------
86//
87// Is Mobile Devices
88//
89//-----------------------------------------------------------
90//
91function _isMobileDevices() {
92	if (is.mobile() || is.tablet()) {
93		return true;
94	} else {
95		return false;
96	}
97}
98
99//-----------------------------------------------------------
100//
101// Is Minimum Browser Width
102//
103//-----------------------------------------------------------
104//
105function _isMinBrowserWidth(width) {
106
107	// Return Boolean
108	//
109	return window.matchMedia("(min-width: " + width + "px)").matches;
110}
111
112//-----------------------------------------------------------
113//
114// Is Maximum Browser Width
115//
116//-----------------------------------------------------------
117//
118function _isMaxBrowserWidth(width) {
119
120	// Return Boolean
121	//
122	return window.matchMedia("(max-width: " + width + "px)").matches;
123}
124
125//-----------------------------------------------------------
126//
127// Has URL Query
128//
129//-----------------------------------------------------------
130//
131function _hasUrlQuery(uri) {
132	return uri.indexOf("?") > 0;
133}
134
135//-----------------------------------------------------------
136//
137// Remove URL Query
138//
139//-----------------------------------------------------------
140//
141function _removeUrlQuery(uri) {
142	return uri.substring(0, uri.indexOf("?"));
143}
144
145//-----------------------------------------------------------
146//
147// Get URL Query
148//
149//-----------------------------------------------------------
150//
151function _getUrlQuery() {
152	var vars = [], hash;
153	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
154	for (var i = 0; i < hashes.length; i++) {
155		hash = hashes[i].split('=');
156		vars.push(hash[0]);
157		vars[hash[0]] = hash[1];
158	}
159	return vars;
160}
161
162//-----------------------------------------------------------
163//
164// Get File Extension from String
165//
166//-----------------------------------------------------------
167//
168function _getFileExtension(file) {
169	return file.substr((file.lastIndexOf('.') + 1));
170}
171
172//-----------------------------------------------------------
173//
174// Convert Extension to File Type
175//
176//-----------------------------------------------------------
177//
178function _convertFileExtensionToFileType(extension) {
179	if (typeof extension !== 'string') {
180		return console.log('The parameter for _convertFileExtensionToFileType() function is not a string');
181	}
182
183	var ext = extension.toLowerCase();
184
185	switch (ext) {
186		case 'png':
187		case 'jpg':
188		case 'jpeg':
189		case 'gif':
190		case 'webp':
191		case 'heic':
192		case 'heif':
193			return 'image';
194		case 'txt':
195			return 'txt';
196		case 'pdf':
197			return 'pdf';
198		case 'xls':
199		case 'xlsx':
200			return 'excel';
201		case 'doc':
202		case 'docx':
203			return 'word';
204		case 'ppt':
205		case 'pptx':
206			return 'powerpoint';
207		case 'mp4':
208		case 'mov':
209		case 'wmv':
210		case 'flv':
211		case 'avi':
212		case 'avchd':
213			return 'video';
214		default:
215			return 'unknown';
216	}
217}
218
219
220//-----------------------------------------------------------------------------------------
221//
222//
223// Init
224//
225//
226//-----------------------------------------------------------------------------------------
227//
228//-----------------------------------------------------------
229//
230// Init ScrollMagic Controller
231//
232//-----------------------------------------------------------
233//
234var SMController = new ScrollMagic.Controller();
235
236
237//-----------------------------------------------------------------------------------------
238//
239//
240// Morweb Modifications
241//
242//
243//-----------------------------------------------------------------------------------------
244//
245//-----------------------------------------------------------
246//
247// siteMainMsg
248//
249//-----------------------------------------------------------
250//
251function handleSiteMainMsg() {
252	var $el = $('.mwPageArea._liveEdInfo');
253
254	if (!$el.length) return false;
255
256	$el.each(function () {
257		var $this = $(this);
258		var $block = $this.children('.liveEdDummyBlock').first();
259
260		$block.html($block.html().replace(/\[+([^\][]+)]+/g, '<span class="badge badgeLarge badgeDark badgeRounded">$1</span>'))
261			.wrapInner('<div class="_liveEdInfoText"/>')
262			.prepend('<div class="_siteMainMsgStep"><span>Step</span><span>01</span></div>')
263			.wrapInner('<div class="_liveEdInfoWrap content-style"/>');
264	});
265}
266
267
268//-----------------------------------------------------------------------------------------
269//
270//
271// Theme Functions
272//
273//
274//-----------------------------------------------------------------------------------------
275//
276// -----------------------------------------------------------
277//
278// Root CSS
279//
280//-----------------------------------------------------------
281//
282function handleRootCSS() {
283
284	setRootCSS();
285
286	$(document).ajaxComplete(function (event, request, settings) {
287		setRootCSS();
288	});
289
290	$(window).on('resize', _debounce(function () {
291		setRootCSS();
292	}, 250));
293
294	function setRootCSS() {
295		$('html').attr('style',
296			'--vh:'           + ($(window).innerHeight() * 0.01).toFixed(2) + 'px;' +
297			'--headerHeight:' + $('.headerWrap').height() + 'px;'
298		);
299	}
300}
301
302//-----------------------------------------------------------
303//
304// Browser Version
305//
306//-----------------------------------------------------------
307//
308function handleBrowserVersion() {
309
310	// Check browser compatibility
311	//
312	if (_isIEVersion() !== false && _isIEVersion() < 10) {
313		$('html').addClass('no-support');
314	}
315
316	if (is.ie()) {
317		$('html').addClass('is-ie');
318	}
319
320	if (is.edge()) {
321		$('html').addClass('is-edge');
322	}
323
324	if (is.desktop()) {
325		$('html').addClass('is-desktop');
326	}
327
328	if (is.mobile()) {
329		$('html').addClass('is-mobile');
330	}
331
332	if (is.tablet()) {
333		$('html').addClass('is-tablet');
334	}
335
336	if (is.touchDevice()) {
337		$('html').addClass('is-touch-device');
338	}
339}
340
341//-----------------------------------------------------------
342//
343// Accessibility
344//
345//-----------------------------------------------------------
346//
347function handleAccessibility() {
348
349	//--------------------------------
350	// Parameters
351	//--------------------------------
352	//
353	var fontSizeIncrement = 1.2;
354	var fontSizeDecrement = 0.8;
355
356	//--------------------------------
357	// Selectors
358	//--------------------------------
359	//
360	var resizeSelectors = ['p', 'a', 'span', 'input', 'textarea', 'select', 'h2', 'h3', 'h4', 'h5', 'h6', '.resizable'].join(', ');
361	var highlightSelectors = ['a', 'button', '.accordionBtn', '.imgCardInner'].join(', ');
362
363	//--------------------------------
364	// Open Accessibility Button
365	//--------------------------------
366	//
367	$('.accessibilityBtn').on('click', function (e) {
368		e.preventDefault();
369		$('#accessibility').toggleClass("open");
370		return false;
371	});
372
373	//--------------------------------
374	// Resize Font
375	//--------------------------------
376	//
377	$(resizeSelectors).each(function () {
378
379		// Selectors
380		//
381		var $el = $(this);
382
383		// Parameters
384		//
385		var originalFontSize = $el.css('font-size');
386
387		// Reset font size
388		//
389		$(".reset").on('click', function () {
390			$el.css('font-size', originalFontSize);
391		});
392
393		// Increase font size
394		//
395		$(".increase").on('click', function () {
396			var currentFontSize = parseFloat($el.css('font-size'));
397			var newFontSize = currentFontSize * fontSizeIncrement;
398			$el.css('font-size', newFontSize);
399			return false;
400		});
401
402		// Decrease font size
403		//
404		$(".decrease").on('click', function () {
405			var currentFontSize = parseFloat($el.css('font-size'));
406			var newFontSize = currentFontSize * fontSizeDecrement;
407			$el.css('font-size', newFontSize);
408			return false;
409		});
410	});
411
412	//--------------------------------
413	// Grayscale
414	//--------------------------------
415	//
416	$('#grayscale').on('click', function () {
417		$('body').toggleClass("bandw");
418		return false;
419	});
420
421	//--------------------------------
422	// Highlight Links
423	//--------------------------------
424	//
425	$('#allLinks').on('click', function () {
426		$(highlightSelectors).toggleClass("linksHighLight");
427	});
428
429	//--------------------------------
430	// Invert Color
431	//--------------------------------
432	//
433	$('#invertAll').on('click', function () {
434		$('body').toggleClass("inverted");
435		return false;
436	});
437}
438
439//-----------------------------------------------------------
440//
441// Text Length
442//
443//-----------------------------------------------------------
444//
445function handleTextLength() {
446	$('[data-text-length]').text(function (index, currentText) {
447		var text_length = $(this).attr('data-text-length');
448
449		if (currentText.length > text_length) {
450			return currentText.substr(0, text_length) + '...';
451		} else {
452			return currentText.substr(0, text_length);
453		}
454	});
455}
456
457//-----------------------------------------------------------
458//
459// Scroll To Top
460//
461//-----------------------------------------------------------
462//
463function handleScrollTop() {
464	$(".scrollTop").on('click', function (e) {
465		e.preventDefault();
466		$('html, body').animate({scrollTop: 0}, 'slow');
467	});
468}
469
470//-----------------------------------------------------------
471//
472// Slide Toggle
473//
474//-----------------------------------------------------------
475//
476function handleSlideToggle() {
477	var $el = $('[data-slide-toggle]');
478
479	$el.each(function () {
480		var $this = $(this);
481		var $target = $($this.attr('data-slide-toggle'));
482
483		if ($target[0].hasAttribute('data-toggle-open')) {
484			$target.toggleClass('toggle-active');
485			$this.toggleClass('toggle-active');
486		} else {
487			$target.hide();
488		}
489
490		$this.on('click', function () {
491			$target.slideToggle();
492			$target.toggleClass('toggle-active');
493			$this.toggleClass('toggle-active');
494		});
495	});
496}
497
498//-----------------------------------------------------------
499//
500// Image Popup
501//
502//-----------------------------------------------------------
503//
504function handleImagePopup() {
505	$('.img-popup').magnificPopup({
506		type: 'image',
507		closeBtnInside: false,
508		closeOnContentClick: false,
509		image: {
510			verticalFit: true,
511			titleSrc: 'title'
512		},
513		gallery: {
514			enabled: true
515		}
516	});
517}
518
519//-----------------------------------------------------------
520//
521// Video Popup
522//
523//-----------------------------------------------------------
524//
525function handleVideoPopup() {
526	$('.video-popup').magnificPopup({
527		type: 'iframe',
528		closeBtnInside: false,
529		closeOnContentClick: false,
530		disableOn: 700,
531		removalDelay: 160
532	});
533}
534
535//-----------------------------------------------------------
536//
537// Handle Form
538//
539//-----------------------------------------------------------
540//
541function handleForm() {
542
543	convertAsterisk();
544
545	$(document).ajaxComplete(function (event, request, settings) {
546		convertAsterisk();
547	});
548
549	function convertAsterisk() {
550		if ($("table.Dialog tr th .asterisk").length || $("table.Dialog tr td label .asterisk").length || $("table.Dialog tr td .icon .asterisk").length) {
551			return;
552		}
553
554		$("table.Dialog tr th:contains('*'), table.Dialog tr td label:contains('*'), table.Dialog tr td .icon:contains('*')").html(function (index, html) {
555			return html.replace(/(\*)/g, '<span class="asterisk">$1</span>');
556		});
557	}
558}
559
560//-----------------------------------------------------------
561//
562// Toggle Form
563//
564// Usage Case:
565// <input type='radio' data-toggle-form='#target-id'/>
566//
567//-----------------------------------------------------------
568//
569function handleToggleForm() {
570
571	$('[data-toggle-form-hidden]').hide();
572	$('[data-toggle-form-hidden-reverse]').show();
573
574	// Toggle Forms
575	$('[data-toggle-form]').change(function () {
576		if ($(this).is('input:radio')) {
577			$($(this).attr('data-toggle-form')).toggle(!!$(this).is(':checked'));
578			return false;
579		} else if ($(this).is('input:checkbox')) {
580			$($(this).attr('data-toggle-form')).toggle(!!$(this).is(':checked'));
581			return false;
582		} else if ($(this).is('select:not([multiple])')) {
583			var val = $(this).val().toLowerCase();
584			var valTarget = $(this).attr('data-toggle-form-val').toLowerCase();
585			$($(this).attr('data-toggle-form')).toggle(val === valTarget);
586			return false;
587		}
588	});
589
590	// Toggle Forms Reverse
591	$('[data-toggle-form-reverse]').change(function () {
592		if ($(this).is('input:radio')) {
593			$($(this).attr('data-toggle-form-reverse')).toggle(!$(this).is(':checked'));
594			return false;
595		} else if ($(this).is('input:checkbox')) {
596			$($(this).attr('data-toggle-form-reverse')).toggle(!$(this).is(':checked'));
597			return false;
598		} else if ($(this).is('select:not([multiple])')) {
599			var val = $(this).val().toLowerCase();
600			var valTarget = $(this).attr('data-toggle-form-val').toLowerCase();
601			$($(this).attr('data-toggle-form-reverse')).toggle(val !== valTarget);
602			return false;
603		}
604	});
605
606	// Multiselect
607	$('[data-toggle-form][multiple] option').on('click', function () {
608		var $this = $(this);
609		var $parent = $this.closest('select');
610		var $target = $($parent.attr('data-toggle-form'));
611		var val = $this.val().toLowerCase();
612		var valTarget = $parent.attr('data-toggle-form-val').toLowerCase();
613
614		if (val === valTarget) {
615			$target.toggle($this.is(':selected'));
616		}
617	});
618}
619
620//-----------------------------------------------------------
621//
622// Input Mask
623//
624//-----------------------------------------------------------
625//
626function handleInputMask() {
627
628	// via data-inputmask attribute
629	//
630	$(":input").inputmask();
631
632	// Options
633	//
634	var phoneOption = {"mask": "(999) 999-9999"};
635	var dateOption = {"alias": "datetime", "inputFormat": "mm/dd/yyyy"};
636	var emailOption = {"alias": "email"};
637
638	// Selectors
639	//
640	var phoneSelectors = [
641		'input[data-input-type="phone"]',
642		'input[name="phone"]',
643		'input[name="phone_number"]',
644		'input[name="contact_phone_number"]',
645		'input[name="business_phone_number"]'
646	].join(', ');
647
648	var dateSelectors = [
649		'input[data-input-type="date"]',
650		'input[name="date"]'
651	].join(', ');
652
653	// Phone
654	//
655	$(phoneSelectors).inputmask(phoneOption);
656
657	// Date
658	//
659	$(dateSelectors).inputmask(dateOption);
660}
661
662//-----------------------------------------------------------
663//
664// Accordion
665//
666//-----------------------------------------------------------
667//
668function handleAccordion() {
669	$('.accordion').each(function () {
670		var $this = $(this);
671		var $btn = $('.accordionBtn', $this);
672		var $content = $('.accordionContent', $this);
673
674		if ($this.hasClass('active')) {
675			$content.show();
676		} else {
677			$content.slideUp();
678		}
679
680		$btn.on('click', function () {
681			if ($this.hasClass('active')) {
682				$this.removeClass('active');
683				$content.slideUp(500);
684			} else {
685				$this.addClass('active');
686				$content.slideDown(500);
687			}
688
689			// Fix for Slick Slider
690			$(".slider .sliderWrap").slick("refresh");
691		});
692	});
693}
694
695//-----------------------------------------------------------
696//
697// Tabs
698//
699//-----------------------------------------------------------
700//
701function handleTabs() {
702	$('.tabs').each(function () {
703		var $tabs = $(this);
704		var $navs = $('.tabsNav', $tabs);
705		var $contents = $('.tabsContent', $tabs);
706
707		$contents.hide();
708		$contents.first().show();
709		$navs.first().addClass('active');
710
711		$navs.on('click', function (e) {
712			e.preventDefault();
713
714			var $nav = $(this);
715			var $index = $nav.index();
716
717			$navs.removeClass('active');
718			$nav.addClass('active');
719
720			$contents.hide();
721			$contents.eq($index).show();
722
723			// Fix for Slick Slider
724			$(".slider .sliderWrap").slick("refresh");
725		});
726	});
727}
728
729//-----------------------------------------------------------
730//
731// Sidebar Mobile
732//
733//-----------------------------------------------------------
734//
735function handleSidebarMobile() {
736
737	$('.sidebar').each(function () {
738
739		//--------------------------------
740		// Selectors
741		//--------------------------------
742		//
743		var $el = $(this);
744		var $body = $('body');
745		var $openBtn = $('.sidebarOpen', $el);
746		var $closeBtn = $('.sidebarClose', $el);
747		var $sidebarInner = $('.sidebarSide .sidebarInner', $el);
748
749		//--------------------------------
750		// Open Sidebar
751		//--------------------------------
752		//
753		$openBtn.on('click', function (e) {
754			e.preventDefault();
755
756			$el.addClass('active');
757			$sidebarInner.fadeIn(400);
758			$body.addClass('_overflow-hidden');
759
760			// Accessibility
761			//
762			$openBtn.attr('aria-disabled', true);
763			$closeBtn.attr('aria-disabled', false);
764		});
765
766		//--------------------------------
767		// Close Sidebar
768		//--------------------------------
769		//
770		$closeBtn.on('click', function (e) {
771			e.preventDefault();
772			$body.removeClass('_overflow-hidden');
773			$sidebarInner.fadeOut(400, function () {
774				$el.removeClass('active');
775			});
776
777			// Accessibility
778			//
779			$openBtn.attr('aria-disabled', false);
780			$closeBtn.attr('aria-disabled', true);
781		});
782
783		//--------------------------------
784		// Resize
785		//--------------------------------
786		//
787		$(window).on('resize', _debounce(function () {
788			if (_isMinBrowserWidth(992)) {
789				$el.removeClass('active');
790				$sidebarInner.css({'display': ''});
791				$body.removeClass('_overflow-hidden');
792			}
793		}, 250));
794	});
795}
796
797//-----------------------------------------------------------
798//
799// Sticky Sidebar
800//
801//-----------------------------------------------------------
802//
803function handleStickySidebar() {
804
805	// Exit if no sticky sidebar
806	//
807	if (!$('.sidebarSticky').length) return false;
808
809	// Sticky Sidebar
810	//
811	$('.sidebarSticky').each(function () {
812
813		// Parameters
814		//
815		var OFFSET = 245;
816
817		// Selectors
818		//
819		var $header = $('.headerWrap');
820		var $el = $(this);
821		var $main = $('.sidebarMainWrap', $el);
822		var $sidebar = $('.sidebarSideWrap', $el);
823
824		// Init scroll scene
825		//
826		var scene = new ScrollMagic.Scene({
827			triggerElement: $sidebar,
828			triggerHook: 0
829		})
830			.setPin($sidebar, {pushFollowers: false})
831			.setClassToggle($el, "stuck")
832			.addTo(SMController);
833
834		// Set scroll scene offset and duration
835		//
836		scene.offset(getOffset());
837		scene.duration(getDuration());
838
839		// Resize
840		//
841		$(window).on('resize', _debounce(function () {
842
843			// Re-calculate scroll scene offset and duration
844			//
845			scene.offset(getOffset());
846			scene.duration(getDuration());
847		}, 250));
848
849		// Get Offset Function
850		//
851		function getOffset() {
852			return -($header.height() + OFFSET);
853		}
854
855		// Get Duration Function
856		//
857		function getDuration() {
858			return $main.height() - $sidebar.height();
859		}
860	});
861}
862
863//-----------------------------------------------------------
864//
865// Initial Avatar
866//
867//-----------------------------------------------------------
868//
869function handleInitialAvatar() {
870	var $el = $('[data-initial-avatar]');
871	var initial = "";
872
873	if (!$el.length) return false;
874
875	if ($el.attr('data-initial-name') && $el.attr('data-initial-name') !== "") {
876		initial = $el.attr('data-initial-name').substring(0, 1).toUpperCase();
877	} else {
878		initial = "A";
879	}
880
881	$el.append('<span>' + initial + '</span>');
882}
883
884//-----------------------------------------------------------
885//
886// Multiple Select Input
887//
888//-----------------------------------------------------------
889//
890function handleMultipleSelect() {
891
892	//--------------------------------
893	// Disable preselect
894	//--------------------------------
895	//
896	$("select[multiple] option").prop("selected", false);
897}
898
899//-----------------------------------------------------------
900//
901// Multiple Select Input without pressing Ctr key
902//
903//-----------------------------------------------------------
904//
905function handleMultipleSelectInputWithoutCtr() {
906	var multiSelect = {};
907
908	if (is.desktop()) {
909		init();
910	}
911
912	function init() {
913		var s = document.getElementsByTagName('select');
914		for (var i = 0; i < s.length; i++) {
915			if (s[i].multiple) {
916				var n = s[i].name;
917				multiSelect[n] = [];
918				for (var j = 0; j < s[i].options.length; j++) {
919					multiSelect[n][j] = s[i].options[j].selected;
920				}
921				s[i].onchange = changeMultiSelect;
922			}
923		}
924	}
925
926	function changeMultiSelect() {
927		var n = this.name;
928		for (var i = 0; i < this.options.length; i++) {
929			if (this.options[i].selected) {
930				multiSelect[n][i] = !multiSelect[n][i];
931			}
932			this.options[i].selected = multiSelect[n][i];
933		}
934	}
935}
936
937//-----------------------------------------------------------
938//
939// Handle Modal
940//
941//-----------------------------------------------------------
942//
943function handleModal() {
944	$('.modal').each(function () {
945
946		//--------------------------------
947		// Selector
948		//--------------------------------
949		//
950		var $this = $(this);
951		var $body = $('body');
952		var $mwBtn = $('.btn a', $this);
953		var $btn = $('.modalBtn', $this);
954		var $panel = $('.modalPanel', $this);
955		var $dialog = $('.modalDialog', $this);
956		var $close = $('.modalClose', $this);
957
958		//--------------------------------
959		// Open modal panel
960		//--------------------------------
961		//
962		if ($mwBtn.length) {
963			$mwBtn.on('click', function (e) {
964				e.preventDefault();
965				openModal();
966			});
967		} else {
968			$btn.on('click', function (e) {
969				e.preventDefault();
970				openModal();
971			});
972		}
973
974		//--------------------------------
975		// Close modal panel
976		//--------------------------------
977		//
978		$close.on('click', function (e) {
979			e.preventDefault();
980			closeModal();
981		});
982
983		$panel.on('click', function (e) {
984			if (e.target === this) {
985				closeModal();
986			}
987		});
988
989		//--------------------------------
990		// Functions
991		//--------------------------------
992		//
993		function openModal() {
994			$body.addClass('_overflow-hidden');
995			$panel.fadeIn(400, function () {
996				$panel.addClass('active');
997				$dialog.addClass('active');
998			});
999		}
1000
1001		function closeModal() {
1002			$body.removeClass('_overflow-hidden');
1003			$panel.removeClass('active');
1004			$dialog.removeClass('active');
1005			$panel.fadeOut();
1006		}
1007	});
1008}
1009
1010//-----------------------------------------------------------
1011//
1012// Hide Empty
1013//
1014//-----------------------------------------------------------
1015//
1016function handleHideEmpty() {
1017	$('[data-hide-empty]').each(function () {
1018		$(this).attr('data-hide-empty') === '' ? $(this).hide() : null;
1019	});
1020}
1021
1022//-----------------------------------------------------------
1023//
1024// Image Placeholder
1025//
1026//-----------------------------------------------------------
1027//
1028function handleImgPlaceholder() {
1029	$('[data-img-placeholder]').each(function () {
1030		if ($(this).attr('data-img-placeholder') === '') {
1031			$(this).removeAttr('data-img-placeholder');
1032			return  $(this).addClass('_img-placeholder');
1033		}
1034	});
1035}
1036
1037//-----------------------------------------------------------
1038//
1039// Hide Empty
1040//
1041//-----------------------------------------------------------
1042//
1043function handleVideoPlayer() {
1044	$('.videoPlayer').each(function () {
1045		var $this = $(this);
1046		var $cover = $('.videoCover', $this);
1047		var $video = $('video', $this);
1048
1049		$cover.on('click', function () {
1050			$video.css('opacity', 1);
1051			$cover.fadeOut('fast', function () {
1052				$video[0].play();
1053			});
1054		});
1055	});
1056}
1057
1058//-----------------------------------------------------------
1059//
1060// Fit Image
1061//
1062//-----------------------------------------------------------
1063//
1064function handleFitImage() {
1065	$('[data-fit-img]').each(function () {
1066		var $parent = $(this);
1067		var $child = $('[data-fit-img-child]', $parent);
1068
1069		var parent_ratio = 0;
1070		var child_ratio = Number($child.outerHeight() / $child.outerWidth()).toFixed(2);
1071
1072		autoFit();
1073
1074		$(window).on('resize', _debounce(function () {
1075			autoFit();
1076		}, 250));
1077
1078		function autoFit() {
1079			parent_ratio = Number($parent.outerHeight() / $parent.outerWidth()).toFixed(2);
1080
1081			if (parent_ratio > child_ratio) {
1082				$child.css({
1083					width: 'auto',
1084					height: '100%'
1085				});
1086			} else {
1087				$child.css({
1088					width: '100%',
1089					height: 'auto'
1090				});
1091			}
1092		}
1093	});
1094}
1095
1096//-----------------------------------------------------------
1097//
1098// Count Up
1099//
1100//-----------------------------------------------------------
1101//
1102function handleCountUp() {
1103	$('.countUp').each(function () {
1104
1105		//--------------------------------
1106		// Selectors
1107		//--------------------------------
1108		//
1109		var $this = $(this);
1110		var $num = $('.countUpNum', $this);
1111		var count = {val: 0};
1112		var newNum = parseInt($num.text());
1113
1114		//--------------------------------
1115		// Check if the "newNum"
1116		// is a number
1117		//--------------------------------
1118		//
1119		if (is.not.number(newNum)) {
1120			console.log('the counter is not a number, please make sure you are using a number.');
1121			return false;
1122		}
1123
1124		//--------------------------------
1125		// Set the number to 0
1126		//--------------------------------
1127		//
1128		$num.text(0);
1129
1130		//--------------------------------
1131		// Animation
1132		//--------------------------------
1133		//
1134		var tl = gsap.to(count, 2, {
1135			val: newNum, roundProps: "val", onUpdate: function () {
1136				$num.text(count.val);
1137			}
1138		});
1139
1140		//--------------------------------
1141		// Scrolling
1142		//--------------------------------
1143		//
1144		new ScrollMagic.Scene({
1145			triggerElement: $this,
1146			triggerHook: 0.8
1147		})
1148			.setTween(tl)
1149			.addTo(SMController);
1150	});
1151}
1152
1153
1154//-----------------------------------------------------------------------------------------
1155//
1156//
1157// Execute After Page Fully Loaded
1158//
1159//
1160//-----------------------------------------------------------------------------------------
1161//
1162$(document).ready(function () {
1163	handleRootCSS();
1164	handleBrowserVersion();
1165	handleSiteMainMsg();
1166	handleAccessibility();
1167	handleTextLength();
1168	handleSlideToggle();
1169	handleScrollTop();
1170	handleImagePopup();
1171	handleVideoPopup();
1172	handleForm();
1173	handleToggleForm();
1174	handleInputMask();
1175	handleAccordion();
1176	handleTabs();
1177	handleSidebarMobile();
1178	handleStickySidebar();
1179	handleInitialAvatar();
1180	handleMultipleSelect();
1181	handleMultipleSelectInputWithoutCtr();
1182	handleModal();
1183	handleHideEmpty();
1184	handleImgPlaceholder();
1185	handleVideoPlayer();
1186	handleFitImage();
1187	handleCountUp();
1188});

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.