From b2f133ffe639ecd7d6fb8158341208e2b24d7fb5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 30 Nov 2015 22:46:52 -0500 Subject: geo --- StoneIsland/www/js/lib/etc/geo.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 StoneIsland/www/js/lib/etc/geo.js (limited to 'StoneIsland/www/js/lib/etc') 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° 58' 90\" -74° 04' 46\"" ) + } + + function as_degrees (n) { + var s = "" + if (n >= 0) s += "+" + s += Math.floor(n) + "° " + + n %= 1 + n *= 60 + s += Math.floor(n) + "'" + + n %= 1 + n *= 60 + + s += Math.floor(n) + '"' + } + + return geo +})() \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 83a884197ff0226631a46e4894f22b8468b15598 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 30 Nov 2015 23:11:28 -0500 Subject: add deep linking lib --- StoneIsland/www/index.html | 2 ++ StoneIsland/www/js/index.js | 2 +- StoneIsland/www/js/lib/_router.js | 11 +++++++++++ StoneIsland/www/js/lib/etc/deeplink.js | 3 +++ StoneIsland/www/js/lib/etc/push.js | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 StoneIsland/www/js/lib/etc/deeplink.js create mode 100644 StoneIsland/www/js/lib/etc/push.js (limited to 'StoneIsland/www/js/lib/etc') diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 7bd73c84..03d4a958 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -1063,6 +1063,8 @@ + + diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index 1f2de128..e6bdf49f 100644 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -69,7 +69,7 @@ var app = (function(){ app.view = null app.router = new SiteRouter () - app.account.connect( app.router.route.bind(app.router) ) + app.account.connect( app.router.launch.bind(app.router) ) $("body").removeClass("loading") } diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js index b70d9be8..23daf4c7 100644 --- a/StoneIsland/www/js/lib/_router.js +++ b/StoneIsland/www/js/lib/_router.js @@ -47,6 +47,17 @@ var SiteRouter = Router.extend({ } } }, + + initial_route: null, + launch: function(){ + if (this.initial_route) { + this.parseRoute( this.initial_route ) + } + else { + this.route() + } + this.initial_route = null + }, go: function(url){ if (app.view && app.view.hide) { diff --git a/StoneIsland/www/js/lib/etc/deeplink.js b/StoneIsland/www/js/lib/etc/deeplink.js new file mode 100644 index 00000000..648dd167 --- /dev/null +++ b/StoneIsland/www/js/lib/etc/deeplink.js @@ -0,0 +1,3 @@ +function handleOpenURL (url) { + app.router.initial_route = url +} \ No newline at end of file diff --git a/StoneIsland/www/js/lib/etc/push.js b/StoneIsland/www/js/lib/etc/push.js new file mode 100644 index 00000000..ab0c0141 --- /dev/null +++ b/StoneIsland/www/js/lib/etc/push.js @@ -0,0 +1 @@ +// \ No newline at end of file -- cgit v1.2.3-70-g09d2