-
Notifications
You must be signed in to change notification settings - Fork 1
/
door_signs.html
67 lines (61 loc) · 2.65 KB
/
door_signs.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="signs.css">
</head>
<body>
<div id="schedule"></div>
<script src="jquery-2.1.1.min.js"></script>
<script src="Config.js"></script>
<script src="Session.js"></script>
<script src="ScheduledSession.js"></script>
<script type="text/javascript">
var scheduledSessions = [];
function retrieveSessions(address) {
return $.getJSON(address, function(scheduled_sessions) {
$.each(scheduled_sessions, function(i) {
var scheduled = new ScheduledSession(this);
scheduledSessions.push(scheduled);
});
console.log("Successfully loaded " + address);
});
};
var scheduled = retrieveSessions("scheduled_sessions.json");
var extra = retrieveSessions("scheduled_extra_sessions.json");
$.when(scheduled, extra).done(function(first, second) {
var scheduleTag = $("#schedule");
for(var day = 1; day <= Config.numberOfDays; day++) {
scheduleTag.append("<div id='day" + day + "' class='day'></div>");
var dayTag = $("#day"+day);
for(var roomNumber = 1; roomNumber <= Config.numberOfRooms; roomNumber++) {
var sessions = $.grep(scheduledSessions, function(session, index) {
return session.day == day && session.room == roomNumber;
});
var sortedSessions = sessions.sort(function(session, otherSession) {
var hourDifference = otherSession.hour - session.hour;
var minuteDifference = otherSession.minutes - session.minutes;
if(hourDifference === 0) {
return minuteDifference;
}
else {
return hourDifference;
}
});
for(var sessionOrder = 0; sessionOrder < sortedSessions.length; sessionOrder++) {
var session = sortedSessions[sessionOrder];
dayTag.prepend("<div id='session_"+session.session.id+"' class='session'>"+
"<span class='room'>"+Config.rooms[session.room]+"</span>"+
"<h1>"+session.session.title+"</h1>"+
"<p class='authors'>"+session.session.authorsDisplayName()+"</p>"+
"<p class='limit' style='"+(session.session.audience_limit === undefined ? "display: none" : "")+"'>Limite: "+session.session.audience_limit+" participantes</p>"+
"<p class='tags' style='"+(session.session.tags.length === 0 ? "display: none;" : "")+"'>#"+session.session.tags.join(" #")+"</p>"+
"<p class='time'>"+Config.days[session.day]+" - "+session.hour+":"+session.minutes+"</p>"+
"</div>");
};
}
}
});
</script>
</body>
</html>