Redesign settings page with sectioned layout, side navigation and choice cards
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b9bf3cd5f
commit
de22f035dc
11 files changed
+934
-294
No files matched your search
@@ -1,3 +1,47 @@
|
||||
(() => {
|
||||
const links = new Map([...document.querySelectorAll(".settings-nav a")].map(link => [link.hash.slice(1), link]));
|
||||
if (links.size === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lastId = [...links.keys()].at(-1);
|
||||
const atBottom = () => window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 4;
|
||||
const activate = id => {
|
||||
links.forEach(link => link.classList.toggle("active", link === links.get(id)));
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver(entries => {
|
||||
if (atBottom()) {
|
||||
activate(lastId);
|
||||
return;
|
||||
}
|
||||
|
||||
const visible = entries.find(entry => entry.isIntersecting);
|
||||
if (visible) {
|
||||
activate(visible.target.id);
|
||||
}
|
||||
}, { rootMargin: "-20% 0px -70% 0px" });
|
||||
|
||||
links.forEach((link, id) => {
|
||||
const section = document.getElementById(id);
|
||||
if (section) {
|
||||
observer.observe(section);
|
||||
}
|
||||
|
||||
link.addEventListener("click", () => activate(id));
|
||||
});
|
||||
|
||||
window.addEventListener("scroll", () => {
|
||||
if (atBottom()) {
|
||||
activate(lastId);
|
||||
}
|
||||
}, { passive: true });
|
||||
|
||||
if (location.hash && links.has(location.hash.slice(1))) {
|
||||
activate(location.hash.slice(1));
|
||||
}
|
||||
})();
|
||||
|
||||
(() => {
|
||||
const value = id => Number.parseInt(document.getElementById(id)?.value ?? "", 10);
|
||||
const output = document.getElementById("drip-bandwidth");
|
||||
|
||||
Reference in new issue
Block a user