PageSourceSearch

https://www.corporatesportingevents.us/search.js

js corporatesportingevents.us collected 2026-09-29 17:19:06 UTC 9,864 bytes, 278 lines download raw bytes

1$(function(){
2	// Get New Page
3	$('.search-pagination > a').click(function(e){
4		e.preventDefault();
5		$('form[name=frmSearch] input[name=lngPageNum]').val($(this).attr('data-page'));
6		$('form[name=frmSearch]').submit();
7	});
8	// Show Description
9	$('.search-open').click(function(e){
10		e.preventDefault();
11		$(this).parent().siblings('.search-content').fadeIn()
12	});
13	// Hide Description
14	$('.search-close').click(function(e){
15		e.preventDefault();
16		$(this).parent().fadeOut();
17	});
18	// Open/Close Sidebar dropdowns
19	$('.search-sidebar > div > a').click(function(e){
20		e.preventDefault();
21		$(this).siblings('.search-sidebar-items').toggleClass('active');
22	});
23	// Submit form when Enter key pressed on Search Box
24	$('.search-search-box').on('keypress',function(e){
25		if(e.which == 13){
26			$('.search-search-button').click();
27		}
28	});
29	// When Buttons Clicked, get all selected values from dropdowns and text from Search box
30	$('.search-search-button,.search-bedrooms-button,.search-baths-button,.search-distance-button,.search-footage-button').click(function(e){
31		ProcessFilters();
32	});
33	var ProcessFilters = function(){
34		// Set var for form
35		var theForm = $('form[name=frmSearch]');
36		// Handle Search box
37		var searchKeyword = $('.search-search-box').val();
38		if(searchKeyword != ''){
39			// Get and convert current Search value to array
40			var curSearch = theForm.find('[data-filter=search]');
41			var arrSearch = curSearch.val().split(',');
42			// check if new value exists in Search Value Array
43			var index = -1;
44			arrSearch.some(function(element,i){
45				if(searchKeyword.toLowerCase() === element.toLowerCase()){
46					index = i;
47					return true;
48				}
49			});
50			// if does not exist, add to Array
51			if(index == -1){
52				arrSearch.push(searchKeyword);
53				curSearch.val(arrSearch.join(','));
54			}
55		}
56		// Loop through Select Boxes, add Filters
57		$('.search-sidebar select[data-filter]').each(function(){
58			var thisFilter = $(this).data('filter');
59			var thisValue = $(this).val();
60			if(thisValue != 0){
61				theForm.find('[data-filter='+thisFilter+']').val(thisValue);
62			}
63		});
64		theForm.submit();
65	};
66	// Add/Remove Filter when clicked
67	$('.search-sidebar-items a').click(function(e){
68		e.preventDefault();
69		// Toggle class to determine whether to add/remove
70		$(this).toggleClass('active');
71		// setup vars for current and new filters
72		var curFilter = $(this).attr('data-filter')
73		var thisFilter = $('form[name=frmSearch] input[data-filter='+curFilter+']');
74		var arrFilter = thisFilter.val().split(',');
75		if(curFilter == 'city'){
76			var thisValue = $(this).attr('data-value').split(',');
77			var thisCity = thisValue[0];
78			var thisState = thisValue[1];
79			var stateFilter = $('form[name=frmSearch] input[data-filter=state]');
80			var arrState = stateFilter.val().split(',');
81			// Add Filter
82			if($(this).hasClass('active')){
83				arrFilter.push(thisCity);
84				arrState.push(thisState);
85			// Remove Filter
86			} else {
87				var index = arrFilter.indexOf(thisCity);
88				if(index > -1){ arrFilter.splice(index,1) }
89				var index = arrState.indexOf(thisState);
90				if(index > -1){ arrState.splice(index,1) }
91			}
92			thisFilter.val(arrFilter.join(','));
93			stateFilter.val(arrState.join(','));
94		} else { // Single value - e.g. Subdivision
95			if($(this).hasClass('active')){
96				arrFilter.push($(this).attr('data-value'));
97			} else {
98				var index = arrFilter.indexOf($(this).attr('data-value'));
99				if(index > -1){ arrFilter.splice(index,1) }
100			}
101			thisFilter.val(arrFilter.join(','));
102		}
103		// Click/Run Magic Button
104		ProcessFilters();
105	});
106
107	// Mobile Toolbar
108	$('a.apply').click(function(e){
109		e.preventDefault();
110		var values = [];
111		var values2 = []
112		var filter = $(this).parent().attr('data-filter');
113		if(filter == 'city'){
114			$(this).siblings('.filter-options').find('a.active').each(function(){
115				var arrValues = $(this).attr('data-value');
116				arrValues = arrValues.split(',')
117				values.push(arrValues[0]);
118				values2.push(arrValues[1]);
119			});
120			$('form[name=frmSearch] input[data-filter=city]').val(values.join(','));
121			$('form[name=frmSearch] input[data-filter=state]').val(values2.join(','));
122		} else if (filter == 'bedrooms'){
123			$('form[name=frmSearch] input[name=lngBedrooms]').val($('#bedrooms-range').slider("value"));
124		} else if (filter == 'baths'){
125			$('form[name=frmSearch] input[name=lngBaths]').val($('#baths-range').slider("value"));
126		} else if (filter == 'distance'){
127			$('form[name=frmSearch] input[name=lngMilesFromCourse]').val($('#distance-range').slider("value"));
128		} else if (filter == 'footage'){
129			$('form[name=frmSearch] input[name=lngApproximateSquareFeet]').val($('#footage-range').slider("value"));
130		} else {
131			$(this).siblings('.filter-options').find('a.active').each(function(){
132				values.push($(this).attr('data-value'));
133			});
134			$('form[name=frmSearch] input[data-filter='+filter+']').val(values.join(','));
135		}
136		$('form[name=frmSearch] input[name=lngPageNum]').val(1);
137		$('form[name=frmSearch]').submit();
138	});
139	
140	$('button.apply').click(function(e){
141		e.preventDefault();
142		$('form[name=frmSearch] input[name=txtSearch]').val($(this).siblings('input').val());
143		$('form[name=frmSearch] input[name=lngPageNum]').val(1);
144		$('form[name=frmSearch]').submit();
145	});
146
147	$('.search-toolbar > a[data-toolbar]').click(function(e){
148		e.preventDefault();
149		var thisWindow = $(this).attr('data-toolbar');
150		$('div[data-toolbar='+thisWindow+']').show();
151		$('body').addClass('noscroll');
152	});
153	
154	$('.search-toolbar a[data-scroll]').click(function(e){
155		e.preventDefault();
156		$('html,body').animate({
157			scrollTop: $('.nav').offset().top
158		},500);
159	});
160	$(window).scrollTop($('.nav').offset().top);
161
162	$('.sort-options > a').click(function(e){
163		e.preventDefault();
164		$('form[name=frmSearch] input[name=lngPerPage]').val($(this).parent().siblings('.sort-perpage').children('[name=lngPerPage]').val());
165		$('form[name=frmSearch] input[name=strSort]').val($(this).attr('data-sort'));
166		$('form[name=frmSearch] input[name=lngPageNum]').val(1);
167		$('form[name=frmSearch]').submit();
168	});
169	
170	$('.filter-items > a').click(function(e){
171		e.preventDefault();
172		var thisWindow = $(this).attr('data-filter');
173		$('div[data-filter='+thisWindow+']').show();
174	});
175	
176	$('.filter-options > a').click(function(e){
177		e.preventDefault();
178		$(this).toggleClass('active');
179	});
180	
181	$('.toolbar-window > h4 > a.close').click(function(e){
182		e.preventDefault();
183		$(this).parent().parent().hide();
184		$('body').removeClass('noscroll');
185	});
186
187	$('.filter-window > h4 > a.close').click(function(e){
188		e.preventDefault();
189		$(this).parent().parent().hide();
190	});
191	
192	$('.filter-active > a').click(function(e){
193		e.preventDefault();
194		var thisFilter = $(this).attr('data-filter');
195		var thisInput = $('form[name=frmSearch] input[data-filter='+thisFilter+']');
196		var thisItem = $(this).attr('data-filter-item');
197		console.log(thisFilter);
198		if(thisFilter == 'all'){
199			$('form[name=frmSearch] input').filter('[data-filter]').not('[data-filter=sort],[data-filter=perpage]').val('')
200		} else if (thisFilter == 'city'){
201			var otherInput = $('form[name=frmSearch] input[data-filter=state]');
202			thisItem = thisItem.split(',');
203			thisInput.val(removeValue(thisInput.val(),thisItem[0]));
204			otherInput.val(removeValue(otherInput.val(),thisItem[1]));
205		} else {
206			thisInput.val(removeValue(thisInput.val(),thisItem));
207		}
208		$('form[name=frmSearch] input[name=lngPageNum]').val(1);
209		$('form[name=frmSearch]').submit();
210	});
211
212	var removeValue = function(list, value, separator) {
213	  separator = separator || ",";
214	  var values = list.split(separator);
215	  for(var i = 0 ; i < values.length ; i++) {
216		if(values[i] == value) {
217		  values.splice(i, 1);
218		  return values.join(separator);
219		}
220	  }
221	  return list;
222	}
223
224	$('#bedrooms-range').slider({
225		range:"max",
226		min:0,
227		max:10,
228		value:document.frmSearch.lngBedrooms.value,
229		slide: function(event,ui){
230			$('#bedrooms-amount').html(ui.value > 0 ? ui.value+'+' : "No Min");
231		}
232	});
233	$('#bedrooms-amount').html($('#bedrooms-range').slider("value") > 0 ? $('#bedrooms-range').slider("value")+'+' : "No Min");
234
235	$('#baths-range').slider({
236		range:"max",
237		min:0,
238		max:10,
239		value:document.frmSearch.lngBaths.value,
240		slide: function(event,ui){
241			$('#baths-amount').html(ui.value > 0 ? ui.value+'+' : "No Min");
242		}
243	});
244	$('#baths-amount').html($('#baths-range').slider("value") > 0 ? $('#baths-range').slider("value")+'+' : "No Min");
245
246	$('#distance-range').slider({
247		range:"min",
248		min:0,
249		max:20,
250		value:document.frmSearch.lngMilesFromCourse.value,
251		slide: function(event,ui){
252			$('#distance-amount').html(ui.value > 0 ? ui.value+' Miles' : "No Max");
253		}
254	});
255	$('#distance-amount').html($('#distance-range').slider("value") > 0 ? $('#distance-range').slider("value")+' Miles' : "No Max");
256
257	$('#footage-range').slider({
258		range:"max",
259		min:0,
260		max:10000,
261		step:500,
262		value:document.frmSearch.lngApproximateSquareFeet.value,
263		slide: function(event,ui){
264			$('#footage-amount').html(ui.value > 0 ? ui.value+'+' : "No Min");
265		}
266	});
267	$('#footage-amount').html($('#footage-range').slider("value") > 0 ? $('#footage-range').slider("value")+'+' : "No Min");
268
269	$('.search-pagination.copy').replaceWith($('.search-pagination').eq(0).clone(true));
270	
271	$('.search-perpage-button, .search-sort-button').click(function(e){
272		e.preventDefault();
273		var thisFilter = $(this).attr('data-filter');
274		var thisBox = $(this).siblings('select[data-filter='+thisFilter+']');
275		$('form[name=frmSearch] input[data-filter='+thisFilter+']').val(thisBox.val());
276		$('form[name=frmSearch]').submit();
277	});
278});

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.