1/* Inizializzazione */ 2var stato; 3 4function attiva_slider(){ 5 jQuery('#sidebar_slide .iosslider').iosSlider({ 6 snapToChildren: true, 7 desktopClickDrag: true, 8 scrollbar: false, 9 infiniteSlider: true, 10 autoSlide: true, 11 autoSlideHoverPause: true, 12 autoSlideTimer: 2500, 13 autoSlideTransTimer: 500 14 }); 15} 16 17function posiziona_bf(){ 18 var /*limite = 800; 19 if (jQuery('#sidebar').hasClass('sb_campagna') || jQuery('#sidebar_slide .strillo_fisso').length || jQuery('#sidebar.sb_campagne').length)*/ limite = 900; 20 if (stato < limite) { 21 if (jQuery('#sidebar_slide .strillo_fisso').length || jQuery('#sidebar.sb_campagne').length) var sb = jQuery('#sidebar_slide'); else if (jQuery('#sidebar.sb_europee .porzione_fissa').length) var sb = jQuery('#sidebar.sb_europee .porzione_fissa'); else var sb = jQuery('#sidebar'); 22 if (jQuery('#sidebar_slide .strillo_fisso').length) var fisso = jQuery('#sidebar_slide .strillo_fisso'); 23 else if (jQuery('#sidebar.sb_campagne').length) var fisso = jQuery('#sidebar_slide .campagne_fisse'); 24// else if (jQuery('#sidebar.sb_europee').length) var fisso = jQuery('#sidebar_slide .campagne_fisse'); 25 else var fisso = jQuery('#sidebar .blocco.fisso'); 26 var pos = sb.offset(), 27 a_blocco = fisso.outerHeight(), 28 finpos = jQuery(window).scrollTop(), 29 margine_aggiunto = 15; 30 if (finpos+jQuery(window).height()-a_blocco-margine_aggiunto >= pos.top) { 31 fisso.addClass('sbloccato'); 32 } else { 33 fisso.removeClass('sbloccato'); 34 } 35 } 36} 37 38function init(){ 39 stato = jQuery('#stato_responsive').width(); 40 41 /* Menu mobile */ 42 if (stato >= 900 && jQuery('#nav_mobile').is(':visible')) { 43 jQuery('#strumenti li#m_str_mobile').removeClass('aperto'); 44 jQuery('#nav_mobile').hide().removeAttr('style'); 45 } 46 47 /* Menu desktop stretto */ 48 /*if (stato == 900 && jQuery('#barra_strumenti').is(':visible')) { 49 jQuery('.sezione.m_str_tutti').show(0); 50 jQuery('#strumenti li.attivo').removeClass('attivo'); 51 jQuery('#strumenti #m_str_tutti').addClass('attivo'); 52 } 53 if (stato != 900 && jQuery('#m_str_tutti').hasClass('attivo')) { 54 jQuery('#strumenti #m_str_tutti').removeClass('attivo'); 55 jQuery('#barra_strumenti').removeClass('attivo').removeAttr('style'); 56 }*/ 57 58 /* Logo */ 59 if (stato < 900) { 60 jQuery('#logo img').css({'margin-top': ((40 - jQuery('#logo img').height()) / 2)+'px', 'opacity': '1'}); 61 } 62 63 /* Sidebar archivi */ 64 if (jQuery('.selettore_insieme').length && stato >= 900 && !jQuery('.selettore_insieme .insieme').is(':visible')) jQuery('.selettore_insieme .insieme').removeAttr('style'); 65 66 /* Mappa regioni */ 67 if (jQuery('#sel_regioni').length) { 68 jQuery('#sel_regioni').height((117*jQuery('#sel_regioni').width())/90); 69 } 70 71 /* Mega promo */ 72 if (jQuery('#mega_promo').length) { 73 jQuery('#mega_promo').height(jQuery(window).height()/* - jQuery('#barra_nav').height()*/); 74 } 75 76 /* Blocchi fissi */ 77 posiziona_bf(); 78 79 /* Fascia attivazione */ 80 if (jQuery('#promo_footer').length && jQuery('#promo_footer .anystretch').length && (jQuery('#promo_footer .anystretch img').width() < 500)) jQuery('#promo_footer').anystretch(jQuery('#promo_footer img.sel_attivazione').attr('src')); 81 82 /* Blocchi touch scorrevoli */ 83 /*if (jQuery('#sidebar_slide .iosslider.pronto' && stato < 900).length) { 84 if (jQuery('#sidebar_slide .iosslider').css('-webkit-perspective') != '1000px') attiva_slider(); 85 // else jQuery('#sidebar_slide .iosslider').iosSlider('destroy'); 86 //if (jQuery('#sidebar_slide .iosslider').css('-webkit-perspective') == '1000px' && stato >= 900) { jQuery('#sidebar_slide .iosslider').iosSlider('destroy'); } 87 }*/ 88} 89 90/* Blocco media */ 91function ultimo_video(data) { 92 var feed = data.feed; 93 var tutti = feed.entry || []; 94 var video = tutti[0]; 95 var idvideo = video.id.$t; 96 idvideo = idvideo.replace('http://gdata.youtube.com/feeds/videos/',''); 97 jQuery('#sel_media .b_yt .video').html('<iframe width="500" height="375" src="http://www.youtube.com/embed/'+idvideo+'?feature=oembed&wmode=transparent&showinfo=1&rel=0&autohide=1" frameborder="0" allowfullscreen></iframe>'); 98} 99 100jQuery.noConflict(); 101jQuery(document).ready(function(){ 102 103 /* Inizializzazione */ 104 jQuery(window).resize(function(){ 105 init();
106 // if (jQuery('#sidebar_slide .iosslider').css('-webkit-perspective') == '1000px') jQuery('#sidebar_slide .iosslider').iosSlider('autoSlidePause'); 107 }); 108 init(); 109 110 /* MENU */ 111 /* Menu desktop */ 112 jQuery('#menu .sezione').mouseenter(function(e){ 113 var sottomenu = jQuery(this).parent().find('.secondario'); 114 sottomenu.show().addClass('ingresso').animate({opacity: '1'/*, top: '49px'*/}, 160, function(){sottomenu.removeClass('ingresso');}); 115 }); 116 jQuery('#menu .annidato').mouseleave(function(e){ 117 var sottomenu = jQuery(this).find('.secondario'); 118 sottomenu.animate({opacity: '0'/*, top: '39px'*/}, 160, function(){sottomenu.removeAttr('style');}); 119 }); 120 jQuery('#strumenti li .apri_bs').click(function(e){ 121 var fascia_strumenti = jQuery('#barra_strumenti'), 122 terminale = jQuery(this).parent(); 123 if (terminale.hasClass('attivo')) { 124 terminale.removeClass('attivo'); 125 fascia_strumenti.animate({opacity: '0'/*, marginTop: '-70px'*/}, 160, function(){fascia_strumenti.removeClass('attivo').removeAttr('style');}); 126 } else { 127 jQuery('#strumenti li.attivo').removeClass('attivo'); 128 terminale.addClass('attivo'); 129 fascia_strumenti.find('.sezione').hide(); 130 fascia_strumenti.find('.'+terminale.attr('id')).show(); 131 fascia_strumenti.removeClass('m_str_lingue m_str_cerca'); 132 fascia_strumenti.addClass(terminale.attr('id')); 133 if (!fascia_strumenti.hasClass('attivo')) { 134 fascia_strumenti.show().addClass('attivo ingresso').animate({opacity: '1'/*, marginTop: '-60px'*/}, 160, function(){fascia_strumenti.removeClass('ingresso');}); 135 } 136 } 137 }); 138 jQuery('#strumenti li.attivo').mouseleave(function(e){ 139 var sottomenu = jQuery(this).find('.secondario'); 140 sottomenu.animate({opacity: '0', top: '39px'}, 160, function(){sottomenu.removeAttr('style');}); 141 }); 142 143 /* Menu mobile */ 144 var menu_m = jQuery('#nav_mobile'), 145 menu_mq = menu_m.find('.quadro'), 146 sezioni = jQuery('#menu .annidato'), 147 corpo_m = '', 148 selettore = jQuery('#strumenti li#m_str_mobile'); 149 sezioni.each(function(e){ 150 corpo_m += '<div class="blocco">'+jQuery(this).html()+'</div>'; 151 }); 152 corpo_m += '<div class="blocco"><span class="sezione">Cerca</span>'+jQuery('#barra_strumenti .m_str_cerca .modulo').html()+'</div>'; 153 /*corpo_m += '<div class="blocco"><span class="sezione">Lingue</span><ul class="secondario">'+jQuery('#barra_strumenti .m_str_lingue ul').html()+'</ul></div>';*/ 154 menu_mq.html(corpo_m); 155 jQuery('#strumenti li#m_str_mobile').click(function(e){ 156 // stato = jQuery('#stato_responsive').width(); 157 // if (stato < 900) { 158 if (menu_m.is(':visible')) { 159 selettore.removeClass('aperto'); 160 menu_m.slideUp({duration: 250, easing: 'easeInOutBack'}); 161 } 162 else { 163 selettore.addClass('aperto'); 164 menu_m.slideDown({duration: 250, easing: 'easeInOutBack'}); 165 } 166 // } 167 }); 168 169 /* Promo Attivazione */ 170 if (jQuery('#promo_footer').length) jQuery('#promo_footer').anystretch(jQuery('#promo_footer img.sel_attivazione').attr('src'), {speed: 320}); 171 if (jQuery('#mega_promo').length) jQuery('#mega_promo .fondale').anystretch(jQuery('#mega_promo img.sel_attivazione').attr('src'), {speed: 320}); 172 173 /* Mega promo */ 174 if (jQuery('#mega_promo').length) { 175 function chiudi_promo(){ 176 jQuery('html, body').scrollTop(0); 177 jQuery('#mega_promo').slideUp({duration: 250, easing: 'easeInOutBack'}); 178 jQuery('#barra_nav').removeClass('bloccata'); 179 } 180 jQuery('#barra_nav').addClass('bloccata'); 181 jQuery('#barra_nav .container').append('<a id="continua_nav" href="#">Continua la navigazione »</a>'); 182 jQuery('#barra_nav #continua_nav').click(function(e){ 183 chiudi_promo(); 184 }); 185 } 186 187 /* Mappa Italia */ 188 if (jQuery('#sel_regioni').length) { 189 function apri_reg_persone(codice) { 190 jQuery('.legata_mappa select option.testo_plc').remove(); 191 jQuery('.sb_persone .persone_regioni .regione').hide(0); 192 jQuery('.sb_persone .persone_regioni .'+codice).show(0); 193 } 194 function apri_reg_eventi(codice) { 195 jQuery('.legata_mappa select option.testo_plc').remove(); 196 jQuery('.sb_eventi .eventi_regioni .regione').hide(0); 197 jQuery('.sb_eventi .eventi_regioni .'+codice).show(0); 198 } 199 var attiva = jQuery('#sel_regioni').data('attiva'), 200 ripieno = '#50b39c', 201 tratto = '#e8e6da', 202 ripieno_hs = '#f04b38'; 203 var mappa_regioni = new jvm.WorldMap({ 204 map: 'it_merc_en', 205 container: jQuery('#sel_regioni'), 206 backgroundColor: 'transparent', 207 zoomOnScroll: false, 208 regionsSelectable: true, 209 regionsSelectableOne: true, 210 regionStyle: { 211 initial: { 212 fill: ripieno, 213 'fill-opacity': 1, 214 stroke: tratto, 215 'stroke-width': 3, 216 'stroke-opacity': 1 217 }, 218 hover: { 219 fill: ripieno_hs, 220 'fill-opacity': 1 221 }, 222 selected: { 223 fill: ripieno_hs 224 }, 225 selectedHover: { 226 } 227 },
228 onRegionSelected: function(e, codice, selezionata){ 229 if (selezionata) { 230 jQuery('.legata_mappa select option:selected').removeAttr('selected'); 231 jQuery('.legata_mappa select option[data-codice='+codice+']').attr('selected','selected'); 232 if (jQuery('#sidebar.sb_persone').length) apri_reg_persone(codice); 233 if (jQuery('#sidebar.sb_eventi').length) apri_reg_eventi(codice); 234 } 235 } 236 }); 237 if (typeof attiva != 'undefined') mappa_regioni.setSelectedRegions(attiva); 238 jQuery('.legata_mappa select').change(function(e){ 239 var select_r = jQuery(this); 240 mappa_regioni.clearSelectedRegions(); 241 if (select_r.val() != '') { 242 mappa_regioni.setSelectedRegions(select_r.find('option:selected').data('codice')); 243 } 244 var pos = jQuery('#sidebar').offset(); 245 if (pos) jQuery('body').animate({scrollTop: pos.top-15}, {duration: 250, easing: 'easeInOutBack', queue: false}); 246 }); 247 } 248 249 /* Azioni campagna */ 250 jQuery('#aderisci.blocco_azione').click(function(e){ 251 jQuery('#aderisci textarea#commento').bind('paste keydown blur', function(e){ 252 jQuery(this).val(function(i, val) { 253 return val.substr(0, 139); 254 }); 255 }); 256 }); 257 258 /* Barra ricerca */ 259 jQuery('form.modulo_ricerca input[type="submit"]').click(function(e){ 260 if (jQuery(this).parent().find('input[name="s"]').val() == '') { 261 e.preventDefault(); 262 return false; 263 } 264 }); 265 266 /* Validazione email */ 267 var mailok = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/; 268 jQuery('form').submit(function(e){ 269 var email = jQuery(this).find('input[type=email]'), 270 cap = jQuery(this).find('input#cap'), 271 errore = false; 272 if (email.length && !mailok.test(email.val())) { 273 email.val(''); 274 errore = true; 275 } 276 if (errore == true) { 277 e.preventDefault(); 278 return false; 279 } 280 }); 281 282 /* Scrolling animato */ 283 jQuery('a[href^="#"]').click(function(e){ 284 e.preventDefault(); 285 var pos = jQuery(this.hash).offset(); 286 if (pos) jQuery('body').animate({scrollTop: pos.top}, {duration: 500, easing: 'easeInOutBack', queue: false}); 287 }); 288 if (jQuery('div').hasClass('punto_partenza')) { 289 var altezza_target = jQuery('div.punto_partenza').first().offset().top; 290 jQuery('html,body').animate({scrollTop: altezza_target}, {duration: 1000, easing: 'easeInOutBack', queue: false}); 291 } 292 293 /* Mappa territori */ 294 if (jQuery('#mappa_territori').length) { 295 var mappa = null, 296 centro_lat = '41.8824865', 297 centro_lng = '12.5022608'; 298 function inizializza() { 299 var val_zoom = 10; 300 var opzioni_mappa = { 301 center: new google.maps.LatLng(centro_lat,centro_lng), 302 zoom: val_zoom, 303 minZoom: 5, 304 scrollwheel: true, 305 disableDefaultUI: true, 306 zoomControl: true, 307 streetViewControl: false, 308 zoomControlOptions: { 309 style: google.maps.ZoomControlStyle.SMALL, 310 position: google.maps.ControlPosition.TOP_LEFT 311 }, 312 mapTypeId: google.maps.MapTypeId.ROADMAP, 313 }; 314 mappa = new google.maps.Map(document.getElementById("mappa_canvas"), opzioni_mappa); 315 } 316 google.maps.event.addDomListener(window, 'load', inizializza); 317 google.maps.event.addDomListener(window, 'resize', function(e){ 318 var centratura = mappa.getCenter(); 319 google.maps.event.trigger(mappa,'resize'); 320 mappa.setCenter(centratura); 321 }); 322 } 323 324 /* Notizia completa */ 325 if (jQuery('.notizia_full #strumenti_mobile').length) { 326 jQuery('#strumenti_mobile').html(jQuery('ul.reazioni').clone()); 327 jQuery('.info_notizia').append('<span class="autore_mobile"> / <a href="'+jQuery('.strumenti .autore').attr('href')+'" class="archivio_autore">'+jQuery('.strumenti .autore span').html()+'</a></span>'); 328 } 329 330 /* Campagna */ 331 if (jQuery('#intro_campagne #reazioni_c_mobile').length) { 332 jQuery('#intro_campagne #reazioni_c_mobile').html(jQuery('ul.reazioni').clone()); 333 } 334 335 /* Sidebar archivi mobile */ 336 jQuery('.selettore_insieme .selettore').click(function(e){ 337 var filtri = jQuery('.selettore_insieme .insieme'); 338 if (filtri.is(':visible')) { filtri.slideUp({duration: 400, easing: 'easeInOutQuint'}); jQuery(this).removeClass('aperto'); } 339 else { filtri.slideDown({duration: 400, easing: 'easeInOutQuint'}); jQuery(this).addClass('aperto'); } 340 }); 341 342 /* Sidebar tesoreria */ 343 if (jQuery('#sidebar.sb_tesoreria').length) { 344 var bilanci = jQuery('#sidebar.sb_tesoreria ul li a'), 345 tesoreria_s = jQuery('#sidebar.sb_tesoreria .dd_bilanci select'),
346 corpo_s = tesoreria_s.html(); 347 bilanci.each(function(e){ 348 corpo_s += '<option value="'+jQuery(this).attr('href')+'">'+jQuery(this).html()+'</option>'; 349 }); 350 tesoreria_s.html(corpo_s); 351 } 352 353 /* Blocchi touch scorrevoli */ 354 if (jQuery('#sidebar_slide').length) { 355 if (jQuery('#sidebar_slide.sbs_campagne').length) { 356 jQuery('#sidebar_slide .iosslider').html(jQuery('#sidebar.sb_campagne ul.lista_campagne').clone()); 357 } 358 if (jQuery('#sidebar_slide .strillo_fisso').length) { 359 jQuery('#sidebar_slide .strillo_fisso .slider').html(jQuery('#sidebar #strilli').html()); 360 } 361// jQuery('#sidebar_slide .iosslider').addClass('pronto'); 362// if (stato < 900 && jQuery('#sidebar_slide .iosslider').css('-webkit-perspective') != '1000px') 363 attiva_slider(); 364 jQuery('#sidebar_slide .iosslider').mouseenter(function(e){ 365 jQuery('#sidebar_slide .iosslider').iosSlider('autoSlidePause'); 366 }); 367 jQuery('#sidebar_slide .iosslider').mouseleave(function(e){ 368 jQuery('#sidebar_slide .iosslider').iosSlider('autoSlidePlay'); 369 }); 370 } 371 372 /* Mini-sidebar fissa */ 373 if (jQuery('#sidebar').hasClass('sb_fstd') || jQuery('#sidebar_slide .strillo_fisso').length || jQuery('#sidebar.sb_campagne').length || jQuery('#sidebar.sb_europee').length) { 374 jQuery(window).scroll(function(e){ 375 posiziona_bf(); 376 }); 377 } 378 379 /* Filtro Download */ 380 if (jQuery('#sidebar').hasClass('sb_download')) { 381 function dl_filtra(uso) { 382 jQuery('.sb_download ul li#'+uso).addClass('attivo'); 383 jQuery('.dd_utilizzi select option[value="'+uso+'"]').attr('selected','selected'); 384 jQuery('#attrezzi .materiale').hide(0); 385 jQuery('#attrezzi .materiale.'+uso).show(0); 386 jQuery('html, body').animate({scrollTop: 0}, {duration: 250, easing: 'easeInOutBack', queue: false}); 387 } 388 function dl_reset() { 389 jQuery('#attrezzi .materiale').show(0); 390 jQuery('.sb_download ul li#filtro_tutti').addClass('attivo'); 391 } 392 jQuery('.sb_download ul li a').click(function(e){ 393 e.preventDefault(); 394 if (!jQuery(this).hasClass('attivo')) { 395 jQuery('.sb_download ul li.attivo').removeClass('attivo'); 396 jQuery('.dd_utilizzi select option:selected').removeAttr('selected'); 397 if (jQuery(this).parent().attr('id') == 'filtro_tutti') dl_reset(); 398 else dl_filtra(jQuery(this).parent().attr('id')); 399 } 400 }); 401 jQuery('.dd_utilizzi select').change(function(e){ 402 jQuery('.sb_download ul li.attivo').removeClass('attivo'); 403 if (jQuery(this).val() == 'filtro_tutti') dl_reset(); 404 else dl_filtra(jQuery(this).val()); 405 }); 406 } 407 408 /* Monitoraggio eventi */ 409 var filetypes = /\.(zip|exe|dmg|pdf|doc.*|xls.*|ppt.*|mp3|ods|txt|rar|wma|mov|avi|wmv|flv|wav)$/i; 410 var baseHref = ''; 411 if (jQuery('base').attr('href') != undefined) baseHref = jQuery('base').attr('href'); 412 jQuery('a').on('click', function(event) { 413 var el = jQuery(this); 414 var track = true; 415 var href = (typeof(el.attr('href')) != 'undefined' ) ? el.attr('href') : ""; 416 var link_interno = href.match(document.domain.split('.').reverse()[1] + '.' + document.domain.split('.').reverse()[0]); 417 if (!href.match(/^javascript:/i)) { 418 var elEv = []; elEv.value=0, elEv.non_i=false; 419 if (href.match(/^mailto\:/i)) { 420 elEv.category = "email"; 421 elEv.action = "click"; 422 elEv.label = href.replace(/^mailto\:/i, ''); 423 elEv.loc = href; 424 } 425 else if (href.match(filetypes)) { 426 var extension = (/[.]/.exec(href)) ? /[^.]+$/.exec(href) : undefined; 427 elEv.category = "download"; 428 elEv.action = "click-" + extension[0]; 429 elEv.label = href.replace(/ /g,"-"); 430 elEv.loc = baseHref + href; 431 } 432 else if (href.match(/^https?\:/i) && !link_interno) { 433 elEv.category = "link"; 434 elEv.action = "click"; 435 elEv.label = href.replace(/^https?\:\/\//i, ''); 436 elEv.non_i = true; 437 elEv.loc = href; 438 } 439 else track = false; 440 if (track) { 441 _gaq.push(['_trackEvent', elEv.category.toLowerCase(), elEv.action.toLowerCase(), elEv.label.toLowerCase(), elEv.value, elEv.non_i]); 442 if ( el.attr('target') == undefined || el.attr('target').toLowerCase() != '_blank') { 443 setTimeout(function() { location.href = elEv.loc; }, 400); 444 return false;
445 } 446 } 447 } 448 }); 449 450});
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.