assets/plugins/map.js in dasht-0.1.5 vs assets/plugins/map.js in dasht-0.1.6

- old
+ new

@@ -91,10 +91,11 @@ var num_entries = options["n"] || 10; var map = new google.maps.Map(map_el, mapOptions); var markers = {}; var geocoder = new google.maps.Geocoder(); var ip_regex = /\d+\.\d+\.\d+\.\d+/; + var coordinate_regex = /\[(-?\d+\.\d+),(-?\d+\.\d+\)]/; Dasht.fill_tile($(el).find(".map")); // Update values. setTimeout(function() { @@ -111,9 +112,15 @@ // Plot each marker. _.each(new_data, function(item, index) { if (item.search(ip_regex) >= 0) { Dasht.map_plot_ip(map, markers, item); + } else if (item.search(coordinate_regex) >= 0) { + var matches = item.match(coordinate_regex); + var lng = parseFloat(matches[1]); + var lat = parseFloat(matches[2]); + var location = new google.maps.LatLng(lat, lng); + Dasht.map_plot_location(map, markers, item, location); } else { Dasht.map_plot_address(map, markers, geocoder, item); } });