1 2$(document).ready(function(){ 3var geocoder; 4var map; 5 6var marker; 7}); 8 9function initialize(lat,lon) { 10 11 var latlng = new google.maps.LatLng(lat,lon); 12 13 14} 15 16function codeLatLng(lat, lon) { 17 18 geocoder = new google.maps.Geocoder(); 19 var latlng = new google.maps.LatLng(lat, lon); 20 21 geocoder.geocode({'latLng': latlng}, function(results, status) { 22 if (status == google.maps.GeocoderStatus.OK) { 23 24 var myOptions = { 25 zoom: 17, 26 mapTypeId: google.maps.MapTypeId.HYBRID, 27 center: latlng 28 } 29 map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 30 31 $("textarea[special='locateme']").val(results[0].address_components['street_number']+' '+results[0].address_components['street_address']+' '+results[0].address_components['postal_code']+' '+results[0].address_components['locality']); 32// $("textarea[special='locateme']").val(results[0].address_components['street_number']); 33 34 35 36 $("textarea[special='locateme']").val(results[0].formatted_address); 37 38 39 40 41 42 43 if (results[1]) { 44 45 marker = new google.maps.Marker({ 46 position: latlng, 47 map: map, 48 draggable:true 49 }); 50 51 52 53 google.maps.event.addListener(marker, "dragend", function() { 54 var lat2=marker.getPosition().lat(); 55 var lng2=marker.getPosition().lng(); 56 var latlng2 = new google.maps.LatLng(lat2, lng2); 57 geocoder.geocode({'latLng': latlng2}, function(results, status) { 58 if (status == google.maps.GeocoderStatus.OK) { 59 $("textarea[special='locateme']").val(results[0].formatted_address); 60 } 61 }); 62 }); 63 64 65 map.panTo(latlng); 66 67 $("#map_canvas").css('display', 'block').hide(); 68 $("#voircarte").show(); 69 $("#voircarte").toggle(function(){ 70 $("#map_canvas").show(); 71 },function(){ 72 $("#map_canvas").hide(); 73 }); 74 75 } 76 } 77 }); 78} 79 80 81 82 function locateme(){ 83 if (navigator.geolocation) { 84 navigator.geolocation.getCurrentPosition(showPosition, errorHandler); 85 } 86 } 87 88 89 90 // show the position on the page and make a google maps link 91 function showPosition(position) { 92 var lat = position.coords.latitude; 93 var lon = position.coords.longitude; 94 95 96 // initialize(lat, lon); 97 codeLatLng(lat, lon); 98 //var gmaps_url = "http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=" + lat + "+" + lon; 99 //document.getElementById("gmaps_link").href = gmaps_url; 100 } 101 // report errors to user 102 function errorHandler(error) { 103 switch (error.code) { 104 case error.PERMISSION_DENIED: 105 alert("Could not get position as permission was denied."); 106 break; 107 case error.POSITION_UNAVAILABLE: 108 alert("Could not get position as this information is not available at this time."); 109 break; 110 case error.TIMEOUT: 111 alert("Attempt to get position timed out."); 112 break; 113 default: 114 alert("Sorry, an error occurred. Code: " + error.code + " Message: " + error.message); 115 break; 116 } 117 }
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.