PageSourceSearch

https://hudsondistrict.ca/wordpress/wp-content/themes/hudsondistrict/javascripts/jquery.core.js

js hudsondistrict.ca collected 2026-10-10 02:09:19 UTC 10,712 bytes, 296 lines download raw bytes

1$(document).ready(function() {
2	//show hide Up arrow
3	$(window).scroll(function(){
4		if($(window).scrollTop() >= 40){
5			$(".backtotop").fadeIn(1000);
6		} else {
7			$(".backtotop").fadeOut(1000);
8		}
9	});
10	
11	//animate Up arrow
12	$(".backtotop").click(function() {
13		$("html, body").animate({scrollTop: 0}, 500);
14		return false;
15	});
16	
17	
18	// scroll in The Community page and highlight active menu item
19	$("#menu-item-19 .sub-menu li a").addClass("scroll");
20	var main = main = $('.menu ul');
21	
22	$("#menu-item-19 .sub-menu li a").click(function(){
23		$('.menu-mobile').removeClass("active");
24	});
25	
26	$("#global.community .scroll").click(function(event) {
27			
28		event.preventDefault();
29	 
30		var full_url = this.href,
31			parts = full_url.split('#'),
32			trgt = parts[1],
33			target_offset = $('#'+trgt).offset(),
34			target_top = target_offset.top - 40;
35			target_top_m = target_offset.top - 60;
36			
37		if ($(window).width() <= 1020) {
38			$("html, body").animate({scrollTop:target_top_m}, 500);
39		} else {
40			$("html, body").animate({scrollTop:target_top}, 500);
41		}
42		main.children().removeClass('nav-active'); /* Remove active class on any li when an anchor is clicked */
43		$(this).parent().addClass('nav-active'); /* Add active class to clicked anchor's parent li */
44		
45		// adding anchor hash # to url
46		window.location.hash=this.hash;
47	
48	});
49	
50	// highlight active menu item when scroll to id
51	var sections = $('section')
52 	var nav = $('nav')
53 	var nav_height = nav.outerHeight();
54 
55	$(window).on('scroll', function () {
56		var cur_pos = $(this).scrollTop();
57	 
58		sections.each(function() {
59			if ($(window).width() <= 1020) {
60				var top = $(this).offset().top - 60;
61			} else {
62				var top = $(this).offset().top - 40;
63			}
64			var bottom = top + $(this).outerHeight();
65	 
66			if (cur_pos >= top && cur_pos <= bottom) {
67				nav.find('li').removeClass('nav-active');
68				nav.find('a[href="#'+$(this).attr('id')+'"]').parent().addClass('nav-active');
69			}
70		});
71	});
72	
73	
74	// close menu when in The Community page when clicked on .scroll menu-item
75	if ($(window).width() <= 1020) {
76		$(".menu.main_menu ul.menu-list").css("display", "none");
77		$("#menu-mobile").removeClass("active");
78		$("a.scroll").click(function(){
79			$(".menu.main_menu ul.menu-list").css("display", "none");
80			$(".menu-mobile").removeClass("active");
81		});
82		
83		/*$('.menu-mobile').click(function(){
84			$(".menu.main_menu ul.menu-list").css("display", "block");
85		});*/
86	} else {
87		$(".menu.main_menu ul.menu-list").css("display", "block");
88		
89		if ($(".menu.main_menu ul.menu-list").css("display") == "none"){
90			$(".menu.main_menu ul.menu-list").css("display", "block");
91		} else {
92			//do nothing
93		}
94		
95		$("a.scroll").click(function(){
96			$(".menu.main_menu ul.menu-list").css("display", "block");
97			$(".menu.main_menu ul.sub-menu").css("display", "");
98		});
99	}
100	
101	$(window).scroll(function(){
102		if($(window).scrollTop() >= 1 && $(window).width() <= 1020){
103			$(".menu.main_menu ul.menu-list").css("display", "none");
104			$(".menu-mobile").removeClass("active");
105		} else {
106			//do nothing
107		}
108	});
109	
110	
111	// add black bg color to header when scroll
112	$(window).scroll(function(){
113		$("#header").toggleClass("addbg minimize", $(window).scrollTop() >= 1);
114		$("#header.reverse").toggleClass("minimize", $(window).scrollTop() >= 1);
115	});
116	
117	
118	// add search icon graphic to menu bar
119	$(".main_menu .menu-item.search").html("<div id='sb-search' class='sb-search'><form method='get' id='searchform' action='http://hudsondistrict.ca/'><input class='sb-search-input' placeholder='Enter Search Phrase...' type='text' value='' name='s' id='s'><input class='sb-search-submit' type='reset' value=''><span class='sb-icon-search'></span></form></div>");
120	
121	$(".footer_menu .menu-item.search").html("<div id='sb-search2' class='sb-search'><form method='get' id='searchform2' action='http://hudsondistrict.ca/'><input class='sb-search-input' placeholder='Enter Search Phrase...' type='text' value='' name='s' id='s'><input class='sb-search-submit' type='reset' value=''><span class='sb-icon-search'></span></form></div>");
122	
123	
124	//* Vendors functions */
125	// show/hide vendor details
126	$(".community_market_vendor_content").hide();
127
128	var defaultimg1 ='http://hudsondistrict.ca/wordpress/wp-content/themes/hudsondistrict/images/img_market1.jpg';
129	var defaultimg2 ='http://hudsondistrict.ca/wordpress/wp-content/themes/hudsondistrict/images/img_market2.jpg';
130	var defaultmap  ='http://hudsondistrict.ca/wordpress/wp-content/themes/hudsondistrict/images/img_market_map.jpg';
131
132	$(".community_market_vendor_thumbs .thumb a").click(function() {
133		var vendor = $(this).attr('data-vendor');
134		var name = $(this).attr('data-vendor-name');
135
136		$("#"+vendor).fadeIn(1000);
137		$(".community_market_vendor_thumbs").hide();
138		var img1 = $('#'+vendor).attr("data-vendor-img1");
139		if (img1!='')$('#vendor_marketing_1 > img').attr('src',img1);
140		else $('#vendor_marketing_1 > img').attr('src',defaultimg1);
141		var img2 = $('#'+vendor).attr("data-vendor-img2");
142		if (img2!='')$('#vendor_marketing_2').attr('style','background-image: url('+img2+')');
143		else $('#vendor_marketing_2').attr('style','background-image: url('+defaultimg2+')');
144
145		var map = $('#'+vendor).attr("data-vendor-map");
146		$('.marketmaplink').attr('title',name);
147		$('.show_vendor_map').show();
148
149		if (map!=''){
150			$('.map.marketmap').attr('src',map);
151			$('.marketmaplink').attr('href',map);
152		}else {
153			$('.map.marketmap').attr('src',defaultmap);
154			$('.marketmaplink').attr('href',defaultmap);
155		}
156		$('html,body').animate({scrollTop: $(".community_market_vendor_wrapper").offset().top - 90}, 500);
157	});
158	
159	$('.show_vendor_map').hide();
160	$(".backtogrid").click(function(e) {
161		$(".community_market_vendor_thumbs").fadeIn(1000);
162		$(".community_market_vendor_content").hide();
163		$('#vendor_marketing_1 > img').attr('src',defaultimg1);
164		$('#vendor_marketing_2').attr('style','background-image: url('+defaultimg2+')');
165		$('.show_vendor_map').hide();
166		$('.marketmap').attr('src',defaultmap);
167		$('.marketmaplink').attr('href',defaultmap);
168		$('.marketmaplink').attr('title','Victoria Public Market');
169		$('html,body').animate({scrollTop: $(".community_market_vendor_wrapper").offset().top - 90}, 500);
170	});
171	$(".community_market_vendor_menu #btn_all").click(function() {
172		$(".community_market_vendor_thumbs").fadeIn(1000);
173		$(".community_market_vendor_content").hide();
174		$('#vendor_marketing_1 > img').attr('src',defaultimg1);
175		$('#vendor_marketing_2').attr('style','background-image: url('+defaultimg2+')');
176		$('.show_vendor_map').hide();
177		$('.marketmap').attr('src',defaultmap);
178		$('.marketmaplink').attr('href',defaultmap);
179		$('.marketmaplink').attr('title','Victoria Public Market');
180	});
181	
182	$(".community_market_vendor_menu a").click(function() {
183		if ($(".community_market_vendor_thumbs").is(":hidden")){
184			$(".community_market_vendor_thumbs").fadeIn(1000);
185			$(".community_market_vendor_content").hide();
186			$('#vendor_marketing_1 > img').attr('src',defaultimg1);
187			$('#vendor_marketing_2').attr('style','background-image: url('+defaultimg2+')');
188			$('.show_vendor_map').hide();
189			$('.marketmap').attr('src',defaultmap);
190			$('.marketmaplink').attr('href',defaultmap);
191			$('.marketmaplink').attr('title','Victoria Public Market');
192		}
193	});
194	
195	
196	// set min-height as same height as .intro_wrapper for .intro_box
197	$(".community .intro_wrapper").css({"min-height":($(".intro_box").outerHeight()+"px")});
198	$(".interested .intro_wrapper").css({"min-height":($(".intro_box_wrapper").outerHeight()+"px")});
199});
200
201
202
203$(window).load(function() {
204	// set height as fullscreen for .homepage .section
205	$(".homepage .section").css({"height":($("body").height()-40+"px")});
206	// set min-height as same height as .intro_wrapper for .homepage .section
207	$(".homepage .section").css({"min-height":($(".intro_wrapper").outerHeight()+"px")});
208	
209	
210	// set min-height as same height as .intro_wrapper for .intro_box
211	$(".community .intro_wrapper").css({"min-height":($(".intro_box").outerHeight()+"px")});
212	$(".interested .intro_wrapper").css({"min-height":($(".intro_box_wrapper").outerHeight()+"px")});
213
214	
215	// set min-height as same height as .listing_images for .listing_row
216	if ($(window).width() > 1000) {
217		$(".listing_row").css({"min-height":($(".listing_images").height()+"px")});
218	} else {
219		$(".listing_row").css({"min-height":"0px"}); 
220	}
221	
222	
223	// open search bar by default when smaller than or equal to 1020
224	if ($(window).width() > 1020) {
225		$("#sb-search").removeClass("sb-search-open");
226	} else {
227		$("#sb-search").addClass("sb-search-open");
228	}
229	
230});
231
232
233
234$(window).on("resize", function() {
235	// close menu when in The Community page when clicked on .scroll menu-item
236	if ($(window).width() <= 1020) {
237		$(".menu.main_menu ul.menu-list").css("display", "none");
238		$("#menu-mobile").removeClass("active");
239		$("a.scroll").click(function(){
240			$(".menu.main_menu ul.menu-list").css("display", "none");
241			$(".menu-mobile").removeClass("active");
242		});
243		
244		/*$('.menu-mobile').click(function(){
245			$(".menu.main_menu ul.menu-list").css("display", "block");
246		});*/
247	} else {
248		$(".menu.main_menu ul.menu-list").css("display", "block");
249		
250		if ($(".menu.main_menu ul.menu-list").css("display") == "none"){
251			$(".menu.main_menu ul.menu-list").css("display", "block");
252		} else {
253			//do nothing
254		}
255		
256		$("a.scroll").click(function(){
257			$(".menu.main_menu ul.menu-list").css("display", "block");
258			$(".menu.main_menu ul.sub-menu").css("display", "");
259		});
260	}
261	
262	$(window).scroll(function(){
263		if($(window).scrollTop() >= 1 && $(window).width() <= 1020){
264			$(".menu.main_menu ul.menu-list").css("display", "none");
265			$(".menu-mobile").removeClass("active");
266		} else {
267			//do nothing
268		}
269	});
270	
271	
272	// set height as fullscreen for .homepage .section
273	$(".homepage .section").css({"height":($("body").height()-40+"px")});
274	// set min-height as same height as .intro_wrapper for .homepage .section
275	$(".homepage .section").css({"min-height":($(".intro_wrapper").outerHeight()+"px")});
276	
277	
278	// set min-height as same height as .intro_wrapper for .intro_box
279	$(".community .intro_wrapper").css({"min-height":($(".intro_box").outerHeight()+"px")});
280	$(".interested .intro_wrapper").css({"min-height":($(".intro_box_wrapper").outerHeight()+"px")});
281	
282	// set min-height as same height as .listing_images for .listing_row
283	if ($(window).width() > 1000) {
284		$(".listing_row").css({"min-height":($(".listing_images").height()+"px")});
285	} else {
286		$(".listing_row").css({"min-height":"0px"}); 
287	}
288	
289	// open search bar by default when smaller than or equal to 1020
290	if ($(window).width() > 1020) {
291		$("#sb-search").removeClass("sb-search-open");
292	} else {
293		$("#sb-search").addClass("sb-search-open");
294	}
295
296});

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.