Skip to content

Commit

Permalink
Another settings menu patch
Browse files Browse the repository at this point in the history
  • Loading branch information
soxfox42 committed May 25, 2023
1 parent 3d233da commit 0b28490
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ const settingsMenu = document.getElementById('settings')!;
const settingsIcon = document.getElementById('settings-icon')!;
let settingsTimer: number | undefined;
settingsIcon.addEventListener('click', () => {
if (settingsMenu.classList.toggle('open')) {
settingsMenu.classList.remove('disabled');
if (settingsTimer) {
clearTimeout(settingsTimer);
}
} else {
// Hide settings drawer after a moment to prevent mobile layout issues
if (settingsMenu.classList.contains('open')) {
settingsMenu.classList.remove('open');
clearTimeout(settingsTimer);
settingsTimer = setTimeout(() => settingsMenu.classList.add('disabled'), 1000);
} else {
settingsMenu.classList.remove('disabled');
clearTimeout(settingsTimer);
settingsTimer = setTimeout(() => settingsMenu.classList.add('open'), 10);
}
});

0 comments on commit 0b28490

Please sign in to comment.