forked from aazurill/EventNow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
151 lines (141 loc) · 3.66 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #51555c;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidenav a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidenav a:hover {
color: #f1f1f1;
}
.sidenav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
}
@media screen and (max-height: 450px) {
.sidenav {padding-top: 15px;}
.sidenav a {font-size: 18px;}
}
</style>
</head>
<body>
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a id="EventCaller" onmouseover = "mouseOver1()">All Events</a>
<a id="ClubCaller" onmouseover = "mouseOver2()">All Clubs</a>
<a href="/ALVIN">Developers</a>
<a href="https://github.com/aazurill/EventNow">Code</a>
</div>
<script>
function openNav() {
document.getElementById("mySidenav").style.width = "250px";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
}
</script>
<!-- Use any element to open the sidenav -->
<span onmouseover="openNav()">open</span>
<div id="map"></div>
<script>
var map;
var data;
var club;
//var listLocation = [['Geisel',32.5,-117.5,1],['Cafe Ventanas',31.5,-116.5,2],['Alvin',32,-117,3]];
var myRequest = new XMLHttpRequest();
myRequest.onreadystatechange = function(){
if(myRequest.readyState === 4){
data = JSON.parse(myRequest.responseText);
}
}
myRequest.open('GET',"/getEvent");
myRequest.send();
var myRequest1 = new XMLHttpRequest();
myRequest1.onreadystatechange = function(){
if(myRequest1.readyState === 4){
club = JSON.parse(myRequest1.responseText);
}
}
myRequest1.open('GET',"/getClub");
myRequest1.send();
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat:32,lng:-117},
zoom: 10
});
setMarkers(map);
function setMarkers(map){
for(var i=0;i<data.length;i++){
var location =data[i];
var marker = new google.maps.Marker({
position: {lat:parseFloat(location["lat"]),lng:parseFloat(location["long"])},
map:map,
title: location["name"],
})
}
}
}
function prettyE(data){
var prett = "";
var converted = JSON.stringify(data);
var result = converted.substring(1,converted.length-1);
converted = JSON.parse("[" + result + "]");
converted.forEach(function(element){
prett = prett + element["name"] + " Hosted By: " + element["group"] + "\n" + element["Description"] + "\n" + "\n";
})
return prett;
}
function prettyC(data){
var prett = "";
var converted = JSON.stringify(data);
var result = converted.substring(1,converted.length-1);
converted = JSON.parse("[" + result + "]");
converted.forEach(function(element){
prett = prett + element["group"] + "\n" + element["Description"] + "\n" + "\n";
})
return prett;
}
function mouseOver1(){
window.alert(prettyE(data));
}
function mouseOver2(){
window.alert(prettyC(club));
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDUsVtkB8CUXf-CgQTfqjo-RbWQJuoy030&callback=initMap" type="text/javascript"
async defer></script>
</body>
</html>