PageSourceSearch

https://www.lonestar.edu/js-out/scripts.js?v=2692311592

js lonestar.edu collected 2026-09-24 08:59:09 UTC 14,437 bytes, 531 lines download raw bytes

1 $(document).ready(function () {
2   // Temporary mylonestar fix
3   $('.header li a:contains("myLoneStar")').attr('href', 'https://my.lonestar.edu/?refresh');
4
5   // GTM Data Layer
6   (function(){
7     var uiID = new Date().getTime();
8     window.dataLayer = window.dataLayer || [];
9     window.dataLayer.push({'uiID': uiID});
10     return uiID;
11   })();
12
13 	var URLVars = getUrlVars();
14 	// console.log(URLVars.v);
15
16 	if ($('body').hasClass('department-page')) {
17 		ScrollReveal().reveal('.standard-section:not(.card-section) img', {
18 			distance: '30px',
19 			delay: 250
20 		});
21 	}
22
23 	/* Intended for programs of study */
24 	$('.btn-pathways:contains("Print Program Pathway")').hide();
25
26 	/* Legacy	*/
27 	//Slicker
28 	$('div[class*="slickbox"]').hide();
29 	/*
30		 $('a[class*="slick-slidetoggle-"]').click(function (e) {
31				 $(this).parent().next('div[class*="slickbox"]').slideToggle();
32				 return false;
33		 });
34		 */
35 	$('a[class*="slick-slidetoggle-"]').each(function (i) {
36 		$(this).click(function (e) {
37 			var target = $(this).attr('class');
38
39 			target = target.replace('-slidetoggle-', 'box');
40 			$('.' + target).slideToggle();
41 			return false;
42 		});
43 	});
44
45
46 	// Popovers
47 	$(function () {
48 		$('[data-toggle="popover"]').popover();
49 	});
50
51 	// Main Navigation
52 	// Sailing plugin for the main navigation
53 	$('.header').sailing();
54 	$('#header-minimal').floating();
55
56 	// hamburger opens/closes mobile navigation
57   /*
58 	$('.main-hamburger').on('click', function () {
59 		$('.mobile-nav-container').fadeToggle().toggleClass('show-mobile-menu');
60 		$('.main-hamburger').toggleClass('main-hamburger-on');
61 	});
62
63 	// Magifying glass opens/closes search
64 	$('.nav-search').on('click', function () {
65 		$('.header').toggleClass('enable-search');
66 		$('.mobile-nav-container').fadeToggle();
67 		$('.mobile-nav-search input').focus();
68 	});
69    */
70
71 	// Sub menus
72  /*
73 	$('.sub-menu-container').click(function () {
74 		$(this).find('.sub-menu').toggle();
75 	});
76  */
77   
78  // Search - Clear input field
79  $('#clear-search').on('click', function(e){
80    e.preventDefault();
81    $('#search-input').val('');
82  });
83   
84  // Search - support the enter key to submit a search 
85  $('#search-input').keypress(function(event) {
86    if (event.which == 13) {
87          event.preventDefault();
88      $('#search-form').submit();
89          console.log('enter');
90    }
91  });
92   
93 	// Support old tabs mainly for programs of study
94 	$('.grid_12.alpha li').click(function () {
95 		$(this).siblings().removeClass('active');
96 		$(this).addClass('active');
97 	});
98
99 	// Accordions
100 	// Commented because it forces all items to be closed on load
101 	// This is not necessary to instatiate the accordion
102 	/* $('.collapse').collapse(); */
103
104 	// Prevent Dropdown Parent from click
105 	$(".sub-menu-container > a").click(function (e) {
106 		return false;
107 	});
108
109 	// Search Box
110   /*
111 	$(".lsc-menu-secondary .icon").on('click', function (e) {
112 		e.stopPropagation();
113 		$(this).parents().find('.search-box').slideToggle();
114 	});
115
116 	$(".hbr-search input").click(function (e) {
117 		e.stopPropagation();
118 	});
119  */
120  
121 	// Go To Top
122 	$('body').prepend('<div class="go-top"><div id="top"><i class="fa fa-angle-up"></i></div></div>');
123 	$(window).scroll(function () {
124 		if ($(window).scrollTop() > 100) {
125 			$('.go-top').fadeIn(600);
126 		} else {
127 			$('.go-top').fadeOut(600);
128 		}
129 	});
130
131 	$('#top').click(function () {
132 		$('body, html').animate({
133 			scrollTop: 0
134 		}, 800);
135 	});
136
137 	var navHeight = $(".main-nav-container").outerHeight();
138 	/*$("#about-menu").sticky({
139 		topSpacing: navHeight,
140 		wrapperClassName: 'sticky-wrapper-about',
141 		getWidthFrom: 'body',
142 		responsiveWidth: true,
143 		zIndex: 100
144 	});
145 	$('#about-menu').on('sticky-start', function () {
146 		$('.header').addClass('about-nav-sticky sailing');
147 	});
148 	$('#about-menu').on('sticky-end', function () {
149 		$('.header').removeClass('about-nav-sticky');
150 	});*/
151
152     if($('.header-slider')[0]){
153      	$(".header-slider").owlCarousel({
154      		items: 1,
155      		smartSpeed: 1000,
156      		autoplay: true,
157      		animateOut: 'fadeOut',
158      		video: true,
159      		loop: true,
160      		navText: ['<i class="fa fa-arrow-left"></i>', '<i class="fa fa-arrow-right"></i>'],
161      		responsiveClass: true,
162      		responsive: {
163      			0: {
164      				nav: false,
165      				dots: true,
166      			},
167      			768: {
168      				nav: true,
169      				dots: false
170      			}
171      		}
172      	});
173 	}
174
175 	//Isotope Masonry
176 	var $grid = $('.trending').isotope({
177 		//itemSelector: '.single-trend',
178 		itemSelector: 'figure',
179 		percentPosition: true,
180 		filter: '*',
181 		masonry: {
182 			// use outer width of grid-sizer for columnWidth
183 			columnWidth: '.grid-sizer'
184 		}
185 	});
186
187 	$grid.imagesLoaded().progress(function () {
188 		$grid.isotope('layout');
189 	});
190
191 	var isoTrigger = $('.trend-menu li');
192
193 	isoTrigger.first().addClass('active');
194
195 	isoTrigger.on('click', 'a', function (e) {
196 		e.preventDefault();
197 		var $this = $(this);
198 		$this.parent('li').addClass('active').siblings().removeClass('active');
199 		$this.parents('.trending-section').find('.trending').isotope({
200 			filter: $(this).data('filter')
201 		});
202 	});
203
204 	// Popup content
205 	/*
206		 $('.gallery').magnificPopup({
207				 delegate: 'a',
208				 type: 'image',
209				 tLoading: 'Loading image #%curr%...',
210				 mainClass: 'mfp-img-mobile',
211				 gallery: {
212						 enabled: true,
213						 navigateByImgClick: true,
214						 preload: [0, 1]
215				 image: {
216						 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
217				 }
218		 });
219		 */
220
221 	$('.gallery').each(function () { // the containers for all your galleries
222 		$(this).magnificPopup({
223 			delegate: 'a',
224 			type: 'image',
225 			tLoading: 'Loading image #%curr%...',
226 			mainClass: 'mfp-img-mobile',
227 			gallery: {
228 				enabled: true,
229 				navigateByImgClick: true,
230 				preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
231 			},
232 			image: {
233 				tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
234 			}
235 		});
236 	});
237
238 	$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
239 		disableOn: 700,
240 		type: 'iframe',
241 		mainClass: 'mfp-fade',
242 		removalDelay: 160,
243 		preloader: true,
244 		fixedContentPos: true
245 	});
246
247 	//$('.header-video').vdo(URLVars.v);
248
249 	$('.anchor').scrollTo();
250
251 });
252
253 function hexToRgb(hex) {
254 	var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
255 	return result ? {
256 		r: parseInt(result[1], 16),
257 		g: parseInt(result[2], 16),
258 		b: parseInt(result[3], 16)
259 	} : null;
260 }
261
262 function numberWithCommas(x) {
263 	return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
264 }
265
266 function detectIE() {
267 	var ua = window.navigator.userAgent;
268
269 	var msie = ua.indexOf('MSIE ');
270 	if (msie > 0) {
271 		// IE 10 or older => return version number
272 		return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
273 	}
274
275 	var trident = ua.indexOf('Trident/');
276 	if (trident > 0) {
277 		// IE 11 => return version number
278 		var rv = ua.indexOf('rv:');
279 		return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
280 	}
281
282 	var edge = ua.indexOf('Edge/');
283 	if (edge > 0) {
284 		// Edge (IE 12+) => return version number
285 		return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
286 	}
287
288 	// other browser
289 	return false;
290 }
291
292 (function ($) {
293
294 	$.fn.sailing = function () {
295 		var h = 58.19;
296 		var $this = $(this);
297 		$(window).scroll(function (e) {
298 			var distanceFromTop = $(window).scrollTop();
299 			var elementHeight = $this.height();
300
301 			if (distanceFromTop > 0) {
302 				$this.addClass('sailing');
303
304 				//if ($('.sailing-wake').length == 0) {
305 				//$this.after('<div class="sailing-wake" style="height: '+h+'px;"></div>');
306 				//}
307 			} else {
308 				$this.removeClass('sailing').addClass('-lsc-transition').delay(1000).queue(function (next) {
309 					$(this).removeClass('-lsc-transition');
310 					next();
311 				});
312 				//$('.sailing-wake').remove();
313 			}
314 		});
315 	};
316
317 })(jQuery);
318
319 (function ($) {
320
321 	$.fn.floating = function () {
322 		var h = 58.19;
323 		var $this = $(this);
324 		$(window).scroll(function (e) {
325 			var distanceFromTop = $(window).scrollTop();
326 			var elementHeight = $this.height();
327
328 			if (distanceFromTop > 0) {
329 				$this.addClass('floating');
330
331 				//if ($('.sailing-wake').length == 0) {
332 				//$this.after('<div class="sailing-wake" style="height: '+h+'px;"></div>');
333 				//}
334 			} else {
335 				$this.removeClass('floating');
336 			}
337 		});
338 	};
339
340 })(jQuery);
341
342 (function ($) {
343
344 	$.fn.toc = function () {
345 		var buffer = 150;
346 		var $this = $(this);
347 		$(window).scroll(function (e) {
348 			var scrollTop = $(window).scrollTop();
349 			var elementOffset = $('.content-well-sidebar').offset().top;
350 			var distance = (elementOffset - scrollTop);
351 			console.log(distance);
352 			if (distance < buffer) {
353 				console.log('if');
354 				$this.addClass('floating');
355 				$this.css({
356 					'position': 'fixed',
357 					'margin-top': '-' + (elementOffset - buffer) + 'px'
358 				});
359 			}
360 			if (distance > buffer) {
361 				console.log('else');
362 				$this.removeClass('floating');
363 				$this.css({
364 					'position': 'relative',
365 					'margin-top': 0
366 				});
367 			}
368 			if ($(window).height() - $this.offset().top < 1600 ) {
369
370 				console.log('bottom '+$(window).height() - $this.offset().top);
371 				$this.removeClass('floating');
372 				$this.css({
373 					'position': 'relative',
374 					'margin-top': 0
375 				});
376 			}
377
378 		});
379 	};
380
381 })(jQuery);
382
383 function getUrlVars() {
384 	var vars = [],
385 		hash;
386 	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
387 	for (var i = 0; i < hashes.length; i++) {
388 		hash = hashes[i].split('=');
389 		vars.push(hash[0]);
390 		vars[hash[0]] = hash[1];
391 	}
392 	return vars;
393 }
394
395
396/* HEADER - SEARCH FILTERS */
397$(document).ready(function(){
398
399  $('#search-filter-select').on('change', function(){
400    var $this = $('#search-filter-select');
401    var filter = $('#search-filter-select option:selected').val();
402    
403    setCampusFilter($this, filter);
404    
405  });
406  
407});
408
409function setCampusFilter($el, filter) {
410  console.log(filter);
411  $el.parent().attr('data-filter-term',filter);
412  var parameters = '{"custom_fields.camp":{"'+filter+'":"true"},"v":3}';
413  $('#search-filter').val(parameters);
414}
415
416function initializeDefaultCampusFilter(campus) {
417  $('#search-filter-select option[value="'+campus+'"]').prop('selected', true);
418  setCampusFilter($('#search-filter-select'), campus);
419}
420
421(function($){
422
423$(document).ready(function(){
424
425let $element = $('#header .dropdown-item');
426$element.on("click", function(event){
427	let $this = $(this);
428	let selected = $this.html();
429	let selectedData = $this.data('campus');
430	let parameters = '{"custom_fields.camp":{"'+selectedData+'":"true"},"v":3}'
431	$('.search-dropdown').html(selected);
432	$('#search-filter').val(parameters);
433	
434	//console.log($this.html());
435});
436
437});
438
439})(jQuery);
440
441/*****************************/
442/* UTM URL Cross Page Tracking */
443/*****************************/
444
445// document.addEventListener("DOMContentLoaded", function () {
446// 	const utmKeys = ['utm_medium', 'utm_campaign'];
447// 	const urlParams = new URLSearchParams(window.location.search);
448  
449// 	// Store UTM values in sessionStorage
450// 	utmKeys.forEach(key => {
451// 	  const value = urlParams.get(key);
452    
453//     if (value && value !== 'viewthrough') {
454//       const cookieName = key;
455//       const cookieValue = urlParams.get(key);
456//       const date = new Date();
457//       const days = 30; // 30 Days from creation
458//       date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
459//       const cookieExpires = 'expires=' + date.toUTCString();
460//       setCookie(cookieName, cookieValue, cookieExpires);
461//     }
462// 	});
463  
464// 	// Get UTM values from sessionStorage
465// 	const storedUTM = {};
466// 	utmKeys.forEach((key) => {
467// 		const cookieValue = getCookie(key)?.toLowerCase();
468// 			if (cookieValue && !cookieValue.includes('geniusmonkey') && !cookieValue.includes('localiqprogramsearch25')) {
469// 				storedUTM[key] = cookieValue;
470// 			}
471		
472// 	});
473  
474// 	// Stop here if no stored UTM values
475// 	if (Object.keys(storedUTM).length === 0) return;
476  
477// 	document.addEventListener('click', function (e) {
478// 	  const anchor = e.target.closest('a');
479// 	  if (!anchor || !anchor.href) return;
480  
481// 	  const isModifiedClick = e.metaKey || e.ctrlKey || e.shiftKey || e.altKey;
482// 	  if (
483// 		anchor.target === '_blank' || isModifiedClick ||
484// 		anchor.href.startsWith('mailto:') || anchor.href.startsWith('tel:')
485// 	  ) return;
486  
487// 	  const linkUrl = new URL(anchor.href, window.location.origin);
488  
489// 	  // Only process lonestar.edu links
490// 	  if (!linkUrl.hostname.endsWith('lonestar.edu')) return;
491  
492// 	  let updated = false;
493// 	  for (const key in storedUTM) {
494//       console.log(linkUrl.searchParams);
495// 		if (!linkUrl.searchParams.has(key)) {
496// 		  linkUrl.searchParams.set(key, storedUTM[key]);
497// 		  updated = true;
498// 		}
499// 	  }
500  
501// 	  if (!updated) return;
502  
503// 	  e.preventDefault();
504// 	  window.location.href = linkUrl.toString();
505// 	});
506  
507//   function getCookie(cookieName) {
508//     function escape(s) { return s.replace(/([.*+?\^$(){}|\[\]\/\\])/g, '\\$1'); }
509//     var match = document.cookie.match(RegExp('(?:^|;\\s*)' + escape(cookieName) + '=([^;]*)'));
510//     return match ? match[1] : null;
511//   }
512  
513//   function setCookie(cookieName, cookieValue, cookieExpires) {
514//     document.cookie = cookieName + '=' + cookieValue + ';' + cookieExpires + ';path=/';
515//   }
516  
517//   });
518
519/*****************************/
520/* Addsearch Modal Search Field Focusing */
521/*****************************/
522const addSearchModal = document.getElementById('addsearch-popup');
523
524addSearchModal.addEventListener('shown.bs.modal', function () {
525	const input = document.querySelector('#searchfield-container input[type="search"]');
526	if (input) {
527		input.focus();
528	}
529});
530/* delete geniusmonkey cookie */
531document.cookie = "gmUTM=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";

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.