PageSourceSearch

http://www.psiadvisor.com/include/js/site_styles/default/201501/default.js

js psiadvisor.com collected 2026-09-26 05:36:48 UTC 13,104 bytes, 440 lines download raw bytes

1AATQ = {
2	init:function(){
3		this.handleElements()
4		
5		if (document.querySelector('.nl-form'))
6			this.handleNS()
7
8		this.onScrollInit()
9		this.onClickInit()
10		if ($('body').hasClass('home') && $('body').hasClass('index')){
11			this.handleSR('init')
12		}
13
14		var blanks = document.querySelectorAll('[target="_blank"]')
15		blanks.forEach(function(a){
16			let al = a.getAttribute('aria-label')
17			if (!al)
18				a.setAttribute('aria-label',a.innerText+' opens in a new window')
19		})
20	},
21	$BisMobile: function(){
22		if( navigator.userAgent.match(/Android/i)
23			|| navigator.userAgent.match(/webOS/i)
24			|| navigator.userAgent.match(/iPhone/i)
25			|| navigator.userAgent.match(/iPad/i)
26			|| navigator.userAgent.match(/iPod/i)
27			|| navigator.userAgent.match(/BlackBerry/i)
28			|| navigator.userAgent.match(/Windows Phone/i)
29		){
30			return true;
31		}
32		else {
33			return false;
34		}
35	},
36	handleElements: function(){
37		var _this = this;
38		var b = document.body;
39		var bc = b.classList;
40		var $b = $('body');
41
42		if (bc.contains('index') && bc.contains('_245')) {
43			if (~$('.snippet-readmore').length) {
44				$('.snippet-readmore').on('click tap', function (event) {
45					event.preventDefault();
46					$("html, body").animate({ scrollTop: $('#HomePageText').offset().top - 200 }, 500);
47				});
48			}
49		}
50
51		const $n = document.getElementById('navigationContainer')
52
53		if ($n && (typeof Slick != 'undefined' && typeof Slick.autoStyling != 'undefined' && Slick.autoStyling)) {
54			const $subULs = document.querySelectorAll('#navigationContainer ul ul')
55			let $mainSubUL
56
57			if ($subULs.length) {
58				[].forEach.call($subULs, function (ul) {
59					ul.style.backgroundColor = _this.customizations.subNavBG;
60					ul.style.color = _this.customizations.subNavText;
61				});
62
63				// Find First Sub UL With Children
64				for (i = 0; i < $subULs.length; i++) {
65					if ($subULs[i].querySelectorAll('li').length) {
66						$mainSubUL = $subULs[i];
67						break;
68					}
69				}
70
71				Slick.styleNav()
72
73				// If Preview, Set data-attr
74				if (bc.contains('isPreview1')) {
75					$mainSubUL.classList.add('cp-show-alpha');
76					$mainSubUL.classList.add('first-subnav');
77					$mainSubUL.setAttribute('data-subitem','subnav');
78					$mainSubUL.setAttribute('data-default-bg',_this.customizations.subNavDefaultBG);
79					$mainSubUL.setAttribute('data-default-tc',_this.customizations.subNavDefaultText);
80					$mainSubUL.setAttribute('data-bgcolor',_this.customizations.subNavBG);
81					$mainSubUL.setAttribute('data-txtcolor',_this.customizations.subNavText);
82				}
83			}
84
85			if (bc.contains('isPreview1')) {
86				window.addEventListener('resize',function(){
87					Slick.styleNav()
88				})
89			}
90		}
91
92		this.handleMH();
93
94		if (document.querySelector('#mapContainer iframe')) {
95			document.querySelector('#mapContainer iframe').classList.add('disable-pointer');
96			this.onClick('mapOn');
97		}
98	},
99	handleMH: function() {
100		if (document.querySelector('.header_masthead') || document.querySelector('.eq-logo')) {
101			var $mh = $('.mpl').first(),
102			template = '<div class="slick-masthead"></div>';
103
104			$('#container').attr('data-masthead','true');
105
106			if ($('#container').data('masthead-location') == 'logo-left' || $('#container').data('masthead-location') == 'logo-right') {
107				$(template).clone().prependTo('.slicknav_menu');
108				$mh.clone().prependTo('.slick-masthead');
109			}
110			else if (($('#container').attr('data-masthead-location') == 'masthead' || document.body.classList.contains('_245')) && document.getElementById('headerContainer')) {
111				if (jQuery(document.getElementById('container').children[0]).is('#headerContainer:not(.hideModular)') || document.body.classList.contains('_245')) {
112					var headerColor = $('#headerContainer').css('background-color');
113					$(template).clone().insertBefore('.slicknav_menu');
114					$mh.clone().prependTo('.slick-masthead');
115					$('.slick-masthead').css('background-color',headerColor);
116
117					if (document.body.classList.contains('_245') && !document.body.classList.contains('_10')) {
118						document.querySelector('#headerContainer').classList.remove('hideModular');
119					}
120				}
121				else {
122					$('#container').attr('data-masthead','false');
123				}
124			}
125		}
126		else {
127			$('#container').attr('data-masthead','false');
128		}
129	},
130	onScrollInit: function(){
131		$(window).scroll(function () {
132			if ($('.menu_content:visible').length && $(window).width() >= 1025) {
133				$('.menu_content:visible').hide();
134			}
135		});		
136	},
137	onClickInit: function(){
138		var b = document.body;
139		var bc = b.classList;
140
141		if (document.querySelector('.scroll-to-top')) {
142			var $stt = $('.scroll-to-top');
143
144			$stt.on('click touchend', function () {
145				$("html, body").animate({ scrollTop: $('body').offset().top }, 500);
146
147				var  $skip = document.querySelector('.skip-main')
148
149				if ($skip)
150					$skip.focus()
151			});
152		}
153
154		if (document.querySelector('.contact-toggle')) {
155			const contact_toggle = document.querySelector('.contact-toggle')
156			const contact_popover = new bootstrap.Popover(contact_toggle, {
157				trigger: 'click',
158				html:true,
159				placement: 'bottom',
160				container: document.querySelector('.page-title-contact-strip  .contact'),
161				content: function () {
162					return document.querySelector('.phone-email-address').innerHTML
163				}
164			})
165			contact_toggle.addEventListener('hidden.bs.popover', function(){
166				this.setAttribute('aria-expanded','false')
167			})
168			contact_toggle.addEventListener('shown.bs.popover', function(){
169				this.setAttribute('aria-expanded','true')
170			})
171		}
172
173		if (bc.contains('agents_list')) {
174			const pbtns = document.querySelectorAll('.profile-button button')
175
176			if (pbtns.length) {
177				const modal = document.getElementById('agentModal'),
178				bs_modal = new bootstrap.Modal(modal),
179				mb = modal.querySelector('.modal-body'),
180				vfp = modal.querySelector('.view-full-page')
181
182				let previousFocus
183
184				this.handleModalFocus(modal)
185
186				modal.addEventListener('hidden.bs.modal',function(e){
187					if (previousFocus)
188						previousFocus.focus()
189				})
190
191				function populateModal(btn) {
192					let	top = btn.closest('.agent_list_item'),
193					url = ''
194
195					previousFocus = btn
196					url = top.dataset.agentUrl
197
198					if(!url || url === '')
199						return false
200
201					vfp.href = url
202
203					if (top.dataset.bio){
204						mb.innerHTML = top.dataset.bio
205						bs_modal.show()
206					}
207					else{
208						jQuery.ajax({
209							url: url,
210							method: 'GET',
211							dataType: 'html'
212						})
213						.done(function (data) {
214							mb.innerHTML = jQuery(data).find('#hcard').html()
215							bs_modal.show()
216						})
217					}
218				}
219
220				pbtns.forEach(function(btn){
221					btn.addEventListener('click',function(){
222						populateModal(btn)
223					})
224				})
225			}
226
227			if (bc.contains('_245') && document.querySelector('.agents_location')) {
228				document.body.classList.add('header-lists');
229				var locs = Array.prototype.slice.call(document.querySelectorAll('.agents_location'));
230
231				locs.forEach(function (el) {
232					el.addEventListener('click', function() {
233
234						if (document.querySelectorAll('.agents_location.open').length > 0 && this.classList.contains('open')) {
235							this.classList.remove('open')
236						}
237						else {
238							locs.forEach(function (el) {el.classList.remove('open')});
239							this.classList.add('open');
240							this.scrollIntoView({behavior:'smooth',block:'start'});
241						}						
242					}, false);
243				});
244			}
245		}
246
247	},
248	validateEmail:function(string){
249		// http://emailregex.com/
250		const regex = new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
251		return regex.test(string);
252	},
253	handleModalFocus:function(element){
254		const modal = element,
255		firstFocus = modal.querySelector('.first-focus-item'),
256		lastFocus = modal.querySelector('.last-focus-item')
257
258		modal.addEventListener('shown.bs.modal',function(e){
259			firstFocus.focus()
260		})
261
262		firstFocus.addEventListener('keydown',function(e){
263			let kc = e.keyCode || e.which
264
265			if (!e.shiftKey)
266				return false
267
268			if(kc == 9){
269				e.preventDefault()
270				lastFocus.focus()
271			}
272		})
273
274		lastFocus.addEventListener('keydown',function(e){
275			let kc = e.keyCode || e.which
276
277			if (e.shiftKey)
278				return false
279
280			if(kc == 9){
281				e.preventDefault()
282				firstFocus.focus()
283			}
284		})
285	},
286	handleNS:function(){
287		const _this = this,
288		nlforms = document.querySelectorAll('.nl-form')
289
290		if (!nlforms.length)
291			return false
292
293		function resetForm(status,form,emailInput){
294			const formMessage = form.querySelector('.form-message')
295			if (status === 'success') {
296				form.className = 'nl-form success'
297				emailInput.value=''
298				formMessage.innerHTML = formMessage.dataset.success
299			}
300			else if (status === 'invalid'){
301				form.className = 'nl-form error'
302				formMessage.innerHTML = formMessage.dataset.invalid
303			}
304			else{
305				form.className = 'nl-form error'
306				formMessage.innerHTML = formMessage.dataset.error
307			}
308
309			form.classList.remove('processing')
310		}
311
312		for (let i=0;nlforms.length>i;i++){
313			let form = nlforms[i],
314			fAction = form.dataset.submiturl
315
316			form.querySelector('button').addEventListener('click',function(){
317				var formSuccess = false
318				const email = form.querySelector('.form-email')
319
320				if (form.classList.contains('processing')){
321					return false;
322				}
323
324				if (form.querySelector('.email-h').value === '' && _this.validateEmail(email.value)){
325					form.classList.add('processing')
326
327					$.ajax({
328						type: 'post',
329						dataType: 'jsonp',
330						url: fAction,
331						data:  $(form).serialize() + "&method=processNLsignup",
332						jsonp: "callback"
333					})
334					.done(function (data, textStatus, jqXHR) {
335						if (data.Success == "true") {
336							formSuccess = true
337						}
338
339						if (formSuccess === true){
340							resetForm('success',form,email)
341						}
342					})
343
344					setTimeout(function(){
345						if (formSuccess === false){
346							resetForm('error',form,email)
347						}
348					},2000)
349				}
350				else{
351					resetForm('invalid',form,email)
352				}
353			},false)
354		}
355	},
356	onClick: function(arg) {
357		if (arg === 'mapOn') {
358			$('#mapContainer').on('click.mapOn touchend.mapOn', function () {
359				$(this).find('iframe').removeClass('disable-pointer');
360				$(this).off('.mapOn');
361				AATQ.onClick('mapOff');
362			});
363		}
364		else if (arg === 'mapOff') {
365			$('.sectionContainer:not(#mapContainer)').on('click.mapOff touchend.mapOff', function () {
366				$('#mapContainer iframe').addClass('disable-pointer');
367				$(this).off('.mapOff');
368				AATQ.onClick('mapOn');
369			});
370		}
371	},
372	handleSR:function(arg) {
373		var _this = this;
374		
375		if (arg === 'init') {
376			window.sr = ScrollReveal({distance:'50px',duration:'600',scale:1,easing:'ease-in-out',reset: true});
377
378			this.srObjects = {
379				addressContainer: {origin:'bottom',distance:'50px',opacity:0},
380				callout1: {origin:'right',distance:'391px',opacity:0},
381				callout3: {origin:'left',distance:'391px',opacity:0},
382				featVideo: {origin: 'left',distance:'50px',opacity:0},
383				featNews: {origin: 'top',distance:'50px',opacity:0},
384				featCalcs: {origin: 'bottom',distance:'50px',opacity:0},
385				featMW: {origin: 'top',distance:'50px',opacity:0},
386				reset: {distance:0,opacity:1}
387			}
388		}
389
390		if ($('#hero-contact').data('p-enabled') == true) {
391			sr.reveal($('#hero-contact')[0],_this.srObjects.addressContainer);
392		}
393		else if (arg != 'init') {
394			sr.reveal($('#hero-contact')[0],_this.srObjects.reset);
395		}
396
397		if ($('#mediaContainer').data('p-enabled') == true) {
398			sr.reveal($('#mediaContainer .col._1')[0],_this.srObjects.callout1);
399			sr.reveal($('#mediaContainer .col._3')[0],_this.srObjects.callout3);
400		}
401		else if (arg != 'init') {
402			sr.reveal($('#mediaContainer .col._1')[0],_this.srObjects.reset);
403			sr.reveal($('#mediaContainer .col._3')[0],_this.srObjects.reset);
404		}
405
406		if ($('#videoContainer').data('p-enabled') == true) {
407			sr.reveal($('#videoContainer>.section-wrapper')[0],_this.srObjects.featVideo);
408		}
409		else if (arg != 'init') {
410			sr.reveal($('#videoContainer>.section-wrapper')[0],_this.srObjects.reset);
411		}
412
413
414		if ($('#cn_container').data('p-enabled') == true) {
415			sr.reveal($('#feat_news')[0],_this.srObjects.featNews);
416			sr.reveal($('#feat_calc')[0],_this.srObjects.featCalcs);
417		}
418		else if (arg != 'init') {
419			sr.reveal($('#feat_news')[0],_this.srObjects.reset);
420			sr.reveal($('#feat_calc')[0],_this.srObjects.reset);
421		}
422
423		if ($('#heroContainer:visible').length >= 1) {
424			if ($('#heroContainer').data('pEnabled') == true) {
425				if(_this.$BisMobile() === false) {
426					skrollr.init([smoothScrolling=true]);
427				}
428			}
429			else {
430				if (skrollr.get() != undefined) {
431					skrollr.get().destroy();
432				}
433			}
434		}
435	}
436}
437
438document.addEventListener('DOMContentLoaded', function() {
439	AATQ.init();
440});

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.