-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
62 lines (52 loc) · 2.29 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
<!DOCTYPE html>
<html>
<head>
<title>Mathu</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Fredoka+One" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- favicon -->
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
<link rel="shortcut icon" href="/favicon/favicon.ico">
</head>
<body>
<h1>Mathü</h1>
<input autofocus maxlength="11" id="name-input" placeholder="Display Name" style="opacity:1;"><br><br>
<button class="button" style="position: absolute; bottom: 3vh;" onclick="window.location.href='settings.html'">Settings</button>
<button id="leaderboard" class="button" style="position: absolute; bottom: 13vh;" onclick="window.location.href='leaderboard/'">Leaderboard</button>
<button id="submit" class="button" onclick="link(document.getElementById('name-input').value);">Start</button>
<script>
window.onload = function(){
if(localStorage.getItem("name") !== null){
document.getElementById("name-input").value = localStorage.getItem("name");
}
if(localStorage.getItem("qCount") === null){
localStorage.setItem("qCount", 10);
};
if(localStorage.getItem("negSubtraction") === null){
localStorage.setItem("negSubtraction", true);
};
}
var btn = document.getElementById("submit");
function link(name){
if(name == name.toUpperCase()){
name = name.toLowerCase();
}
if(name.length > 11){
name = name.substring(0, 11);
}
localStorage.setItem("name", name);
window.location.href = "main.html";
}
document.getElementById("name-input")
.addEventListener("keyup", function(event) {
event.preventDefault();
if (event.keyCode === 13) {
btn.click();
}
});
</script>
</body>
</html>