1/* lp gps */ 2 3var geocoderr; 4 5function lpGetGpsLocName(lpcalback){ 6 if (navigator.geolocation) { 7 navigator.geolocation.getCurrentPosition(function(position){ 8 var clat = position.coords.latitude; 9 var clong = position.coords.longitude; 10 jpCodeLatLng(clat,clong, function(citynamevalue){ 11 lpcalback(citynamevalue); 12 }); 13 }); 14 15 } else { 16 alert("Geolocation is not supported by this browser."); 17 } 18 19} 20 21function lpgeocodeinitialize() { 22 geocoderr = new google.maps.Geocoder(); 23} 24 25function jpCodeLatLng(lat, lng, lpcitycallback) { 26 var geocoder, city, state, country; 27 geocoder = new google.maps.Geocoder(); 28 var latlng = new google.maps.LatLng(lat, lng); 29 30 geocoder.geocode( 31 {'latLng': latlng}, 32 function(results, status) { 33 if (status == google.maps.GeocoderStatus.OK) { 34 35 for (var ac = 0; ac < results[0].address_components.length; ac++) { 36 var component = results[0].address_components[ac]; 37 38 switch(component.types[0]) { 39 case 'locality': 40 city = component.long_name; 41 break; 42 case 'administrative_area_level_1': 43 state = component.short_name; 44 break; 45 case 'country': 46 47 country = component.short_name; 48 break; 49 } 50 }; 51 52 //lpcitycallback(state); 53 //lpcitycallback(country); 54 lpcitycallback(city); 55 56 57 } 58 else { 59 console.log("Geocoder failed due to: " + status); 60 } 61 } 62 ); 63 64 65 66} 67 68 69/* test call */ 70 71jQuery(document).ready(function(){ 72 lpgeocodeinitialize(); 73});
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.