2026-06-05 14:31:12 -06:00
|
|
|
---
|
|
|
|
|
import "../styles/global.css";
|
2026-11-24 14:30:44 -07:00
|
|
|
import Menu from './Menu.astro';
|
2026-06-05 14:31:12 -06:00
|
|
|
|
2026-11-24 19:32:44 -07:00
|
|
|
import { Icon } from 'astro-icon/components';
|
|
|
|
|
|
2026-07-09 19:33:16 -06:00
|
|
|
import { urlfrag } from '../utils/path';
|
|
|
|
|
|
2026-06-05 14:31:12 -06:00
|
|
|
const base = import.meta.env.BASE_URL;
|
|
|
|
|
---
|
2026-12-02 18:25:32 -07:00
|
|
|
<header id="header">
|
2026-11-23 14:42:32 -07:00
|
|
|
<div class="justify-self-start">
|
2026-11-24 14:30:44 -07:00
|
|
|
<Menu />
|
2026-11-23 14:42:32 -07:00
|
|
|
</div>
|
|
|
|
|
<h1 class="text-center">
|
2026-07-09 15:39:55 -06:00
|
|
|
<a href={base}><b>Just Us</b> Notes</a>
|
2026-11-23 14:42:32 -07:00
|
|
|
</h1>
|
2026-11-24 19:32:44 -07:00
|
|
|
<div class="justify-self-end flex items-center gap-2">
|
|
|
|
|
<a id="af-toggle" class="hidden">
|
|
|
|
|
<Icon name="eye" desc="Disable Accessibility Options" />
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
2026-12-02 18:25:32 -07:00
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
const header = document.getElementById('header');
|
|
|
|
|
const DWELL_TIME = 1500;
|
|
|
|
|
let lastpos = window.scrollY;
|
|
|
|
|
let hideTimeout: NodeJS.Timeout;
|
2026-12-03 14:07:33 -07:00
|
|
|
let hideScroll = false;
|
2026-12-02 18:25:32 -07:00
|
|
|
function onScroll() {
|
|
|
|
|
const currentpos = window.scrollY;
|
|
|
|
|
clearTimeout(hideTimeout);
|
2026-12-03 14:07:33 -07:00
|
|
|
if (hideScroll) {
|
|
|
|
|
header?.classList.add('-translate-y-full');
|
|
|
|
|
hideScroll = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-12-02 18:25:32 -07:00
|
|
|
if (currentpos <= 100 || currentpos < lastpos) {
|
|
|
|
|
header?.classList.remove('-translate-y-full');
|
|
|
|
|
console.log("<", currentpos, lastpos);
|
|
|
|
|
} else if (currentpos > lastpos) {
|
|
|
|
|
header?.classList.remove('-translate-y-full');
|
|
|
|
|
hideTimeout = setTimeout(() => {
|
|
|
|
|
//if (window.scrollY > 100) {
|
|
|
|
|
header?.classList.add('-translate-y-full');
|
|
|
|
|
//}
|
|
|
|
|
}, DWELL_TIME);
|
|
|
|
|
}
|
|
|
|
|
lastpos = currentpos;
|
|
|
|
|
}
|
2026-12-03 14:07:33 -07:00
|
|
|
document.querySelectorAll('sup > a').forEach((el) => {
|
|
|
|
|
el.addEventListener('click', () => {
|
|
|
|
|
hideScroll = true;
|
|
|
|
|
}, {passive: true});
|
|
|
|
|
});
|
2026-12-02 18:25:32 -07:00
|
|
|
header?.addEventListener('mouseenter', () => clearTimeout(hideTimeout));
|
|
|
|
|
header?.addEventListener('focusin', () => clearTimeout(hideTimeout));
|
|
|
|
|
window.addEventListener('scroll', onScroll, {passive: true});
|
|
|
|
|
</script>
|