85 lines
3.1 KiB
Text
85 lines
3.1 KiB
Text
<header>
|
|
<nav>
|
|
<div class="nav-categories">
|
|
<a href="{{ "/" | url }}">{{ site.title }}</a>
|
|
<a href="{{ "/posts" | url }}">/posts</a>
|
|
<a href="{{ "/timeline" | url }}">/timeline</a>
|
|
<a href="{{ "/recipes" | url }}">/recipes</a>
|
|
<a href="{{ "/music" | url }}">/music</a>
|
|
<a href="{{ "/books" | url }}">/books</a>
|
|
</div>
|
|
<div class="nav-toggles">
|
|
<label class="nav-toggle-button">☀️<input type="radio" name="theme" value="light"/></label>
|
|
<label class="nav-toggle-button">🌒<input type="radio" name="theme" value="dark"/></label>
|
|
/
|
|
<label class="nav-toggle-button" data-language="english">English<input type="radio" name="language" value="english"/></label>
|
|
<label class="nav-toggle-button" data-language="aurebesh">Aurebesh<input type="radio" name="language" value="aurebesh"/></label>
|
|
<script type="text/javascript">
|
|
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
const defaultPrefs = {
|
|
language: 'english',
|
|
theme: darkModeMediaQuery.matches
|
|
? 'dark'
|
|
: 'light'
|
|
};
|
|
Object.entries(defaultPrefs).forEach(([key, defaultPref]) => {
|
|
const currentPref = localStorage.getItem(key) ?? defaultPref;
|
|
applyPreference(key, currentPref, false)
|
|
document.querySelectorAll(`input[name=${key}]`).forEach(input => {
|
|
input.addEventListener('change', (e) => {
|
|
applyPreference(key, e.currentTarget.value, true);
|
|
})
|
|
})
|
|
});
|
|
darkModeMediaQuery.addEventListener('change', e => {
|
|
if (localStorage.getItem('theme') != null) {
|
|
return;
|
|
}
|
|
applyPreference(
|
|
'theme',
|
|
e.matches
|
|
? 'dark'
|
|
: 'light',
|
|
false
|
|
);
|
|
})
|
|
function applyPreference(key, value, shouldSave) {
|
|
document.body.setAttribute(`data-${key}`, value);
|
|
document.querySelectorAll(`input[name=${key}]`).forEach(input => {
|
|
if (input.value === value) {
|
|
input.checked = true;
|
|
}
|
|
})
|
|
if (shouldSave) {
|
|
localStorage.setItem(key, value);
|
|
}
|
|
}
|
|
</script>
|
|
</div>
|
|
</nav>
|
|
<div class="scene">
|
|
<div class="sky">
|
|
<div id="brand">
|
|
<h1>{{ tag | capitalize if tag else title }}</h1>
|
|
<div class="header-meta">
|
|
{%- if author -%}
|
|
<author>{{ author }}</author>
|
|
{%- endif -%}
|
|
{%- if date -%}
|
|
<date>{{ date | formatDate("MMMM D, YYYY") }}</date>
|
|
{%- endif -%}
|
|
</div>
|
|
</div>
|
|
<div class="cloud" style="--n: 0"></div>
|
|
<div class="cloud" style="--n: 1"></div>
|
|
<div class="cloud" style="--n: 2"></div>
|
|
<div class="cloud" style="--n: 3"></div>
|
|
<div class="cloud" style="--n: 4"></div>
|
|
<div class="cloud" style="--n: 5"></div>
|
|
<div class="cloud" style="--n: 6"></div>
|
|
<div class="cloud" style="--n: 7"></div>
|
|
<div class="cloud" style="--n: 8"></div>
|
|
<div class="cloud" style="--n: 9"></div>
|
|
</div>
|
|
</div>
|
|
</header>
|