home: wip
This commit is contained in:
parent
f129d40ae1
commit
12b390d068
3 changed files with 144 additions and 65 deletions
|
|
@ -16,58 +16,58 @@
|
|||
</head>
|
||||
|
||||
<body hx-boost="true" hx-target="#content">
|
||||
<crt>
|
||||
<persistent-ui>
|
||||
{% include "partials/header.html" %}
|
||||
<miniplayer-container id="miniplayer-container">
|
||||
{% block miniplayer %}{% endblock %}
|
||||
</miniplayer-container>
|
||||
</persistent-ui>
|
||||
<crt>
|
||||
<persistent-ui>
|
||||
{% include "partials/header.html" %}
|
||||
<miniplayer-container id="miniplayer-container">
|
||||
{% block miniplayer %}{% endblock %}
|
||||
</miniplayer-container>
|
||||
</persistent-ui>
|
||||
|
||||
<main id="content">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
</crt>
|
||||
<main id="content">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
</crt>
|
||||
|
||||
<script src="/static/miniplayer.js"></script>
|
||||
<script>
|
||||
function updateMiniplayerVisibility() {
|
||||
const isMusicPage = window.location.pathname === '/music';
|
||||
const miniplayer = document.getElementById('miniplayer-container');
|
||||
if (miniplayer) {
|
||||
miniplayer.style.display = isMusicPage ? 'none' : '';
|
||||
}
|
||||
<script src="/static/miniplayer.js"></script>
|
||||
<script>
|
||||
function updateMiniplayerVisibility() {
|
||||
const isMusicPage = window.location.pathname === '/music';
|
||||
const miniplayer = document.getElementById('miniplayer-container');
|
||||
if (miniplayer) {
|
||||
miniplayer.style.display = isMusicPage ? 'none' : '';
|
||||
}
|
||||
}
|
||||
|
||||
function updateNavState() {
|
||||
const path = window.location.pathname;
|
||||
document.querySelectorAll('navbar input[type="radio"]').forEach(radio => {
|
||||
radio.checked = false;
|
||||
});
|
||||
if (path === '/') {
|
||||
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;
|
||||
}
|
||||
function updateNavState() {
|
||||
const path = window.location.pathname;
|
||||
document.querySelectorAll('navbar input[type="radio"]').forEach(radio => {
|
||||
radio.checked = false;
|
||||
});
|
||||
if (path === '/') {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
function closeMobileMenu() {
|
||||
const checkbox = document.getElementById('nav-toggle-checkbox');
|
||||
if (checkbox) checkbox.checked = false;
|
||||
}
|
||||
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>
|
||||
|
||||
document.body.addEventListener('htmx:afterSwap', () => {
|
||||
updateMiniplayerVisibility();
|
||||
updateNavState();
|
||||
closeMobileMenu();
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue