dasht 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40d3069511f251aed61edcf612e2abd59ab3f691
4
- data.tar.gz: cc9ad8dc60e394571d4aa7a1e92f4d8d8b627ffc
3
+ metadata.gz: 4172297a523fc233da93c9116c3576f8220301ab
4
+ data.tar.gz: cfc58240f9357a835fabe76bf2ed2316ca4dde60
5
5
  SHA512:
6
- metadata.gz: 91f2acd7ec9858f7344b8b5743d22a24dd9b182375a5519c5e92ec9e2ee5e419d83a88da569dac4fe4b991495f9eba39f23668c1115eb581bd61c528af51d4b0
7
- data.tar.gz: a98a0da102662584d6a076ed5e808e2463a9ba50d19214c5f95ef95e14689d0334ceb468589c1d978c3ba5a42080794218693d97dc9e69d9236a3eb2bd632d14
6
+ metadata.gz: c5f033754984bff49d718f7ca6d72fd9341b6e5ff04054231094d38c5ff6d25657c00b86fc0651d21279a582675587785bb50d7b656a7fdd33fb893d7fb076a6
7
+ data.tar.gz: 2f6bc5e70760c73d60437e8273fd64541ac1c71324c1355b182297949fa6497768cfeb27fb4bbb4409cac22c3b4e6afa23649bfaf18889d1982fd9490b016cbb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
1
+ 0.1.9
@@ -40,7 +40,24 @@ Dasht.map_plot_ip = function(map, markers, ip) {
40
40
  });
41
41
  }
42
42
 
43
- Dasht.map_plot_location = function(map, markers, address_or_ip, location) {
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[address_or_ip] = marker;
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
- var matches = item.match(coordinate_regex);
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
  }
@@ -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.8 ruby lib
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.8"
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"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dasht
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rusty Klophaus