PageSourceSearch

http://mainstreetcupertino.com/wp-content/themes/mainst-2/scripts/general.js

js mainstreetcupertino.com collected 2026-10-04 10:16:39 UTC 7,900 bytes, 259 lines download raw bytes

1(function($){
2
3	//add classes to form inputs based on their type
4	for(var i = 0, len = document.getElementsByTagName('input').length; i<len; i++){
5		document.getElementsByTagName('input')[i].className += ' ' + document.getElementsByTagName('input')[i].type;
6	}
7
8	//open links in new window (target=_blank); checks if the url is external
9	var hostname = window.location.hostname,
10	links = document.getElementsByTagName('a'),
11	pattern = /^https?:\/\/(www.)?/i;
12
13	for(var i=0, len = links.length; i<len; i++) {
14	  if(pattern.test(links[i].href) && links[i].href.toLowerCase().indexOf(hostname) == -1){
15	    links[i].target = "_blank";
16	    links[i].className += ' external';
17	  }
18	}
19
20	//--------------------------------------- utils ------------------------------------------------//
21
22	//equal height columns function
23	function equalHeight(group) {
24		var tallest = 0;
25		group.each(function() {
26			var thisHeight = $(this).height();
27			if(thisHeight > tallest) {
28				tallest = thisHeight;
29			}
30		});
31		group.height(tallest);
32	}
33	//equalHeight($("//here put the selector"));
34
35	//---------------------------------- other scripts ---------------------------------------------//
36
37	$(document).ready(function() {
38		var wHeight = $(window).height();
39		var footerHeight = $('#footer').height();
40		var containerPaddingTop = $('#container').css('padding-top').replace("px", "");
41
42		$('#siteplan').height(wHeight - footerHeight);
43		$('.page-template-template-sitemap-php #content').height(wHeight - footerHeight - containerPaddingTop);
44
45		$(window).resize(function() {
46			var wHeight = $(window).height();
47			var footerHeight = $('#footer').height();
48			var containerPaddingTop = $('#container').css('padding-top').replace("px", "");
49
50			$('#siteplan').height(wHeight - footerHeight);
51			$('.page-template-template-sitemap-php #content').height(wHeight - footerHeight - containerPaddingTop);
52		});
53
54		// add a class when the scroll starts
55		$(window).scroll(function() {
56			if( $(window).scrollTop() >= 10 ){
57				$('body').addClass('scroll');
58			} else {
59				$('body').removeClass('scroll');
60			}
61		});
62
63
64		// frontpage header
65		// $(document).scroll(function() {
66		// 	if( $(document).scrollTop() >= 10 ){
67		// 		$('body.home #header').removeClass('front-header');
68		// 	} else {
69		// 		$('body.home #header').addClass('front-header');
70		// 	}
71		// });
72
73		//scroll to
74		$('a.scroll-to').click(function(event){
75			event.preventDefault();
76			$('html,body').animate({scrollTop:$(this.hash).offset().top}, 1000);
77		});
78
79		// if(window.location.hash == '#overview') {
80		// 	$('body.home #header').removeClass('front-header');
81		// 	setTimeout(function(){
82		// 		$('html,body').animate({scrollTop:$(window.location.hash).offset().top}, 10);
83		// 	}, 50);
84		// }
85
86		//navigation
87		$('#navigation').prepend('<span class="navigation-close">Close</span>');
88
89		$('span.navigation-trigger').on('click touch', function() {
90//			$('#navigation').show();
91			$('body').addClass('navigation-open');
92		});
93
94		//hide navigation when clicking anywhere else
95		$(document).bind('click touch', function(event) {
96			if (!$(event.target).parents().addBack().is('span.navigation-trigger')) {
97				$('body').removeClass('navigation-open');
98			}
99		});
100
101		$('span.navigation-close').on('click touch', function() {
102//			$('#navigation').hide();
103			$('body').removeClass('navigation-open');
104		});
105
106		// Stop propagation to prevent hiding "#navigation" when clicking on it
107		$('#navigation').bind('click touch', function(event) {
108			event.stopPropagation();
109		});
110
111//		$('.social-nav .social-link-trigger').on('click touch', function(event) {
112//			event.preventDefault();
113//			$(this).parent('.social-nav').toggleClass('expanded');
114//		});
115
116		//disabled menu links
117		$('#navigation .menu li.disabled a').on('click touch', function(event) {
118			event.preventDefault();
119		});
120
121		//remove active class from overview on homepage
122		$('#navigation .menu li.overview-menu-item').removeClass('current-menu-item current_page_item');
123
124		//slideshow
125		$('.slideshow').append('<div id="slide-counter"></div>');
126
127		function insertCount(slide_curr,slide_count){
128			$('#slide-counter').html('<span>'+ (slide_curr + 1) +'</span>/'+ slide_count);
129		};
130
131		var slider = $('.slideshow-view').bxSlider({
132			auto: true,
133			pause: 5000,
134			speed: 1000,
135			pager: true,
136			touchEnabled: false,
137			onSliderLoad: function() {
138				$('.slideshow .bx-pager').prepend('<span class="fake-bx-prev"></span>');
139				$('.slideshow .bx-pager').append('<span class="fake-bx-next"></span>');
140
141				$('.slideshow span.fake-bx-prev').on('click touch', function() {
142					slider.goToPrevSlide();
143				});
144
145				$('.slideshow span.fake-bx-next').on('click touch', function() {
146					slider.goToNextSlide();
147				});
148
149				var slide_count = slider.getSlideCount();
150				var slide_curr = slider.getCurrentSlide();
151				insertCount(slide_curr,slide_count);
152			},
153			onSlideAfter: function() {
154				var slide_count = slider.getSlideCount();
155				var slide_curr = slider.getCurrentSlide();
156				insertCount(slide_curr,slide_count);
157			}
158		});
159
160
161		//gallery
162		$('#gallery ul.gallery-view').bxSlider({
163			auto: true,
164			mode: 'fade',
165			pause: 5000,
166			speed: 1000,
167			pager: true,
168			pagerType: 'short',
169			controls: true,
170			// pagerCustom: '#gallery-pager',
171			// nextSelector: '#gallery-next',
172			// prevSelector: '#gallery-prev',
173			nextText: '<i class="fa fa-angle-right"></i>',
174			prevText: '<i class="fa fa-angle-left"></i>'
175		});
176
177		//overview gallery
178		// $('.overview-gallery > ul').bxSlider({
179		// 	auto: false,
180		// 	mode: 'fade',
181		// 	pause: 5000,
182		// 	speed: 1000,
183		// 	pager: true,
184		// 	pagerCustom: '#overview-gallery-pager',
185		// 	controls: true,
186		// 	nextText: '<i class="fa fa-angle-right"></i>',
187		// 	prevText: '<i class="fa fa-angle-left"></i>'
188		// });
189
190		//slide gallery
191		$('.slidegallery > ul').bxSlider({
192			auto: false,
193			mode: 'fade',
194			pause: 5000,
195			speed: 1000,
196			pager: false,
197			controls: true,
198			nextText: '<i class="fa fa-angle-right"></i>',
199			prevText: '<i class="fa fa-angle-left"></i>'
200		});
201
202		//maps tabs
203		$('.location-map-tabs > a').on('click touch', function(event) {
204			event.preventDefault();
205			$(this).siblings().removeClass('active');
206			$(this).addClass('active');
207
208			$(this).parent().next('.location-map').find('> div').removeClass('active');
209			$(this).parent().next('.location-map').find('> div').eq($(this).index()).addClass('active');
210		});
211
212		// section expander
213		$('.view-section-content').append('<span class="view-section-close">Close</span>');
214
215		$('.view-section-head > .button').on('click touch', function(event) {
216			event.preventDefault();
217			$(this).closest('.view-section').toggleClass('expanded');
218			$(this).parent().next('.view-section-content').slideToggle(500);
219
220			// toggle the word 'View'
221			var text = $(this).text();
222
223			if( $(this).closest('.view-section').hasClass('expanded') ) {
224				$(this).text(text.replace('View', 'Close'));
225			} else {
226				$(this).text(text.replace('Close', 'View'));
227			}
228		});
229
230		$('.view-section-close').on('click touch', function(event) {
231			event.preventDefault();
232			$(this).closest('.view-section').removeClass('expanded');
233			$(this).parent('.view-section-content').slideToggle(500);
234
235			var text = $(this).text();
236			$(this).text(text.replace('Close', 'View'));
237		});
238
239
240		//
241		// $('.contact-departments .contact-department-box-inner').on('click touch', function() {
242		// 	$(this).closest('li').siblings('li').removeClass('active');
243		// 	$(this).closest('li').addClass('active');
244		// });
245
246		$('#join-our-mail-btn').on('click touch', function(event) {
247			event.preventDefault();
248			$('body').addClass('big-announcement-active');
249			$('#big-announcement-frame').fadeIn(500);
250		});
251
252		$('#big-announcement > .close').on('click touch', function() {
253			$(this).closest('#big-announcement-frame').fadeOut(500);
254			$('body').removeClass('big-announcement-active');
255		});
256
257	});
258
259})(jQuery);

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.