-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
85 lines (75 loc) · 4.28 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
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]> <html class="no-js"> <!--<![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title> Contextual: Music Based on Your Location</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"/>
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="/server.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="container-fluid">
<h1> Contextual: Music Based on Your Location </h1>
<div id="music-content">
<button onclick="getLocation()">Suggest a song</button>
<p id="coordinate"></p>
<p id="video"></p>
</div>
</div>
<script>
const x = document.getElementById("coordinate");
var now = new Date();
var time = now.getHours() + ":" + now.getMinutes();
var timeHours = now.getHours();
var coordinates = parseInt(x);
console.log(typeof coordinates);
console.log(coordinates.toString());
// This returns the coordinates of the user's location
var coordinateTag = document.getElementById("coordinate");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
coordinateTag.innerHTML = "Geolocation is not supported by this browser.";
}
}
var video = document.getElementById("video");
function showPosition(position) {
// coordinateTag.innerHTML = Math.round(position.coords.latitude * 100) / 100;
var latitude = Math.round(position.coords.latitude * 100) / 100;
//var docklands = -37.82;
console.log(latitude);
if (latitude == -37.71) {
coordinateTag.innerHTML = "You're at Home!"
video.innerHTML = "<iframe width='1200' height='500' src='https://www.youtube.com/embed/epOf2RLqLdw' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>"
} else
if (latitude == -37.81) {
coordinateTag.innerHTML = "You're near Fitzroy Gardens!"
video.innerHTML = "<iframe width='560' height='315' src='https://www.youtube.com/embed/vHS8fXF3X8A' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>"
} else
if (latitude == -37.70) {
coordinateTag.innerHTML = "You're near Boronia Reserve!"
video.innerHTML = "<iframe width='560' height='315' src='https://www.youtube.com/embed/tQsC5IEXDag' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>"
} else
if (latitude = docklands) {
coordinateTag.innerHTML = "You're near Docklands!"
video.innerHTML = "<iframe width='560' height='315' src='https://www.youtube.com/embed/wl-HPIu5kcs' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>"
}
else {
coordinateTag.innerHTML = "Music coming to your area soon!"
}
}
</script>
</body>
</html>