-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
54 lines (53 loc) · 2.66 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
<!DOCTYPE html>
<html>
<head>
<title>Noodle - Search</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="autocompletion/autocomplete.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="autocompletion/autocomplete.js"></script>
<script type="text/javascript">
const sites = ['Future-of-computing', 'Basics-of-Computer-Science', 'AI-and-Ethics', 'Sustainability', 'Time-Management'];
window.addEventListener("load", (event) => {
document.getElementById("copyright").innerHTML = `©${new Date().getFullYear()} Niclas Jung | <a href="./about.html">About</a>`;
const site = sites[Math.floor(Math.random() * 5)]
document.getElementById("hint").innerHTML = site;
document.getElementById("hint").href = `article/${site.toLowerCase()}.html`;
autocomplete(document.getElementById("input"), sites);
});
function formsubmit (event) {
event.preventDefault();
if (sites.map(word => word.toLowerCase()).includes(document.getElementById('input').value.toLowerCase())) {
window.location.href = `./article/${document.getElementById('input').value.toLowerCase()}.html`;
}
else {
window.location.href = `./404.html?q=${document.getElementById('input').value}`;
}
};
</script>
</head>
<body>
<div class="center">
<div class="search">
<div class="noodle-logo">
<span class="blue">N</span>
<span class="red">o</span>
<span class="yellow">o</span>
<span class="blue">d</span>
<span class="green">l</span>
<span class="red">e</span>
</div>
<form onsubmit="formsubmit(event);" autocomplete="off">
<div class="autocomplete">
<input type="text" placeholder="Search..." id="input">
</div>
<button type="submit">Go</button>
</form>
<p>Search of the day: <a id="hint" style="font-weight: bold;" href="article/adventures.html">Adventures</a></p>
</div>
</div>
<p class="copyright" id="copyright">©2023 Niclas Jung | <a href="./about.html">About</a></p>
</body>
</html>