1!function(a){a.fn.datepicker.dates.fr={days:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],daysShort:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],daysMin:["DIM","LUN","MAR","MER","JEU","VEN","SAM"],months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],monthsShort:["janv.","févr.","mars","avril","mai","juin","juil.","août","sept.","oct.","nov.","déc."],today:"Aujourd'hui",monthsTitle:"Mois",clear:"Effacer",weekStart:1,format:"dd/mm/yyyy"}}(jQuery); 2(function($){ 3 $(document).ready(function(){ 4 var datepicker = null; 5 var datas = null; 6 var cities = new Array(); 7 var current_city = ""; 8 var init_search = false; 9 var old_search = ""; 10 11 // Ãchappe les caractères HTML pour empêcher toute injection (XSS) 12 // lorsqu'une valeur saisie par l'utilisateur est insérée dans le DOM. 13 function escapeHtml(value) { 14 return $('<div>').text(value == null ? '' : value).html(); 15 } 16 17 18 $( "#input_commune" ).keyup(function() { 19 if(old_search != $(this).val()) 20 $('.input_calendar').removeClass('reset'); 21 if($(this).val().length == 0) { 22 $('.input_calendar').removeClass('reset'); 23 } 24 }); 25 26 function sort_datas() { 27 var new_tab = new Array(); 28 29 $.each( datas, function( nom_commune, communes ){ 30 cities.push(nom_commune); 31 $.each( communes, function( index, commune ){ 32 var infos = new Array(); 33 infos['commune'] = nom_commune; 34 infos['date'] = commune.date; 35 infos['titre'] = commune.titre; 36 infos['adresse_1'] = commune.adresse_1; 37 infos['adresse_2'] = commune.adresse_2; 38 infos['horaires'] = commune.horaires; 39 if(new_tab[commune.date] == undefined) 40 new_tab[commune.date] = new Array(); 41 new_tab[commune.date].push(infos); 42 }); 43 }); 44 datas = new_tab; 45 } 46 function getDaysInMonth(month, year) { 47 var date = new Date(year, month, 1); 48 var days = []; 49 while (date.getMonth() === month) { 50 days.push(new Date(date)); 51 date.setDate(date.getDate() + 1); 52 } 53 return days; 54 } 55 56 function fill_infos(tab, day, month, reset_data, date) { 57 if(reset_data !== false) { 58 $('#infos_dates').html(""); 59 $('.calendar_items_mobile').html(""); 60 } 61 var month_fr = ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jui', 'Jui', 'Aou', 'Sep', 'Oct', 'Nov', 'Dec'] 62 var today = new Date(); 63 64 $.each( tab, function( key, val ){ 65 var new_item = $('#clone_template').clone(); 66 new_item.removeAttr('id'); 67 new_item.find('.day').html(day+'<span>'+month_fr[month]+'</span>') 68 new_item.find('.titre').html(val.titre) 69 new_item.find('.commune').html(val.commune) 70 new_item.find('.adresse_1').html(val.adresse_1) 71 new_item.find('.adresse_2').html(val.adresse_2) 72 new_item.find('.horaires').html(val.horaires) 73 74 if (today <= date || init_search === true) { 75 new_item.appendTo('#infos_dates'); 76 new_item.appendTo('.calendar_items_mobile'); 77 } 78 79 80 }); 81 } 82 83 function setDates(date) { 84 var day = ('0' + (date.getDate())).slice(-2); 85 var monthIndex = ('0' + (date.getMonth()+1)).slice(-2); 86 var year = date.getFullYear(); 87 var obj_return = new Object(); 88 var current_date = year+'-'+monthIndex+'-'+day; 89 var today = new Date(); 90 91 92 // console.log(datas[current_date]) 93 94 if(datas[current_date] != undefined) { 95 if(current_city != "") { 96 $.each( datas[current_date], function( key, val ){ 97 if(val.commune.toLowerCase() == current_city.toLowerCase()) { 98 fill_infos(datas[current_date], day, date.getMonth(), false, date) 99 return obj_return = { enabled : true, classes:"has_dates"} 100 } 101 }); 102 } 103 else { 104 105 if (today <= date) { 106 console.log(date) 107 obj_return = { enabled : true, classes:"has_dates"} 108 fill_infos(datas[current_date], day, date.getMonth(), false, date) 109 } else { 110 obj_return = {enabled: true, classes: 'last_date'} 111 fill_infos(datas[current_date], day, date.getMonth(), false, date) 112 } 113 114 } 115 } 116 else { 117 obj_return = { enabled : false, classes:""} 118 } 119 120 return obj_return; 121 } 122 123 function remove_old_days(show_reset) { 124 init_search = true; 125 old_search = $('#input_commune').val(); 126 if ($('#input_commune').val().length > 0 && show_reset != "reset") { 127 $('.input_calendar').addClass('reset'); 128 } 129 130 var error_msg = '<p class="no_results">Aucune visite nâest prévue sur la commune de '+escapeHtml($('#input_commune').val())+' prochainement</p>'; 131 if($('#infos_dates .item_calendar').length <= 0) { 132 $('#infos_dates').html(error_msg); 133 134 } 135 if($('.calendar_items_mobile .item_calendar').length <= 0) { 136 $('.calendar_items_mobile').html(error_msg); 137 } 138 var x = $('#datepicker .old.day'); 139 if(x.length === 7){ 140 x.hide(); 141 x.addClass("hide"); 142 } 143 new SimpleBar($('#infos_dates')[0]); 144 } 145 function get_visites() { 146 jQuery.post( 147 ajaxurl, 148 { 149 'action': 'get_visites', 150 }, 151 function(json){ 152 datas = JSON.parse(json); 153 sort_datas(); 154 $('#datepicker').datepicker({ 155 dateFormat: "dd/mm/yy", 156 maxViewMode: 0, 157 language: 'fr', 158 beforeShowDay: setDates, 159 firstDay: 1 160 }) 161 remove_old_days(); 162 } 163 ); 164 } 165 if($("#tpl_ella").length > 0) { 166 get_visites(); 167 $('#input_commune').autocomplete({ 168 source : cities, 169 select : function(event, ui){ // lors de la sélection d'une proposition 170 current_city = ui.item.label; 171 } 172 }); 173 $('.filter_communes_mobile').on('click',function(){ 174 $('.mobile_calendar .content > div').each(function(){ 175 $(this).removeClass('active'); 176 }) 177 $('.mobile_calendar .tabs > div').each(function(){ 178 $(this).removeClass('active'); 179 }) 180 181 $('.calendar_items_mobile').addClass('active'); 182 $('.mobile_calendar').removeClass('blue_bg'); 183 }) 184 185 function setSearch() { 186 $('#infos_dates').html(""); 187 current_city = $('#input_commune').val(); 188 189 $('.calendar_items_mobile').html(""); 190 $('#datepicker').datepicker('destroy').datepicker({ 191 dateFormat: "dd/mm/yy", 192 maxViewMode: 0, 193 language: 'fr', 194 beforeShowDay: setDates, 195 firstDay: 1 196 }); 197 $('.mobile_calendar .content > div').each(function(){ 198 $(this).removeClass('active'); 199 }) 200 $('.mobile_calendar .tabs > div').each(function(){ 201 $(this).removeClass('active'); 202 }) 203 204 $('.calendar_items_mobile').addClass('active'); 205 $('.mobile_calendar').removeClass('blue_bg'); 206 remove_old_days(); 207 } 208 function resetSearch() { 209 $('#infos_dates').html(""); 210 current_city = ""; 211 $('.calendar_items_mobile').html(""); 212 $('#datepicker').datepicker('destroy').datepicker({ 213 dateFormat: "dd/mm/yy", 214 maxViewMode: 0, 215 language: 'fr', 216 beforeShowDay: setDates, 217 firstDay: 1 218 }); 219 $('.mobile_calendar .content > div').each(function(){ 220 $(this).removeClass('active'); 221 }) 222 $('.mobile_calendar .tabs > div').each(function(){ 223 $(this).removeClass('active'); 224 }) 225 226 $('.calendar_items_mobile').addClass('active'); 227 $('.mobile_calendar').removeClass('blue_bg'); 228 remove_old_days("reset"); 229 } 230 231 $('#input_commune').bind("enterKey",function(e){ 232 setSearch(); 233 }); 234 $('#input_commune').keyup(function(e){ 235 if(e.keyCode == 13) 236 { 237 setSearch(); 238 } 239 }); 240 241 $('#set_filter, .trigger_search').on('click',function(){ 242 if($( '.input_calendar' ).hasClass( "reset" )) { 243 $('.input_calendar').removeClass('reset'); 244 resetSearch(); 245 } 246 else { 247 setSearch(); 248 } 249 250 }) 251 252 253 $(document).on('changeMonth','#datepicker', function(e) { 254 $('#infos_dates').html(""); 255 $('.calendar_items_mobile').html(""); 256 setTimeout(function(){remove_old_days();},10) 257 }); 258 259 $('.communes_trigger').click(function() 260 { 261 262 $('.mobile_calendar .tabs > div').each(function(){ 263 $(this).removeClass('active'); 264 }) 265 $('.mobile_calendar .content > div').each(function(){ 266 $(this).removeClass('active'); 267 }) 268 $(this).toggleClass('active'); 269 $('.content_communes').addClass('active'); 270 $('.mobile_calendar').addClass('blue_bg'); 271 }); 272 $('.date_trigger').click(function() 273 { 274 275 $('.mobile_calendar .tabs > div').each(function(){ 276 $(this).removeClass('active'); 277 }) 278 $('.mobile_calendar .content > div').each(function(){ 279 $(this).removeClass('active'); 280 }) 281 $(this).toggleClass('active'); 282 $('.content_date').addClass('active'); 283 $('.mobile_calendar').addClass('blue_bg'); 284 }) 285 $('.btn_trigger_calendar').click(function(){ 286 $('html').addClass('fixed'); 287 $('.mobile_calendar').toggleClass('isActive'); 288 }); 289 $('.close_calendar').click(function(){ 290 $('html').removeClass('fixed'); 291 $('.mobile_calendar').removeClass('isActive'); 292 }); 293 294 295 $(document).on('changeDate','#datepicker', function(e) { 296 var date = e.date; 297 var day = ('0' + (date.getDate())).slice(-2); 298 var monthIndex = ('0' + (date.getMonth()+1)).slice(-2); 299 var year = date.getFullYear(); 300 var current_date = year+'-'+monthIndex+'-'+day; 301 302 remove_old_days(); 303 304 if(datas[current_date] != undefined) { 305 fill_infos(datas[current_date], day, date.getMonth(), true, date) 306 } 307 }); 308 } 309 }); 310})(jQuery);
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.