mirror of
https://github.com/owntracks/recorder.git
synced 2026-05-19 03:46:34 +00:00
apiKey support for last/index.html
This commit is contained in:
1
docroot/last/.gitignore
vendored
1
docroot/last/.gitignore
vendored
@@ -1 +1,2 @@
|
||||
config.js
|
||||
apikey.js
|
||||
|
||||
1
docroot/last/apikey.js.sample
Normal file
1
docroot/last/apikey.js.sample
Normal file
@@ -0,0 +1 @@
|
||||
var apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
@@ -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);
|
||||
|
||||
@@ -32,18 +32,35 @@
|
||||
.latlon { color: gray; }
|
||||
|
||||
</style>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
|
||||
<script src="apikey.js"></script>
|
||||
<script src="functions.js"></script>
|
||||
<script src="websock.js"></script>
|
||||
<script src="config.js"></script>
|
||||
<script src="../static/js/moment.min.js"></script>
|
||||
<script src="../static/js/mustache.js"></script>
|
||||
<script>
|
||||
function loadMapsAPI() {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = 'https://maps.googleapis.com/maps/api/js?v=3' +
|
||||
'&signed_in=true&key=' + apiKey +'&callback=initialize';
|
||||
document.body.appendChild(script);
|
||||
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
loadMapsAPI();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="output"></div>
|
||||
<div id="wrapper">
|
||||
<div id="map-canvas"></div>
|
||||
<div id="maplabel"></div>
|
||||
</div>
|
||||
<div id="output"></div>
|
||||
<div id="wrapper">
|
||||
<div id="map-canvas"></div>
|
||||
<div id="maplabel"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user