summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-11-30 22:46:52 -0500
committerJules Laplace <jules@okfoc.us>2015-11-30 22:46:52 -0500
commitb2f133ffe639ecd7d6fb8158341208e2b24d7fb5 (patch)
tree82739939d4cf4edaefab3fd298bb425151172f16 /StoneIsland/www/js/lib
parentb5a159707f00828235e81c04061e8851f033bdf2 (diff)
geo
Diffstat (limited to 'StoneIsland/www/js/lib')
-rw-r--r--StoneIsland/www/js/lib/etc/geo.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/StoneIsland/www/js/lib/etc/geo.js b/StoneIsland/www/js/lib/etc/geo.js
new file mode 100644
index 00000000..0270d681
--- /dev/null
+++ b/StoneIsland/www/js/lib/etc/geo.js
@@ -0,0 +1,33 @@
+var geo = (function(){
+ var geo = {}
+
+ geo.fetch = function(){
+ navigator.geolocation.getCurrentPosition(geo.success, geo.error, {timeout: 15000})
+ }
+
+ geo.success = function(position){
+ var lat_str = as_degrees( position.coords.latitude )
+ var lng_str = as_degrees( position.coords.longitude )
+ }
+
+ geo.error = function(error){
+ $(".latlng").html( "+40&deg; 58' 90\" -74&deg; 04' 46\"" )
+ }
+
+ function as_degrees (n) {
+ var s = ""
+ if (n >= 0) s += "+"
+ s += Math.floor(n) + "&deg; "
+
+ n %= 1
+ n *= 60
+ s += Math.floor(n) + "'"
+
+ n %= 1
+ n *= 60
+
+ s += Math.floor(n) + '"'
+ }
+
+ return geo
+})() \ No newline at end of file