-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
86 lines (77 loc) · 2.32 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="index.css">
<link rel="stylesheet" type="text/css" href="highlights.css">
</head>
<body>
<h2></h2>
<ul id="tagList"></ul>
<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 src="Table.js"></script>
<script type="text/javascript">
var scheduledSessions = [];
var highlights = {};
var tagIndex = 0;
function retrieveSessions(address) {
$.getJSON(address)
.done(function(scheduled_sessions) {
$.each(scheduled_sessions, function(i) {
var scheduled = new ScheduledSession(this);
scheduled.positionYourself();
scheduledSessions.push(scheduled);
});
console.log("Successfully loaded " + address);
})
.fail(function() {
console.log("error retrieving accepted_sessions from " + address);
});
}
function buildBaseTable (day) {
var table = Table.create(day);
table.appendTo("#schedule")
}
function lightSessions () {
var selectedTag = $(this).attr("id");
console.log("lightSession tag: " + selectedTag);
if (highlights[selectedTag] == undefined) {
var highlightClass = "highlighted" + tagIndex;
$(this).parent().addClass(highlightClass);
$("." + selectedTag).addClass(highlightClass);
highlights[selectedTag] = tagIndex;
tagIndex = (tagIndex + 1) % 22;
} else {
var index = highlights[selectedTag];
var highlightClass = "highlighted" + index;
$("." + selectedTag).addClass(highlightClass);
$(this).parent().removeClass(highlightClass);
$("." + selectedTag).removeClass(highlightClass);
highlights[selectedTag] = undefined;
}
}
function buildTagList () {
$("h2").text("Destaque, abaixo, os assuntos te interessam mais!");
var tags = $("#tagList");
for (var i = Config.numberOfTags() - 1; i >= 0; i--) {
var item = $("<li>");
$("<a>").attr("id", Config.tagClass(i))
.text(Config.tag(i))
.click(lightSessions)
.appendTo(item);
item.appendTo(tags);
}
}
buildTagList();
buildBaseTable(1);
buildBaseTable(2);
buildBaseTable(3);
retrieveSessions("scheduled_extra_sessions.json");
retrieveSessions("scheduled_sessions.json");
</script>
</body>
</html>