PageSourceSearch

https://h2n.pt/wp-content/themes/h2n/js/script.js?ver=485

js h2n.pt collected 2026-10-06 04:42:55 UTC 10,638 bytes, 472 lines download raw bytes

1(function($){
2	$('a[href*="#"]')
3	// Remove links that don't actually link to anything
4		.not('[href="#"]')
5		.not('[href="#0"]')
6		.click(function(event) {
7		// On-page links
8		if (
9			location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
10			&&
11			location.hostname == this.hostname
12		) {
13			// Figure out element to scroll to
14			var target = $(this.hash);
15			target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
16			// Does a scroll target exist?
17			if (target.length) {
18				// Only prevent default if animation is actually gonna happen
19				event.preventDefault();
20				$('html, body').animate({
21					scrollTop: target.offset().top
22				}, 1000, function() {
23					// Callback after animation
24					// Must change focus!
25					var $target = $(target);
26					$target.focus();
27					if ($target.is(":focus")) { // Checking if the target was focused
28						return false;
29					} else {
30						$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
31						$target.focus(); // Set focus again
32					};
33				});
34			}
35		}
36	});
37})(jQuery);
38
39(function($){
40	if($('.hero-slider,.hero-mobile-slider').length >0 ){
41
42		$(document).ready(function(){
43			$('.hero-slider,.hero-mobile-slider').slick({
44				infinite: true,
45				speed: 750,
46				fade: true,
47				autoplaySpeed: 1000,
48				responsive: [
49					{
50						breakpoint: 991,
51						settings: {
52							arrows:false
53						}
54					},
55				]
56			});
57		});
58	}
59})(jQuery);
60
61(function($){
62	if($('.home #intro').length >0 ){
63
64		$(document).ready(function(){
65			$('.home #intro').css( "padding-bottom", "0px" );
66		});
67	}
68})(jQuery);
69
70(function($){
71	if($('.areas_meta_wrapper').length >0 ){
72		var maxHeight = 0;
73
74		$(".areas_meta_wrapper").each(function(){
75			if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
76		});
77
78		$(".areas_meta_wrapper").height(maxHeight);
79	}
80})(jQuery);
81
82(function($){
83	if($('.we_slider').length >0 ){
84
85		$(document).ready(function(){
86			$('.we_slider').slick({
87				infinite: true,
88				speed: 750,
89				fade: true,
90				autoplay: true,
91				autoplaySpeed: 1000,
92				arrows: false,
93			});
94		});
95	}
96})(jQuery);
97
98
99(function($){
100  if ($('.embla').length === 0) return;
101
102  $(document).ready(function(){
103    const emblaNode = document.querySelector('.embla');
104    if (!emblaNode) return;
105
106    const viewportNode = emblaNode.querySelector('.embla__viewport');
107    if (!viewportNode) {
108      console.error('Embla: .embla__viewport not found');
109      return;
110    }
111
112    const OPTIONS = { loop: true };
113
114    const autoScrollOptions = {
115      speed: 2,
116      playOnInit: true,
117      stopOnInteraction: true,
118      stopOnMouseEnter: true,
119      stopOnResize: true,
120    };
121
122    // UMD globals: EmblaCarousel and EmblaCarouselAutoScroll
123    const emblaApi = EmblaCarousel(viewportNode, OPTIONS, [
124      EmblaCarouselAutoScroll(autoScrollOptions)
125    ]);
126
127    // Pause on pointerDown (extra safety) and resume on pointerUp
128    emblaApi.on('pointerDown', () => {
129      try { emblaApi.plugins().autoScroll && emblaApi.plugins().autoScroll.stop(); } catch(e) {}
130    });
131    emblaApi.on('pointerUp', () => {
132      try { emblaApi.plugins().autoScroll && emblaApi.plugins().autoScroll.play(); } catch(e) {}
133    });
134
135    // Expose for debugging if needed:
136    window._embla = emblaApi;
137  });
138})(jQuery);
139
140
141
142
143(function($){
144	if($('.animate-text').length >0 ){
145
146
147		const quotes = document.querySelectorAll(".animate-text h1, .animate-text h3, .animate-text h2");
148
149		function setupSplits() {
150			quotes.forEach(quote => {
151				// Reset if needed
152				if(quote.anim) {
153					quote.anim.progress(1).kill();
154					quote.split.revert();
155				}
156
157				quote.split = new SplitText(quote, {
158					type: "lines,words,chars",
159					linesClass: "split-line"
160				});
161
162				// Set up the anim
163				quote.anim = gsap.from(quote.split.chars, {
164					scrollTrigger: {
165						trigger: quote,
166						toggleActions: "play none none none",
167					},
168					duration: 0.2,
169					ease: "circ.out",
170					y: 80,
171					stagger: 0.02,
172				});
173			});
174		}
175
176		ScrollTrigger.addEventListener("refresh", setupSplits);
177		setupSplits();
178
179
180	}
181})(jQuery);
182
183(function($){
184	if($('.animate-text-brands').length >0 ){
185
186		var $quote = $(".animate-text-brands"),
187			mySplitText = new SplitText($quote, {type:"words"}),
188			splitTextTimeline = gsap.timeline();
189
190		mySplitText.split({type:"lines"})
191		splitTextTimeline.from(mySplitText.lines, {
192			scrollTrigger: {
193				trigger: $quote,
194				toggleActions: "play none none none",
195			},
196			duration: 0.5,
197			opacity:0,
198			rotationX:-120,
199			force3D:true,
200			transformOrigin:"50% 0% -150",
201			stagger: 0.1
202		});
203
204		splitTextTimeline.play();
205
206
207	}
208})(jQuery);
209
210(function($){
211	$( ".rgpd_check" ).click(function() {
212		$(".wpcf7-list-item input").click();
213		$(".rgpd_check").toggleClass("checked");
214	});
215})(jQuery);
216
217(function($){
218	if($('.article_wrapper figcaption').length >0 ){
219
220		$( ".article_wrapper figcaption" ).click(function() {
221			$(this).toggleClass("view");
222		});
223
224	}
225})(jQuery);
226
227(function($){
228	if($('.jarallax').length >0 ){
229		jarallax(document.querySelectorAll('.jarallax'), {
230			speed: 0.95,
231		});
232	}
233})(jQuery);
234
235(function($){
236  if($('#pills-tabContent').length > 0) {
237    const pillButtons = $('#pills-tab button[data-bs-toggle="pill"]');
238    const allTab = $('#pills-all');
239
240    pillButtons.on('click', function(e) {
241      // Check if this button is already active
242      if ($(this).hasClass('active')) {
243        e.preventDefault();
244        e.stopPropagation();
245
246        // Remove active class from all buttons
247        pillButtons.removeClass('active');
248
249        // Hide all tab panes
250        $('.tab-pane').removeClass('show active');
251
252        // Show the "pills-all" tab (default content)
253        allTab.addClass('show active');
254      }
255    });
256  }
257})(jQuery);
258
259
260(function($){
261	if($('.slide-up-box').length >0 ){
262
263		const boxes = gsap.utils.toArray('.slide-up-box');
264		boxes.forEach((box, i) => {
265			const anim = gsap.fromTo(box, {autoAlpha: 0, y: 50}, {duration: 1, autoAlpha: 1, y: 0});
266			ScrollTrigger.create({
267				start: "top 90%+=100px",
268				trigger: box,
269				animation: anim,
270				toggleActions: 'play none none none',
271				once: true,
272			});
273		});
274
275	}
276})(jQuery);
277
278(function($){
279	if($('#accordionAgenda .accordion').length >0 ){
280
281		const boxes = gsap.utils.toArray('#accordionAgenda .accordion');
282		boxes.forEach((box, i) => {
283			const anim = gsap.fromTo(box, {autoAlpha: 0, y: 50}, {duration: 1, autoAlpha: 1, y: 0});
284			ScrollTrigger.create({
285				start: "top 90%+=100px",
286				trigger: box,
287				animation: anim,
288				toggleActions: 'play none none none',
289				once: true,
290			});
291		});
292
293	}
294})(jQuery);
295
296new SmoothScroll(document,120,20)
297
298function SmoothScroll(target, speed, smooth) {
299	if (target === document)
300		target = (document.scrollingElement
301				  || document.documentElement
302				  || document.body.parentNode
303				  || document.body) // cross browser support for document scrolling
304
305	var moving = false
306	var pos = target.scrollTop
307	var frame = target === document.body
308	&& document.documentElement
309	? document.documentElement
310	: target // safari is the new IE
311
312	target.addEventListener('mousewheel', scrolled, { passive: false })
313	target.addEventListener('DOMMouseScroll', scrolled, { passive: false })
314
315	function scrolled(e) {
316		e.preventDefault(); // disable default scrolling
317
318		var delta = normalizeWheelDelta(e)
319
320		pos += -delta * speed
321		pos = Math.max(0, Math.min(pos, target.scrollHeight - frame.clientHeight)) // limit scrolling
322
323		if (!moving) update()
324	}
325
326	function normalizeWheelDelta(e){
327		if(e.detail){
328			if(e.wheelDelta)
329				return e.wheelDelta/e.detail/40 * (e.detail>0 ? 1 : -1) // Opera
330			else
331				return -e.detail/3 // Firefox
332		}else
333			return e.wheelDelta/120 // IE,Safari,Chrome
334	}
335
336	function update() {
337		moving = true
338
339		var delta = (pos - target.scrollTop) / smooth
340
341		target.scrollTop += delta
342
343		if (Math.abs(delta) > 0.5)
344			requestFrame(update)
345		else
346			moving = false
347	}
348
349	var requestFrame = function() { // requestAnimationFrame cross browser
350		return (
351			window.requestAnimationFrame ||
352			window.webkitRequestAnimationFrame ||
353			window.mozRequestAnimationFrame ||
354			window.oRequestAnimationFrame ||
355			window.msRequestAnimationFrame ||
356			function(func) {
357				window.setTimeout(func, 1000 / 50);
358			}
359		);
360	}()
361	}
362
363document.addEventListener("DOMContentLoaded", function(){
364
365	el_autohide = document.querySelector('.autohide');
366
367	if(el_autohide){
368		var last_scroll_top = 0;
369		window.addEventListener('scroll', function() {
370			let scroll_top = window.scrollY;
371			if(scroll_top < last_scroll_top) {
372				el_autohide.classList.remove('scrolled-down');
373				el_autohide.classList.add('scrolled-up');
374			}
375			else {
376				el_autohide.classList.remove('scrolled-up');
377				el_autohide.classList.add('scrolled-down');
378			}
379			last_scroll_top = scroll_top;
380		});
381		// window.addEventListener
382	}
383	// if
384
385});
386
387(function($){
388	if($('.culture_connectors_wrapper').length >0 ){
389
390		gsap.registerPlugin(ScrollTrigger);
391
392		let allVideoDivs = gsap.utils.toArray('.culture_connectors_wrapper');
393
394		allVideoDivs.forEach((videoDiv, i) => {
395
396			let videoElem = videoDiv.querySelector('video')
397
398			ScrollTrigger.create({
399				trigger: videoElem,
400				start: 'top 80%',
401				end: 'top 20%',
402				onEnter: () => videoElem.play(),
403				onEnterBack: () => videoElem.play(),
404				onLeave: () => videoElem.pause(),
405				onLeaveBack: () => videoElem.pause(),
406			});
407
408		});
409
410	}
411})(jQuery);
412
413const boxes = gsap.utils.toArray('.slide-up-item');
414
415boxes.forEach((box, i) => {
416	const anim = gsap.fromTo(box, {autoAlpha: 0, y: 50}, {duration: 1, autoAlpha: 1, y: 0});
417	ScrollTrigger.create({
418		trigger: box,
419		animation: anim,
420		toggleActions: 'play none none none',
421		once: true,
422	});
423});
424
425(function($){
426	if($('.testimonials-slider').length >0 ){
427
428		$(document).ready(function(){
429			$('.testimonials-slider').slick({
430				infinite: true,
431				speed: 1000,
432				autoplaySpeed: 5000
433			});
434		});
435
436	}
437})(jQuery);
438
439document.addEventListener('DOMContentLoaded', function() {
440	if (typeof Swiper === 'undefined') {
441		return;
442	}
443
444	document.querySelectorAll('.js-awards-slider').forEach(function(slider) {
445		var container = slider.querySelector('.swiper-container');
446		var slides = slider.querySelectorAll('.swiper-slide');
447
448		if (!container || slides.length < 2) {
449			return;
450		}
451
452		new Swiper(container, {
453			slidesPerView: 'auto',
454			spaceBetween: 32,
455			speed: 600,
456			watchOverflow: true,
457			keyboard: {
458				enabled: true,
459				onlyInViewport: true
460			},
461			navigation: {
462				nextEl: slider.querySelector('.js-awards-next'),
463				prevEl: slider.querySelector('.js-awards-previous')
464			},
465			breakpoints: {
466				1025: {
467					spaceBetween: 56
468				}
469			}
470		});
471	});
472});

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.