-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
200 lines (190 loc) · 6.15 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="styles.css" />
<link rel="icon" href="/favicon-32x32.png" type="image/png" />
<title>YoannFleuryDev's StartPage</title>
</head>
<body>
<div id="search">
<input
id="search-field"
type="text"
name="search-field"
onkeypress="return search(event)"
/>
</div>
<div class="container">
<div id="clock"></div>
<div class="weather-container">
<div class="row">
<div id="weather-description" class="inline"></div>
<div class="inline">-</div>
<div id="temp" class="inline"></div>
</div>
</div>
<div class="bookmark-container">
<div class="bookmark-set">
<div class="bookmark-title">
<span role="img" aria-label="Calendar">📅</span> Daily
</div>
<div class="bookmark-inner-container">
<a
class="bookmark"
href="https://gmail.google.com/"
target="_blank"
rel="noopener noreferrer"
>Gmail</a
>
<a
class="bookmark"
href="https://github.com/"
target="_blank"
rel="noopener noreferrer"
>GitHub</a
>
<a
class="bookmark"
href="https://calendar.google.com/"
target="_blank"
rel="noopener noreferrer"
>Calendar</a
>
</div>
</div>
<div class="bookmark-set">
<div class="bookmark-title">
<span role="img" aria-label="TV">📺</span> Media
</div>
<div class="bookmark-inner-container">
<a
class="bookmark"
href="https://youtube.com"
target="_blank"
rel="noopener noreferrer"
>Youtube</a
>
<a
class="bookmark"
href="https://netflix.com"
target="_blank"
rel="noopener noreferrer"
>Netflix</a
>
<a
href="http://twitch.tv"
class="bookmark"
target="_blank"
rel="noopener noreferrer"
>Twitch</a
>
</div>
</div>
<div class="bookmark-set">
<div class="bookmark-title">
<span role="img" aria-label="Orange Circle">🟠</span> Reddit
</div>
<div class="bookmark-inner-container">
<a
class="bookmark"
href="https://reddit.com/r/battlestations"
target="_blank"
rel="noopener noreferrer"
>/r/battlestations</a
>
<a
class="bookmark"
href="https://reddit.com/r/unixporn"
target="_blank"
rel="noopener noreferrer"
>/r/unixporn</a
>
<a
class="bookmark"
href="https://reddit.com/r/vim"
target="_blank"
rel="noopener noreferrer"
>/r/vim</a
>
</div>
</div>
<div class="bookmark-set">
<div class="bookmark-title">
<span role="img" aria-label="Computer Scientist">👩💻</span> Social
</div>
<div class="bookmark-inner-container">
<a
class="bookmark"
href="https://twitter.com"
target="_blank"
rel="noopener noreferrer"
>Twitter</a
>
<a
class="bookmark"
href="https://linkedin.com"
target="_blank"
rel="noopener noreferrer"
>Linkedin</a
>
</div>
</div>
</div>
</div>
<script>
const dateTimeFormatter = new Intl.DateTimeFormat("en-GB", {
timeStyle: "medium",
});
function closeSearch() {
document.getElementById("search-field").value = "";
document.getElementById("search-field").blur();
document.getElementById("search").style.display = "none";
}
// Search on enter key event
function search(e) {
if (e.keyCode == 13) {
var val = document.getElementById("search-field").value;
window.open("https://google.com/search?q=" + val);
closeSearch();
}
}
// Get current time and format
function getTime() {
const date = new Date();
return dateTimeFormatter.format(date);
}
window.onload = async () => {
const response = await fetch(
"https://api.openweathermap.org/data/2.5/weather?q=Amiens,France&units=metric&appid=e5b292ae2f9dae5f29e11499c2d82ece"
);
if (response.ok) {
const json = await response.json();
document.getElementById("temp").innerHTML =
json.main.temp.toFixed(0) + "°C";
document.getElementById("weather-description").innerHTML =
json.weather[0].description;
}
// Set up the clock
document.getElementById("clock").innerHTML = getTime();
// Set clock interval to tick clock
setInterval(() => {
document.getElementById("clock").innerHTML = getTime();
}, 100);
};
document.addEventListener("keydown", (event) => {
if (event.keyCode == 32) {
// Spacebar code to open search
document.getElementById("search").style.display = "flex";
document.getElementById("search-field").focus();
event.stopPropagation();
} else if (event.keyCode == 27) {
// Esc to close search
closeSearch();
}
});
</script>
</body>
</html>