summaryrefslogtreecommitdiffhomepage
path: root/src/templates/base.html.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates/base.html.tmpl')
-rw-r--r--src/templates/base.html.tmpl43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/templates/base.html.tmpl b/src/templates/base.html.tmpl
new file mode 100644
index 0000000..0d5e731
--- /dev/null
+++ b/src/templates/base.html.tmpl
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang={{ .Printer.Locale.Bcp }}>
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link href="/style.css" type="text/css" rel="stylesheet">
+ <!-- TODO: Translate website name -->
+ <title>Euro Cash</title>
+ <script type="text/javascript">
+ const $ = q => document.querySelector(q);
+ const $$ = q => document.querySelectorAll(q);
+
+ const validate = theme =>
+ ["light", "dark"].includes(theme) ? theme : "light";
+ const toggle = theme =>
+ theme == "light" ? "dark" : "light";
+
+ const setTheme = theme => {
+ localStorage.setItem("theme", theme);
+ $("html").setAttribute("data-theme", theme);
+ $(`#nav-icon-theme-${theme}`).style.display = "";
+ $(`#nav-icon-theme-${toggle(theme)}`).style.display = "none";
+ };
+
+ document.addEventListener("DOMContentLoaded", _ => {
+ $("#theme-button").onclick = () =>
+ setTheme(toggle(validate(localStorage.getItem("theme"))));
+ setTheme(validate(localStorage.getItem("theme")));
+ });
+ </script>
+ </head>
+ <body>
+ {{ template "content" . }}
+ <footer>
+ <p>
+ <small>
+ {{ .T "Found a mistake or want to contribute missing information?" }}
+ <a href="/about">{{ .T "Feel free to contact us!" }}</a>
+ </small>
+ </p>
+ </footer>
+ </body>
+</html>