PageSourceSearch

https://hurricanemedia.co.uk/wp-content/themes/hurricane/js/main.js?ver=1790616855

js hurricanemedia.co.uk collected 2026-09-28 23:22:17 UTC 8,707 bytes, 327 lines download raw bytes

1jQuery(document).ready(function( $ ){
2    "use strict";
3	
4	$('#navToggle').click(function() {
5		if ($('#navToggle').hasClass('open')) {
6			$('body').removeClass('open');
7			$('nav').removeClass('open');			
8			setTimeout(function() {
9				$('#navToggle').removeClass('open');
10			}, 600);
11		}
12		else {
13			$('#navToggle').addClass('open');
14			$('body').addClass('open');
15			$('nav').addClass('open');
16		}
17	});
18	
19	$(window).resize(function(){
20		if( $(window).height() < 821) {
21			$("#hero").addClass('tablet');
22		}
23	});
24	
25	/*** CHECK WINDOW HEIGHT ***/
26	function checkSize() {
27		if($(window).width() > 768) {
28			$('#hero').addClass('tablet');
29		}
30		else {
31			$('#hero').removeClass('tablet');
32		}
33	}
34	checkSize();
35
36	$( window ).resize(function() {
37		checkSize();
38	});
39	$(window).trigger('resize');
40	/*** END ***/
41	
42	
43	
44	
45	// TOP NAV TOGGLE //
46	$('.topbar-toggle').click(function() {
47		$('.topbar-links').slideToggle();
48		$(this).toggleClass('active')
49	});
50	// END TOP NAV TOGGLE //
51    
52	// HIDE CONTACT POPUP //
53    $(window).scroll(function() {
54        if ($('.module-contact-block').is(':in-viewport')) {
55            $('.contact-popout').addClass('fadeout');
56        } else {
57            $('.contact-popout').removeClass('fadeout');
58        }
59    });
60	// END HIDE CONTACT POPUP //
61	
62	// ANIMATE CAROUSEL ARROWS //
63    $(window).scroll(function() {
64        if ($('.module-google-reviews').is(':in-viewport')) {
65			setTimeout(function() {
66				$('.slick-prev').addClass('slidein');
67				$('.slick-next').addClass('slidein');
68			}, 500);
69        } else {
70            $('.slick-prev').removeClass('slidein');
71            $('.slick-next').removeClass('slidein');			
72        }
73    });
74	// END HIDE CONTACT POPUP //
75	
76
77
78	// GOOGLE REVIEWS CAROUSEL //
79	$('.module-google-reviews-carousel').slick({
80		slidesToShow: 1,
81		slidesToScroll: 1,
82		autoplay: true,
83		autoplaySpeed: 5000,
84		arrows: true,
85		dots: true,
86		responsive: [
87			{
88				breakpoint: 992,
89				settings: {
90					arrows: false,
91				}
92			}
93		]
94	});
95	// END GOOGLE REVIEWS CAROUSEL //
96	
97	// MOBILE CAROUSEL //
98	if($(window).width() < 769) {	
99		$('.image-grid-two-two, .image-grid-three-col, .module-image-grid-two-col-carousel, .other-portfolios-grid').slick({
100			slidesToShow: 1,
101			slidesToScroll: 1,
102			autoplay: true,
103			autoplaySpeed: 5000,
104			arrows: false,
105			dots: true,
106			centerMode: true
107		});
108	}
109	// END MOBILE CAROUSEL //
110
111	
112	
113	// ACCORDION //
114	$('.accordion-header').toggleClass('inactive-header');
115	
116	var contentwidth = $('.accordion-header').width();
117	$('.accordion-content').css({'width' : contentwidth });
118
119	$('.accordion-header').click(function () {
120		if($(this).is('.inactive-header')) {
121			$('.active-header').toggleClass('active-header').toggleClass('inactive-header').next().slideToggle().toggleClass('open-content');
122			$(this).toggleClass('active-header').toggleClass('inactive-header');
123			$(this).next().slideToggle().toggleClass('open-content');
124		}
125		
126		else {
127			$(this).toggleClass('active-header').toggleClass('inactive-header');
128			$(this).next().slideToggle().toggleClass('open-content');
129		}
130	});
131	// END ACCORDION //
132	
133	// SCROLL TOs //
134	$.fn.scrollView = function () {
135		return this.each(function () {
136		$('html, body').animate({
137		scrollTop: $(this).offset().top -0
138		}, 1000);
139		});
140	}
141
142	$('.link-to-showreel').click(function (event) {
143		event.preventDefault();
144		$('#showreel').scrollView();
145	});
146	// END SCROLL TOs //
147	
148	$('#frm_form_2_container button.frm_button_submit').append('<span></span>');
149		
150	
151	// MASK //
152	$(".mask").width(($(window).width()-1400)/2);
153	$(window).resize(function(){
154		$(".mask").width(($(window).width()-1400)/2);
155	});
156	// END //	
157	
158	// PORTFOLIO FILTERS //
159	$('#our-services').click(function() {
160		$('#our-services-list').slideDown();
161		$('.portfolio-grid-wrapper').toggleClass('offset');
162		$('.portfolio-hero').toggleClass('nopad-bottom');
163	})
164	// END //
165	
166	// CONTACT POPOUT //
167	 // Set a timeout to execute a function after a 2-second delay
168		setTimeout(function() {
169			// Code to be executed after the delay
170			// This could include jQuery operations, such as manipulating the DOM
171			$('.contact-popout').addClass('active');
172		}, 2000);
173	
174	$('.contact-popout-close').click(function() {
175		$('.contact-popout').toggleClass('closed');
176	})
177	// END //
178        
179    $('.block-whatwedo-header').click(function() {
180      $('.portfolio-hero').toggleClass('nopad-bottom')
181		$('.portfolio-grid-wrapper').toggleClass('offset')
182    })
183    
184
185
186	// VANILLA JS
187
188	// Our Work gif animation on hover
189
190
191
192	
193    // What we do
194		var element = document.querySelectorAll('.block-whatwedo-header');
195		var elementBlock = document.querySelectorAll('.block-whatwedo-lists .block-list');
196		
197		if (element) {
198			  element.forEach(function(el, key){				
199				 el.addEventListener('click', function () {
200					el.classList.toggle("active");	
201					var elementB = el.getAttribute('id');
202					// let eb = el('[data-type="modal"]');
203					//elementB.classList.toggle("active");	
204
205					// document.querySelectorAll('.block-whatwedo-lists .block-list').classList.toggle("active");					
206					 element.forEach(function(ell, els){
207						 if(key !== els) {
208							 ell.classList.remove('active');
209						 }
210					 });
211					 if (elementBlock) {
212						elementBlock.forEach(item => {				
213							item.classList.remove("active");	
214			  			})				
215					}	
216					if (el.classList.contains("active")) {
217						document.getElementById(elementB + "-list").classList.add("active");
218					}		
219					//  setTimeout(function() {
220						// el.classList.toggle("active");	
221						// classList.toggle("active");	
222					// }, 100);
223				
224				 });
225			  });
226			}
227
228
229		// H ANIM HOME
230
231		var hanim = document.querySelectorAll('.h-anim');
232		function hAnim() {
233			hanim.forEach(function(el){				
234				if (el.classList.contains("active")) {
235					el.classList.remove("active");	
236				} else {
237					el.classList.add("active");	
238				}
239		  });	
240		}
241		if (hanim) {
242			var hanimInterval = setInterval(hAnim, 1000);
243			setTimeout(function() {
244				clearInterval(hanimInterval)
245			}, 1000);	
246		}
247
248
249		////////////////////////////
250		// TEAM Modal
251		////////////////////////////
252
253		let myModal = document.querySelectorAll('[data-type="modal"]');
254		if (myModal) {
255			for(var i=0; i<myModal.length; i++) { 
256				myModal[i].addEventListener("click", function(e){
257					e.preventDefault();
258					console.log(this.getAttribute('id'));
259					document.querySelector('.fullscreen-overlay').classList.add('open');
260					document.querySelector('body').classList.add('stopscroll');
261					callModalContent(this.getAttribute('id'));
262				});        
263			}
264		}
265
266		// Content
267		function callModalContent(id) {
268			const url = "/wp-json/wp/v2/team/"+id+"?acf_format=standard";
269			fetch(url)
270			.then(response => response.json())
271			.then(data => {
272				document.querySelector('.team-flyout-wrapper').classList.add('open');
273
274				var myModal = document.querySelector('.flyout-content');
275				// myModal.classList.add('loaded');
276
277				//Add content
278				myModal.querySelector('h3#team-name').innerHTML = data.title.rendered;
279				myModal.querySelector('p#team-job-title').innerHTML = data.acf.job_title;
280				myModal.querySelector('#team-image').innerHTML = '<img src="'+data.acf.alternate_image+'">';
281				// myModal.querySelector('.tel a').innerHTML = data.acf.contact_number;
282				// myModal.querySelector('.tel a').setAttribute('href', 'tel:'+data.acf.contact_number);
283				// myModal.querySelector('.email a').innerHTML = data.acf.email_address;
284				// myModal.querySelector('.email a').setAttribute('href', 'mailto:'+data.acf.email_address);
285				myModal.querySelector('p#team-content').innerHTML = data.content.rendered;
286				
287			})
288			.catch(error => console.error(error)); 
289		}
290
291		// Close button
292		let closer = document.querySelectorAll(".close-flyout, .fullscreen-overlay");
293		if (closer) {
294			for(var i=0; i<closer.length; i++) { 
295				closer[i].addEventListener("click", function(e){
296					e.preventDefault();
297					if(document.querySelector('.team-flyout-wrapper').classList.contains('open')) {
298						document.querySelector('.team-flyout-wrapper.open').classList.remove('open'); 
299						document.querySelector('.fullscreen-overlay.open').classList.remove('open');
300						document.querySelector('body.stopscroll').classList.remove('stopscroll');
301					}
302				});
303			}    
304		}
305
306
307});
308
309function loadHovers() {
310	let elements = document.getElementsByClassName('hoverAnim');
311	if (elements) {
312		for(var i=0; i<elements.length; i++) { 
313			elements[i].addEventListener("mouseenter", function(){
314				 this.src = this.getAttribute('hover');
315			});
316			elements[i].addEventListener("mouseleave", function(){
317				 this.src = this.getAttribute('orig');
318			});
319		}    
320	}
321}
322
323loadHovers();
324
325almComplete = function(alm){
326	loadHovers();
327};

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.