codesite-noreply at google.com
2010-May-21 18:59 UTC
[Mapstraction] [mapstraction] r83 committed - Making the geocoder pass JSLint
Revision: 83 Author: dezfowler Date: Fri May 21 11:57:43 2010 Log: Making the geocoder pass JSLint http://code.google.com/p/mapstraction/source/detail?r=83 Modified: /trunk/source/mxn.google.geocoder.js ======================================--- /trunk/source/mxn.google.geocoder.js Wed May 19 16:33:35 2010 +++ /trunk/source/mxn.google.geocoder.js Fri May 21 11:57:43 2010 @@ -28,7 +28,7 @@ this.callback = callback; this.geocoders = {}; if(error_callback === null) { - this.error_callback = this.geocode_error + this.error_callback = this.geocode_error; } else { this.error_callback = error_callback; } @@ -67,7 +67,7 @@ default: alert(api + '' not supported by mapstraction-geocoder''); } -} +}; /** * Change the Routing API to use * @param {String} api The API to swap to @@ -76,17 +76,17 @@ if (this.api == api) { return; } this.api = api; - if (this.geocoders[this.api] == undefined) { + if (!this.geocoders.hasOwnProperty(this.api)) { this.addAPI($(element),api); } -} +}; /** * Default Geocode error function */ MapstractionGeocoder.prototype.geocode_error = function(response) { alert("Sorry, we were unable to geocode that address"); -} +}; /** * Default handler for geocode request completion @@ -107,14 +107,14 @@ return_location.country = ""; var place = response.Placemark[0]; - if(place.AddressDetails.Country.AdministrativeArea != null) { + if(place.AddressDetails.Country.AdministrativeArea !== null) { return_location.region = place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName; - if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea != null) { - if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality != null) { + if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea !== null) { + if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality !== null) { return_location.locality = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName; - if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare != null) { + if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare !== null) { return_location.street = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName; } } @@ -132,7 +132,7 @@ case ''mapquest'': break; } -} +}; /** @@ -147,7 +147,7 @@ switch (this.api) { case ''google'': - if (address.address == null || address.address == "") { + if (address.address === null || address.address === "") { address.address = address.street + ", " + address.locality + ", " + address.region + ", " + address.country; } this.geocoders[this.api].getLocations(address.address, function(response) { mapstraction_geocoder.geocode_callback(response, mapstraction_geocoder); }); @@ -176,4 +176,4 @@ alert(api + '' not supported by mapstraction-geocoder''); break; } - } + };