1// Javascript principal 2 3// ---------------------------------------------------------------------------------------------------- // 4// Site 5// ---------------------------------------------------------------------------------------------------- // 6$().ready(function(){ 7 // Au chargement initial 8 $(window).load(function(){ 9 redimensionnement(); 10 }); 11 // En cas de redimensionnement de la fenetre 12 $(window).resize(function(){ 13 redimensionnement(); 14 }); 15 // Boutons images 16 $('img.bt').mouseover(function(){ 17 $(this).stop().fadeTo(350,0.6); 18 }); 19 $('img.bt').mouseout(function(){ 20 $(this).stop().fadeTo(350,1); 21 }); 22 // Effets hover slide 23 if($('.bt_slideup').length) { 24 // Preload 25 $('.bt_slideup').each(function(index, element) { 26 // Nom de l'image 27 $nom_image = $(element).attr('src'); 28 $extension = $nom_image.substr($nom_image.lastIndexOf('.')); 29 $nom_hover = $nom_image.substr(0, $nom_image.lastIndexOf('.')) + '-hover' + $extension; 30 $(element).parent('a').append('<img src="' + $nom_hover + '" class="bt_slideup_hidden">'); 31 $('.bt_slideup_hidden').hide(); 32 }); 33 // Hover 34 $('.bt_slideup').parent('a').mouseenter(function(){ 35 $(this).find('img').hide(); 36 $(this).find('.bt_slideup_hidden').show(); 37 }); 38 $('.bt_slideup').parent('a').mouseleave(function(){ 39 $(this).find('img').show(); 40 $(this).find('.bt_slideup_hidden').hide(); 41 }); 42 } 43 44 45 // ---------------------------------------------------------------------------------------------------- // 46 // Slider partenaires 47 // ---------------------------------------------------------------------------------------------------- // 48 $('#slider_partenaires').slick({ 49 autoplay: true, 50 autoplaySpeed: 3000, 51 slidesToShow: 1, 52 slidesToScroll: 1, 53 arrows: false, 54 }) 55 56}); 57 58// ---------------------------------------------------------------------------------------------------- // 59// Mouseover avec un délai 60// ---------------------------------------------------------------------------------------------------- // 61(function($) { 62 $.fn.delayedMouseover = function(callback, options) { 63 64 var options = $.extend({ delay: 1000 }, options); 65 66 return this.each(function() { 67 var obj = $(this); 68 var timer = false; 69 obj.mouseover( function(event) { 70 if(timer) clearTimeout(timer); 71 timer = setTimeout( function() { callback.apply(obj[0], [event]); }, options.delay ); 72 }); 73 obj.mouseout( function(event) { 74 if(timer) clearTimeout(timer); 75 timer = false; 76 }); 77 }); 78 }; 79 80})(jQuery); 81 82// ---------------------------------------------------------------------------------------------------- // 83// Redimensionnement 84// ---------------------------------------------------------------------------------------------------- // 85function redimensionnement() { 86 // Colonnes 87 var hauteur = $('#contenu').height(); 88 if($('#contenu_centre').length > 0) $('#contenu_centre').css('min-height', hauteur + "px"); 89 if($('.colonne_gauche').length > 0) $('.colonne_gauche').css('height', hauteur + "px"); 90 if($('.colonne_droite').length > 0) $('.colonne_droite').css('height', hauteur + "px"); 91} 92 93function redimImage(image, position){ 94 95 var $image = image; 96 var image_width = $image.width(); 97 var image_height = $image.height(); 98 99 var over = image_width / image_height; 100 var under = image_height / image_width; 101 102 var parent_width = $(image).parent('div').width(); 103 var parent_height = $(image).parent('div').height(); 104 105 if(parent_width / parent_height >= over) { 106 $image.css({ 107 'width': parent_width + 'px', 108 'height': Math.round(under * parent_width) + 'px', 109 'left': '0px' 110 }); 111 } else { 112 $image.css({ 113 'width': Math.round(over * parent_height) + 'px', 114 'height': parent_height + 'px', 115 'left': Math.abs((over * parent_height) - parent_width) / -2 + 'px' 116 }); 117 } 118 119 if(position == "bottom") $image.css({'bottom':'0px'}); 120 else $image.css({'top':'0px'}); 121 122} 123 124// ---------------------------------------------------------------------------------------------------- // 125// Facebook 126// ---------------------------------------------------------------------------------------------------- // 127function fbs_click() { 128 u = location.href; 129 t = document.title; 130 window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=700,height=500'); 131 return false; 132} 133 134// ---------------------------------------------------------------------------------------------------- // 135// Ecriture des adresses E-mail (anti-spam) 136// ---------------------------------------------------------------------------------------------------- // 137$().ready(function(e) { 138 if($('.email').length > 0) { 139 $('.email').each(function() { 140 email = $(this).attr('id').substr($(this).attr('id').indexOf('_', 1)+1); 141 email = email.split("@"); 142 if(email[0] != undefined && email[1] != undefined) $(this).html('<a href="mailto: ' + email[0] + '@' + email[1] + '" title="">' + email[0] + '@' + email[1] + '</a>'); 143 }); 144 } 145}); 146 147// ---------------------------------------------------------------------------------------------------- // 148// Effacement du champ input 149// ---------------------------------------------------------------------------------------------------- // 150function clearInput(texte, champ) { 151 if($(champ).val() == texte) $(champ).val(''); 152} 153 154// ---------------------------------------------------------------------------------------------------- // 155// Envoi de formulaire 156// ---------------------------------------------------------------------------------------------------- // 157// Support de l'attribut required 158var supportsRequired = 'required' in document.createElement('input') 159if(supportsRequired) var required = true; 160else var required = false; 161 162$().ready(function(e) { 163 // Envoi du formulaire en ajax 164 if($('.form').length > 0) { 165 $('.form').ajaxForm({ 166 beforeSubmit:validate, 167 success:retourForm, 168 }); 169 } 170}); 171 172// Validation 173function validate(formData, jqForm, options) { 174 var form = jqForm[0]; 175 var erreur = false; 176 $(formData).each(function(i,e) { 177 if(e.required == "required" && e.value == '') erreur = true; 178 }); 179 if(erreur && !required) alert($('#erreur_champs').html()); 180} 181 182// Retour du formulaire 183function retourForm(data) { 184 // Erreurs 185 if(data != "" && data.indexOf("#") != -1) { 186 erreurs = data.split('#'); 187 var erreurs_aff = ""; 188 $.each(erreurs, function(i, element){ 189 // Séparation des valeurs et des noms des champs 190 tab_element = element.split('|'); 191 if(tab_element[0] != "") erreurs_aff += '<li>' + tab_element[0] + '</li>'; 192 // Mise en évidence des champs en erreurs 193 $("input[name='" + tab_element[1] + "'], select[name='" + tab_element[1] + "']").removeClass(); 194 $("input[name='" + tab_element[1] + "'], select[name='" + tab_element[1] + "']").addClass('form_erreur'); 195 196 }); 197 $('.txt_erreur').fadeIn(); 198 $('.txt_erreur').find("ul").html(erreurs_aff); 199 $('.txt_erreur').offset({ 200 top:$('.form input[type="submit"]').offset().top + $('.txt_erreur').height(), 201 left:$('#contenu').offset().left + $('#contenu').css('padding-left'), 202 }); 203 $('.txt_erreur').delay(5000).fadeOut(); 204 } else { 205 $('.form').hide(); 206 $('#txt_confirm').fadeIn(); 207 } 208} 209 210// ---------------------------------------------------------------------------------------------------- // 211// Menu du haut 212// ---------------------------------------------------------------------------------------------------- // 213$().ready(function() { 214 215 // Afficher le menu mobile 216 $('.affiche-menu').click(function(){ 217 $('menu').slideToggle(); 218 }); 219 220 // Si la largeur de la fenêtre est supérieure à 959px 221 if($(window).width() > 959) { 222 223 // On cache le menu mobile 224 $('.affiche-menu').hide; 225 226 // Niveau 1 227 $('menu ul.m_cat_1 > li > a').mouseenter(function(e){
228 $('menu ul.m_cat_1 > li > a').removeClass('m_cat_1_sel'); 229 $(this).addClass('m_cat_1_sel'); 230 }); 231 $('menu').mouseleave(function(e){ 232 $('menu ul.m_cat_1 > li > a').removeClass('m_cat_1_sel'); 233 }); 234 $('menu ul.m_cat_1').children('li.expanded').children('a').mouseenter(function(e){ 235 $sous_menu = $(this).parent('li').find('ul.m_cat_2'); 236 $sous_menu.show(); 237 // Calcul du padding en fonction de la largeur de l'écran 238 padding = ($(window).width() - $('.c_fixe').width()) / 2; 239 $sous_menu.css({ 240 'padding-left':padding +'px', 241 'padding-right':padding +'px', 242 'width':$('menu').width() - (padding * 2) 243 }); 244 $sous_menu.offset({left:$('menu').offset().left}); 245 }); 246 $('menu ul.m_cat_1').children('li.expanded').mouseleave(function(){ 247 $sous_menu = $(this).find('ul.m_cat_2'); 248 $sous_menu.hide(); 249 }); 250 251 } 252 // Si la largeur de l'écran est inférieure ou égale à 959px 253 else { 254 255 // On affiche le menu mobile 256 $('.affiche-menu').show(); 257 258 // Sous-menu 259 $('menu ul').on('click', 'li.expanded a, li.expanded span', function(e){ 260 e.stopPropagation(); 261 // Elements 262 $menu_parent = $(this).parent('li'); 263 if($menu_parent.length == 0) $menu_parent = $(this).parent().parent('li'); 264 $sous_menu_1 = $menu_parent.children('ul'); 265 // Affichage 266 if($menu_parent.hasClass("active")) { 267 $sous_menu_1.slideUp(); 268 } else { 269 $sous_menu_1.slideDown(); 270 } 271 $menu_parent.toggleClass("active"); 272 }); 273 } 274}); 275 276// ---------------------------------------------------------------------------------------------------- // 277// Carte de France 278// ---------------------------------------------------------------------------------------------------- // 279$().ready(function(e) { 280 $('#carte_france').vectorMap({ 281 map:'france_fr', 282 hoverOpacity: 0.5, 283 hoverColor:"#EA6118", 284 backgroundColor:"none", 285 color:"#0882ec", 286 borderColor:"#0777d8", 287 selectedColor:"#EA6118", 288 enableZoom:false, 289 showTooltip:true, 290 showLabels:true, 291 onRegionClick: function(element, code, region) { 292 window.location.href = "/carte-france.html?comite=" + code + "&vmap=1"; 293 } 294 }); 295}); 296 297// ---------------------------------------------------------------------------------------------------- // 298// Galerie photos 299// ---------------------------------------------------------------------------------------------------- // 300/*function affichePhoto(galerie, type) { 301 var num = eval("galerie_photos_num_" + galerie); 302 var nb = eval("galerie_photos_nb_" + galerie); 303 if(type == "plus") { 304 num = num + 1; 305 if(num > nb) num = 1; 306 } else if(type == "moins") { 307 num = num - 1; 308 if(num < 1) num = nb; 309 } 310 eval("galerie_photos_num_" + galerie + " = " + num); 311 $('#encart_galerie_photos .photo').hide(); 312 $('#encart_galerie_photos .photo:nth-child(' + num + ')').show(); 313}*/ 314 315// ---------------------------------------------------------------------------------------------------- // 316// Scroll sur l'accueil 317// ---------------------------------------------------------------------------------------------------- // 318if(!mobile) { 319 $().ready(function() { 320 // Initialisation 321 var controller = $.superscrollorama({ 322 triggerAtCenter: false, 323 playoutAnimations: true 324 }); 325 326 controller.addTween(50, TweenMax.to($('#logo_haut img'), 0.2, {css:{width:150}})); 327 controller.addTween(50, TweenMax.to($('header'), 0.1, {css:{height:50}})); 328 controller.addTween(50, TweenMax.to($('#rs_haut'), 0.2, {css:{top:15,left:200}})); 329 controller.addTween(50, TweenMax.to($('#titre_site'), 0.2, {css:{top:20,left:360}})); 330 }); 331} 332 333// ---------------------------------------------------------------------------------------------------- // 334// Colorbox 335// ---------------------------------------------------------------------------------------------------- // 336$().ready(function() { 337 if($('.colorbox').length) { 338 $('.colorbox').colorbox({ 339 rel:"group1", 340 current:'photo {current} sur {total}', 341 }); 342 } 343}); 344 345// ---------------------------------------------------------------------------------------------------- // 346// Cookies 347// ---------------------------------------------------------------------------------------------------- // 348function messageCookies(param) { 349 if(param == "1") { 350 $('#msg_cookies').hide(); 351 $.ajax({
352 url:'/global/includes/ajax/message-cookies.php', 353 data:{action:'validation-cookies'}, 354 type:"POST", 355 success: function(data) { 356 } 357 }); 358 } 359} 360 361// ---------------------------------------------------------------------------------------------------- // 362// Lien vers les mois suivants ou précédents 363// ---------------------------------------------------------------------------------------------------- // 364function lienMoisEvenement(date, calendrier, full, specialite, recherche) { 365 $.ajax({ 366 url:'/global/includes/ajax/functions.php', 367 data:{action:'maj-calendrier', date:date, specialite:specialite, full:full, recherche:recherche}, 368 type:"POST", 369 success: function(data) { 370 $(calendrier).parents('.calendrier').html(data); 371 } 372 }); 373} 374 375// ---------------------------------------------------------------------------------------------------- // 376// Sélection d'un licencié 377// ---------------------------------------------------------------------------------------------------- // 378function selectLicencie(mois, calendrier) { 379 licence = $('input[name="licence"]').val(); 380 381 $.ajax({ 382 url:'/global/includes/ajax/select-licencie.php', 383 data:{licence:licence}, 384 type:"POST", 385 success: function(data) { 386 if(data != "") $('#nom_licencie').html(data); 387 else alert("Ce numéro de licence est inconnu"); 388 } 389 }); 390} 391 392// ---------------------------------------------------------------------------------------------------- // 393// Popup 394// ---------------------------------------------------------------------------------------------------- // 395$().ready(function(e) { 396 if($('.lien_popup').length) { 397 $('.lien_popup').click(function(){ 398 id = $(this).attr('id').substr($(this).attr('id').lastIndexOf("_")+1); 399 var content = $('#popup_' + id).html(); 400 401 $(this).colorbox({ 402 html:content, 403 opacity:0.20, 404 width:400, 405 height:400 406 }); 407 }); 408 } 409}); 410 411// ---------------------------------------------------------------------------------------------------- // 412// Sélection de tags enfants 413// ---------------------------------------------------------------------------------------------------- // 414function selectTagsEnfants(selectItem, champ, specialite, discipline) { 415 id_tag = $(selectItem).val(); 416 417 $.ajax({ 418 url:'/global/includes/ajax/functions.php', 419 data:{id_tag:id_tag,specialite:specialite,discipline:discipline,action:'select-tags-enfants'}, 420 type:"POST", 421 success: function(data) { 422 // On supprime les éléments actuels 423 $(champ).find('option:not(:first)').remove(); 424 if(data != '') { 425 $(champ).removeAttr('disabled'); 426 $(champ).removeClass('disabled'); 427 $(data).insertAfter($(champ).find('option').first()); 428 } else { 429 $(champ).attr('disabled', true); 430 $(champ).addClass('disabled'); 431 } 432 } 433 }); 434} 435 436// ---------------------------------------------------------------------------------------------------- // 437// Calendrier 438// ---------------------------------------------------------------------------------------------------- // 439$().ready(function() { 440 initDatepicker(); 441}); 442function initDatepicker() { 443 if($(".datepicker").length > 0) { 444 $(".datepicker").datepicker({ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], dateFormat: 'dd-mm-yy', monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Decembre'], currentText: 'Date du jour', closeText: 'OK', firstDay:1}); 445 } 446 if($(".datepicker_select").length > 0) { 447 $(".datepicker_select").datepicker({ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], dateFormat: 'dd-mm-yy', monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Decembre'], monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', 'Jul','Aou','Sep','Oct','Nov','Déc'], currentText: 'Date du jour', closeText: 'OK', changeMonth: true, changeYear: true, yearRange: yearD + ':' + yearF, firstDay:1}); 448 } 449 if($(".datepicker_time").length > 0) { 450 $(".datepicker_time").datetimepicker({ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], dateFormat: 'dd-mm-yy', monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','N
450ovembre','Decembre'], showSecond:false, timeFormat:'HH:mm', currentText:'Date du jour', closeText:'OK', firstDay:1}); 451 } 452 if($(".datepicker_time_qh").length > 0) { 453 $(".datepicker_time_qh").datetimepicker({ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], dateFormat: 'dd-mm-yy', monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Decembre'], showSecond:false, timeFormat:'HH:mm', currentText:'Date du jour', closeText:'OK', firstDay:1, hourMin:10, hourMax:21, stepMinute:15}); 454 } 455 if($(".timepicker").length > 0) { 456 $(".timepicker").timepicker({currentText:'Heure actuelle', showSecond:false, timeFormat:'HH:mm', timeOnlyTitle:'Choix de l\'heure', closeText:'OK', timeText:'', hourText:'Heure', minuteText:'Minute'}); 457 } 458 if($(".monthpicker").length > 0) { 459 $('.monthpicker').datepicker({changeMonth: true, changeYear: true, showButtonPanel: true, dateFormat: 'dd-mm-yy', monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', 'Jul','Aou','Sep','Oct','Nov','Déc'], monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Decembre'], closeText: "Valider", currentText: "Date du jour"}).focus(function() { 460 var thisCalendar = $(this); 461 $('.ui-datepicker-calendar').detach(); 462 $('.ui-datepicker-close').click(function() { 463 var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val(); 464 var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val(); 465 thisCalendar.datepicker('setDate', new Date(year, month, 1)); 466 }); 467 }); 468 } 469} 470function afficheCalendrier(calendrier) { 471 $("#" + calendrier).datepicker( 'show' ); 472} 473 474$().ready(function() { 475 if($(window).width() > 959){ 476 $('evenement_num_jour').click(function(){ 477 $(this).children('.evenements_jour').appendTo('.encart_05'); 478 $(this).children('.evenements_jour').show(); 479 }); 480 } 481 482 483 484}); 485 486// ---------------------------------------------------------------------------------------------------- // 487// Suite d'une recherche 488// ---------------------------------------------------------------------------------------------------- // 489function afficheSuiteRecherche(recherche, type) { 490 // Loader 491 $('#' + type).find('.liste_suite').html('<div class="center"><img src="/global/img/bg/loader.gif" style="height:30px;"></div>'); 492 493 $.ajax({ 494 url:'/global/includes/ajax/functions.php', 495 data:{recherche:recherche,type:type,action:'affiche-suite-recherche'}, 496 type:"POST", 497 success: function(data) { 498 $('#' + type).html(data); 499 } 500 }); 501} 502 503// ---------------------------------------------------------------------------------------------------- // 504// Chargement des comités d'une ligue 505// ---------------------------------------------------------------------------------------------------- // 506function selectComites(id_ligue) { 507 $.ajax({ 508 url:'/global/includes/ajax/functions.php', 509 data:{ligue:id_ligue,action:'select-comites'}, 510 type:"POST", 511 success:function(data) { 512 // On supprime les éléments actuels 513 $('#comites').find('option:not(:first)').remove(); 514 515 if(data != '') { 516 $('#comites').removeAttr('disabled'); 517 $('#comites').removeClass('disabled'); 518 $(data).insertAfter($('#comites').find('option').first()); 519 } else { 520 $('#comites').attr('disabled', true); 521 $('#comites').addClass('disabled'); 522 } 523 } 524 }); 525}
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.