PageSourceSearch

https://nyackboatclub.org/javascripts/frontend/site.js

js nyackboatclub.org collected 2026-10-08 08:22:11 UTC 4,539 bytes, 165 lines download raw bytes

1var stickyTop;
2function sticky() {
3	var on = $(window).scrollTop() > stickyTop;
4	$('#grouping').toggleClass('sticky',on);
5	$('body').toggleClass('stuck',on);
6};
7function sticky_nav() {
8	var on = $(window).scrollTop() > stickyTop;
9	$('#navigation').toggleClass('sticky',on);
10	$('body').toggleClass('stuck',on);
11};
12function toggle_secondary_menu() {
13	$('#secondary').toggleClass('show');
14}
15function toggle_menu( i ) {
16	if ($('#menu'+i+':visible').length==0)
17		pop_open( i );
18	else
19		pop_shut( i );
20}
21function toggle_menu_with_click( i, desktop_only_click_url ) {
22	if (desktop_only_click_url && window.innerWidth>800) {
23		window.location = desktop_only_click_url;
24		return;
25	}
26	toggle_menu( i );
27}
28function mobile() {
29	// Return true if we are in mobile mode
30	// Base decision on small chunk of CSS added by a media query.
31	return $('body').css('padding-bottom') == '1px';
32}
33$(function(){
34	$('.popdown').hover(function(e){
35		if (mobile()) return;
36		pop_open($(this).data('index'))
37	},function(e){
38		if (mobile()) return;
39		pop_close($(this).data('index'))
40	})
41})
42var pop_id = null;
43var timeouts = new Object();
44var skip_next_hover_out = false;
45
46function checkIfInView(element){
47    var offset = element.offset().top - $(window).scrollTop();
48		offset += 60; // if the menu is REALLY close but still ON the bottom of the screen then we still would like a scroll please.
49    if (offset > window.innerHeight) {
50        // Not in view so scroll to it
51        $('html,body').animate({scrollTop: offset}, 1000);
52        return false;
53    }
54   return true;
55}
56
57function pop_open( id ) {
58	$('#popdown').show();
59	$('#popdown .inner > div').hide();
60	if (timeouts[id]) {
61		clearTimeout( timeouts[id] );
62		timeouts[id] = null;
63	}
64	$('#menu'+id).slideDown( 200 ); // or $('#menu'+id).fadeIn( 100 );
65	$('#menu'+id).closest('li').css('z-index','1000');
66
67	//$('#menu'+id)[0].scrollIntoView();
68	checkIfInView( $('#menu'+id) );
69
70	// NEW: Un-highlight popped menu option
71	if (pop_id!==null) {
72		$('#navigation .inner ul li[data-index='+pop_id+']').removeClass('on');
73		pop_id = null;
74	}
75
76	// NEW: Highlight popped menu option
77	$('#navigation .inner ul li[data-index='+id+']').addClass('on');
78	pop_id = id;
79
80	// Clear all timeouts
81	for(var i in timeouts) {
82		if (timeouts[i]) {
83			clearTimeout( timeouts[i] )
84		}
85	}
86	timeouts = new Object();
87	// Hide everything else immediately
88	$('#menu'+id).parent().siblings().find('> div').hide();
89}
90function pop_shut( id ) {
91
92	// NEW: Un-highlight popped menu option
93	if (pop_id!==null) {
94		$('#navigation .inner ul li[data-index='+pop_id+']').removeClass('on');
95		pop_id = null;
96	}
97
98	$('#menu'+id).fadeOut( 250, function() {
99		$('#popdown').hide();
100	} );
101}
102function pop_close( id ) {
103	$('#menu'+id).closest('li').css('z-index','auto');
104	timeouts[id] = setTimeout(function(){pop_shut(id)}, 250 )
105}
106var equalise_what = null;
107var resizeId = null;
108var include_padding = false;
109var min_equalise_height = 0;
110function equalise() {
111	var max = min_equalise_height;
112	$(equalise_what).each( function() {
113	    var height = include_padding ? $(this).outerHeight() : $(this).height();
114	    if (height>max) max = height;
115	}).css( 'min-height', max+'px' );
116}
117function equally_high( what ) {
118	equalise_what = what;
119	$(window).on("load",equalise);
120}
121function equally_high_with_padding( what ) {
122	include_padding = true;
123	equalise_what = what;
124	$(window).on("load",equalise);
125}
126function maintain_equally_high( what ) {
127	equally_high( what )
128	$(window).resize( resizing );
129}
130function force_equally_high( what ) {
131	var tmp = equalise_what;
132	equalise_what = what;
133	equalise();
134	equalise_what = tmp;
135}
136function resizing() {
137    clearTimeout( resizeId );
138    resizeId = setTimeout( equalise, 250 );
139}
140function toggle_search() {
141	$('#top-search input').toggle();
142}
143
144function setup_sticky_menu() {
145	$(function() {
146		if ($('#navigation').offset()===undefined) {
147			/* Do nothing */
148		} else {
149			stickyTop = $('#navigation').offset().top;
150			$( "<style>body.stuck { padding-top:"+$('#navigation').height()+"px; } @media screen and (max-width:800px) { body.stuck { padding-top:0px; } }</style>" ).appendTo( "head" )
151			$(window).scroll(sticky);
152		}
153	});
154}
155function setup_sticky_menu_nav() {
156	$(function() {
157		if ($('#navigation').offset()===undefined) {
158			/* Do nothing. */
159		} else {
160			stickyTop = $('#navigation').offset().top;
161			$( "<style>body.stuck { padding-top:"+$('#navigation').height()+"px; } @media screen and (max-width:800px) { body.stuck { padding-top:0px; } }</style>" ).appendTo( "head" )
162			$(window).scroll(sticky_nav);
163		}
164	});
165}

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.