-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
279 lines (240 loc) · 10.4 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ClujQuest</title>
<link rel="manifest" href="site.webmanifest">
<link rel="apple-touch-icon" href="icon.png">
<!-- Place favicon.ico in the root directory -->
<link rel="apple-touch-icon" sizes="76x76" href="img/apple-icon.png">
<link rel="icon" type="image/png" href="img/favicon.png">
<!--<link rel="stylesheet" href="css/normalize.css">-->
<link rel="stylesheet" href="css/main.css">
<link href="css/bootstrap.min.css" rel="stylesheet"/>
<link href="css/material-kit.css" rel="stylesheet"/>
<!-- Fonts and icons -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css"/>
<script src="js/user.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.3.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyCMae0phU392hzly12XBSAbl02O6_KGNtk",
authDomain: "fstvlr-d5aeb.firebaseapp.com",
databaseURL: "https://fstvlr-d5aeb.firebaseio.com",
projectId: "fstvlr-d5aeb",
storageBucket: "fstvlr-d5aeb.appspot.com",
messagingSenderId: "239483498365"
};
firebase.initializeApp(config);
</script>
<script type="text/javascript">
initApp = function () {
firebase.auth().onAuthStateChanged(function (fuser) {
if (fuser) {
// User is signed in.
var displayName = fuser.displayName;
var photoURL = fuser.photoURL;
fuser.getIdToken().then(function (accessToken) {
document.getElementById('user-photo').src = photoURL;
document.getElementById('user-name').textContent = displayName;
});
user.uid = fuser.uid;
firebase.database().ref().child('/users').once('value', function (snapshot) {
var users = [];
snapshot.forEach(function (child) {
users.push(child.val());
});
users.sort(function (a, b) {
if (a.level === b.level)
return (a.experience < b.experience) ? 1 : -1;
return (a.level < b.level) ? 1 : -1;
});
for (var i = 1; i <= users.length; ++i) {
$('#tbody').append('<tr><td>' + i.toString() + '</td><td>' + users[i - 1].name + '</td><td>' + users[i - 1].experience + '</td><td>' + users[i - 1].level + '</td></tr>');
}
});
firebase.database().ref('/users/' + fuser.uid).once('value').then(function (snapshot) {
var level = (snapshot.val() && snapshot.val().level);
var experience = (snapshot.val() && snapshot.val().experience);
var levelExp = (snapshot.val() && snapshot.val().levelExp);
var badgeInt = (snapshot.val() && snapshot.val().badges);
for(var i=0;i<6;++i)
if (badgeInt & Math.pow(2, i))
$('#badges').children()[i].style = 'opacity: 1';
user.level = 1;
user.experience = 0;
user.levelExp = 300;
user.name = displayName;
if (level !== null)
user.level = level;
if (experience !== null)
user.experience = experience;
if (levelExp !== null)
user.levelExp = levelExp;
addExp(0);
});
} else {
document.getElementById('user-photo').style.display = 'none';
document.getElementById('user-name').textContent = 'No user signed in.';
}
}, function (error) {
console.log(error);
});
};
window.addEventListener('load', function () {
initApp()
});
</script>
<style>
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: -1;
top: 0;
left: 0;
background-color: rgba(17, 17, 17, 0.8);
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;
}
#main {
transition: margin-left .5s;
padding: 16px;
}
@media screen and (max-height: 450px) {
.sidenav {
padding-top: 15px;
}
.sidenav a {
font-size: 18px;
}
}
.card {
background-color: rgba(255, 255, 255, 1);
}
.table {
margin-top: 50px;
color: white;
}
#badges img {
margin-right: 25px;
margin-bottom: 10px;
opacity: 0.2;
}
</style>
</head>
<body>
<div id="wrapper" style="position: relative;height:100%">
<div id="map"></div>
<div id="over_map" style="position: absolute; top: 10px; left: 10px; z-index: 99;">
<div id="main">
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<div class="card">
<div class="content text-center">
<img id="user-photo" src="" class="img-circle img-raised" style="width:75px;height:75px;">
</div>
<div id="user-name" class="content text-center">
</div>
<div id="lvl" class="content text-center">Level 1</div>
<div class="progress">
<div class="progress-bar" role="progressbar" id="pbar" aria-valuenow="60" aria-valuemin="0"
aria-valuemax="100" style="width: 0%;" title="30%">
<span class="sr-only">30% Complete</span>
</div>
</div>
<div id="badges" class="content text-center">
<img src="img/centru.png" alt="">
<img src="img/manastur.png" alt="">
<img src="img/gruia.png" alt="">
<img src="img/marasti.png" alt="">
<img src="img/zorilor.png" alt="">
<img src="img/gheorgheni.png" alt="">
</div>
</div>
<table class="table">
<thead style="color:#fff">
<tr>
<th class="text-center">#</th>
<th>Name</th>
<th>Experience</th>
<th>Level</th>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
<span style="font-size:30px;cursor:pointer;z-index:999999" onclick="openNav()">☰ EXPLORE</span>
</div>
</div>
</div>
<script>
function openNav() {
document.getElementById("mySidenav").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementById("main").style.marginLeft = "0";
document.body.style.backgroundColor = "white";
}
</script>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/material.min.js"></script>
<!-- Plugin for the Sliders, full documentation here: http://refreshless.com/nouislider/ -->
<script src="js/nouislider.min.js" type="text/javascript"></script>
<!-- Plugin for the Datepicker, full documentation here: http://www.eyecon.ro/bootstrap-datepicker/ -->
<script src="js/bootstrap-datepicker.js" type="text/javascript"></script>
<!-- Control Center for Material Kit: activating the ripples, parallax effects, scripts from the example pages etc -->
<script src="js/material-kit.js" type="text/javascript"></script>
<script src="js/vendor/modernizr-3.5.0.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-3.2.1.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<script src="js/map.js"></script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDYUljVrv2IyV0WRhvsetmoM7xyL72mqac&libraries=places&callback=initMap"></script>
<!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->
<script>
window.ga = function () {
ga.q.push(arguments)
};
ga.q = [];
ga.l = +new Date;
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview')
</script>
<script src="https://www.google-analytics.com/analytics.js" async defer></script>
</body>
</html>