PageSourceSearch

https://www.woodlands.co.nz/edit/modules/events/calendar.js?version=1.1.4

js woodlands.co.nz collected 2026-10-09 00:38:16 UTC 5,621 bytes, 240 lines download raw bytes

1/* 
2	Calendar jQuery JavaScript Document
3	Created on September 2015
4	by Josh Tere
5*/
6
7
8	$(document).ready(function() {
9		//
10		"use strict";
11		
12		
13		// Simple seasons filter
14		$('#seasons').on('click', '.season', function() {
15			"use strict";
16
17			var season = $(this).attr('id');
18
19			//$('.'+season).parent().prepend($('.'+season));
20			
21			$('.active-event').removeClass('active-event');			
22			$('.season').removeClass('active');
23			
24			$('.event-item').appendTo('.events-list-holder');
25			
26			$('.event-item').css('order','0');
27			
28			$(this).addClass('active');
29			
30			$('.'+season).addClass('active-event');
31
32			$('.active-event').appendTo('.events.list');
33	
34		});
35		
36		// Move summer to top on page load
37		//$('.summer').parent().prepend($('.summer'));
38		
39		//
40		{
41			$(".summary-calendar-holder").on("click",".summary-calendar-previous",function(event) {
42				
43				event.preventDefault();
44				
45				var section = $(this).data('section');
46				var base    = $(this).data('base');
47				var month 	= $(this).data('month');
48				var year  	= $(this).data('year');
49				
50				summary_calendar_ajax(section,base,month,year);
51			});
52			
53			$(".summary-calendar-holder").on("click",".summary-calendar-next",function(event) {
54				
55				event.preventDefault();
56				
57				var section = $(this).data('section');
58				var base    = $(this).data('base');
59				var month 	= $(this).data('month');
60				var year  	= $(this).data('year');
61				
62				summary_calendar_ajax(section,base,month,year);
63			});
64			
65			
66			// Hightlight event days on calendar
67			$(".summary-calendar-holder").on("mouseover",".summary-calendar-events a",function() {
68				
69				var eventId = $(this).data('event');
70				
71				// Add highlight
72				$(".summary-calendar-day").removeClass('calendar-highlight');
73				$("."+eventId+"-day").addClass('calendar-highlight');
74				
75			}).on("mouseleave",".summary-calendar-events a",function() {
76				
77				// Remove all
78				$(".summary-calendar-day").removeClass('calendar-highlight');
79			});
80		}
81		
82		
83		
84		{
85			$(".full-calendar-holder").on("click",".full-calendar-previous",function(event) {
86				
87				event.preventDefault();
88				
89				var section = $(this).data('section');
90				var base    = $(this).data('base');
91				var month 	= $(this).data('month');
92				var year  	= $(this).data('year');
93				
94				full_calendar_ajax(section,base,month,year);
95			});
96			
97			$(".full-calendar-holder").on("click",".full-calendar-next",function(event) {
98				
99				event.preventDefault();
100				
101				var section = $(this).data('section');
102				var base    = $(this).data('base');
103				var month 	= $(this).data('month');
104				var year  	= $(this).data('year');
105				
106				full_calendar_ajax(section,base,month,year);
107			});
108			
109			
110			// Hightlight event days on calendar
111			$(".full-calendar-holder").on("mouseover",".full-calendar-events a",function() {
112				
113				var eventId = $(this).data('event');
114				
115				// Add highlight
116				$(".full-calendar-day").removeClass('calendar-highlight');
117				$("."+eventId+"-day").addClass('calendar-highlight');
118				
119			}).on("mouseleave",".full-calendar-events a",function() {
120				
121				// Remove all
122				$(".full-calendar-day").removeClass('calendar-highlight');
123			});
124			
125			
126			// Add initial state
127			if($(".full-calendar-holder").length > 0) {
128				//
129				var stateObj = { 
130					section: $(".full-calendar-holder h2").data('section'),
131					base: $(".full-calendar-holder h2").data('base'),
132					month: $(".full-calendar-holder h2").data('month'),
133					year: $(".full-calendar-holder h2").data('year')
134				};
135				
136				// Write history
137				history.pushState(stateObj,'',document.location);
138				
139				// Match height
140				$(".full-calendar-dates .full-calendar-day").matchHeight({
141					byRow: true,
142					property: "height"
143				});
144
145			}
146		}
147		
148		
149		window.onpopstate = function(event) {    
150			if(event && event.state.section) {
151				//
152				full_calendar_ajax(event.state.section,event.state.base,event.state.month,event.state.year,true);
153			}
154		};
155	});
156	
157	
158	function summary_calendar_ajax(section,base,month,year) {
159		//
160		"use strict";
161		
162		if(month !== '' && year !== '') {
163			// Run ajax call
164			$.ajax({
165				type: "GET",
166				url: pageRelativity+'edit/template.ajax.php',
167				dataType: "jsonp",
168				jsonp: "callback",
169				timeout: 5000,
170				data: {
171					type: 'summary-calendar',
172					section: section,
173					base: base,
174					month: month,
175					year: year,
176					relative: pageRelativity
177				},
178				success: function(data) {
179					// If data
180					if(data.results) {
181						// 
182						$(".summary-calendar-holder").html(data.results);
183					}
184				},
185				error: function(request, status, error) {
186					//
187					alert(request.responseText);
188				}
189			});	
190		}
191	}
192	
193	
194	function full_calendar_ajax(section,base,month,year,skipState) {
195		//
196		"use strict";
197		
198		if(month !== '' && year !== '') {
199			// Run ajax call
200			$.ajax({
201				type: "GET",
202				url: pageRelativity+'edit/template.ajax.php',
203				dataType: "jsonp",
204				jsonp: "callback",
205				timeout: 5000,
206				data: {
207					type: 'full-calendar',
208					section: section,
209					base: base,
210					month: month,
211					year: year,
212					relative: pageRelativity
213				},
214				success: function(data) {
215					// If data
216					if(data.results) {
217						// 
218						$(".full-calendar-holder").html(data.results);
219						
220						if(skipState === true) {}
221						else {
222							var stateObj = { 
223								section: section,
224								base: base,
225								month: month,
226								year: year
227							};
228							
229							// Write history
230							history.pushState(stateObj,'',data.newurl);
231						}
232					}
233				},
234				error: function(request, status, error) {
235					//
236					alert(request.responseText);
237				}
238			});	
239		}
240	}

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.