-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfound.html
executable file
·84 lines (82 loc) · 3.66 KB
/
found.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
75
76
77
78
79
80
81
82
83
84
<head>
<title>Lost And Found</title>
<script src="https://www.gstatic.com/firebasejs/3.6.6/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.6.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.6.2/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.6.2/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.6.2/firebase-messaging.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="assets/css/main.css">
<script src="found.js"></script>
</head>
<body>
<br>
<br>
<h1 style="font-size: 100px;"><center>Trace.It</center></h1>
<br>
<br>
<header style="margin-top: -20px;"><center>Hello there! You just found an item that someone else lost.<center></header>
<p>This site is going to transmit the location of your device to the person who lost his/her item so that they can come and retrieve the item.</p>
<p>Please enable location services so that the location will be transmitted.<p>
<br>
<p>We will only transmit the location of your device at this moment only. No other information on your device will be touched.</p>
</p>
<h3>Please wait until you get a message notifying you that your location has been transmitted.</p>
<script>
determineUID();
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
var xmlHttp = new XMLHttpRequest();
//var max = 0;
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
//var best;
var response = JSON.parse(xmlHttp.responseText);
/*console.log(response);
for(var i = 0; i< response.results.length; i++){
if(max<response.results[i].address_components.length)
best = response.results[i].formatted_address;
}*/
console.log(response.results[0]);
storeaddressandtime(response.results[0]);
}
}
xmlHttp.open("GET", "https://maps.googleapis.com/maps/api/geocode/json?latlng="+lat+","+lng+"&key=AIzaSyBlxJd9QXL6HGbqe4g29eYnlUBhb7rfwVM", true); // true for asynchronous
xmlHttp.send();
/*
storeloc(lat,lng);
var geocoder = new google.maps.Geocoder;
var latlng = {lat: lat, lng: lng};
geocoder.geocode({'location': latlng}, function(results, status) {
if (status === 'OK') {
if (results[1]) {
storeaddress(results[1]);
} else {
console.log("no results moron");
}
} else {
console.log("geocode failed");
}
});
}, function() {
console.log("rip");
});
*/
});
} else {
// Browser doesn't support Geolocation
console.log("fail");
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBlxJd9QXL6HGbqe4g29eYnlUBhb7rfwVM">
</script>
</body>