$(document).ready(function($){ if($('#ev_d_de').length > 0 && $('#ev_d_a').length > 0){ function formatFrench(id){ var index; var d_namesFr = ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"]; var d_namesEn = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var m_namesFr = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"]; var m_namesEn = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; for (index = 0; index < d_namesEn.length; ++index) {/*Jour*/ var dateBrut = $(id).html(); dateBrut = dateBrut.replace(d_namesEn[index], d_namesFr[index]); $(id).html(dateBrut); }; for (index = 0; index < m_namesEn.length; ++index) {/*Mois*/ var dateBrut = $(id).html(); dateBrut = dateBrut.replace(m_namesEn[index], m_namesFr[index]); $(id).html(dateBrut); }; }; function formatCustomDate(id){ //var outFormatFr = 'DD, d MM, yy'; //out : Lundi, 2 Octobre, 2012 //var outFormatEn = 'DD, MM d, yy'; //out : Tuesday, October 2, 2012 var outFormatFr = 'd MM, yy'; //out : Octobre, 2012 var outFormatEn = 'MM d, yy'; //out : October 2, 2012 var parseDateFormat = 'dd/mm/yy'; if(mondoInPageApi.currentLocale == 'fr'){ var dateRebuild = $.datepicker.formatDate(outFormatFr, $.datepicker.parseDate(parseDateFormat, $(id).html())); $(id).html(dateRebuild); formatFrench(id); }else { var dateRebuild = $.datepicker.formatDate(outFormatEn, $.datepicker.parseDate(parseDateFormat, $(id).html())); $(id).html(dateRebuild); }; }; if($('#ev_d_de').html().length > 0){formatCustomDate('#ev_d_de');}; if($('#ev_d_a').html().length > 0){formatCustomDate('#ev_d_a');}; var fullDate = $('#ev_d_de').html(); if($('#ev_d_a').html().length > 0){fullDate = 'Du ' + fullDate + ' au ' + $('#ev_d_a').html()}; var heure = ""; $('#ev_detail_right_date').html(fullDate + heure); if($('.event-tab-button').length < 0 ){ $('.event-tab-button').click(function(){ if(!$(this).hasClass('button-active')){ var id = $(this).attr('data-name'); $('.secondTabContent').each(function(){ $(this).hide(); }); $('.event-tab-button').removeClass('button-active'); $('.secondTabContent').hide(); $(this).addClass('button-active'); $(id).show(); } }); $('.event-tab-button').first().click(); } } });