agahnim.dev/templates/base.html
2026-05-16 22:58:29 +02:00

95 lines
3.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- Welcome!! -->
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, interactive-widget=resizes-content"
/>
<link rel="icon" type="image/gif" href="/static/assets/gifs/pcgif.gif" />
<!-- <title></title> -->
<title>Agahnim proto</title>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=DotGothic16&family=VT323&display=swap"
/>
<link rel="stylesheet" href="/static/style.css" />
<script src="/static/vendor/htmx.min.js"></script>
<script>
htmx.config.scrollIntoViewOnBoost = false;
</script>
</head>
<body hx-boost="true" hx-target="#content">
<crt>
<!-- They won't ever disappear -->
<persistent-ui>
{% include "partials/header.html" %}
<miniplayer-container id="miniplayer-container">
{% block miniplayer %}{% endblock %}
</miniplayer-container>
</persistent-ui>
<!-- Will get swapped by HTMX-->
<main id="content">{% block content %}{% endblock %}</main>
</crt>
<!-- Noooooooooooooooooooooooooo -->
<script src="/static/miniplayer.js"></script>
<script src="/static/contextmenu.js"></script>
<script>
function updateMiniplayerVisibility() {
const isMusicPage = window.location.pathname === "/music";
const miniplayer = document.getElementById("miniplayer-container");
if (miniplayer) {
miniplayer.style.display = isMusicPage ? "none" : "";
}
if (isMusicPage) {
const audio = document.querySelector("mini-player audio");
if (audio) audio.pause();
}
}
function updateNavState() {
const path = window.location.pathname;
document
.querySelectorAll('navbar input[type="radio"]')
.forEach((radio) => {
radio.checked = false;
});
if (path === "/home") {
const homeRadio = document.getElementById("nav-home");
if (homeRadio) homeRadio.checked = true;
} else if (path === "/music") {
const musicRadio = document.getElementById("nav-music");
if (musicRadio) musicRadio.checked = true;
} else if (path === "/blog") {
const blogRadio = document.getElementById("nav-blog");
if (blogRadio) blogRadio.checked = true;
} else if (path === "/about") {
const aboutRadio = document.getElementById("nav-about");
if (aboutRadio) aboutRadio.checked = true;
} else if (path === "/projects") {
const projectsRadio = document.getElementById("nav-projects");
if (projectsRadio) projectsRadio.checked = true;
}
}
function closeMobileMenu() {
const checkbox = document.getElementById("nav-toggle-checkbox");
if (checkbox) checkbox.checked = false;
}
updateMiniplayerVisibility();
updateNavState();
document.body.addEventListener("htmx:afterSwap", () => {
updateMiniplayerVisibility();
updateNavState();
closeMobileMenu();
window.scrollTo(0, 0);
});
</script>
</body>
</html>