This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
121 lines (107 loc) · 5.74 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>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="./style.css">
<title>CS 170 Spring 2021 Project Leaderboard</title>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sjcl/1.0.8/sjcl.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.5.1/tabletop.min.js'></script>
<!--Autocomplete CSS/JS-->
<link rel="stylesheet" href="awesomplete.css"/>
<script src="awesomplete.min.js" async></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand nav-title" onclick="moveToIndex()"><span class="lg-view">CS 170 Spring 2021 Project Leaderboard</span><span class="sm-view">CS 170 Leaderboard</span></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
</ul>
<form class="navbar-form form-inline my-2 my-lg-0" style="padding-right: 0.5em;">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="size" id="inlineRadio1" value="small">
<label class="form-check-label" for="inlineRadio1">S</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="size" id="inlineRadio2" value="medium">
<label class="form-check-label" for="inlineRadio2">M</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="size" id="inlineRadio3" value="large">
<label class="form-check-label" for="inlineRadio3">L</label>
</div>
<input class="form-control mr-sm-2" type="search" maxlength="3" name="num" placeholder="Input Number" aria-label="Input Number">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><i class="fa fa-search"></i> Input</button>
</form>
<form class="navbar-form form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" name="team" placeholder="Team Name" aria-label="Team Name" id="autocomplete">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><i class="fa fa-search"></i> Team
</button>
</form>
</div>
</nav>
<div class="container">
<h1 id="table-title" class="title pt-4"></h1>
<br>
<div class="container" id="table">
<div class="loader"></div>
</div>
</div>
<!--Leaderboard JS-->
<script src="leaderboard.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-database.js"></script>
<script>
async function refresh(graphName) {
document.getElementById("table").innerHTML = '<div class="loader"></div>';
await generateLeaderboard(graphName, firebase)
}
async function teamView(teamName) {
document.getElementById("table").innerHTML = '<div class="loader"></div>';
await generateTeamView(teamName, firebase);
}
async function router(event) {
const size = getQueryVariable('size');
const num = getQueryVariable('num');
const team = getQueryVariable('team');
let graphName = null;
if (!(size == null || num == null)) {
await refresh(`${size}-${num}`);
} else if (team != null) {
await teamView(team);
} else {
await refresh(null);
}
let autocompleteInput = document.getElementById("autocomplete");
await loadAutocomplete(autocompleteInput, firebase);
}
function moveToTeam(teamName) {
window.location.search = `?team=${teamName}`;
}
function moveToLeaderboard(graphName) {
const size = graphName.split('-')[0];
const num = graphName.split('-')[1];
window.location.search = `?size=${size}&num=${num}`;
}
function moveToIndex() {
window.location.search = "";
}
window.addEventListener('load', (event) => router(event), false);
window.addEventListener('hashchange', (event) => router(event), false);
</script>
</body>
</html>