PageSourceSearch

https://networkdigital360.it/js/home.js

js networkdigital360.it collected 2026-09-28 10:45:12 UTC 6,979 bytes, 212 lines download raw bytes

1(function(window, document, undefined){
2
3	var homeNav;
4	var lastIndicator;
5	var testataModal;
6	var firstSection,mainNav, scrollTopBtn;
7
8	document.addEventListener('DOMContentLoaded', function() {
9		initEditorialiEvents();
10		initNavigation();
11		firstSection = document.querySelector('#sezione1-heading');
12		mainNav = document.querySelector('.navbar-n4');
13		scrollTopBtn = document.querySelector('.scrolltop-btn');
14		scrollTopBtn.addEventListener('click', scrollToTop);
15		window.addEventListener('scroll', handleScrollToTopButton);
16		$('.scrollspy').scrollSpy({
17			scrollOffset: 350,
18			activeClass: 'is-active',
19			getActiveElement: function(id) {
20				switch(id) {
21					case 'hero':
22						return '';
23					break;
24					case 'about':
25						return '.homeNav .nav-item:nth-child(7)';
26					break;
27					default:
28						return '.homeNav .nav-item:nth-child('+ id.slice(-1) +')';
29				}
30			}
31		});
32	});
33
34	function handleScrollToTopButton(event) {
35		//Prendo gli elementi hero 
36		firstSectionOffsetTop = firstSection.getBoundingClientRect().top;
37		homeNavHeight = homeNav.getBoundingClientRect().height;
38		mainNavHeight  = mainNav.getBoundingClientRect().height;
39		var threshold = firstSectionOffsetTop - homeNavHeight - mainNavHeight;
40
41		if(threshold <= 0 ) {
42			requestAnimationFrame(showScrollTopButton);
43		} else {
44			requestAnimationFrame(hideScrollTopButton);
45		}
46	}
47
48	function showScrollTopButton() {
49		scrollTopBtn.classList.add('active');
50	}
51
52	function hideScrollTopButton() {
53		scrollTopBtn.classList.remove('active');
54	}
55
56	function scrollToTop(event) {
57		$('html, body').animate({
58			scrollTop: 0
59		});
60	}
61
62	function initNavigation() {
63		homeNav = document.querySelector('.homeNav');
64		homeNav.addEventListener('click', handleIndicator);
65		$('.homeNav a').click(scrollToSection);
66		$('.side-nav a[href*=sezione]').click(scrollToSectionMobile);
67		var observer = new MutationObserver(addTransition);
68		observer.observe(homeNav, {
69			subtree: true,
70			attributes: true
71		});
72	}
73
74	function scrollToSection(event) {
75		event.preventDefault();
76		var offset = $('.navbar-n4').height();
77		//20 è il margine della riga
78		var sectionOffset = $(this.getAttribute('href')).offset().top;
79		$('html, body').animate({
80			scrollTop: sectionOffset - offset - 20
81		});
82	}
83
84	function scrollToSectionMobile(event) {
85		event.preventDefault();
86		var offset = $('.navbar-n4').height();
87		//20 è il margine della riga
88		var sectionOffset = $(this.getAttribute('href')).prev().offset().top;
89		$('html, body').animate({
90			scrollTop: sectionOffset - offset
91		});
92	}
93
94	function addTransition(mutation, observer) {
95		homeNav.classList.add('homeNav--withTransition');
96		observer.disconnect();
97	}
98
99	function handleIndicator(event) {
100		if(!homeNav.classList.contains('homeNav--withTransition')) {
101			homeNav.classList.add('homeNav--withTransition');
102		}
103		if(event.target.nodeName === 'LI') {
104			updateIndicator(event.target);
105		} else if (event.target.nodeName === 'A') {
106			updateIndicator(event.target.parentNode);
107		}
108	}
109
110	function updateIndicator(item) {
111		item.classList.add('is-active');
112		if(lastIndicator) {
113			lastIndicator.classList.remove('is-active');
114		}
115		lastIndicator = item;		
116	}
117
118	function initEditorialiEvents() {
119		testataModal = $('#testata-modal').modal({
120			complete: function() {
121				var input = testataModal[0].querySelector('input[type=email]');
122				input.value = '';
123				input.classList.remove('invalid');
124				input.nextElementSibling.classList.remove('active');
125				//Riattivo il pulsante
126				testataModal[0].querySelector('button[type=submit]').classList.remove('disabled');
127			}
128		});
129		var sezioniEditoriali = document.querySelectorAll('.siti-editoriali');
130		for (var i = sezioniEditoriali.length - 1; i >= 0; i--) {
131			sezioniEditoriali[i].addEventListener('mouseover', colorBlock);
132			sezioniEditoriali[i].addEventListener('mouseout', removeColor);
133			sezioniEditoriali[i].addEventListener('click', handleClickTestata);
134		}
135	}
136
137	function colorBlock(event) {
138		// debugger;
139		if(!isBlockTestata(event.target))
140			return;
141		event.target.style.backgroundColor = event.target.dataset.primarycolor;
142	}
143
144	function isBlockTestata(node) {
145		return node.nodeName === 'DIV' && node.classList.contains('testata-block');
146	}
147
148	function handleClickTestata(event) {
149		if(isBlockTestata(event.target)) {
150			var testata = event.target;
151			if(!testata.dataset.listid.length || subscriptions.indexOf(testata.dataset.listid) !== -1 ) {
152				window.open(testata.dataset.url, '_blank');
153				return;
154			}
155			//Inserisco i dati della testata nella finestra modale
156			if( '' !== testata.dataset.cattext ) {
157				testataModal[0].querySelector('.testata-block__category p').innerHTML = testata.dataset.cattext;
158				testataModal[0].querySelector('.testata-block__category').style.display = 'block';
159			} else {
160				testataModal[0].querySelector('.testata-block__category').style.display = 'none';
161			}
162
163			var nlOnlyCompanyEmail =[
164				"619ea0b725", //Digital4 executive
165				"61644652ca", //People&Change360 (ex Digital4 HR)
166				"f275db3a80", //Digital4 finance
167				"085dd508ae", //Digital4 PMI
168				"8556c6645c", //Digital4 marketing
169				"435026a702", //Digital4 supply chain
170				"1fc28648ae", //Digital4 legal
171				"9c9872894b", //Digital4 procurement
172				"b78e1375dd", //Agenda
173				"7e993dc350", //Agenda infrastrutture
174				"52d9e54290", //Agenda cittadinanza
175				"52a5c99f86", //Agenda documenti
176				"f48b78b617", //Agenda procurement
177				"c5d0819a05", //Agenda scuola
178				"400fbfa33d", //Agenda sicurezza
179				"d677fb8e63", //Agenda sanità
180				"4c583282fd", //Corcom
181				"18a18e0502", //ZeroUno
182				"1c3ceafdfe", //CyberSecurity
183				"2573e1bda0", //EconomyUp
184				"38593bda4a", //EconomyUp automotive
185				"a00d5f724d", //EconomyUp banking
186				"d3a659ed1b", //EconomyUp retail
187				"c8b9849311", //EconomyUp smartmobility
188				"951376c1a5", //Proptech360
189				"867902fb7d", //HealthTech360
190				"0574e9e9b0", //SpacEconomy360
191				"235ea69bf7"  //Innovation Post
192			];
193
194			testataModal[0].querySelector('.modal-header').style.backgroundColor = testata.dataset.primarycolor;
195			testataModal[0].querySelector('.modal-header img').src = testata.dataset.logo;
196			testataModal[0].querySelector('.modal-header img').dataset.testata = testata.dataset.name;
197			testataModal[0].querySelector('#nl-name').innerHTML = testata.dataset.name;
198			testataModal[0].querySelector('#nl-label').innerHTML = nlOnlyCompanyEmail.includes(testata.dataset.listid) ? "Email aziendale" : "Email";
199			testataModal[0].querySelector('input[type=email]').dataset.listid = testata.dataset.listid;
200			testataModal[0].querySelector('input[type=email]').dataset.emailservice = testata.dataset.emailservice;
201			testataModal[0].querySelector('#nl-site').innerHTML = testata.dataset.urlsimple;
202			testataModal[0].querySelector('a.btn').href = testata.dataset.url;
203			testataModal.modal('open');
204		}
205	}
206	function removeColor(event) {
207		if(!isBlockTestata(event.target)) 
208			return;
209		event.target.style.backgroundColor = '';
210	}
211
212}(window,document));

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.