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 | |
Alex | dcb792f | 2021-10-04 14:24:21 -0500 | [diff] [blame^] | 35 | // Process all row_buttons |
| 36 | var coll = document.getElementsByClassName("row_button"); |
| 37 | var i; |
| 38 | |
| 39 | for (i = 0; i < coll.length; i++) { |
| 40 | coll[i].addEventListener("click", function() { |
| 41 | this.classList.toggle("row_active"); |
| 42 | var content = this.nextElementSibling; |
| 43 | if (content.style.maxHeight){ |
| 44 | content.style.maxHeight = null; |
| 45 | } else { |
| 46 | content.style.maxHeight = content.scrollHeight + "px"; |
| 47 | } |
| 48 | }); |
| 49 | } |
Alex | 4148552 | 2019-04-12 17:26:18 -0500 | [diff] [blame] | 50 | } |
| 51 | function openBar(evt, barName) { |
| 52 | // Declare all variables |
| 53 | var i, barcontent, baritems; |
| 54 | |
| 55 | // Get all elements with class="barcontent" and hide them |
| 56 | barcontent = document.getElementsByClassName("barcontent"); |
| 57 | for (i = 0; i < barcontent.length; i++) { |
| 58 | barcontent[i].style.display = "none"; |
| 59 | } |
| 60 | |
| 61 | // Get all elements with class="bar-item" and remove the class "active" |
| 62 | baritems = document.getElementsByClassName("bar-item"); |
| 63 | for (i = 0; i < baritems.length; i++) { |
| 64 | baritems[i].className = baritems[i].className.replace(" active", ""); |
| 65 | } |
| 66 | |
| 67 | // Show the current tab, and add an "active" class to the link that opened the tab |
| 68 | document.getElementById(barName).style.display = "block"; |
| 69 | evt.currentTarget.className += " active"; |
| 70 | } |
| 71 | </script> |