PageSourceSearch

https://colossal.com/wp-content/themes/colossal/js/theme.js?cache=1790240822&ver=7.0.5

js colossal.com collected 2026-09-24 09:17:01 UTC 9,632 bytes, 415 lines download raw bytes

1
2$(document).ready(function() {
3	
4
5
6
7
8
9	// Slide Out Menu
10	$('#hamburger').click(function() {
11
12		$('#slide-out').toggleClass('active');
13		$('body').toggleClass('slide-out-open');
14		return false;
15	});
16
17	$('#slide-out ul li.menu-item-has-children > a').click(function() {
18		$(this).find('.sub-menu').slideUp();
19
20		if ( $(this).hasClass( "active" ) ) {
21			$(this).parent().find('.sub-menu').first().slideUp();
22			$(this).removeClass('active');
23		} else {
24			$(this).parent().find('.sub-menu').first().slideDown();
25			$(this).addClass('active');
26		}
27		return false;
28	});
29	// End slide out menu
30
31	
32
33	setTimeout(function(){ 
34
35		var scrollme = scrollme || {};
36
37		scrollme;
38
39		if (Object.keys(scrollme).length === 0) {
40			// console.log('scrollme is empty');
41		} else {
42			scrollme.on_resize();
43		}
44	}, 1000);
45
46	
47
48
49
50
51
52
53	$('#step-navigation a').click(function(event) {
54		event.preventDefault();
55
56		var distance = $('.step').width();
57
58		var step = $(this).data('step');
59		var scroll = distance * step;
60		console.log(scroll);
61
62		$('#scroller .inside').animate({
63			scrollLeft: scroll+"vw"
64		}, "slow");
65
66		// $('#step-navigation a').removeClass('active');
67		// $(this).addClass('active');
68	});
69
70
71
72	$('#scroller .inside').scroll(function() {
73		var stepWidth = $('.step').width();
74		var totalWidth = stepWidth * 11;
75
76
77		var currentPosition = ($('#scroller .inside').scrollLeft() + 150);
78		var currentStep = 1;
79
80		if(stepWidth * 1 < currentPosition){currentStep = 2;}
81		if(stepWidth * 2 < currentPosition){currentStep = 3;}
82		if(stepWidth * 3 < currentPosition){currentStep = 4;}
83		if(stepWidth * 4 < currentPosition){currentStep = 5;}
84		if(stepWidth * 5 < currentPosition){currentStep = 6;}
85		if(stepWidth * 6 < currentPosition){currentStep = 7;}
86		if(stepWidth * 7 < currentPosition){currentStep = 8;}
87		if(stepWidth * 8 < currentPosition){currentStep = 9;}
88		if(stepWidth * 9 < currentPosition){currentStep = 10;}
89		if(stepWidth * 10 < currentPosition){currentStep = 11;}
90
91
92		console.log(currentStep);
93
94		$('#step-navigation a').removeClass('active');
95		$('#step-navigation a#step-'+currentStep).addClass('active');
96		$('.step-indicator span').html(currentStep);
97	});
98
99
100
101
102
103	$('#section-4 .item').click(function(event) {
104		event.preventDefault();
105
106		var id = $(this).data('id');
107		
108		$('#section-4 .item').removeClass('active');
109		$(this).addClass('active');
110
111		$('.heatmap-container .heatmap').removeClass('active');
112		$('.heatmap-container .heatmap-'+id).addClass('active');
113		// $('#step-navigation a').removeClass('active');
114		// $(this).addClass('active');
115	});
116
117
118
119
120	
121
122	if (typeof ScrollMagic !== 'undefined') {
123		var controller = new ScrollMagic.Controller({ globalSceneOptions: { triggerHook: "onLeave", duration: "200%" } });
124		new ScrollMagic.Scene({ triggerElement: "#parallax1" })
125			.setTween("#parallax1 > div", { y: "80%", ease: Linear.easeNone })
126			.addTo(controller);
127	}
128
129
130
131	// Affix actions
132	$(window).on('scroll', function(event) {
133		var scrollValue = $(window).scrollTop();
134		if (scrollValue > 150) {
135			$('.site-header').addClass('affix');
136			$('.page-index').addClass('affix');
137		} else {
138			$('.site-header').removeClass('affix');
139			$('.page-index').removeClass('affix');
140		}
141	});
142
143	var scrollValue = $(window).scrollTop();
144	if (scrollValue > 150) {
145		$('.site-header').addClass('affix');
146		$('.page-index').addClass('affix');
147	} else {
148		$('.site-header').removeClass('affix');
149		$('.page-index').removeClass('affix');
150	}
151
152
153
154
155	// Open page index 
156	$('.group.index').click(function(event) {
157		$(this).toggleClass('active')
158		$('.page-index').toggleClass('active');
159		// $('.page-index-dropdown').removeClass('active');
160		// $('.page-section-dropdown').removeClass('active');
161		// $('.group.last').toggleClass('inactive');
162		return false;
163	});
164
165
166	// Species dropdown
167	var dropdowntimer;
168
169	$(".has-dropdown").hover(function() {
170		clearTimeout(dropdowntimer);
171		$(".dropdown").stop(true, true).slideDown("fast");
172		$(".site-header").addClass('dropdown-active');
173	}, function() {
174		var $this = $(this);
175		dropdowntimer = setTimeout(function() {
176			$(".dropdown").stop(true, true).slideUp("fast");
177			$(".site-header").removeClass('dropdown-active');
178		}, 800);
179	});
180
181	$(".dropdown").hover(function() {
182		clearTimeout(dropdowntimer);
183	}, function() {
184		var $this = $(this);
185		dropdowntimer = setTimeout(function() {
186			$this.stop(true, true).slideUp("fast");
187			$(".site-header").removeClass('dropdown-active');
188		}, 500);
189	});
190
191
192	// Open secondary page index 
193	// $('#menu-scroll .left').click(function(event) {
194	// 	$('.page-index-dropdown').toggleClass('active');
195	// 	$('.page-index').removeClass('active');
196	// 	$('.page-section-dropdown').removeClass('active');
197	// 	return false;
198	// });
199
200	// // Open section index 
201	// $('#menu-scroll .right').click(function(event) {
202	// 	$('.page-index-dropdown').removeClass('active');
203	// 	$('.page-index').removeClass('active');
204	// 	$('.page-section-dropdown').toggleClass('active');
205	// 	return false;
206	// });
207
208
209
210	// Hide menu dropdowns on scroll
211	let previousScrollPosition = 0;
212	let isScrolling = false;
213
214	function debounce(func, delay) {
215		let timeout;
216		return function() {
217			const context = this;
218			const args = arguments;
219			clearTimeout(timeout);
220			timeout = setTimeout(() => {
221				func.apply(context, args);
222			}, delay);
223		};
224	}
225
226	window.addEventListener("scroll", debounce(function() {
227		const currentScrollPosition = window.scrollY;
228		if (currentScrollPosition > previousScrollPosition) {
229			$('.page-index').removeClass('active');
230			$('.group.last').removeClass('inactive');
231			$('.page-section-dropdown').removeClass('active');
232			$('.page-index-dropdown').removeClass('active');
233		} else {
234			$('.page-index').removeClass('active');
235			$('.group.last').removeClass('inactive');
236			$('.page-section-dropdown').removeClass('active');
237			$('.page-index-dropdown').removeClass('active');
238		}
239		previousScrollPosition = currentScrollPosition;
240	}, 10));
241
242
243
244
245
246	// Determine section ID and change header
247	$(document).scroll(function() {
248
249		var scrollTop = $(this).scrollTop();
250
251  		// iterate through each section on the page
252		$('.page-section').each(function() {
253
254			var section = $(this);
255			var sectionTop = section.offset().top;
256			var sectionHeight = section.outerHeight();
257			var sectionBottom = sectionTop + sectionHeight;
258
259    		// check if the user's scroll position is within the section
260			if (scrollTop > sectionTop && scrollTop < sectionBottom) {
261      			// get the data attribute of the section ID
262				var sectionID = section.data('section-number');
263				var sectionTitle = section.data('section-title');
264
265      			// update the content of the div with the section ID
266				$('.current-page-section').text(sectionTitle);
267				$('.current-section-number').text(sectionID);
268
269				$('#menu.page-sections a').removeClass('active');
270				$('#menu.page-sections').find('.section-'+sectionID).addClass('active');
271
272      		return false; // exit the loop once we find the current section
273    		}
274  		});
275	});
276
277
278
279
280	// Populate page sections nav with page section data
281	$('.page-section').each(function() {
282
283			var currentPagenumber = $('.current-page-number').html();
284			var section = $(this);
285			var sectionID = section.data('section-number');
286			var sectionTitle = section.data('section-title');
287			var sectionOffset = section.data('section-offset');
288
289			$('#menu.page-sections').append('<a href="" data-target="'+sectionID+'" data-title="'+sectionTitle+'" data-offset="'+sectionOffset+'" class="section-'+sectionID+'"><div class="d-flex"><span>0'+currentPagenumber+'-0' + sectionID + '</span> <span>' + sectionTitle +'</span></div></a>');
290
291	});
292
293
294
295	// Make page sections scroll to appropriate sections
296	$('#menu.page-sections a').on('click', function(event) {
297		event.preventDefault();
298		
299		var offset = 0;
300
301		var link = $(this);
302
303		var target = $(this).data('target');
304
305		if ($(this).data('offset') != 'undefined') {
306			offset = offset + $(this).data('offset');
307		}
308
309		offset = offset + 3;
310
311		var sectionTitle = $(this).data('title');
312
313		$('.current-page-section').html(sectionTitle);
314		
315		$('html, body').animate({
316			scrollTop: $('.page-section[data-section-number="'+target+'"]').offset().top + offset
317		}, 1000);
318
319		setTimeout( function(){ 
320			$('.current-page-section').html(sectionTitle); 
321			$('#menu.page-sections a').removeClass('active');
322			$(link).addClass('active');
323		} , 1100 )
324		
325
326	});	
327
328
329
330	// Sticky Nav
331  // var doc = document.documentElement;
332  // var w = window;
333
334  // var prevScroll = w.scrollY || doc.scrollTop;
335  // var curScroll;
336  // var direction = 0;
337  // var prevDirection = 0;
338
339  // var header = document.getElementById('site-header');
340
341
342  // var checkScroll = function() {
343
344  //   /*
345  //   ** Find the direction of scroll
346  //   ** 0 - initial, 1 - up, 2 - down
347  //   */
348
349  //   curScroll = w.scrollY || doc.scrollTop;
350  //   if (curScroll > prevScroll) { 
351  //     //scrolled up
352  //     direction = 2;
353  //   }
354  //   else if (curScroll < prevScroll) { 
355  //     //scrolled down
356  //     direction = 1;
357  //   }
358
359  //   if (direction !== prevDirection) {
360  //     toggleHeader(direction, curScroll);
361  //   }
362
363  //   prevScroll = curScroll;
364  // };
365
366  // var toggleHeader = function(direction, curScroll) {
367  //   if (direction === 2 && curScroll > 52) { 
368
369  //     //replace 52 with the height of your header in px
370  //     header.classList.remove('show');
371      
372  //     prevDirection = direction;
373  //   }
374  //   else if (direction === 1) {
375  //     header.classList.add('show');
376  //     prevDirection = direction;
377  //   }
378  // };
379
380  // window.addEventListener('scroll', checkScroll);
381
382
383
384
385
386
387});
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415

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.