PageSourceSearch

https://www.okwu.edu/wp-content/themes/okwu-divi/js/scripts.js?ver=1.0.3

js okwu.edu collected 2026-10-01 11:33:46 UTC 13,453 bytes, 402 lines download raw bytes

1jQuery(document).ready(function ($) {
2  // Code Here
3  
4  $(window).load(function(){
5	var et_hash = window.location.hash;
6	if(window.location.hash) {
7	$( '.et_pb_toggle' + et_hash )
8	.removeClass('et_pb_toggle_close')
9	.addClass('et_pb_toggle_open')
10	}
11	
12	// MailChimp Styles
13	let head = $("#PopupSignupForm_0 iframe").contents().find("head");
14	let css = '<style type="text/css">.bannerContent__description{font-size: 17px; text-align: center; margin-top: 15px; margin-bottom: 15px;} .bannerContent__subscribeButton{width: 100%; height: 45px; font-size: 17px; text-transform: uppercase;}</style>';
15	jQuery(head).append(css);
16  });
17  
18  // GA Events added to GPS Request Info buttons
19  jQuery('.onClick .et_pb_button_one, #menu-item-39283, #gform_submit_button_55').click(function() {
20	// This function reports an event to Google Analytics servers.
21	ga('send', 'event', { eventCategory: 'Form', eventAction: 'Click', eventLabel: 'Request Info'});
22  });
23  
24  
25  
26  // Automatically Open Accordion or Toggle from Anchor Link
27	(function($){
28		let hash = '';
29		function doClasses(url){
30			hash = url;
31			let target = '.' + hash,
32				module_check = hash.split("_");
33			if(module_check[2] == 'accordion' || module_check[2] == 'toggle'){
34				if(!$(target).hasClass('et_pb_toggle_open')){
35					$(target).toggleClass('et_pb_toggle_open et_pb_toggle_close');
36					$(target).siblings('.et_pb_accordion_item').removeClass('et_pb_toggle_open').addClass('et_pb_toggle_close');
37				}
38			}
39		}
40		function scrollToElement(el){
41				let elementTop = $('.' + el).offset().top,
42				    headerTop = 90;
43				if($('body').hasClass('et_fixed_nav')){
44					headerTop = $('header').height() + 90;
45			}
46			let scrollTo = elementTop - headerTop;
47			$('html, body').animate({scrollTop: scrollTo + "px"}, 300);
48		}
49		function loadToggle(){
50			if( window.location.hash.slice(1) && (window.location.hash.slice(1).includes('accordion') ||  window.location.hash.slice(1).includes('toggle') )){
51				doClasses(window.location.hash.slice(1));
52            	scrollToElement(window.location.hash.slice(1));		
53			}
54		}
55        function clickToggle(){
56            $('a.et_pb_button').click(function(e){
57				const href = $(this).attr('href'),
58					  splitHref = href.split('#'),
59					  postHref = splitHref[1];
60				doClasses(postHref);
61                scrollToElement(postHref)
62			});
63        }
64
65		loadToggle();
66		console.log('loaded');
67		$('a.et_pb_button').off();
68		clickToggle();
69		
70	})(jQuery)
71	
72	
73	var checkMailchimp = setInterval(function() {
74		var wrapper = $('[id^="mcforms-"]')[0];
75		if (wrapper && wrapper.shadowRoot) {
76			$(wrapper.shadowRoot).append('<style>#el_polWSV2eID { z-index: 999 !important; }</style>');
77			clearInterval(checkMailchimp);
78			console.log('Fixed!');
79		}
80	}, 100);
81
82	setTimeout(function() { clearInterval(checkMailchimp); }, 4000);
83
84  
85});
86
87
88
89// Main menu dropdown system
90(function($) {
91	function setup_collapsible_submenus() {
92		var $menu = $('nav > ul.nav'),
93			top_level_link = '.menu-item-has-children > a';
94		
95		$menu.find('a').each(function() {
96			$(this).off('click');
97			if ($(this).is(top_level_link)) {
98				$(this).attr('href', '#');
99				$(this).next('.sub-menu').addClass('hide');
100			}
101			if ($(this).siblings('.sub-menu').length) {
102				$(this).on('click', function(event) {
103					event.preventDefault();
104					event.stopPropagation();
105					
106					var $clickedSubmenu = $(this).next('.sub-menu');
107					var $clickedItem = $(this).parent();
108					
109					// If this is the first <a> inside a .column-menu item, do nothing
110					if ($clickedItem.hasClass('column-menu')) {
111						return false;
112					}
113					
114					// Check if this submenu is already open
115					var isAlreadyOpen = $clickedSubmenu.hasClass('visible');
116					
117					// Only close sibling submenus at the same level
118					$clickedItem.siblings('.menu-item-has-children').each(function() {
119						$(this).find('.sub-menu').removeClass('visible active');
120						$(this).removeClass('active');
121						$(this).find('.menu-item-has-children').removeClass('active');
122					});
123					
124					// If it was already open, keep it open (don't toggle)
125					if (isAlreadyOpen) {
126						$clickedSubmenu.addClass('visible');
127						$clickedItem.addClass('active');
128						
129						// Re-apply the child submenus that were open
130						if ($clickedItem.hasClass('program-menu')) {
131							var $firstThirdLevel = $clickedSubmenu
132								.children('.menu-item-has-children')
133								.first();
134							
135							$firstThirdLevel.children('.sub-menu').addClass('visible');
136							$firstThirdLevel.addClass('active');
137							
138							var $firstFourthLevel = $firstThirdLevel.children('.sub-menu')
139								.children('.menu-item-has-children')
140								.first();
141							
142							$firstFourthLevel.children('.sub-menu').addClass('visible');
143							$firstFourthLevel.addClass('active');
144						} else {
145							$clickedSubmenu
146								.children('.menu-item-has-children')
147								.each(function() {
148									$(this).children('.sub-menu').addClass('visible active');
149								});
150						}
151					} else {
152						// It was closed, so open it
153						$clickedSubmenu.addClass('visible');
154						$clickedItem.addClass('active');
155						
156						if ($clickedItem.hasClass('program-menu')) {
157							var $firstThirdLevel = $clickedSubmenu
158								.children('.menu-item-has-children')
159								.first();
160							
161							$firstThirdLevel.children('.sub-menu').addClass('visible');
162							$firstThirdLevel.addClass('active');
163							
164							var $firstFourthLevel = $firstThirdLevel.children('.sub-menu')
165								.children('.menu-item-has-children')
166								.first();
167							
168							$firstFourthLevel.children('.sub-menu').addClass('visible');
169							$firstFourthLevel.addClass('active');
170						} else {
171							$clickedSubmenu
172								.children('.menu-item-has-children')
173								.each(function() {
174									$(this).children('.sub-menu').addClass('visible active');
175								});
176						}
177					}
178					
179					return false;
180				});
181			}
182		});
183		
184		// Auto-open when main nav opens - open first .menu-dropdown item
185		$menu.children('.menu-item-has-children').each(function() {
186			$(this).children('a').on('click', function(event) {
187				event.preventDefault();
188				event.stopPropagation();
189				
190				var $parentMenuItem = $(this).parent();
191				var $currentSubmenu = $(this).next('.sub-menu');
192				
193				// Check if already opened - if so, close everything and return
194				if ($parentMenuItem.hasClass('opened')) {
195					$menu.find('.sub-menu').removeClass('visible active');
196					$parentMenuItem.removeClass('opened');
197					$menu.find('.menu-item-has-children').removeClass('active');
198					return false;
199				}
200				
201				// Close all submenus and remove classes
202				$menu.find('.sub-menu').removeClass('visible active');
203				$menu.children('.menu-item-has-children').removeClass('opened');
204				$menu.find('.menu-item-has-children').removeClass('active');
205				
206				// Add opened class to the clicked top-level item
207				$parentMenuItem.addClass('opened');
208				
209				// Open the clicked first-level submenu
210				$currentSubmenu.addClass('visible');
211				
212				if ($currentSubmenu.hasClass('visible')) {
213					// Look for .menu-dropdown as the first second-level item
214					var $menuDropdown = $currentSubmenu.children('.menu-dropdown').first();
215					
216					if ($menuDropdown.length) {
217						// Open ONLY the first .menu-dropdown item
218						$menuDropdown.children('.sub-menu').addClass('visible');
219						$menuDropdown.addClass('active');
220						
221						// Open all direct children of the menu-dropdown
222						$menuDropdown.children('.sub-menu')
223							.children('.menu-item-has-children')
224							.each(function() {
225								$(this).children('.sub-menu').addClass('visible active');
226							});
227					} else {
228						// No .menu-dropdown found, use default behavior on first item
229						var $firstSecondLevel = $currentSubmenu
230							.children('.menu-item-has-children')
231							.first();
232						
233						$firstSecondLevel.children('.sub-menu').addClass('visible');
234						$firstSecondLevel.addClass('active');
235						
236						// Open all direct children of the first second-level item
237						$firstSecondLevel.children('.sub-menu')
238							.children('.menu-item-has-children')
239							.each(function() {
240								$(this).children('.sub-menu').addClass('visible active');
241							});
242					}
243				}
244				
245				return false;
246			});
247		});
248	}
249
250	// Register the outside-click handler for DESKTOP only
251	function setup_outside_click_close() {
252		var $menu = $('nav > ul.nav');
253		
254		// Remove any existing handler first
255		$(document).off('click.closemenu');
256		
257		// Add the handler
258		$(document).on('click.closemenu', function(e) {
259			// Only run on desktop (when mobile menu is not visible)
260			if ($('#mobile_menu').is(':visible')) {
261				return;
262			}
263			
264			// Check if the click is outside the navigation
265			if (!$(e.target).closest('#top-menu').length && 
266				!$(e.target).closest('nav').length && 
267				!$(e.target).closest('.nav').length) {
268				$('.sub-menu').removeClass('visible active');
269				$menu.children('.menu-item-has-children').removeClass('opened');
270				$menu.find('.menu-item-has-children').removeClass('active');
271			}
272		});
273	}
274
275	// Mobile Menu Behavior
276	function setup_mobile_menu() {
277		var $mobileMenu = $('#mobile_menu');
278		
279		// Remove ALL existing click handlers from mobile menu links
280		$mobileMenu.find('a').off('click');
281		
282		// Initial setup
283		$mobileMenu.find('.sub-menu').removeClass('visible').hide();
284		$mobileMenu.find('.menu-item-has-children').removeClass('active');
285		
286		// Open the top level submenu
287		$mobileMenu.children('.menu-item-has-children').each(function() {
288			var $topLevelItem = $(this);
289			var $topLevelSubmenu = $topLevelItem.children('.sub-menu');
290			
291			// Leave open the top level .sub-menu
292			$topLevelSubmenu.addClass('visible').css('display', 'block');
293			$topLevelItem.addClass('active');
294		});
295		
296		// Prevent clicks inside the mobile menu from bubbling up
297		$mobileMenu.on('click', function(e) {
298			e.stopPropagation();
299		});
300		
301		// Prevent Divi from closing mobile menu when clicking outside
302		$(document).off('click.mobile_close touchstart.mobile_close');
303		$(document).on('click.mobile_close touchstart.mobile_close', function(e) {
304			// Only prevent closing if we're clicking outside mobile menu but NOT on the toggle button
305			if (!$(e.target).closest('#mobile_menu').length && 
306				!$(e.target).closest('.mobile_menu_bar_toggle').length &&
307				$('#mobile_menu').is(':visible')) {
308				e.stopImmediatePropagation();
309				return false;
310			}
311		});
312		
313		// Specifically protect the top-level submenu from being hidden
314		var checkInterval = setInterval(function() {
315			var $topLevelSubmenu = $mobileMenu.children('.menu-item-has-children').children('.sub-menu');
316			if ($mobileMenu.is(':visible') && $topLevelSubmenu.length && !$topLevelSubmenu.hasClass('visible')) {
317				$topLevelSubmenu.addClass('visible').css('display', 'block');
318			}
319		}, 100);
320		
321		// Clear interval after 5 seconds (once everything is stable)
322		setTimeout(function() {
323			clearInterval(checkInterval);
324		}, 5000);
325		
326		// Click handlers
327		$mobileMenu.on('click', '.menu-item-has-children > a', function(e) {
328			e.preventDefault();
329			e.stopPropagation();
330			e.stopImmediatePropagation();
331			
332			var $clickedLink = $(this);
333			var $clickedItem = $clickedLink.parent('.menu-item-has-children');
334			var $clickedSubmenu = $clickedLink.siblings('.sub-menu');
335			var $topLevelSubmenu = $mobileMenu.children('.menu-item-has-children').children('.sub-menu');
336			
337			// Don't toggle if it's the top-level menu item itself
338			if ($clickedItem.parent().is($mobileMenu)) {
339				return false;
340			}
341			
342			// If this is the first <a> inside a .column-menu item, do nothing
343			if ($clickedItem.hasClass('column-menu')) {
344				return false;
345			}
346			
347			// Check if this is a second-level item
348			var isSecondLevel = $clickedItem.parent().is($topLevelSubmenu);
349			
350			if (isSecondLevel) {
351				// Close other second-level submenus and remove active class
352				$topLevelSubmenu.children('.menu-item-has-children').not($clickedItem).each(function() {
353					$(this).find('.sub-menu').removeClass('visible').hide();
354					$(this).removeClass('active');
355					$(this).find('.menu-item-has-children').removeClass('active');
356				});
357				
358				// Toggle the clicked submenu
359				if ($clickedSubmenu.hasClass('visible')) {
360					$clickedSubmenu.removeClass('visible').hide();
361					$clickedItem.removeClass('active');
362				} else {
363					$clickedSubmenu.addClass('visible').show();
364					$clickedItem.addClass('active');
365				}
366			} else {
367				// For deeper levels, just toggle
368				if ($clickedSubmenu.hasClass('visible')) {
369					$clickedSubmenu.removeClass('visible').hide();
370					$clickedSubmenu.find('.sub-menu').removeClass('visible').hide();
371					$clickedItem.removeClass('active');
372					$clickedSubmenu.find('.menu-item-has-children').removeClass('active');
373				} else {
374					$clickedSubmenu.addClass('visible').show();
375					$clickedItem.addClass('active');
376				}
377			}
378			
379			return false;
380		});
381	}
382	
383	// Run on document ready
384	$(document).ready(function() {
385		setup_collapsible_submenus();
386		setup_mobile_menu();
387		setup_outside_click_close();
388		
389		// Set class of .mobile-nav-open on body when the mobile nav is opened
390		$('.mobile_menu_bar_toggle').on('click', function() {
391			$('body').toggleClass('mobile-nav-open');
392		});
393	});
394	
395	// Also run after Divi's builder reinitializes (if applicable)
396	$(window).on('load', function() {
397		setTimeout(function() {
398			setup_mobile_menu();
399			setup_outside_click_close();
400		}, 100);
401	});
402})(jQuery);

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.