PageSourceSearch

https://gmuhsathletics.com/assets/scripts/pfs/MobileNav.js?v=release-202607020820

js gmuhsathletics.com collected 2026-09-24 13:58:09 UTC 3,706 bytes, 137 lines download raw bytes

1var MobileNav = (function() {
2	'use strict';
3
4	var self = {};
5
6	init();
7	function init() {
8		resize();
9		bindEvents();
10	}
11
12
13	/**
14	 *  bindEvents()
15	 *  Bind necessary event handlers.
16	 */
17	function bindEvents() {
18		FastClick.attach(document.body);
19		$(window).on('resize', resize);
20		$('.js-toggle-nav').on('click', toggleNav);
21		$('.js-mobile-nav-item').on('click', changeScreen);
22	}
23
24
25	/**
26	 *  resize()
27	 *  Sizes the screens and adjusts content height for scrolling.
28	 */
29	function resize() {
30		$('.js-mobile-nav-screen').width( $('.mobile-nav').width() );
31		$('.mobile-nav__screens').width( $('.js-mobile-nav-screen').width() * $('.js-mobile-nav-screen').length );
32		$('.js-screen-content').height( $(window).height() - 48 - 56 - 49 );
33		var screenWidth = $(window).width();
34		var sideNavAllSportsDiv = $('.js-screen-content.side-nav-allsports');
35		sideNavAllSportsDiv.height( $(window).height() - 48 - 56 - 49 - 180);
36		if(screenWidth < sideNavAllSportsDiv.parent().width()){
37			sideNavAllSportsDiv.width(screenWidth);
38		}else{
39			sideNavAllSportsDiv.width(sideNavAllSportsDiv.parent().width()-28);
40		}
41		$('.js-screen-content.side-nav-allsports>.row').css('margin-right','0px');
42	}
43
44
45	/**
46	 *  Shows/Hides the mobile navigation.
47	 *  @param {Event} e
48	 */
49	function toggleNav(e) {
50		var $nav = $('.js-mobile-nav');
51		$nav.toggleClass('slide-in');
52
53		if ($nav.hasClass('slide-in')) {
54			// $nav.show();
55			$('html').addClass('nav-open');
56			$('#primaryNav .dropdown-menu').removeClass('show');
57			var style = document.createElement('style');
58			style.id = 'navBackdropStyle';
59			style.textContent = `
60			#gradientDiv:after {
61				position: fixed;
62				top: 0;
63				left: 0;
64				right: 0;
65				bottom: 0;
66				background: rgba(0, 0, 0, 0.5);
67				content: '';
68				z-index: 1;
69				transition: opacity 0.3s ease;
70			}
71			`;
72
73			document.head.appendChild(style);
74			resize();
75		}
76		else {
77			// $nav.hide();
78			$('html').removeClass('nav-open');
79			var styleElement = document.getElementById('navBackdropStyle');
80			if (styleElement) {
81				styleElement.textContent = styleElement.textContent.replace(/#gradientDiv:after\s*{[^}]*}/, '');
82				if (styleElement.textContent.trim() === '') {
83					styleElement.parentNode.removeChild(styleElement);
84				}
85			}
86
87		}
88	}
89
90
91	/**
92	 *  Navigates from one section to another.
93	 *  @param {Event} e
94	 */
95	function changeScreen(e) {
96		var screen = $(this).data('screen');
97		var $screen = $('.js-mobile-nav-screen[data-screen="' + screen + '"]');
98		var content = $(this).data('content');
99		var $container = $('.mobile-nav__screens');
100		var width = $('.mobile-nav').width();
101		var translate = -(width * screen) + "px";
102
103
104		if (typeof content != 'undefined') {
105			$screen.find('.js-screen-content').hide();
106			$screen.find('.js-screen-content[data-content="' + content + '"]').show();
107		}
108
109		$container.css('transform', 'translateX(' + translate + ')');
110		$('.mobile-nav__screens').css('transition', 'transform 0.3s ease');
111
112	}
113
114	return self;
115})();
116
117$(document).ready(function() {
118    var pfsNav = $('.pfs-nav');
119    var $nav = $('.js-mobile-nav');
120    $(document.body).click(function(event) {
121		if ((!pfsNav.is(event.target) && pfsNav.has(event.target).length === 0)){
122			if(!event.target.classList.contains("menueventcheck")){
123				if ($('html').hasClass('nav-open')) {
124					$nav.hide();
125					$('html').removeClass('nav-open');
126					var styleElement = document.getElementById('navBackdropStyle');
127					if (styleElement) {
128						styleElement.textContent = styleElement.textContent.replace(/#gradientDiv:after\s*{[^}]*}/, '');
129						if (styleElement.textContent.trim() === '') {
130							styleElement.parentNode.removeChild(styleElement);
131						}
132					}
133				}
134			}
135		}
136    });
137});

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.