|
|
@ -39,6 +39,9 @@ import { |
|
|
userManualBtn, |
|
|
userManualBtn, |
|
|
guideModal, |
|
|
guideModal, |
|
|
guideModalCloseBtn, |
|
|
guideModalCloseBtn, |
|
|
|
|
|
codebaseBtn, |
|
|
|
|
|
codebaseModal, |
|
|
|
|
|
codebaseModalCloseBtn, |
|
|
} from "./dom.js"; |
|
|
} from "./dom.js"; |
|
|
|
|
|
|
|
|
function toggleMenu(show) { |
|
|
function toggleMenu(show) { |
|
|
@ -67,6 +70,19 @@ function toggleGuideModal(show) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function toggleCodebaseModal(show) { |
|
|
|
|
|
if (show) { |
|
|
|
|
|
codebaseModal.classList.remove("hidden"); |
|
|
|
|
|
// Reset iframe to ensure it starts at the top
|
|
|
|
|
|
const iframe = codebaseModal.querySelector("iframe"); |
|
|
|
|
|
if (iframe) { |
|
|
|
|
|
iframe.src = iframe.src; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
codebaseModal.classList.add("hidden"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function handleColorToggles(e) { |
|
|
function handleColorToggles(e) { |
|
|
const colorToggles = [ |
|
|
const colorToggles = [ |
|
|
toggleSnrColor, |
|
|
toggleSnrColor, |
|
|
@ -108,6 +124,18 @@ export function initUIEventListeners() { |
|
|
toggleGuideModal(false); |
|
|
toggleGuideModal(false); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// --- Codebase Modal ---
|
|
|
|
|
|
codebaseBtn.addEventListener("click", (e) => { |
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
toggleCodebaseModal(true); |
|
|
|
|
|
}); |
|
|
|
|
|
codebaseModalCloseBtn.addEventListener("click", () => toggleCodebaseModal(false)); |
|
|
|
|
|
codebaseModal.addEventListener("click", (e) => { |
|
|
|
|
|
if (e.target === codebaseModal) { |
|
|
|
|
|
toggleCodebaseModal(false); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
// Global Key Listener for 'k' and 'ESC'
|
|
|
// Global Key Listener for 'k' and 'ESC'
|
|
|
document.addEventListener("keydown", (e) => { |
|
|
document.addEventListener("keydown", (e) => { |
|
|
@ -116,10 +144,12 @@ export function initUIEventListeners() { |
|
|
const isHidden = shortcutsModal.classList.contains("hidden"); |
|
|
const isHidden = shortcutsModal.classList.contains("hidden"); |
|
|
toggleShortcutsModal(isHidden); |
|
|
toggleShortcutsModal(isHidden); |
|
|
} |
|
|
} |
|
|
// Prioritize closing the guide modal if open, then shortcuts modal
|
|
|
|
|
|
|
|
|
// Prioritize closing the guide modal if open, then codebase, then shortcuts
|
|
|
if (e.key === "Escape") { |
|
|
if (e.key === "Escape") { |
|
|
if (!guideModal.classList.contains("hidden")) { |
|
|
if (!guideModal.classList.contains("hidden")) { |
|
|
toggleGuideModal(false); |
|
|
toggleGuideModal(false); |
|
|
|
|
|
} else if (!codebaseModal.classList.contains("hidden")) { |
|
|
|
|
|
toggleCodebaseModal(false); |
|
|
} else if (!shortcutsModal.classList.contains("hidden")) { |
|
|
} else if (!shortcutsModal.classList.contains("hidden")) { |
|
|
toggleShortcutsModal(false); |
|
|
toggleShortcutsModal(false); |
|
|
} |
|
|
} |
|
|
|