PageSourceSearch

https://www.valleycollege.edu/_resources/js/v2/custom.js?v=2023.03.20.21.13.05

js valleycollege.edu collected 2026-09-24 08:58:33 UTC 4,598 bytes, 168 lines download raw bytes

1jQuery(document).ready(function($) {
2
3	
4	//Check if screen is mobile
5	function isMobileDevice() {
6		let isAndroid = /android/i.test(navigator.userAgent.toLowerCase());
7		let isWindows = /windows phone/i.test(navigator.userAgent.toLowerCase());
8		let isBlackberry = /blackberry/i.test(navigator.userAgent.toLowerCase());
9		let isiDevice = /ipad|iphone|ipod/i.test(navigator.userAgent.toLowerCase());
10		if( isAndroid || isWindows || isBlackberry || isiDevice ) {
11			return true;
12		}
13		return false;
14	}
15	
16	//Close all open header items
17	function closeOpenHeaderItems() {
18		$("#header .active, #overlay").removeClass("active");
19		$("#nav-accordion .accordion-title").attr("aria-expanded", false);
20		$("#hamburger i").removeClass("fa-times").addClass("fa-bars");
21		$("body").removeClass("overflow-hidden");
22	}
23	
24	//Close open header items when a bootstrap modal is opened
25	$(document).on("show.bs.modal", function(e) {
26		closeOpenHeaderItems();
27	});
28	
29	//Close open header items when ESC key is pressed
30	$(document).on("keydown", function(e) {
31		if( e.keyCode == 27 ) {
32			closeOpenHeaderItems();
33		}
34	});
35	
36	//Close open header items when the user clicks elsewhere
37	$(document).on("click", function(e) {
38		if( $(e.target).closest("#header .active").length === 0 ) {
39			closeOpenHeaderItems();
40		}
41	});
42	
43	//Control nav accordion menu logic
44	$("#nav-accordion").on("mouseleave", function(e) {
45		let target = e.toElement || e.relatedTarget;
46		if( $(e.relatedTarget).closest("#bottom-nav").length === 0 ) {
47			closeOpenHeaderItems();
48		}
49	});
50	
51
52	//Control nav accordion menu logic
53	$("#nav-accordion .accordion-title").on("click mouseover", function(e) {
54		e.preventDefault();
55		
56		let button = $(this);
57		let menu = $( button.data("target") );
58		let siblings = button.closest(".accordion-item").siblings();
59		
60		//Prevent hover from toggling class if button has active class
61		if( e.type == "mouseover" && menu.hasClass("active") ) {
62			return;
63		}
64		
65		button.toggleClass("active").attr("aria-expanded", () => {
66			return button.hasClass("active") ? true : false;
67		});
68		siblings.each(function() {
69			$(this).find(".active").removeClass("active");
70			$(this).find(".accordion-title").attr("aria-expanded", false);
71		});
72		menu.toggleClass("active");
73		
74		$("#overlay").addClass("active");
75	});
76	
77	//Remove mouseover on mobile for nav accordion items
78	if( isMobileDevice() ) {
79		$("#nav-accordion .accordion-title").off("mouseover");
80	}
81	
82	//Control hamburger menu logic
83	$("#hamburger").click(function(e) {
84		e.preventDefault();
85		
86		let button = $(this);
87		let icon = button.find("i");
88		let nav = $("#bottom-nav");
89
90		if( button.hasClass("active") ) {
91			closeOpenHeaderItems();
92			return;
93		}
94		
95		button.addClass("active").attr("aria-expanded", true);
96		icon.removeClass("fa-bars").addClass("fa-times");	
97		nav.addClass("active");
98		
99		$("body").addClass("overflow-hidden");
100		$("#overlay").addClass("active");
101	});
102	
103	//Focus nav search input (Google search form embed) on modal opening
104	$("#nav-search-modal").on("shown.bs.modal", function(e) {
105		$("#nav-search-modal input[name=search]").focus();
106	});
107	
108
109	//Smooth-scroll back-to-top href
110	$("#back-to-top").click(function(e) {
111		e.preventDefault();
112		$("html, body").animate({
113			scrollTop: 0
114		}, "800");
115	});
116	
117	
118	//Hide back-to-top button at certain window heights
119	$(window).scroll(function() {
120		if( $(this).scrollTop() > 500 ) {
121			$("#back-to-top").fadeIn();   
122		} else {
123			$("#back-to-top").fadeOut();
124		}
125	});
126
127	
128
129	$(function() {
130		// selector for the nav container
131		var navigation = $('#sidebar nav ul'); 
132		
133		// e.g. a.cms.omniupdate.com
134		var sassHost = 'wcms.sbccd.org'; 
135
136		var path = window.location.pathname;
137		var ext = 'php';
138
139		if (window.location.host == sassHost) {
140			var href = window.location.href;
141			var startPath = '&path=';
142			var startPathPos = href.indexOf(startPath) + startPath.length;
143			var endPathPos = href.indexOf('&', startPathPos);
144			path = decodeURIComponent(href.substring(startPathPos, endPathPos));
145			path = path.replace('pcf', ext); //replace with correct extension
146		} else {
147			if ( path.indexOf(ext) < 0) {
148				path = path + "index." + ext + '"], a[href="' + path +'"], a[href="' + path.substring(0, path.length-1);
149			}
150		}
151
152		var current = navigation.find('a[href="' + path + '"]');
153		//current.parent().addClass('selected');
154		current.addClass('selected');
155	});
156
157	
158	
159	//Smooth scroll to .scroll classes href
160	$(".smooth-scroll").on("click", function(e) {
161		e.preventDefault();
162		$("html, body").animate({
163			scrollTop: $($(this).attr("href")).offset().top - 150
164		}, "600");
165	});
166	
167	
168});

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.