dasht 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/assets/plugins/map.js +20 -7
- data/dasht.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4172297a523fc233da93c9116c3576f8220301ab
|
4
|
+
data.tar.gz: cfc58240f9357a835fabe76bf2ed2316ca4dde60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5f033754984bff49d718f7ca6d72fd9341b6e5ff04054231094d38c5ff6d25657c00b86fc0651d21279a582675587785bb50d7b656a7fdd33fb893d7fb076a6
|
7
|
+
data.tar.gz: 2f6bc5e70760c73d60437e8273fd64541ac1c71324c1355b182297949fa6497768cfeb27fb4bbb4409cac22c3b4e6afa23649bfaf18889d1982fd9490b016cbb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
data/assets/plugins/map.js
CHANGED
@@ -40,7 +40,24 @@ Dasht.map_plot_ip = function(map, markers, ip) {
|
|
40
40
|
});
|
41
41
|
}
|
42
42
|
|
43
|
-
Dasht.
|
43
|
+
Dasht.map_plot_coordinates = function(map, markers, coordinates) {
|
44
|
+
// Maybe pull the location from cache.
|
45
|
+
var location;
|
46
|
+
if (location = Dasht.map_geocoder_cache[coordinates]) {
|
47
|
+
Dasht.map_plot_location(map, markers, coordinates, location);
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
|
51
|
+
var coordinate_regex = /\[(-?\d+\.\d+),\s*(-?\d+\.\d+)\]/;
|
52
|
+
var matches = coordinates.match(coordinate_regex);
|
53
|
+
var lng = parseFloat(matches[1]);
|
54
|
+
var lat = parseFloat(matches[2]);
|
55
|
+
var location = new google.maps.LatLng(lat, lng);
|
56
|
+
Dasht.map_geocoder_cache[coordinates] = location;
|
57
|
+
Dasht.map_plot_location(map, markers, coordinates, location);
|
58
|
+
}
|
59
|
+
|
60
|
+
Dasht.map_plot_location = function(map, markers, item, location) {
|
44
61
|
var location_exists = _.any(_.values(markers), function(marker) {
|
45
62
|
return _.isEqual(marker.position, location);
|
46
63
|
});
|
@@ -54,7 +71,7 @@ Dasht.map_plot_location = function(map, markers, address_or_ip, location) {
|
|
54
71
|
});
|
55
72
|
|
56
73
|
// Keep track of markers.
|
57
|
-
markers[
|
74
|
+
markers[item] = marker;
|
58
75
|
}
|
59
76
|
|
60
77
|
Dasht.map_init = function(el, options) {
|
@@ -115,11 +132,7 @@ Dasht.map_init = function(el, options) {
|
|
115
132
|
if (item.search(ip_regex) >= 0) {
|
116
133
|
Dasht.map_plot_ip(map, markers, item);
|
117
134
|
} else if (item.search(coordinate_regex) >= 0) {
|
118
|
-
|
119
|
-
var lng = parseFloat(matches[1]);
|
120
|
-
var lat = parseFloat(matches[2]);
|
121
|
-
var location = new google.maps.LatLng(lat, lng);
|
122
|
-
Dasht.map_plot_location(map, markers, item, location);
|
135
|
+
Dasht.map_plot_coordinates(map, markers, item);
|
123
136
|
} else {
|
124
137
|
Dasht.map_plot_address(map, markers, geocoder, item);
|
125
138
|
}
|
data/dasht.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: dasht 0.1.
|
5
|
+
# stub: dasht 0.1.9 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "dasht"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.9"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|