PageSourceSearch

https://www.fiamitalia.it/wp-content/themes/wk-hello-theme__child_dev/dev/js/sito.js?v=210

js fiamitalia.it collected 2026-09-24 10:01:44 UTC 9,282 bytes, 368 lines download raw bytes

1/* DIMENSIONI SCHERMO */
2	 
3	var $width = $(window).width();
4	var $height = $(window).height();
5	var $docheight = document.documentElement.scrollHeight;
6	var $scrollspace = $docheight-$height;
7
8function is_touch_device() {
9 return (('ontouchstart' in window)
10      || (navigator.maxTouchPoints > 0)
11      || (navigator.msMaxTouchPoints > 0));
12 //navigator.msMaxTouchPoints for microsoft IE backwards compatibility
13}
14
15
16$(document).ready(function() {
17
18	// OTTIMIZZAZIONE PER RETINA */
19	
20	if (window.devicePixelRatio == 2) {
21
22          var images = $("img.hires");
23
24          // loop through the images and make them hi-res
25          for(var i = 0; i < images.length; i++) {
26
27            // create new image name
28            var imageType = images[i].src.substr(-4);
29            var imageName = images[i].src.substr(0, images[i].src.length - 4);
30            imageName += "@x2" + imageType;
31
32            //rename image
33            images[i].src = imageName;
34          }
35     }
36	 
37	
38	if(!is_touch_device()){
39		
40		$(".touch").addClass("notouch");
41		$("body").addClass("notouch");
42		
43	}
44
45
46	
47	/* FORM */
48
49	$('label.form-label').on('click', function(){
50		$(this).siblings('.form-input').trigger('focus');
51	});
52
53	$('.form-input').focus(function(){
54	  	$(this).parents('.form-group').addClass('focused');
55	});
56
57	$('.form-input').blur(function(){
58		var inputValue = $(this).val();
59		if ( inputValue == "" ) {
60			$(this).removeClass('filled');
61			$(this).parents('.form-group').removeClass('focused');  
62		} else {
63			$(this).addClass('filled');
64		}
65	});
66
67	/***
68     *  Funzione per inviare form (AJAX)
69     ***/
70    
71    $("#form-id").on('submit', function(e){
72    	e.preventDefault();
73
74    	var form = $(this);
75
76    	var results = form.serializeArray();
77
78    	//if(validateForm(form)){
79
80	        var request = $.ajax({
81	            type: "POST",
82	            url: ajaxurl, 
83			    data: {
84				    action: 'webkolm_ajax_form_submit',
85				    content: results,
86				},
87	           
88	            success: function(data){
89	                $(form).children().fadeOut(500, function(){
90	                	$(form).addClass('success').find('.sa').fadeIn(500, function(){
91	                		$(this).addClass('active');
92	                	});
93	                });
94
95	                //console.log(data);
96	            }   
97	        }); 
98	    //} else {
99	    	//console.log("error!!!");
100	   //}
101    });  
102
103
104
105	
106	if($width<1000) {
107		
108		/* PER SMARTPHONE */
109		
110		
111		/* TASTO PER APERTURA MENU */
112		$("a.mobile-menu").on('click', function (){
113		  	$('body').toggleClass('nav-open');
114		  	$("body").toggleClass("bloccoscroll");
115			$("html").toggleClass("bloccoscroll");
116		});
117		
118		$("nav.onlymobile .menu").on('click', 'li a', function(){
119			var $this=$(this);
120			if($this.hasClass("attivo"))
121			{
122				$this.toggleClass("attivo");
123				$this.next('ul.sub-menu').slideToggle();
124			}
125			else{
126				$this.next('ul.sub-menu').slideToggle();
127				$this.toggleClass("attivo");	
128			}
129			
130			if($(this).siblings("ul.sub-menu").size()!=0){
131			  	return false;
132			}
133		});
134		
135		$("nav.onlymobile .menu li.current-menu-ancestor > a").addClass("attivo");
136	} 
137
138	/* SLIDER SITO */
139
140	if($(".gallery-container").length > 0){
141		$('.gallery-container').flexslider({
142		    animation: "fade",
143		    animationLoop: true,
144		    slideshow: true,
145		    slideshowSpeed : "4000",
146		     pauseOnHover: true,
147		    multipleKeyboard: true,
148		    keyboard: true,
149		    controlNav: true, 
150
151		});
152	}
153
154
155
156	/* CAROUSEL POST
157
158	$('.owl-carousel').owlCarousel({
159	   loop:true,
160	       margin:30,
161	       responsiveClass:true,
162	       autoplay:true,
163	       dots:false,
164	       nav:true,
165	       navText:['&#60;','&#62;'],
166	       responsive:{
167	           0:{
168	               items:1
169	           },
170	           600:{
171	               items:2
172	           },
173	           1000:{
174	               items:3
175	           }
176	           1280:{
177	               items:4
178	           }
179	       }
180	}); */
181
182	/* BLOCCO CALL TO ACTION GESTIONE POPUP SHARE NATIVO */
183
184	const shareButton = document.querySelector('.wk_share-button');
185
186	if(shareButton != null){
187			shareButton.addEventListener('click', event => {
188			  if (navigator.share) { 
189			   navigator.share({
190			      title: document.title,
191			      url: document.URL
192			    }).then(() => {
193			      console.log('Thanks for sharing!');
194			    })
195			    .catch(console.error);
196			    } else {
197			        shareButton.classList.add('is-open');
198			    }
199			});
200	}
201
202
203	/**
204	 * Topbar lingua
205	 */
206	const wkTopbar = document.querySelector('.wk-topbar');
207
208	if (wkTopbar) {
209		const wkSelect = document.querySelector('.wk-select ul');
210		const wkSelectItems = document.querySelectorAll('.wk-select li');
211		const wkSelectHeight = wkSelect.scrollHeight;
212		const wkSelectButton = document.querySelector('.wk-button');
213		const wkCloseTopbar = document.querySelector('.wk-close-topbar');
214
215		// Funzioni cookie
216		function wkSetCookie(name, value, hours) {
217			const date = new Date();
218			date.setTime(date.getTime() + (hours * 60 * 60 * 1000));
219			const domain = window.location.hostname.split('.').slice(-2).join('.');
220			document.cookie = `${name}=${value}; expires=${date.toUTCString()}; path=/; domain=${domain}`;
221		}
222
223		function wkGetCookie(name) {
224			const cookies = document.cookie.split('; ');
225			for (let cookie of cookies) {
226				const [cookieName, cookieValue] = cookie.split('=');
227				if (cookieName === name) return cookieValue;
228			}
229			return null;
230		}
231
232		// Mostra/nascondi topbar
233		if (!wkGetCookie('topbarClosed')) wkTopbar.style.display = 'block';
234		else wkTopbar.style.display = 'none';
235
236		// Chiudi topbar
237		wkCloseTopbar.addEventListener('click', () => {
238			wkTopbar.style.display = 'none';
239			wkSetCookie('topbarClosed', 'true', 24);
240		});
241
242		let wkIsSelectOpen = false;
243
244		// Apertura/chiusura menu
245		wkSelect.addEventListener('click', (event) => {
246			wkIsSelectOpen = !wkIsSelectOpen;
247			wkSelect.style.height = wkIsSelectOpen ? wkSelectHeight + 'px' : '35px';
248			wkSelect.parentElement.classList.toggle('wk-open');
249			event.stopPropagation();
250		});
251
252		document.addEventListener('click', () => {
253			if (wkIsSelectOpen) {
254				wkIsSelectOpen = false;
255				wkSelect.style.height = '35px';
256				wkSelect.parentElement.classList.remove('wk-open');
257			}
258		});
259
260		// Selezione lingua al click su <li>
261		wkSelectItems.forEach(item => {
262			item.addEventListener('click', () => {
263				if (item.classList.contains('wk-current-el')) return;
264
265				wkSelectItems.forEach(e => e.removeAttribute('data-selected'));
266				item.setAttribute('data-selected', '');
267				wkSelect.querySelector('.wk-current-el').textContent = item.textContent.trim();
268			});
269		});
270
271		// Cambio lingua al click sul pulsante
272		wkSelectButton.addEventListener('click', () => {
273			const selectedItem = wkSelect.querySelector('li[data-selected]:not(.wk-current-el)');
274			if (selectedItem) {
275				const href = selectedItem.getAttribute('data-href');
276				if (href) {
277					wkSetCookie('topbarClosed', 'true', 24);
278					window.location.href = href;
279				}
280			}
281		});
282
283		// Selezione automatica lingua browser al caricamento
284		const browserLang = navigator.language.slice(0, 2);
285		let selected = false;
286
287		wkSelectItems.forEach(item => {
288			if (item.classList.contains('wk-current-el')) return;
289
290			const itemLang = item.getAttribute('data-lang');
291			if (itemLang === browserLang) {
292				item.setAttribute('data-selected', '');
293				wkSelect.querySelector('.wk-current-el').textContent = item.textContent.trim();
294				selected = true;
295			}
296		});
297
298		// Fallback inglese
299		if (!selected) {
300			wkSelectItems.forEach(item => {
301				if (item.classList.contains('wk-current-el')) return;
302				if (item.getAttribute('data-lang') === 'en') {
303					item.setAttribute('data-selected', '');
304					wkSelect.querySelector('.wk-current-el').textContent = item.textContent.trim();
305				}
306			});
307		}
308	}
309
310
311	/**
312	 * Tab materioteca
313	 */
314	const wkTabNavs = document.querySelectorAll('.wk_tab_nav_item');
315	const wkTabContents = document.querySelectorAll('.wk_tab_body');
316	const elem2 = document.getElementById('griglia_materioteca_altri');
317	const filters = document.querySelectorAll('.filter-content');
318
319	// Crea l'istanza Isotope una sola volta, se esiste l'elemento
320	if (elem2) {
321		iso3 = new Isotope(elem2, {
322			itemSelector: '.wk_finitura',
323			layoutMode: 'fitRows',
324			fitRows: {
325				gutter: 20
326			}
327		});
328	}
329
330	wkTabNavs.forEach((nav, i) => {
331		nav.addEventListener('click', () => {
332			// Rimuove "active" da tutti i tab e contenuti
333			wkTabNavs.forEach(n => n.classList.remove('active'));
334			wkTabContents.forEach(content => {
335				content.style.display = 'none';
336				content.classList.remove('active');
337			});
338
339			// Attiva il tab selezionato
340			nav.classList.add('active');
341
342			// Mostra il contenuto corrispondente
343			const activeTab = wkTabContents[i];
344			activeTab.style.display = 'flex';
345			activeTab.classList.add('active');
346
347			// Attiva la sezione interna, se presente
348			if (nav.getAttribute('data-tab') == 'vetro') {
349				filters.forEach(filter => {
350					filter.classList.add('is-vetro');
351				})
352			} else {
353				filters.forEach(filter => {
354					filter.classList.remove('is-vetro');
355				})
356			}
357
358			// Aggiorna layout Isotope (senza ricreare l’istanza)
359			setTimeout(() => {
360				if (iso2) iso2.layout();
361				if (iso3) iso3.layout();
362			}, 50);
363		});
364	});
365
366	
367
368});	/* FINE DOCUMENT READY */

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.