-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
121 lines (103 loc) · 4.68 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Advent of Code Ranking</title>
<meta name="author" content="Iskandar Setiadi">
<meta content="Show all non-zero score AoC participants in one, global scoreboard" name="description" />
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/dataTables.bootstrap.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css" rel="stylesheet" />
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script type="text/javascript" src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script type="text/javascript" src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<a class="github-fork-ribbon right-bottom fixed" href="https://github.com/freedomofkeima/aoc-ranking" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>
<div class="container-fluid">
<h2>Advent of Code Ranking</h2>
<form name="yearForm">
<label style="font-size: large;">
<b>Year:</b>
<select name="year"></select>
</label>
</form>
<div id="table-containers"></div>
</div><!-- /.container -->
<footer class='footer'>
<div class='container-fluid'>
<hr />
<p class='pull-left'><a href='https://github.com/freedomofkeima/aoc-ranking'>Advent of Code Ranking</a></p>
</div>
</footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.csv.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="js/csv_to_html_table.js"></script>
<script type="text/javascript">
var years = [], today = new Date(), initialized = {};
for (var j = 2015; j < today.getFullYear() + (today.getMonth() == 11); j++) {
years.push(j);
initialized[j] = false;
var container = document.createElement("div");
container.id = "table-container-" + j;
container.style.display = "none";
document.getElementById("table-containers").appendChild(container);
var option = document.createElement("option");
option.value = j;
option.appendChild(document.createTextNode(j));
document.yearForm.year.prepend(option);
}
var prev = today.getFullYear().toString();
document.yearForm.year.value = prev;
document.yearForm.year.addEventListener('change', function() {
if (this.value !== prev) {
switch_year(this.value);
prev = this.value;
}
});
function format_link(link){
if (link)
return "<a href='" + link + "' target='_blank'>Link</a>";
else
return "";
}
function format_avatar(link){
if (link)
return "<img src='" + link + "' height='30'/>";
else
return "";
}
function switch_year(year) {
if (!initialized[year]) {
CsvToHtmlTable.init({
csv_path: 'data/' + year + '.txt',
element: 'table-container-' + year,
allow_download: true,
csv_options: {separator: ',', delimiter: '"'},
datatables_options: {"paging": false},
custom_formatting: [[3, format_link], [4, format_avatar]]
});
initialized[year] = true;
}
for (var i of years) {
document.getElementById("table-container-" + i).style.display = "none";
}
document.getElementById("table-container-" + year).style.display = "block";
}
switch_year(today.getFullYear())
</script>
</body>
</html>
<!-- Made with ♥ by freedomofkeima - Iskandar Setiadi © 2020 -->