diff options
| author | Matthew Kosarek <matthew.kosarek@vention.cc> | 2021-02-25 20:50:12 -0500 |
|---|---|---|
| committer | Matthew Kosarek <matthew.kosarek@vention.cc> | 2021-02-25 20:50:12 -0500 |
| commit | 026abdb98ad30209df0e88795f25b1f74556585e (patch) | |
| tree | 39c7e60ea78331ada41fc71bc5f6e5b91b5fd75c /frontend/index.js | |
| parent | f0d1398b0d1b1a7c5bd1d4e0b3488b7f1aa74364 (diff) | |
Updated the sidebar for usability's sake
Diffstat (limited to 'frontend/index.js')
| -rw-r--r-- | frontend/index.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/frontend/index.js b/frontend/index.js index d14ca95..b943463 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -6,8 +6,29 @@ $.get('/navbar.html', function(pData) { $('nav').html(pData); - const lPathName = window.location.pathname.length > 1 && window.location.pathname.startsWith('/') ? window.location.pathname.substr(1) : window.location.pathname; - $('nav').find('a[href="' + lPathName + '"').addClass('nav-selected'); + // Set selected tab as selected + $('nav').find('a').removeClass('nav-selected'); + $('nav').find('a[href="' + window.location.pathname + '"').addClass('nav-selected'); + + // Set up tree callbacks + $('.outer-tree > li').click(function() { + $(this).toggleClass('expanded'); + }) + + $('.inner-tree > li').click(function(pEv) { + pEv.stopPropagation(); + }) + + // Open up the selected document from the navigation tree + var lSplitPath = window.location.pathname.split('/'); + if (lSplitPath.length < 3) { + return; + } + + if (lSplitPath[1] === '2d') { + $('nav > ul > li:first-child').addClass('expanded'); + $('nav > ul > li:last-child').removeClass('expanded'); + } }); } |
