Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
nstevens1040 authored Oct 4, 2024
1 parent c2fcb47 commit 55930b7
Showing 1 changed file with 51 additions and 7 deletions.
58 changes: 51 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,14 @@
}
)[0].short_name;
} else {
city = adr.filter( (a) => {
if(adr.filter( (a) => {
return (a.types.indexOf("postal_town") != -1);
}).length > 0)
{
city = adr.filter( (a) => {
return (a.types.indexOf("postal_town") != -1);
})[0].short_name;
}
)[0].short_name;
}
var state = adr.filter( (a) => {
return (a.types.indexOf("administrative_area_level_1") != -1);
Expand Down Expand Up @@ -382,16 +386,56 @@
}
if (ro) {
street_name = ro.short_name;
loc_address = street_number + " " + street_name + ", " + city + ", " + state + " " + zip_code;
loc_address = "";
if(typeof(street_number) != 'undefined'){
loc_address = street_number;
}
if(typeof(street_name) != 'undefined'){
loc_address+= " " + street_name;
}
if(typeof(city) != 'undefined'){
loc_address+= ", " + city;
}
if(typeof(state) != 'undefined'){
loc_address+= ", " + state;
}
if(typeof(zip_code) != 'undefined'){
loc_address+= " " + zip_code;
}
} else {
loc_address = "";
if (!street_number) {
if (!zip_code) {
loc_address = city + ", " + state;
if(typeof(city) != 'undefined'){
loc_address = city;
}
if(typeof(state) != 'undefined'){
loc_address+= ", " + state;
}
} else {
loc_address = city + ", " + state + " " + zip_code;
if(typeof(city) != 'undefined'){
loc_address+= ", " + city;
}
if(typeof(state) != 'undefined'){
loc_address+= ", " + state;
}
if(typeof(zip_code) != 'undefined'){
loc_address+= " " + zip_code;
}
}
} else {
loc_address = street_number + ", " + city + ", " + state + " " + zip_code;
if(typeof(street_number) != 'undefined'){
loc_address = street_number;
}
if(typeof(city) != 'undefined'){
loc_address+= ", " + city;
}
if(typeof(state) != 'undefined'){
loc_address+= ", " + state;
}
if(typeof(zip_code) != 'undefined'){
loc_address+= " " + zip_code;
}
}
}
if (document.getElementById("start").style.display == "inline-block") {
Expand All @@ -407,6 +451,7 @@
document.getElementById("address").innerHTML = loc_address;
src_coords_obj.lat = response.results[0].geometry.location.lat();
src_coords_obj.lng = response.results[0].geometry.location.lng();
handler.originPlaceId = response.results[0].geometry.location;
var ts = Math.floor(new Date().getTime() / 1000);
$.ajax({
type: "GET",
Expand All @@ -420,7 +465,6 @@
tz_offset = (tz_response.rawOffset + tz_response.dstOffset) * 1000;
}
});
handler.originPlaceId = response.results[0].geometry.location;
if (map) {
map.center = {
lat: src_coords_obj.lat,
Expand Down

0 comments on commit 55930b7

Please sign in to comment.