PageSourceSearch

https://westridge.com/wp-content/themes/wrc2018/assets/js/main.js

js westridge.com collected 2026-10-02 06:28:21 UTC 9,984 bytes, 338 lines download raw bytes

1$(document).ready(function(){
2
3  /* -------------------- Main Navigation -------------------- */
4	
5	$('.main-nav .container .menu ul li').hover(function(){
6		TweenMax.to($(this).find('.drop-down'), .3, {opacity:1, ease:Expo.easeOut, marginTop:"0", display:"block", delay: 0});
7		$('.main-nav-closer').css('display','block');
8	}, function(){
9		TweenMax.to($(this).find('.drop-down'), .3, {opacity:0, ease:Expo.easeOut, marginTop:"15px", display:"none", delay: .3});
10		$('.main-nav-closer').css('display','none');
11	});
12	
13	$('.main-nav-closer').click(function(){
14		TweenMax.to($('.main-nav .container .menu ul li .drop-down'), .3, {opacity:0, ease:Expo.easeOut, marginTop:"15px", display:"none", delay: .3});
15		$('.main-nav-closer').css('display','none');
16	});
17	
18	var showDSM = false;
19
20  $('.main-nav .desktop-hamburger a').click(function(){
21    if(showDSM == true){
22			$(this).parent().removeClass('open');
23      $('.mobile-nav').fadeOut(300);
24      $('.mobile-nav-shadow').fadeOut(300);
25      showDSM = false;
26    } else {
27      $('.modal-search').fadeOut(300);
28			$('.main-nav .container .menu ul li.search a').html('<i class="fas fa-search"></i>');
29      showSM = false;
30			
31			$(this).parent().addClass('open');
32			$('.mobile-nav').fadeIn(300);
33      $('.mobile-nav-shadow').fadeIn(300);
34      showDSM = true;
35    }
36  });
37	
38	$('.mobile-nav .container .main li a.dd').click(function(){
39		var dropdown = $(this).attr('dropdown');
40		
41		$('.mobile-nav .container .main').slideUp(300);
42		$('.mobile-nav .container .sub').each(function(){
43			if($(this).attr('dropdown') == dropdown){
44				$(this).slideDown(300);
45			} else {
46				$(this).slideUp(300);
47			}
48		});
49	});
50	
51	$('.mobile-nav .container .sub .back a').click(function(){
52		$('.mobile-nav .container .main').slideDown(300);
53		$('.mobile-nav .container .sub').slideUp(300);
54	});
55
56	/* -------------------- Filter Bar / Quick Links -------------------- */
57	
58	filterBar = $('.filter-bar');
59	filterHeight = 0;
60	if (filterBar.length > 0){
61		filterHeight = filterBar.offset().top - 70;
62	}
63	
64	if ($(window).width <= 900){
65		if (filterBar){
66			filterHeight = filterBar.offset().top - 60;
67		}
68	}
69	
70	var fbdd = false;
71	$('.filter-bar .container .menu').click(function(){
72		if (fbdd == true){
73			$(this).parent().find('ul').slideUp(300);
74			fbdd = false;
75		} else {
76			$(this).parent().find('ul').slideDown(300);
77			fbdd = true;
78		}
79	});
80	
81	/* -------------------- Header Scroll -------------------- */
82	
83  headerScroll();
84
85	$(window).scroll(function(){
86		headerScroll();
87		if ($(window).width > 900){
88			closeSearch();
89		}
90		
91		if (scrollPosition > filterHeight) {
92  		$('.filter-bar').addClass('scroll');
93  	} else {
94  		$('.filter-bar').removeClass('scroll');
95  	}
96	});
97	
98	/* -------------------- Search Modal -------------------- */
99	
100	var showSM = false;
101	
102	$('.main-nav .search a').click(function(){
103    if(showSM == true){
104      $('.modal-search').fadeOut(300);
105      showSM = false;
106			$(this).html('<i class="fas fa-search"></i>');
107    } else {
108			$('.desktop-hamburger').removeClass('open');
109      $('.mobile-nav').fadeOut(300);
110      $('.mobile-nav-shadow').fadeOut(300);
111			showDSM = false;
112			
113			$('.modal-search').fadeIn(300);
114			$('.modal-search .search-input input').focus();
115      showSM = true;
116			$(this).html('<i class="fas fa-times"></i>');
117    }
118  });
119	
120	$('a.search-form').click(function(){
121    if(showSM == true){
122      $('.modal-search').fadeOut(300);
123      showSM = false;
124    } else {
125			$('.desktop-hamburger').removeClass('open');
126      $('.mobile-nav').fadeOut(300);
127      $('.mobile-nav-shadow').fadeOut(300);
128			showDSM = false;
129			
130			$('.modal-search').fadeIn(300);
131			$('.modal-search .search-input input').focus();
132      showSM = true;
133    }
134  });
135	
136	$(document).keyup(function(e) {
137		if (e.keyCode === 27){
138			closeSearch();
139		}
140	});
141	
142	/* -------------------- Front Page Scroll Arrow -------------------- */
143	
144	$('.intro .scroll-btn').click(function(){
145		screenWidth = $(window).width();
146		if (screenWidth >= 900){
147			banner = $('.intro').height() + 70;
148		} else {
149			banner = $('.intro').height();
150		}
151		
152		$('html,body').animate({scrollTop: banner}, 700);
153	});
154	
155	/* -------------------- PJS Add To Calendar Button -------------------- */
156	
157	var openCalendar = false;
158	
159	$('.pjs-addtocalendar').click(function(e){
160		if (openCalendar == true){
161			e.stopPropagation();
162			$(this).find('.add-to-calendar').slideUp(300);
163			openCalendar = false;
164		} else {
165			e.stopPropagation();
166			$(this).find('.add-to-calendar').slideDown(300);
167			openCalendar = true;
168		}
169	});
170	
171	var openShare = false;
172	
173	$('.pjs-share-dd').click(function(){
174		if (openShare == true){
175			$(this).find('.dropdown').slideUp(300);
176			openShare = false;
177		} else {
178			$(this).find('.dropdown').slideDown(300);
179			openShare = true;
180		}
181	});
182	
183	/* -------------------- Close Dropdowns on Click -------------------- */
184	
185	$('body,html').click(function(e){
186		if (e.target.className == 'pjs-addtocalendar trans'){} else {
187			$('.pjs-addtocalendar .add-to-calendar').slideUp(300);
188			openCalendar = false;
189		}
190		
191		if (e.target.className == 'pjs-share-dd trans'){} else {
192			$('.pjs-share-dd .dropdown').slideUp(300);
193			openShare = false;
194		}
195		
196		if (e.target.className == 'menu' || 'fas fa-bars'){} else {
197			$('.filter-bar .container .menu').parent().find('ul').slideUp(300);
198			fbdd = false;
199		}
200	});
201	
202	$('.single-info').on({ 'touchstart' : function(e){
203		if (e.target.className == 'pjs-addtocalendar trans'){} else {
204			$('.pjs-addtocalendar .add-to-calendar').slideUp(300);
205			openCalendar = false;
206		}
207		
208		if (e.target.className == 'pjs-share-dd trans'){} else {
209			$('.pjs-share-dd .dropdown').slideUp(300);
210			openShare = false;
211		}
212		
213		if (e.target.className == 'menu' || 'fas fa-bars'){} else {
214			$('.filter-bar .container .menu').parent().find('ul').slideUp(300);
215			fbdd = false;
216		}
217	} });
218	
219	$('.banner').on({ 'touchstart' : function(e){
220		if (e.target.className == 'pjs-addtocalendar trans'){} else {
221			$('.pjs-addtocalendar .add-to-calendar').slideUp(300);
222			openCalendar = false;
223		}
224		
225		if (e.target.className == 'pjs-share-dd trans'){} else {
226			$('.pjs-share-dd .dropdown').slideUp(300);
227			openShare = false;
228		}
229		
230		if (e.target.className == 'menu' || 'fas fa-bars'){} else {
231			$('.filter-bar .container .menu').parent().find('ul').slideUp(300);
232			fbdd = false;
233		}
234	} });
235	
236	$('.footer').on({ 'touchstart' : function(e){
237		if (e.target.className == 'pjs-addtocalendar trans'){} else {
238			$('.pjs-addtocalendar .add-to-calendar').slideUp(300);
239			openCalendar = false;
240		}
241		
242		if (e.target.className == 'pjs-share-dd trans'){} else {
243			$('.pjs-share-dd .dropdown').slideUp(300);
244			openShare = false;
245		}
246		
247		if (e.target.className == 'menu' || 'fas fa-bars'){} else {
248			$('.filter-bar .container .menu').parent().find('ul').slideUp(300);
249			fbdd = false;
250		}
251	} });
252	
253	/* -------------------- Video Play Button -------------------- */
254	
255	$('.panel-video .container .video a').click(function(){
256		playVideo($(this));
257	});
258	
259	$('.product-stories .container .featured .inner a').click(function(){
260		playVideo($(this));
261	});
262	
263	$('.product-faqs .container h2').click(function(){
264		var container = $(this).parent();
265		if (container.hasClass('show')){
266			container.removeClass('show');
267			container.find('p').slideUp(300);
268		} else {
269			container.addClass('show');
270			container.find('p').slideDown(300);
271		}
272	});
273	
274	/* -------------------- Read More Button -------------------- */
275	
276	var moreTag = '<!--more-->';
277	var tagCounter = 1;
278	
279	$('p').each(function(){
280		if ($(this).html().indexOf(moreTag) != -1){
281			$('<div class="more-tag" more-tag=' + tagCounter + '></div>').insertAfter($(this));
282			
283			if (tagCounter%2 == 0){
284				var previousTag = tagCounter-1;
285				var hiddenElements = $('.more-tag[more-tag=' + previousTag + ']').nextUntil('.more-tag[more-tag=' + tagCounter + ']');
286				hiddenElements.wrapAll('<div class="read-more-content">');
287			} else if (tagCounter%2 == 1) {
288				$('<div class="buttons dark"><a href="javascript:;" class="read-more" more-tag="' + tagCounter + '">Read More</a></div>').insertAfter($(this));
289			}
290			
291			$(this).remove();
292			tagCounter++;
293		}
294	});
295	
296	$('.buttons .read-more').click(function(){
297		var buttonTag = $(this).parent();
298		var moreTag = $(this).attr('more-tag');
299		var rmcTag = $(this).parent().parent().find('.more-tag[more-tag=' + moreTag + ']').next();
300		
301		buttonTag.slideUp(300);
302		rmcTag.slideDown(300);
303	});
304	
305  /* -------------------- PJS Functions -------------------- */
306
307	function closeSearch(){
308  	$('.modal-search').fadeOut(300);
309		showSM = false;
310		$('.main-nav .search a').html('<i class="fas fa-search"></i>');
311  }
312	
313	function headerScroll(){
314  	scrollPosition = $(document).scrollTop();
315
316  	if (scrollPosition > 100) {
317  		$('.main-nav').addClass('scroll');
318  		$('.modal-search').addClass('scroll');
319  	} else {
320  		$('.main-nav').removeClass('scroll');
321  		$('.modal-search').removeClass('scroll');
322  	}
323  }
324	
325	function playVideo(thisVideo){
326		videoType = thisVideo.find('.video-type').html();
327		videoId = thisVideo.find('.video-id').html();
328		if (videoType == 'vimeo'){
329			videoIframe = '<iframe width="100%" height="100%" src="https://player.vimeo.com/video/' + videoId + '?autoplay=1&title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
330		} else {
331			videoIframe = '<iframe width="100%" height="100%" src="https://www.youtube.com/embed/' + videoId + '?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>';
332		}
333		thisVideo.parent().append(videoIframe);
334		thisVideo.parent().find('iframe').fadeIn(300);
335		thisVideo.fadeOut(300);
336	}
337
338});

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.