-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
74 lines (72 loc) · 2.97 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!doctype html>
<html lang="en">
<head>
<title>BhEEM Saves!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
<link rel=stylesheet href=css/bheem.css>
<link rel=stylesheet href=css/rescue.css>
<script type="text/javascript">
var websocket = new WebSocket("ws://localhost:1337/");
websocket.onopen = function(event) {
// The connection was opened
};
websocket.onclose = function(event) {
// The connection was closed
};
websocket.onmessage = function(event) {
var message = event.data;
console.log(message);
};
websocket.onerror = function(event) {
// There was an error with your WebSocket
};
function sendMessage(msg) {
if (websocket.readyState === WebSocket.OPEN) {
websocket.send(msg);
} else {
console.log('Websocket state: ' + websocket.readyState);
}
}
</script>
</head>
<body>
<div class="map-container"></div>
<div class="rescue-cta-container">
<p><a id="helpme" class="rescue-link" href="helpme"><button class="btn btn-danger btn-rescue-cta">help me!</button></a></p>
<p><a id="helper" class="rescue-link" href="helper"><button class="btn btn-success btn-rescue">I can help</button></a></p>
</div>
<script src="js/geoloc.js"></script>
<script>
geoloc.get();
</script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position){
//var mapcanvas = document.createElement('div');
//mapcanvas.classList.add('map-canvas');
var mc = document.querySelector('.map-container');
//mc.appendChild(mapcanvas);
var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
/*var myOptions = {
zoom: 15,
center: latlng,
mapTypeControl: false,
panControl: false,
zoomControl: false,
scaleControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.querySelector(".map-canvas"), myOptions);*/
var url = "http://maps.googleapis.com/maps/api/staticmap?center="+position.coords.latitude+","+ position.coords.longitude+"&zoom=14&scale=2&size="+mc.clientWidth+"x"+mc.clientHeight+"&sensor=true";
var img = document.createElement("img");
img.src=url;
img.classList.add('map-canvas');
mc.appendChild(img);
});
}
</script>
</body>
</html>