From 834530a1f51f71712797f944f71b0878d55cc13c Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Thu, 14 Jul 2016 18:28:52 +0200 Subject: [PATCH] apiKey support for last/index.html --- docroot/last/.gitignore | 1 + docroot/last/apikey.js.sample | 1 + docroot/last/functions.js | 4 +++- docroot/last/index.html | 29 +++++++++++++++++++++++------ docroot/last/websock.js | 3 ++- 5 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 docroot/last/apikey.js.sample diff --git a/docroot/last/.gitignore b/docroot/last/.gitignore index 1bf4259..1d76347 100644 --- a/docroot/last/.gitignore +++ b/docroot/last/.gitignore @@ -1 +1,2 @@ config.js +apikey.js diff --git a/docroot/last/apikey.js.sample b/docroot/last/apikey.js.sample new file mode 100644 index 0000000..45dfcef --- /dev/null +++ b/docroot/last/apikey.js.sample @@ -0,0 +1 @@ +var apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; diff --git a/docroot/last/functions.js b/docroot/last/functions.js index e0266cd..06b8904 100644 --- a/docroot/last/functions.js +++ b/docroot/last/functions.js @@ -33,6 +33,8 @@ function initialize() { buttonControlDiv.index = 1; map.controls[google.maps.ControlPosition.BOTTOM_LEFT].push(buttonControlDiv); + + ws_go(); // Connect to websocket and start listening } function ButtonControl(controlDiv, map) { @@ -215,4 +217,4 @@ function map_marker(loc) } } -google.maps.event.addDomListener(window, 'load', initialize); +// google.maps.event.addDomListener(window, 'load', initialize); diff --git a/docroot/last/index.html b/docroot/last/index.html index e2f3a9c..058f165 100644 --- a/docroot/last/index.html +++ b/docroot/last/index.html @@ -32,18 +32,35 @@ .latlon { color: gray; } - + + + -
-
-
-
-
+
+
+
+
+
diff --git a/docroot/last/websock.js b/docroot/last/websock.js index e0135e4..bf6a774 100644 --- a/docroot/last/websock.js +++ b/docroot/last/websock.js @@ -56,7 +56,7 @@ function ws_connect() { }; } -window.onload = function() { +function ws_go() { // var url = 'ws://' + location.host + '/ws/last'; // console.log(JSON.stringify(location)); @@ -68,6 +68,7 @@ window.onload = function() { url = url + "ws/last"; console.log("Websocket URI: " + url); + ws_url = url; ws_connect();