Files: ce4b7beb55a8ce0ae7e807490fa7dcb9fc37190d / javascripts / nav.js
806 bytesRaw
1 | (function() { |
2 | var nav_els, current_view, viewport_view; |
3 | nav_elm = document.getElementsByClassName('nav nav-tabs')[0]; |
4 | viewport_view = document.getElementById('viewport-view'); |
5 | if (!current_view) { |
6 | viewport_view.innerHTML = document.getElementById('viewport-home').innerHTML; |
7 | current_view = nav_elm.children[0]; |
8 | } |
9 | nav_elm.addEventListener('click', function (e) { |
10 | var hash, viewport; |
11 | if (e.target.hash) { |
12 | hash = e.target.hash.split('#')[1]; |
13 | viewport = document.getElementById('viewport-' + hash); |
14 | viewport_view.innerHTML = viewport.innerHTML; |
15 | e.target.parentElement.className = 'active'; |
16 | current_view.className = ''; |
17 | current_view = e.target.parentElement; |
18 | } |
19 | }); |
20 | }()); |
21 |
Built with git-ssb-web