PageSourceSearch

https://www.atb.group/assets/templates/js/custom.min.js

js atb.group collected 2026-10-10 00:00:33 UTC 12,892 bytes, 321 lines download raw bytes

1// templatev750	
2
3/* rimuovo parametro REF dall'URL ================
4==================================================*/
5// history.replaceState && history.replaceState(
6// 	null, '', location.pathname + location.search.replace(/[\?&]ref=[^&]+/, '').replace(/^&/, '?') + location.hash
7// 	// null, '', location.pathname + location.search.replace(/[\?&]ref=[^&]+/, '').replace(/^&/, '?').replace(/[\?&]pag=[^&]+/, '').replace(/^&/, '?') + location.hash
8// );
9
10/* scroll auto tematica  =========================
11==================================================*/
12// 	 spostato
13//   setTimeout(() => {
14//   document.getElementById( 'content' ).scrollIntoView({ 
15//     behavior: 'smooth', 
16//     block: 'start' 
17//     },)
18//   }, 5000);
19
20/* refresh pagina  =========================
21==================================================*/
22// Recupero il button
23document.addEventListener('DOMContentLoaded', function() {
24  const btn = document.getElementById('btnRefresh');
25  if (btn) {
26    btn.addEventListener('click', function() {
27      location.reload();
28    });
29  }
30});
31
32
33/* script iframe youtube - gemini =========================
34==================================================*/
35// Variabile globale per prevenire loop di ricarica infiniti
36        let isReloadingDueToConsent = false;
37
38        // Controlla sessionStorage all'inizio del caricamento della pagina
39        // Se il flag è presente, significa che la pagina è stata appena ricaricata a causa di un cambio di consenso.
40        if (sessionStorage.getItem('iubenda_reloaded_for_consent')) {
41            isReloadingDueToConsent = true;
42            sessionStorage.removeItem('iubenda_reloaded_for_consent'); // Rimuovi il flag
43            console.log("Pagina ricaricata a causa di un cambio di consenso. Impedisco un'ulteriore ricarica immediata.");
44        }
45
46        /**
47         * Funzione per controllare lo stato del video di YouTube e mostrare/nascondere il placeholder.
48         * Si basa sugli attributi che Iubenda aggiunge all'iframe quando blocca il contenuto.
49         */
50        function checkYouTubeConsent() {
51            const youtubeVideo = document.getElementById('youtube-video');
52            const youtubePlaceholder = document.getElementById('youtube-placeholder');
53
54            // Verifica che gli elementi HTML siano presenti nella pagina.
55            // Se non ci sono, la funzione termina silenziosamente senza errori.
56            if (!youtubeVideo || !youtubePlaceholder) {
57                // console.log("Elementi video o placeholder non trovati. Non è una pagina con video YouTube.");
58                return; // Termina la funzione se gli elementi non sono presenti
59            }
60
61            // Controlla se l'iframe di YouTube è stato bloccato da Iubenda.
62            // Iubenda imposta l'attributo 'src' su 'about:blank' e sposta l'URL originale
63            // nell'attributo 'data-suppressedsrc' quando blocca il contenuto.
64            const isBlockedByIubenda = youtubeVideo.src === 'about:blank' && youtubeVideo.hasAttribute('data-suppressedsrc');
65
66            if (isBlockedByIubenda) {
67                // Se il video è bloccato, nascondi l'iframe e mostra il placeholder personalizzato.
68                console.log("Video di YouTube bloccato da Iubenda. Mostro il placeholder.");
69                youtubeVideo.style.display = 'none'; // Nasconde l'iframe
70                youtubePlaceholder.style.display = 'flex'; // Mostra il placeholder come flexbox per centrare
71            } else {
72                // Se il video non è bloccato (o è stato sbloccato), mostra l'iframe e nascondi il placeholder.
73                console.log("Video di YouTube caricato (o non bloccato da Iubenda). Nascondo il placeholder.");
74                youtubeVideo.style.display = 'block'; // Mostra l'iframe
75                youtubePlaceholder.style.display = 'none'; // Nasconde il placeholder
76            }
77        }
78
79        /**
80         * Funzione per aprire la modale di gestione delle preferenze di Iubenda.
81         * Questa funzione viene chiamata dal pulsante nel placeholder.
82         */
83        function openIubendaPreferences() {
84            // Tenta prima di usare la funzione diretta di Iubenda, se disponibile
85            if (window._iub && window._iub.cs && typeof window._iub.cs.showPreferences === 'function') {
86                console.log("Tentativo di aprire la modale delle preferenze di Iubenda tramite showPreferences().");
87                window._iub.cs.showPreferences(); // Chiama la funzione Iubenda per aprire la modale
88            } else {
89                // Fallback: cerca un elemento con la classe iubenda-cs-preferences-link e simulane il click
90                // Questo è utile se lo script del widget non espone direttamente showPreferences()
91                const hiddenLink = document.getElementById('iubend
91a-hidden-preferences-link');
92                if (hiddenLink) {
93                    console.log("La funzione showPreferences() non è disponibile. Tentativo di aprire la modale cliccando il link nascosto con classe 'iubenda-cs-preferences-link'.");
94                    hiddenLink.click(); // Simula il click sul link nascosto
95                } else {
96                    // Messaggio di errore se nessuna delle due opzioni funziona
97                    console.error('Errore: La funzione _iub.cs.showPreferences() non è disponibile e il link di fallback non è stato trovato.');
98                    alert('Impossibile aprire le preferenze cookie. Si prega di controllare le configurazioni di Iubenda.');
99                }
100            }
101        }
102
103        // Aggiungi un listener per l'evento DOMContentLoaded per eseguire il controllo
104        // una volta che il DOM è completamente caricato.
105        document.addEventListener('DOMContentLoaded', function() {
106            // Un piccolo ritardo per dare a Iubenda il tempo di inizializzarsi e agire sull'iframe
107            setTimeout(checkYouTubeConsent, 500);
108        });
109
110        // Aggiungi un listener per l'evento 'load' della finestra come fallback,
111        // per assicurarsi che il controllo venga eseguito anche dopo il caricamento completo di tutte le risorse.
112        window.addEventListener('load', function() {
113            setTimeout(checkYouTubeConsent, 1000);
114        });
115
116        // Aggiungi un listener per il callback onReady di Iubenda, che è il momento ideale
117        // per eseguire il controllo dello stato del video.
118        if (window._iub && window._iub.csConfiguration) {
119            _iub.csConfiguration.callback = _iub.csConfiguration.callback || {};
120            _iub.csConfiguration.callback.onReady = function() {
121                console.log("Iubenda è pronto tramite callback onReady! Eseguo checkYouTubeConsent().");
122                setTimeout(checkYouTubeConsent, 300);
123            };
124            _iub.csConfiguration.callback.onPreferenceExpressed = function() {
125                // Solo ricarica se non siamo già in un ciclo di ricarica dovuto al consenso
126                if (!isReloadingDueToConsent) {
127                    console.log("Preferenze cookie espresse o cambiate. Ricarico la pagina per applicare i cambiamenti.");
128                    sessionStorage.setItem('iubenda_reloaded_for_consent', 'true'); // Imposta il flag
129                    location.reload();
130                } else {
131                    console.log("Prevenuta ricarica immediata dopo cambio consenso (flag attivo).");
132                }
133            };
134        } else {
135            console.warn("Iubenda csConfiguration non disponibile al caricamento iniziale per i callback.");
136        }
137
138// /* / FINE YOUTUBE ==========================*/
139
140
141
142
143
144
145/* revo cerchi colorati ==========================
146==================================================*/
147function addClass(o, c){
148	var re = new RegExp("(^|\\s)" + c + "(\\s|$)", "g")
149	if (re.test(o.className)) return
150	o.className = (o.className + " " + c).replace(/\s+/g, " ").replace(/(^ | $)/g, "")
151    }
152     
153function removeClass(o, c){
154	var re = new RegExp("(^|\\s)" + c + "(\\s|$)", "g")
155	o.className = o.className.replace(re, "$1").replace(/\s+/g, " ").replace(/(^ | $)/g, "")
156}
157
158
159// $('.card').hover(
160// 	function(){ $(this).addClass('hover') },
161// 	function(){ $(this).removeClass('disabled') }
162//  );
163
164// $('.card').onmouseout(
165// 	function(){ $(this).addClass('disabled') },
166// 	function(){ $(this).removeClass('hover') }
167//  );
168
169
170/* IE Block ============================================
171==================================================*/
172var IE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
173if(IE6){
174
175	$(function(){
176		
177		$("<div>")
178			.css({
179				'position': 'absolute',
180				'top': '0px',
181				'left': '0px',
182				backgroundColor: 'black',
183				'opacity': '0.75',
184				'width': '100%',
185				'height': $(window).height(),
186				zIndex: 5000
187			})
188			.appendTo("body");
189			
190		$("<div><img src='/assets/templates/img/no-ie6.png' alt='' style='float: left;'/><p><br /><strong>Sorry! This page doesn't support Internet Explorer 6.</strong><br /><br />If you'd like to read our content please <a href='http://getfirefox.org'>upgrade your browser</a> or <a href='http://feeds.feedburner.com/CssTricks'>subscribe to our RSS feed</a>.</p>")
191			.css({
192				backgroundColor: 'white',
193				'top': '50%',
194				'left': '50%',
195				marginLeft: -210,
196				marginTop: -100,
197				width: 410,
198				paddingRight: 10,
199				height: 200,
200				'position': 'absolute',
201				zIndex: 6000
202			})
203			.appendTo("body");
204	});		
205}
206
207 /* area map home ==================================
208==================================================*/
209
210/*$('#worldMap area').mousemove(function (e) {
211    "use strict";
212
213    var coords = $(this).attr('coords').split(','),
214        mouseX = +coords[0] - 85,
215        mouseY = +coords[1] - 60;
216
217    $('.tooltip').css({
218        'top':  mouseY,
219        'left': mouseX
220    }).fadeIn('slow');
221
222});*/
223
224/*
225	$(".tooltip-bot").tooltip({
226		placement: "bottom"
227	});
228	$(document).mousemove( function(e) {	
229		var mouseX = e.pageX - $('#worldwide').offset().left - 50;
230		var mouseY = e.pageY - $('#worldwide').offset().top - 40;
231		$('.tooltip').css({'top':mouseY,'left':mouseX}).fadeIn('slow');
232	});
233*/
234
235/* timeline storia ===============================
236==================================================*/
237if ($('.timeline').length > 0) {
238    $('.timeline area').click(function () {
239        var imgUrl = '/client-assets/content/storia/timeline/' + $(this).data('img') + '.png';
240        $('.timeline-point img').attr('src', imgUrl);
241        $('.content-timeline').each(function () {
242            $(this).removeClass('active').hide();
243        });
244        $('#' + $(this).data('img')).addClass('active').fadeIn();
245    });
246}
247
248/* sidebar menu calcolo elementi per responsive ==
249==================================================*/
250var count_element = $('.sidebar-menu > ul.nav > li.sidemenu-itemcalc > a').length
251$('.sidemenu-item-tot').each(function () {
252	$(this).addClass('tot' + count_element);
253});
254
255var count_element = $('.sidebar-menu > ul.nav > li.sidemenu-itemcalc.active > ul > li > a').length
256$('.sidemenu-inner-tot').each(function () {
257	$(this).addClass('tot' + count_element);
258});
259/* CAMBIO ICONA dropdown click ===================
260==================================================*/
261
262/*$(document).ready(function() {
263	$(".dropdown > .dropdown-toggle" ).click(function() {
264		$(".dropdown > .dropdown-toggle > i.fa-caret-down").removeClass('fa-caret-down').addClass('fa-caret-up');
265	});
266});*/
267
268/* popgallery ====================================
269==================================================*/
270$(document).ready(function() {
271	$('.fotogallery').magnificPopup({
272		delegate: 'a.popgallery',
273		type: 'image',
274		tLoading: 'Loading image #%curr%...',
275		mainClass: 'mfp-img-mobile',
276		gallery: {
277			enabled: true,
278			navigateByImgClick: true,
279			preload: [0,1] // Will preload 0 - before current, and 1 after the current image
280		},
281		image: {
282			tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
283			
284		}
285	});
286});
287/* Messaggio allerta cookie =======================
288==================================================*/
289
290$(function() {
291	var status = $.cookie('alert_cookie');
292	if (status != "hide") {
293		$('#alertcookie').show();
294	}
295	$('#hide').click(function() {
296		$('#alertcookie').slideUp(1000, function() {
297			$.cookie('alert_cookie', 'hide', { expires: 30, path: '/' });
298
299		});
300
301	});
302
303});
304/* jquery textfill ================================
305==================================================*/
306// $(document).ready(function() {
307//     $('.h1textfill').textfill({ 
308// 		minFontPixels: 10,
309// 		maxFontPixels: 100,
310// 		innerTag: 'h1'
311// 	});
312// });
313
314
315/* jsSocials ====================================== rimosso 2018.05.29.
316==================================================*/
317/*$("#share").jsSocials({
318	shares: ["email", "twitter", "facebook", "googleplus", "linkedin", "pinterest", "whatsapp"],
319	showLabel: true,
320	showCount: true
321});*/

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.