1/*********************************************************/ 2/* Gestion des cookies */ 3/*********************************************************/ 4function gmapfp_createCookie(name,value,days) { 5 if (days) { 6 var date = new Date(); 7 date.setTime(date.getTime()+(days*24*60*60*1000)); 8 var expires = "; expires="+date.toGMTString(); 9 } 10 else var expires = ""; 11 document.cookie = name+"="+value+expires+"; path=/"; 12} 13 14function gmapfp_readCookie(name) { 15 var nameEQ = name + "="; 16 var ca = document.cookie.split(';'); 17 for(var i=0;i < ca.length;i++) { 18 var c = ca[i]; 19 while (c.charAt(0)==' ') c = c.substring(1,c.length); 20 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 21 } 22 return null; 23} 24 25function gmapfp_eraseCookie(name) { 26 gmapfp_createCookie(name,"",-1); 27} 28 29/*********************************************************/ 30/* position html5 */ 31/*********************************************************/ 32var gmapfp_geolocalisation_ok = false; 33var gmapfp_maposition_lat = null; 34var gmapfp_maposition_lng = null; 35function displayGeolocalisation(map_num) { 36 active_map = map_num; 37 if (navigator.geolocation) { 38 navigator.geolocation.watchPosition(positionSuccess, positionError); 39 } else { 40 positionError(-1); 41 } 42} 43 44function positionError(err) { 45 var msg; 46 switch(err.code) { 47 case err.UNKNOWN_ERROR: 48 msg = Joomla.JText._('COM_GMAPFP_MAP_LOCATION_ERROR_UNKNOWN_ERROR'); 49 break; 50 case err.PERMISSION_DENINED: 51 msg = Joomla.JText._('COM_GMAPFP_MAP_LOCATION_ERROR_PERMISSION_DENINED'); 52 break; 53 case err.POSITION_UNAVAILABLE: 54 msg = Joomla.JText._('COM_GMAPFP_MAP_LOCATION_ERROR_POSITION_UNAVAILABLE'); 55 break; 56 case err.BREAK: 57 msg = Joomla.JText._('COM_GMAPFP_MAP_LOCATION_ERROR_BREAK'); 58 break; 59 default: 60 msg = Joomla.JText._('COM_GMAPFP_MAP_LOCATION_ERROR_DEFAULT'); 61 } 62 for (i = 0; i <= GMapFP_num.length - 1; i++) { 63 document.getElementById('info_geolocalisation' + GMapFP_num).innerHTML = msg; 64 } 65} 66 67function contains(array, item) { 68 for (var i = 0, I = array.length; i < I; ++i) { 69 if (array[i] == item) return true; 70 } 71 return false; 72} 73 74/*********************************************************/ 75/* Goto place */ 76/*********************************************************/ 77var come_back_goto_place = []; 78 79function goto_place(map_num, glat, glng, place_id) { 80 if (gmapfp_geolocalisation_ok) { 81 come_back_goto_place = []; 82 jQuery('#select_from' + map_num + ' option:eq(1)').prop('selected', true); 83 jQuery('#select_to' + map_num + ' option[value="' + glat + ',' + glng + ',' + place_id + '"]').prop('selected', true); 84 eval('OnSubmit_Itin(' + map_num + ')'); 85 } else { 86 come_back_goto_place = [map_num, glat, glng, place_id]; 87 displayGeolocalisation(map_num); 88 // alert(Joomla.JText._('COM_GMAPFP_ERROR_YOUR_PLACE_NOT_LOCALIZED')); 89 } 90} 91 92function get_new_place(select_zone, text_zone) { 93 jQuery('#' + select_zone).parent().toggle(500); 94 jQuery('#' + text_zone).parent().toggle(500); 95} 96 97/*********************************************************/ 98/* Calcul l'itinéraire */ 99/*********************************************************/ 100function OnSubmit_Itin(num_map) { 101 CalculRoute(num_map); 102 Show_bp_print(num_map); 103} 104function onchange_travel_mode(modeselected, map_num) { 105 switch (modeselected) { 106 case "bike": 107 mode = 'BICYCLING'; 108 gmapfp_createCookie('gmapfp_itin_travelMode', 'BICYCLING', 1); 109 jQuery("[class^='map-bike-button-']").addClass('selected'); 110 jQuery("[class^='map-walk-button-']").removeClass('selected'); 111 jQuery("[class^='map-transit-button-']").removeClass('selected'); 112 jQuery("[class^='map-car-button-']").removeClass('selected'); 113 break; 114 case "walk": 115 mode = 'WALKING'; 116 gmapfp_createCookie('gmapfp_itin_travelMode', 'WALKING', 1); 117 jQuery("[class^='map-bike-button-']").removeClass('selected'); 118 jQuery("[class^='map-walk-button-']").addClass('selected'); 119 jQuery("[class^='map-transit-button-']").removeClass('selected'); 120 jQuery("[class^='map-car-button-']").removeClass('selected'); 121 break; 122 case "transit": 123 mode = 'TRANSIT'; 124 gmapfp_createCookie('gmapfp_itin_travelMode', 'TRANSIT', 1); 125 jQuery("[class^='map-bike-button-']").removeClass('selected'); 126 jQuery("[class^='map-walk-button-']").removeClass('selected'); 127 jQuery("[class^='map-transit-button-']").addClass('selected'); 128 jQuery("[class^='map-car-button-']").removeClass('selected'); 129 break; 130 default: 131 mode = 'DRIVING'; 132 gmapfp_createCookie('gmapfp_itin_travelMode', 'DRIVING', 1); 133 jQuery("[class^='map-bike-button-']").removeClass('selected'); 134 jQuery("[class^='map-walk-button-']").removeClass('selected'); 135 jQuery("[class^='map-transit-button-']").removeClass('selected'); 136 jQuery("[class^='map-car-button-']").addClass('selected'); 137 } 138 eval('travel_mode' + map_num + ' = mode;'); 139} 140 141/*********************************************************/ 142/* Affiche de l'affichage de zones "select" */ 143/*********************************************************/ 144 145//rafraichi les données d'itinéraire
146function DisplayDirectionData(map_num){ 147 let directions = []; 148 eval('datas_direction = map_datas' + map_num + ';'); 149 eval('jQuery("#select_from'+map_num+' option").remove();'); 150 eval('jQuery("#select_to'+map_num+' option").remove();'); 151 jQuery("<option />", { val: '', text: Joomla.JText._('COM_GMAPFP_MAP_SELECT') }).appendTo(jQuery("#select_from"+map_num)); 152 jQuery("<option />", { val: '', text: Joomla.JText._('COM_GMAPFP_MAP_SELECT') }).appendTo(jQuery("#select_to"+map_num)); 153 jQuery.each(datas_direction, function(index, value){ 154 // Create option 155 directions.push({'title' : value['title'], 'data' : (value['glat']+','+value['glng']+','+value['id'])}); 156 }); 157 158 //trie par ordre alpha 159 Array.prototype.sortOn = function(key){ 160 this.sort(function(a, b){ 161 if(a[key] < b[key]){ 162 return -1; 163 }else if(a[key] > b[key]){ 164 return 1; 165 } 166 return 0; 167 }); 168 } 169 directions.sortOn('title'); 170 171 jQuery.each(directions, function(index, value){ 172 // Create option 173 jQuery("<option />", { val: value['data'], text: value['title'] }).appendTo(jQuery("#select_from"+map_num)); 174 jQuery("<option />", { val: value['data'], text: value['title'] }).appendTo(jQuery("#select_to"+map_num)); 175 }); 176} 177 178function Show_bp_print(map_num) { 179 var ok = false; 180 if (document.getElementById("select_from"+map_num).selectedIndex!=0 && (document.getElementById("select_to"+map_num).selectedIndex!=0 || document.getElementById("text_to"+map_num).value!="")) { 181 ok = true; 182 } else if (document.getElementById("select_to"+map_num).selectedIndex!=0 && document.getElementById("text_from"+map_num).value!="") { 183 ok = true; 184 } 185/* if (ok) { 186 jQuery("#bp_print_itin"+map_num).css("display", "block"); 187 eval("directionsDisplay"+map_num+".setMap(carteGMapFP"+map_num+");"); 188 } else { 189 jQuery("#bp_print_itin"+map_num).css("display", "none"); 190 jQuery("#gmapfp_directions"+map_num).text(""); 191 eval("directionsDisplay"+map_num+".setMap(null);"); 192 }*/ 193} 194 195//active ou desactive les éléments de selection en attendant le rafraichissement des données 196function GMapFP_disable_filter (value, map_num) { 197 eval('tmp = typeof(gmapfp_filtres'+map_num+');'); 198 eval(' if (tmp != \'undefined\') for(var i = 0; i < gmapfp_filtres'+map_num+'.length; i++) { if (document.getElementById(gmapfp_filtres'+map_num+'[i])) document.getElementById(gmapfp_filtres'+map_num+'[i]).disabled = value;};'); 199 jQuery("#filtre_search").attr('disabled', value); 200 jQuery("#filtre_reset_search").attr('disabled', value); 201 jQuery("#search_gmapfp").attr('disabled', value); 202 jQuery(".gmapfp_cat_sel input").attr('disabled', value); 203 eval('jQuery("form[name=direction_form'+map_num+'] input").attr("disabled", '+value+');'); 204 eval('jQuery("form[name=direction_form'+map_num+'] select").attr("disabled", '+value+');'); 205} 206 207function update_info(map_num) { 208 DisplayDirectionData(map_num); 209 GMapFP_disable_filter (false, map_num) 210} 211 212function show_marker_link (id, num) { 213 214 var map_link = ''; 215 var options = ''; 216 217 if (typeof id == 'object') { 218 options = this.options; 219 id = options.item_id; 220 } else { 221 if(num) eval('map_marker = map_marker' + num + ';'); 222 options = map_marker[id].options; 223 } 224 map_link = options.item_link; 225 226 switch (params_map.target) { 227 case '1': // open in parent avec navigation 228 parent.location = map_link; 229 break; 230 case '2': // open in nouvelle fenêtre avec barre de navigation 231 window.open(map_link, 'info' + id, 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width="' + params_map.gmapfp_largeur_lightbox + '",height="' + params_map.gmapfp_hauteur_lightbox + '"'); 232 break; 233 case '3': // open in a popup window 234 window.open(map_link+'&tmpl=component', 'info' + id, 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="' + params_map.gmapfp_largeur_lightbox + '",height="' + params_map.gmapfp_hauteur_lightbox + '"'); 235 break; 236 default: // open in lightbox joomla 237 jQuery.fancybox.open({type: 'iframe', iframe: {css: {width: params_map.gmapfp_largeur_lightbox, height: params_map.gmapfp_hauteur_lightbox, padding: '10px !important' }}, src: map_link+'&tmpl=component'}); 238 } 239} 240
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.