Alex | 4148552 | 2019-04-12 17:26:18 -0500 | [diff] [blame] | 1 | <script language="JavaScript"> |
| 2 | function toggleClassByID(pkg) { |
| 3 | var element = document.getElementById(pkg); |
| 4 | //var button = document.getElementById(pkg+"_button"); |
| 5 | |
| 6 | if( element.className && element.className.indexOf("in") > -1 ) { |
| 7 | element.classList.remove("in"); |
| 8 | //button.innerHTML = "↑" |
| 9 | } |
| 10 | else { |
| 11 | element.classList.add("in"); |
| 12 | //button.innerHTML = "↓" |
| 13 | } |
| 14 | } |
| 15 | </script> |
| 16 | <script language="JavaScript"> |
| 17 | function init() { |
| 18 | // Declare all variables |
| 19 | var i, content, items; |
| 20 | |
| 21 | // Get all elements with class="barcontent" and hide them |
| 22 | content = document.getElementsByClassName("barcontent"); |
| 23 | for (i = 1; i < content.length; i++) { |
| 24 | content[i].style.display = "none"; |
| 25 | } |
| 26 | content[0].style.display = "block"; |
| 27 | |
| 28 | // Get all elements with class="bar-item" and remove the class "active" |
| 29 | items = document.getElementsByClassName("bar-item"); |
| 30 | for (i = 1; i < items.length; i++) { |
| 31 | items[i].className = items[i].className.replace(" active", ""); |
| 32 | } |
| 33 | items[0].className += " active"; |
| 34 | |
| 35 | } |
| 36 | function openBar(evt, barName) { |
| 37 | // Declare all variables |
| 38 | var i, barcontent, baritems; |
| 39 | |
| 40 | // Get all elements with class="barcontent" and hide them |
| 41 | barcontent = document.getElementsByClassName("barcontent"); |
| 42 | for (i = 0; i < barcontent.length; i++) { |
| 43 | barcontent[i].style.display = "none"; |
| 44 | } |
| 45 | |
| 46 | // Get all elements with class="bar-item" and remove the class "active" |
| 47 | baritems = document.getElementsByClassName("bar-item"); |
| 48 | for (i = 0; i < baritems.length; i++) { |
| 49 | baritems[i].className = baritems[i].className.replace(" active", ""); |
| 50 | } |
| 51 | |
| 52 | // Show the current tab, and add an "active" class to the link that opened the tab |
| 53 | document.getElementById(barName).style.display = "block"; |
| 54 | evt.currentTarget.className += " active"; |
| 55 | } |
| 56 | </script> |