-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
41 lines (39 loc) · 1.16 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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flower</title>
</head>
<script defer>
let html = {
log: (info)=>{
document.body.insertAdjacentHTML('beforeend', JSON.stringify(cloneAsObject(info)))
}
}
function cloneAsObject(obj) {
if (obj === null || !(obj instanceof Object)) {
return obj;
}
var temp = (obj instanceof Array) ? [] : {};
// ReSharper disable once MissingHasOwnPropertyInForeach
for (var key in obj) {
temp[key] = cloneAsObject(obj[key]);
}
return temp;
}
function locate(){
navigator.geolocation.getCurrentPosition((position)=>{
position.time = Date(position.timestamp)
html.log(position)
}, (error)=>{
console.log(error)
html.log(error)
});
}
</script>
<body>
<button onclick="locate()">Locate</button>
<button onclick="alert('something')">alert</button>
</body>
</html>