PageSourceSearch

https://zamboni.com/wp-content/themes/zamboni/js/script.js

js zamboni.com collected 2026-10-02 04:01:40 UTC 9,999 bytes, 303 lines download raw bytes

1jQuery(document).ready(function() {
2
3	setEqualHeight(jQuery("#machines li div"));
4	equalHeight(jQuery(".the-machines .post_content article"));
5
6	/* Fancybox v3 */
7
8	if (jQuery('[data-fancybox], .ngg-gallery-thumbnail a').length > 0) {
9		jQuery('[data-fancybox], .ngg-gallery-thumbnail a').fancybox({
10			toolbar  : true,
11			smallBtn : true,
12			iframe : {
13				preload : false,
14				attr: {
15					scrolling: "auto"
16				},
17				css : {
18					width : '90%',
19					height : '90%'
20				}
21			},
22			animationEffect : 'fade'
23		});
24	}
25
26	/* Fancybox v2 */
27
28	if (jQuery('a.zamboni-fancybox-iframe').length > 0) {
29		jQuery('a.zamboni-fancybox-iframe').fancybox({
30			maxWidth	: 960,
31			maxHeight	: 960,
32			fitToView	: false,
33			width		: '90%',
34			height		: '90%',
35			autoSize	: false,
36			closeClick	: false,
37			openEffect	: 'none',
38			closeEffect	: 'none'
39		});
40	}
41
42	if (jQuery('a[rel=gall').length > 0) {
43		jQuery("a[rel=gall]").fancybox({
44			'transitionIn'		: 'elastic',
45			'transitionOut'		: 'fade'
46		});
47	}
48
49	if (jQuery('a#control').length > 0) {
50		jQuery("a#control").fancybox({
51			'transitionIn'		: 'elastic',
52			'transitionOut'		: 'fade'
53		});
54	}
55
56	if (jQuery('.page-id-52 #content').length > 0) {
57  		jQuery(".page-id-52 #content").fitVids();
58	}
59
60	if (jQuery('#seeit').length > 0) {
61		jQuery("#seeit").click(function() {
62			$.fancybox({
63					'padding'		: 0,
64					'autoScale'		: false,
65					'transitionIn'	: 'none',
66					'transitionOut'	: 'none',
67					'title'			: this.title,
68					'width'		: 680,
69					'height'		: 495,
70					'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
71					'type'			: 'swf',
72					'swf'			: {
73						'wmode'		: 'transparent',
74						'allowfullscreen'	: 'true',
75						'autoplay' : 'true'
76					}
77				});
78
79			return false;
80		});
81	}
82
83	/* Main Menu */
84
85	var desktopBreakpoint = 960;
86	var windowWidth = jQuery(window).width();
87	var menuToggleOpen = '/wp-content/themes/zamboni/img/close-24px.svg';
88	var menuToggleClose = '/wp-content/themes/zamboni/img/menu-24px.svg';
89	var searchToggleOpen = '/wp-content/themes/zamboni/img/close-24px.svg';
90	var searchToggleClose = '/wp-content/themes/zamboni/img/search-24px.svg';
91	var menuArrowUp = '/wp-content/themes/zamboni/img/keyboard_arrow_up-24px.svg';
92	var menuArrowDown = '/wp-content/themes/zamboni/img/keyboard_arrow_down-24px.svg';
93	var menuArrowRight = '/wp-content/themes/zamboni/img/keyboard_arrow_right-24px.svg';
94	var menuShop = '/wp-content/themes/zamboni/img/shopping_cart-24px.svg';
95
96	resetMainMenu();
97	jQuery(window).resize(function() { resetMainMenu(); });
98
99	/* Down arrows for parent nav, down or right arrows for child nav depending on screen width */
100	var subMenuDirection = menuArrowDown;
101	if (windowWidth >= desktopBreakpoint) { var subMenuDirection = menuArrowRight; }
102	if (jQuery("#menu-header-menu li.menu-item-has-children").children("ul").length) {
103		jQuery("#menu-header-menu li.menu-item-has-children a").not("#menu-header-menu li.menu-item-has-children ul.sub-menu a").append( ' <img alt="Icon" class="toggle-sub-menu" src="' + menuArrowDown + '" height="15" width="15"> ');
104		jQuery("#menu-header-menu li.menu-item-has-children li.menu-item-has-children a").not("#menu-header-menu li.menu-item-has-children li.menu-item-has-children ul.sub-menu a").append( ' <img alt="Icon" class="toggle-sub-menu" src="' + subMenuDirection + '" height="15" width="15"> ');
105	}
106
107	/* Special icon for the shop */
108	jQuery("#menu-header-menu li:last-of-type a").not("#menu-header-menu li li:last-of-type a").prepend( ' <img alt="Icon" src="' + menuShop + '" height="15" width="15"> ');
109
110	jQuery(".toggle-sub-menu").click(function(e) {
111
112		e.preventDefault();
113
114		/* If > desktop breakpoint, arrows are intentionally unclickable */
115		if (windowWidth >= desktopBreakpoint) { return false; }
116
117		var subMenu = jQuery(this).parent().next(".sub-menu");
118		var countSubMenu = jQuery(this).parents(".sub-menu").length; /* 0 = parent, 1 = child */
119
120		/* Parent menus get special treatment */
121		if (countSubMenu === 0) {
122			jQuery("#menu-header-menu .sub-menu").not(subMenu).hide();
123		}
124
125		/* Toggle the correct menu on click */
126		jQuery(subMenu).slideToggle("fast", "linear");
127
128		/* Change arrow direction based on toggle */
129		if (countSubMenu === 0) {
130			jQuery("#menu-header-menu .toggle-sub-menu").not(this).attr('src', menuArrowDown);
131		}
132		var subMenuToggleSRC = (jQuery(this).attr('src') === menuArrowDown)
133			? menuArrowUp
134			: menuArrowDown;
135		jQuery(this).attr('src', subMenuToggleSRC);
136
137		/* Open menu if arrow is down and visa versa */
138		if (subMenuToggleSRC === menuArrowUp) {
139			jQuery(subMenu).addClass("sub-menu-open");
140			jQuery(subMenu).removeClass("sub-menu-close");
141		} else {
142			jQuery(subMenu).addClass("sub-menu-close");
143			jQuery(subMenu).removeClass("sub-menu-open");
144		}
145
146		/* Close all sub-menus if parent is closed */
147		if (countSubMenu === 0 && subMenuToggleSRC != menuArrowUp) {
148			jQuery("#menu-header-menu .sub-menu").addClass("sub-menu-close");
149			jQuery("#menu-header-menu .sub-menu").removeClass("sub-menu-open");
150		}
151
152	});
153
154	jQuery("#menu-toggle").click(function(e) {
155		e.preventDefault();
156		if (windowWidth >= desktopBreakpoint) { return false; } /* If > desktop breakpoint, don't show "Menu" icon/text */
157		jQuery("#menu-header-menu").toggle();
158		var menuToggleSRC = (jQuery("#menu-toggle img").attr('src') === menuToggleOpen)
159			? menuToggleClose
160			: menuToggleOpen;
161		jQuery("#menu-toggle img").attr('src', menuToggleSRC);
162	});
163
164	jQuery("#search-toggle").click(function(e) {
165		e.preventDefault();
166		if (windowWidth >= desktopBreakpoint) { return false; } /* If > desktop breakpoint, don't show "Menu" icon/text */
167		jQuery("#menu-header-search").toggle();
168		var searchToggleSRC = (jQuery("#search-toggle img").attr('src') === searchToggleOpen)
169			? searchToggleClose
170			: searchToggleOpen;
171		jQuery("#search-toggle img").attr('src', searchToggleSRC);
172	});
173
174	jQuery('#ubermenu-main-502-main_nav a').not(".parent").click(function(e){
175		var clicked = e.currentTarget, url = clicked.href.replace(/#.*$/, '');
176		gtag('event', url, {
177			'event_category': 'Header Navigation',
178			'event_label': 'Click'
179		});
180	});
181
182	jQuery('#menu-header-menu a').not(".parent").click(function(e){
183		var clicked = e.currentTarget, url = clicked.href.replace(/#.*$/, '');
184		gtag('event', url, {
185			'event_category': 'Header Navigation (2020)',
186			'event_label': 'Click'
187		});
188	});
189
190	jQuery('#vendor-list a.vendor-contact-button').click(function(e){
191		var clicked = e.currentTarget, url = clicked.href.replace(/#.*$/, '');
192		gtag('event', url, {
193			'event_category': 'Facility Contact',
194			'event_label': 'Click'
195		});
196	});
197
198	/* Legacy functions */
199
200	if (jQuery('#home #main section article section, #page #main section .intro div, #content dl').length > 0) {
201		jQuery('#home #main section article section').columnize({ width: 280, buildOnce: false  });
202		jQuery('#page #main section .intro div').columnize({ width: 280, buildOnce: false  });
203		jQuery('#content dl').columnize({ width: 280, buildOnce: false  });
204	}
205
206	jQuery('#page .entry-meta').hide();
207
208	if(!Modernizr.input.placeholder){
209
210		jQuery('[placeholder]').focus(function() {
211		  var input = jQuery(this);
212		  if (input.val() == input.attr('placeholder')) {
213			input.val('');
214			input.removeClass('placeholder');
215		  }
216		}).blur(function() {
217		  var input = jQuery(this);
218		  if (input.val() == '' || input.val() == input.attr('placeholder')) {
219			input.addClass('placeholder');
220			input.val(input.attr('placeholder'));
221		  }
222		}).blur();
223		jQuery('[placeholder]').parents('form').submit(function() {
224		  jQuery(this).find('[placeholder]').each(function() {
225			var input = jQuery(this);
226			if (input.val() == input.attr('placeholder')) {
227			  input.val('');
228			}
229		  })
230		});
231
232	}
233
234	jQuery(".552, .560, .545, .525, .445").click(function(){
235	     window.location = jQuery(this).find("a").attr("href");
236	     return false;
237	});
238
239	jQuery("nav select").change(function() {
240	  window.location = jQuery(this).find("option:selected").val();
241	});
242
243	jQuery(".the-machines .post_content article:nth-child(3n+2)").addClass("sub-mid");
244
245	if (jQuery('.gform_wrapper').length > 0) {
246		var recaptchaTerms = '<small>This form is protected by reCAPTCHA and the Google <a href="https://policies.google.com/privacy" target="_blank" rel="nofollow">Privacy Policy</a> and <a href="https://policies.google.com/terms" target="_blank" rel="nofollow">Terms of Service</a> apply.</small>';
247		jQuery(".gform_wrapper").append(recaptchaTerms);
248		console.log("reCAPTCHA footer added automatically.");
249	}
250
251});
252
253function resetMainMenu() {
254
255	var desktopBreakpoint = 960;
256	var windowWidth = jQuery(window).width();
257	var menuToggleOpen = '/wp-content/themes/zamboni/img/close-24px.svg';
258	var menuToggleClose = '/wp-content/themes/zamboni/img/menu-24px.svg';
259	var menuArrowUp = '/wp-content/themes/zamboni/img/keyboard_arrow_up-24px.svg';
260	var menuArrowDown = '/wp-content/themes/zamboni/img/keyboard_arrow_down-24px.svg';
261	var menuArrowRight = '/wp-content/themes/zamboni/img/keyboard_arrow_right-24px.svg';
262
263	jQuery("#menu-toggle img").attr('src', menuToggleClose);
264	jQuery("#menu-header-menu .sub-menu .toggle-sub-menu").attr('src', menuArrowDown);
265	jQuery("#menu-header-menu").hide();
266	jQuery("#menu-header-search").hide();
267
268	if (windowWidth >= desktopBreakpoint) {
269		// console.log("Desktop breakpoint");
270		jQuery("#menu-header-menu .toggle-sub-menu").attr('src', menuArrowDown);
271		jQuery("#menu-header-menu .sub-menu .toggle-sub-menu").attr('src', menuArrowRight);
272		jQuery("#menu-header-menu").show();
273		jQuery("#menu-header-search").show();
274	}
275
276}
277
278function equalHeight(group) {
279	var tallest = 0;
280	group.each(function() {
281		var thisHeight = jQuery(this).height();
282		if(thisHeight > tallest) {
283			tallest = thisHeight;
284		}
285	});
286	group.height(tallest);
287}
288
289
290function setEqualHeight(columns) {
291 var tallestcolumn = 0;
292 columns.each(
293 function()
294 {
295 currentHeight = jQuery(this).height();
296 if(currentHeight > tallestcolumn)
297 {
298 tallestcolumn  = currentHeight;
299 }
300 }
301 );
302 columns.height(tallestcolumn);
303}

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.