|
1 | | -// Claude Code Chat Browser — Entry module (router + theme + window registrations). |
| 1 | +// Claude Code Chat Browser — Entry module (router + theme + navbar wiring). |
2 | 2 | // Route modules live in sessions.js, projects.js, search.js, export.js. |
3 | 3 | // Shared helpers live in shared/utils.js, shared/markdown.js, shared/theme.js. |
4 | 4 |
|
5 | 5 | import { state } from './shared/state.js'; |
6 | 6 | import { toggleSidebar, closeSidebar, loadingBar } from './shared/utils.js'; |
7 | 7 | import { HLJS_THEME_SHEETS, applyHljsTheme, applyTheme, toggleTheme, setWorkspaceMode } from './shared/theme.js'; |
8 | 8 | import { showProjects } from './projects.js'; |
9 | | -import { showWorkspace, loadSession, selectSession, copyAll } from './sessions.js'; |
10 | | -import { showSearchPage, doSearch } from './search.js'; |
11 | | -import { bulkExport, downloadSession } from './export.js'; |
| 9 | +import { showWorkspace, loadSession } from './sessions.js'; |
| 10 | +import { showSearchPage } from './search.js'; |
12 | 11 |
|
13 | 12 | // ==================== Router ==================== |
14 | 13 |
|
@@ -69,22 +68,18 @@ document.addEventListener('DOMContentLoaded', () => { |
69 | 68 | topBtn.addEventListener('click', () => window.scrollTo({ top: 0, behavior: 'smooth' })); |
70 | 69 | document.body.appendChild(topBtn); |
71 | 70 | window.addEventListener('scroll', () => topBtn.classList.toggle('show', window.scrollY > 400)); |
72 | | -}); |
73 | | - |
74 | | -// ==================== Window registrations for inline HTML handlers ==================== |
75 | | -// Functions listed here are called from onclick="..." attributes in index.html or |
76 | | -// in HTML strings generated by route modules. ES module scope does not expose |
77 | | -// identifiers to the global scope automatically, so they must be registered on window. |
78 | 71 |
|
79 | | -window.showProjects = showProjects; |
80 | | -window.showSearchPage = showSearchPage; |
81 | | -window.toggleTheme = toggleTheme; |
82 | | -window.toggleSidebar = toggleSidebar; |
83 | | -window.selectSession = selectSession; |
84 | | -window.copyAll = copyAll; |
85 | | -window.downloadSession = downloadSession; |
86 | | -window.bulkExport = bulkExport; |
87 | | -window.doSearch = doSearch; |
| 72 | + document.getElementById('hamburger-btn')?.addEventListener('click', toggleSidebar); |
| 73 | + document.getElementById('navbar-brand')?.addEventListener('click', (e) => { |
| 74 | + e.preventDefault(); |
| 75 | + showProjects(); |
| 76 | + }); |
| 77 | + document.getElementById('nav-search-link')?.addEventListener('click', (e) => { |
| 78 | + e.preventDefault(); |
| 79 | + showSearchPage(); |
| 80 | + }); |
| 81 | + document.getElementById('theme-toggle')?.addEventListener('click', toggleTheme); |
| 82 | +}); |
88 | 83 |
|
89 | 84 | // Keep HLJS_THEME_SHEETS accessible for test_hljs_theme_consistency.py (source-level check) |
90 | 85 | export { HLJS_THEME_SHEETS }; |
0 commit comments