Usage
addressLookup(lat, lng)
Parameters
lat
(Required) (Float) Latitude
Default: None
lng
(Required) (Float) Longitude
Default: None
Examples
addressLookup('43.0537', '-76.1655');
Source File
Located in /assets/js/modules/location.js on line 307.
No Hooks
This function does not have any filters or actions available. Request one?nebula.addressLookup = function(lat, lng){ let geocoder = new google.maps.Geocoder(); let latlng = new google.maps.LatLng(lat, lng); //lat, lng geocoder.geocode({'latLng': latlng}, function(results, status){ if ( status === google.maps.GeocoderStatus.OK ){ if ( results ){ nebula.session.geolocation.address = { number: nebula.extractFromAddress(results[0].address_components, "street_number"), street: nebula.extractFromAddress(results[0].address_components, "route"), city: nebula.extractFromAddress(results[0].address_components, "locality"), town: nebula.extractFromAddress(results[0].address_components, "administrative_area_level_3"), county: nebula.extractFromAddress(results[0].address_components, "administrative_area_level_2"), state: nebula.extractFromAddress(results[0].address_components, "administrative_area_level_1"), country: nebula.extractFromAddress(results[0].address_components, "country"), zip: nebula.extractFromAddress(results[0].address_components, "postal_code"), formatted: results[0].formatted_address, place: { id: results[0].place_id, }, }; nebula.crm('identify', {'address_lookup': results[0].formatted_address}); sessionStorage['nebulaSession'] = JSON.stringify(nebula.session); nebula.dom.document.trigger('addressSuccess'); if ( nebula.session.geolocation.accuracy.meters < 100 ){ nebula.placeLookup(results[0].place_id); } } } }); };
Override
To override or disable this JavaScript function, simply redeclare it with the exact same function name. Remember: Some functionality is conditionally loaded via dynamic imports, so if your function is not overriding properly, try listening for a DOM event (described below).
For non-module import functions:
nebula.addressLookup = function(lat, lng){ //Write your own code here, leave it blank, or return false. }
For dynamically imported module function overrides:
jQuery(window).on('load', function(){ nebula.addressLookup = function(lat, lng){ //Write your own code here, leave it blank, or return false. } });
Custom Nebula DOM events do also exist, so you could also try the following if the Window Load listener does not work:
jQuery(document).on('nebula_module_loaded', function(module){ //Note that the module variable is also available to know which module specifically was imported if ( typeof nebula.addressLookup === 'function' ){ nebula.addressLookup = function(lat, lng){ //Write your own code here, leave it blank, or return false. } } });