blob: e6c4a1d4cd7410828559d5f8098b32308535d19f (
plain) (
blame)
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
|
package templates
import "git.thomasvoss.com/euro-cash.eu/i18n"
templ Base(head, body templ.Component) {
{{ p := ctx.Value("printer").(i18n.Printer) }}
<!DOCTYPE html>
<html lang={ p.Locale.Bcp }>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" type="text/css" href="/style.css"/>
<title>Euro Cash</title>
<script type="text/javascript">
const validate = theme =>
["light", "dark"].includes(theme) ? theme : "light";
const toggle = theme =>
theme == "light" ? "dark" : "light";
const setTheme = theme => {
localStorage.setItem("theme", theme);
document
.getElementsByTagName("html")[0]
.setAttribute("data-theme", theme);
document
.getElementById(`nav-icon-theme-${theme}`)
.style.display = '';
document
.getElementById(`nav-icon-theme-${toggle(theme)}`)
.style.display = 'none';
};
document.addEventListener('DOMContentLoaded', _ => {
document.getElementById("theme-button").onclick = () => {
setTheme(toggle(validate(localStorage.getItem("theme"))));
};
setTheme(validate(localStorage.getItem("theme")));
});
</script>
if head != nil {
@head
}
</head>
<body>
if body != nil {
@body
}
<footer>
<p>
<small>
{ p.T("Found a mistake or want to contribute missing information?") }
<a href="/">{ p.T("Feel free to contact us!") }</a>
</small>
</p>
</footer>
</body>
</html>
}
|