PageSourceSearch

https://blue-ridge.org/Themes/BlueRidge/Assets/Js/scripts.js

js blue-ridge.org collected 2026-09-26 21:32:04 UTC 14,360 bytes, 501 lines download raw bytes

1$(document).ready(function(){
2
3	"use strict";
4
5	// Nav Sticky
6
7	$(window).scroll(function(){
8		//$('.top-bar').addClass('nav-sticky');
9
10		if($(window).scrollTop() > 425){
11			//$('.overlay-bar').addClass('nav-sticky');
12			$('.top-bar-nav-container').addClass('fade-nav')
13		}else{
14			//$('.overlay-bar').removeClass('nav-sticky');
15			$('.top-bar-nav-container').removeClass('fade-nav')
16		}
17	});
18
19	// Offscreen Nav
20
21	$('.offscreen-toggle').click(function(){
22		$('.main-container').toggleClass('reveal-nav');
23		$('.offscreen-container').toggleClass('reveal-nav');
24		$('.offscreen-menu .container').toggleClass('reveal-nav');
25	});
26
27	$('.main-container').click(function(){
28		if($(this).hasClass('reveal-nav')){
29			$('.main-container').toggleClass('reveal-nav');
30			$('.offscreen-container').toggleClass('reveal-nav');
31			$('.offscreen-menu .container').toggleClass('reveal-nav');
32		}
33	});
34
35	// Detect logo dimensions and add correct class
36
37	var logoImage = $('.top-bar .logo:first-of-type');
38
39	var theImage = new Image();
40	theImage.src = logoImage.attr("src");
41
42	var logoWidth = theImage.width;
43	var logoHeight = theImage.height;
44	var logoRatio = logoWidth / logoHeight;
45
46	if(logoRatio > 2.8){
47		$('.top-bar .logo').addClass('logo-wide');
48	}
49
50	if(logoRatio < 2){
51		$('.top-bar .logo').addClass('logo-square');
52	}
53
54	// Smooth scroll
55
56	// $('.inner-link').smoothScroll({offset: -96, speed: 800});
57
58	// Mobile Toggle
59
60	$('.mobile-toggle').click(function(){
61		$('nav').toggleClass('open-nav');
62	});
63
64	// Fullscreen nav toggle
65
66	$('.fullscreen-nav-toggle').click(function(){
67		if(!$('.fullscreen-nav-container').hasClass('show-fullscreen-nav')){
68			$('.fullscreen-nav-container').addClass('show-fullscreen-nav');
69			setTimeout(function(){
70				$('.fullscreen-nav-container').addClass('fade-fullscreen-nav');
71			},100);
72			$(this).addClass('toggle-icon');
73		}else{
74			$(this).removeClass('toggle-icon');
75				$('.fullscreen-nav-container').removeClass('fade-fullscreen-nav');
76			setTimeout(function(){
77
78				$('.fullscreen-nav-container').removeClass('show-fullscreen-nav');
79			},500);
80		}
81	});
82
83	$('.fullscreen-nav-container .menu li a').click(function(){
84		$('.fullscreen-nav-toggle').removeClass('toggle-icon');
85			$('.fullscreen-nav-container').removeClass('fade-fullscreen-nav');
86		setTimeout(function(){
87			$('.fullscreen-nav-container').removeClass('show-fullscreen-nav');
88		},500);
89	});
90
91	// Margin first section for top bar
92
93	/*if(!$('nav').hasClass('overlay-bar') && !$('nav').hasClass('contained-bar')){
94		$('.main-container').first().css('margin-top', $('nav').outerHeight());
95	}
96
97	$(window).resize(function(){
98		if(!$('nav').hasClass('overlay-bar') && !$('nav').hasClass('contained-bar')){
99			$('.main-container').first().css('margin-top', $('nav').outerHeight());
100		}
101	});*/
102
103	// Pad first section for overlay bar
104
105	/*if($('nav').hasClass('overlay-bar') || $('nav').hasClass('contained-bar') ){
106		var currentPad = parseInt($('.main-container').find(':first-child').css('padding-top'));
107		var newPad = currentPad + $('nav').outerHeight() - 48;
108		if(currentPad > 0){
109			$('.main-container').children(':first').css('padding-top', newPad);
110		}else if($('.main-container').find(':first').hasClass('hero-slider')){
111			var height = parseInt($('.hero-slider .slides li:first-child').outerHeight());
112			var newHeight = height + $('nav').outerHeight();
113			$('.hero-slider .slides li').css('height', newHeight);
114		}
115	}*/
116
117
118	// Fullwidth Subnavs
119
120	// Position Fullwidth Subnavs fullwidth correctly
121
122    $('.subnav-fullwidth').each(function () {
123        $(this).css('width', $('.container').width());
124        var offset = $(this).closest('.has-dropdown').offset();
125        offset = offset.left;
126        var containerOffset = $(window).width() - $('.container').outerWidth();
127        containerOffset = containerOffset /2;
128        offset = offset - containerOffset - 15;
129        $(this).css('left', -offset);
130    });
131
132    $(window).resize(function () {
133        $('.subnav-fullwidth').each(function () {
134            $(this).css('width', $('.container').width());
135			var offset = $(this).closest('.has-dropdown').offset();
136			offset = offset.left;
137			var containerOffset = $(window).width() - $('.container').outerWidth();
138			containerOffset = containerOffset /2;
139			offset = offset - containerOffset - 15;
140			$(this).css('left', -offset);
141        });
142    });
143
144
145	// Scroll Reveal
146
147
148
149
150	// Slide Sizes
151
152	$('.slider-fullscreen .slides li').each(function(){
153		$(this).css('height', $(window).height());
154	});
155
156	$('.fullscreen-element').each(function(){
157		$(this).css('height', $(window).height());
158	});
159
160
161	// Feature Selector
162
163	$('.selector-tabs li').click(function(){
164		$(this).parent('.selector-tabs').children('li').removeClass('active');
165		$(this).addClass('active');
166
167		var activeTab = $(this).index() + 1;
168
169		$(this).closest('.feature-selector').find('.selector-content').children('li').removeClass('active');
170		$(this).closest('.feature-selector').find('.selector-content').children('li:nth-child('+activeTab+')').addClass('active');
171	});
172
173	// Append .background-image-holder <img>'s as CSS backgrounds
174
175	$('.background-image-holder').each(function(){
176		var imgSrc= $(this).children('img').attr('src');
177		$(this).css('background', 'url("' + imgSrc + '")');
178    	$(this).children('img').hide();
179        $(this).css('background-position', '50% 0%');
180	});
181
182	// Accordion
183
184	$('.accordion li').click(function(){
185		$(this).parent('.accordion').children('li').removeClass('active');
186		$(this).addClass('active');
187	});
188
189	/************** Parallax Scripts **************/
190
191    var isFirefox = typeof InstallTrigger !== 'undefined';
192    var isIE = /*@cc_on!@*/ false || !!document.documentMode;
193    var isChrome = !!window.chrome;
194    var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
195    var prefix;
196
197    if (isFirefox) {
198        prefix = '-moz-';
199    } else if (isIE) {
200
201    } else if (isChrome || isSafari) {
202        prefix = '-webkit-';
203    }
204
205    $('.main-container section:first-child').addClass('first-child');
206
207    $('.parallax-background').each(function () {
208
209        if ($(this).closest('section').hasClass('first-child') && !$(this).closest('section').hasClass('slider-fullscreen')) {
210            $(this).attr('data-top', prefix + 'transform: translate3d(0px,0px, 0px)');
211            $(this).attr('data-top-bottom', prefix + 'transform: translate3d(0px,200px, 0px)');
212
213        } else {
214
215            $(this).attr('data-bottom-top', prefix + 'transform: translate3d(0px,-100px, 0px)');
216            $(this).attr('data-center', prefix + 'transform: translate3d(0px,0px, 0px)');
217            $(this).attr('data-top-bottom', prefix + 'transform: translate3d(0px,100px, 0px)');
218
219        }
220
221    });
222
223
224
225    // Map Holder Overlay
226
227	$('.map-holder').click(function(){
228		$(this).addClass('on');
229	});
230
231	$(window).scroll(function(){
232		if($('.map-holder').hasClass('on')){
233			$('.map-holder').removeClass('on');
234		}
235	});
236
237	// Map Details Holder
238
239	$('.details-holder').each(function(){
240		$(this).css('height', $(this).width());
241	});
242
243	$('.details-holder').mouseenter(function(){
244		$(this).closest('.map-overlay').addClass('fade-overlay');
245	}).mouseleave(function(){$(this).closest('.map-overlay').removeClass('fade-overlay');});
246
247	// Countdown
248
249	$('.countdown').each(function(){
250		$(this).countdown({until: new Date($(this).attr('data-date'))});
251	});
252
253	// Twitter Feed
254
255	if($('#tweets').length){
256		twitterFetcher.fetch($('#tweets').attr('data-widget-id'), '', 5, true, true, true, '', false, handleTweets);
257
258    }
259
260    // Contact form code
261
262    $('form.email-form').submit(function (e) {
263		// return false so form submits through jQuery rather than reloading page.
264		if(e.preventDefault) e.preventDefault();
265		else e.returnValue = false;
266
267		var thisForm 		= $(this).closest('.email-form'),
268			error 			= 0,
269			originalError 	= thisForm.attr('original-error'),
270			loadingSpinner;
271
272		if (typeof originalError !== typeof undefined && originalError !== false) {
273			thisForm.find('.form-error').text(originalError);
274		}
275
276
277		$(thisForm).find('.validate-required').each(function(){
278			if($(this).val() === ''){
279				$(this).addClass('field-error');
280				error = 1;
281			}else{
282				$(this).removeClass('field-error');
283			}
284		});
285
286		$(thisForm).find('.validate-email').each(function(){
287			if(!(/(.+)@(.+){2,}\.(.+){2,}/.test($(this).val()))){
288				$(this).addClass('field-error');
289				error = 1;
290			}else{
291				$(this).removeClass('field-error');
292			}
293		});
294
295
296        if (error === 1){
297            $(this).closest('.email-form').find('.form-error').fadeIn(200);
298        }else {
299			// Hide the error if one was shown
300			$(this).closest('.email-form').find('.form-error').fadeOut(200);
301			// Create a new loading spinner while hiding the submit button.
302			loadingSpinner = $('<div />').addClass('form-loading').insertAfter($(thisForm).find('input[type="submit"]'));
303			$(thisForm).find('input[type="submit"]').hide();
304
305            jQuery.ajax({
306                type: "POST",
307                url: "mail/mail.php",
308                data: thisForm.serialize(),
309                success: function (response) {
310                	// Swiftmailer always sends back a number representing numner of emails sent.
311					// If this is numeric (not Swift Mailer error text) AND greater than 0 then show success message.
312					$(thisForm).find('.form-loading').remove();
313					$(thisForm).find('input[type="submit"]').show();
314					if($.isNumeric(response)){
315						if(parseInt(response) > 0){
316							thisForm.find('.form-success').fadeIn(1000);
317							thisForm.find('.form-error').fadeOut(1000);
318							setTimeout(function(){ thisForm.find('.form-success').fadeOut(500); }, 5000);
319						}
320					}
321					// If error text was returned, put the text in the .form-error div and show it.
322					else{
323						// Keep the current error text in a data attribute on the form
324						thisForm.find('.form-error').attr('original-error', thisForm.find('.form-error').text());
325						// Show the error with the returned error text.
326						thisForm.find('.form-error').text(response).fadeIn(1000);
327						thisForm.find('.form-success').fadeOut(1000);
328					}
329                },
330                error: function (errorObject, errorText, errorHTTP) {
331                	// Keep the current error text in a data attribute on the form
332					thisForm.find('.form-error').attr('original-error', thisForm.find('.form-error').text());
333					// Show the error with the returned error text.
334					thisForm.find('.form-error').text(errorHTTP).fadeIn(1000);
335					thisForm.find('.form-success').fadeOut(1000);
336                	$(thisForm).find('.form-loading').remove();
337					$(thisForm).find('input[type="submit"]').show();
338                }
339            });
340        }
341		return false;
342    });
343
344
345	// Expanding Lists (updated in Pivot 1.4.0)
346
347	$('.expanding-ul li').click(function(){
348		$('.expanding-ul li').removeClass('active');
349		$(this).addClass('active');
350	});
351
352});
353
354$(window).load(function(){
355
356  "use strict";
357
358
359	// Align Elements Vertically
360
361	alignVertical();
362	alignBottom();
363
364	$(window).resize(function(){
365		alignVertical();
366		alignBottom();
367	});
368
369	
370
371	// Instagram Feed
372
373	if($('.instafeed').length){
374		jQuery.fn.spectragram.accessData = {
375			accessToken: '1406933036.fedaafa.feec3d50f5194ce5b705a1f11a107e0b',
376			clientID: 'fedaafacf224447e8aef74872d3820a1'
377		};
378
379		$('.instafeed').each(function () {
380			$(this).children('ul').spectragram('getUserFeed', {
381				query: $(this).attr('data-user-name')
382			});
383
384		});
385
386	}
387
388    if($('#tweets').length){
389    	$('#tweets').flexslider({ directionNav: false, controlNav: false });
390    }
391
392    // Remove Loader
393
394    $('.loader').css('opacity', 0);
395    setTimeout(function(){$('.loader').hide();}, 600);
396
397	// Mailchimp/Campaign Monitor Mail List Form Scripts
398	$('form.mail-list-signup').on('submit', function(){
399
400		var iFrame = $(this).closest('section, header').find('iframe.mail-list-form'),
401		thisForm 		= $(this).closest('.mail-list-signup'),
402		userEmail 		= $(this).find('.signup-email-field').val(),
403		userFullName 	= $(this).find('.signup-name-field').val(),
404		userFirstName 	= $(this).find('.signup-first-name-field').val(),
405		userLastName 	= $(this).find('.signup-last-name-field').val(),
406		error			= 0;
407
408		$(thisForm).find('.validate-required').each(function(){
409			if($(this).val() === ''){
410				$(this).addClass('field-error');
411				error = 1;
412			}
413			else{
414				$(this).removeClass('field-error');
415			}
416		});
417
418		$(thisForm).find('.validate-email').each(function(){
419			if(!(/(.+)@(.+){2,}\.(.+){2,}/.test($(this).val()))){
420				$(this).addClass('field-error');
421				error = 1;
422			}
423			else{
424				$(this).removeClass('field-error');
425			}
426		});
427
428		if(error === 0){
429			iFrame.contents().find('#mce-EMAIL, #fieldEmail').val(userEmail);
430			iFrame.contents().find('#mce-LNAME, #fieldLastName').val(userLastName);
431			iFrame.contents().find('#mce-FNAME, #fieldFirstName').val(userFirstName);
432			iFrame.contents().find('#mce-FNAME, #fieldName').val(userFullName);
433			iFrame.contents().find('form').attr('target', '_blank').submit();
434		}
435		return false;
436	});
437
438	// Blog Masonry
439
440
441
442
443
444});
445
446function handleTweets(tweets){
447          var x = tweets.length;
448          var n = 0;
449          var element = document.getElementById('tweets');
450          var html = '<ul class="slides">';
451          while(n < x) {
452            html += '<li>' + tweets[n] + '</li>';
453            n++;
454          }
455          html += '</ul>';
456          element.innerHTML = html;
457    }
458
459function alignVertical(){
460
461		$('.align-vertical').each(function(){
462			var that = $(this);
463			var height = that.height();
464			var parentHeight = that.parent().height();
465			var padAmount = (parentHeight / 2) - (height/2);
466			that.css('padding-top', padAmount);
467		});
468
469}
470
471function alignBottom(){
472	$('.align-bottom').each(function(){
473		var that = $(this);
474		var height = that.height();
475		var parentHeight = that.parent().height();
476		var padAmount = (parentHeight) - (height) - 32;
477		that.css('padding-top', padAmount);
478	});
479}
480
481// Youtube Background Handling
482
483function onYouTubeIframeAPIReady() {
484	$(window).load(function(){
485		$('.youtube-bg-iframe').each(function(index){
486			$(this).attr('id', 'yt-'+index);
487			var player = new YT.Player($(this).attr('id'), {
488				events: {
489				'onReady': function(){
490					player.mute();
491					player.playVideo();
492				},
493				'onStateChange': function(newState){
494					player.playVideo();
495				}
496			}
497			});
498		});
499	});
500
501}

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.