-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.html
52 lines (45 loc) · 1.39 KB
/
base.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/icon.ico" type="image/x-icon" />
<title>@ndyg</title>
<meta property="og:title" content="@ndyg" />
<script>
const ONE_HOUR = 3600000;
const currentTime = Date.now();
const getSystemTheme = () =>
window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
let theme, expiry;
try {
({ theme, expiry } = JSON.parse(localStorage.getItem("theme") || "{}"));
} catch {
expiry = 0;
}
if (!expiry || currentTime - expiry >= ONE_HOUR) {
theme = getSystemTheme();
}
document.documentElement.setAttribute("data-theme", theme);
</script>
<link rel="stylesheet" href="/styles.css?v=1.1" />
</head>
<body>
<div style="padding-left: 1em; padding-right: 1em">
<header>
<h1>@<a href="/">ndyg</a></h1>
{% include 'socials.html' %}
</header>
<div>{% block main %}{% endblock %}</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("em").forEach((el) => {
if (el.textContent.startsWith("Status:")) {
el.classList.add("status");
}
});
});
</script>
</body>
</html>