geofsh 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/geofsh/version.rb +1 -1
- data/vendor/assets/javascripts/geofsh.js +55 -53
- metadata +3 -3
data/lib/geofsh/version.rb
CHANGED
@@ -1,55 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
(function(){
|
2
|
+
var geolocError, addMarker, getPosition, hideAddressAndZip, hideGeoLoc, geolocSuccess, googleMap, mapOptions, map, marker, geolat, geolng, geoCoords;
|
3
|
+
|
4
|
+
googleMap = function(geolat, geolng) {
|
5
|
+
if(document.getElementById("google-map")){
|
6
|
+
geoCoords = new google.maps.LatLng(geolat, geolng);
|
7
|
+
mapOptions = {
|
8
|
+
zoom: 16,
|
9
|
+
center: geoCoords,
|
10
|
+
mapTypeId: google.maps.MapTypeId.ROADMAP
|
11
|
+
};
|
12
|
+
|
13
|
+
map = new google.maps.Map(document.getElementById("google-map"), mapOptions);
|
14
|
+
addMarker(geoCoords, "You are here!");
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
addMarker = function(position, title) {
|
19
|
+
marker = new google.maps.Marker({
|
20
|
+
position: position,
|
21
|
+
map: map,
|
22
|
+
title: title
|
23
|
+
});
|
14
24
|
}
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
};
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
return
|
45
|
-
}
|
46
|
-
|
47
|
-
return "Geolocation not supported";
|
48
|
-
}
|
49
|
-
};
|
50
|
-
|
51
|
-
|
52
|
-
$(function() {
|
53
|
-
return getPosition();
|
54
|
-
});
|
25
|
+
geolocSuccess = function(position) {
|
26
|
+
geolat = position.coords.latitude;
|
27
|
+
geolng = position.coords.longitude;
|
28
|
+
$('input#latitude').val(geolat);
|
29
|
+
$('input#longitude').val(geolng);
|
30
|
+
return googleMap(geolat, geolng);
|
31
|
+
};
|
32
|
+
|
33
|
+
geolocError = function() {
|
34
|
+
hideGeoLoc();
|
35
|
+
return "Geolocation Unsuccessful";
|
36
|
+
};
|
37
|
+
|
38
|
+
|
39
|
+
hideGeoLoc = function() {
|
40
|
+
return $('.geoloc-hide').parent().hide();
|
41
|
+
};
|
42
|
+
|
43
|
+
getPosition = function() {
|
44
|
+
if (navigator.geolocation) {
|
45
|
+
return navigator.geolocation.getCurrentPosition(geolocSuccess, geolocError);
|
46
|
+
} else {
|
47
|
+
hideGeoLoc();
|
48
|
+
return "Geolocation not supported";
|
49
|
+
}
|
50
|
+
};
|
51
|
+
|
52
|
+
|
53
|
+
$(function() {
|
54
|
+
return getPosition();
|
55
|
+
})
|
56
|
+
}).call(this);
|
55
57
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geofsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -106,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
segments:
|
108
108
|
- 0
|
109
|
-
hash:
|
109
|
+
hash: 225897693785589626
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
none: false
|
112
112
|
requirements:
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
segments:
|
117
117
|
- 0
|
118
|
-
hash:
|
118
|
+
hash: 225897693785589626
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
121
|
rubygems_version: 1.8.24
|