1document.addEventListener('DOMContentLoaded', () => { 2 document.addEventListener('click', (event) => { 3 let formTitle = event.target.closest('.formTitle'); 4 if (formTitle) { 5 const allFormTitles = document.querySelectorAll('.formTitle'); 6 allFormTitles.forEach(ft => { 7 const description = ft.nextElementSibling; 8 if (ft !== formTitle) { 9 description.classList.remove('show'); 10 description.style.maxHeight = null; 11 ft.querySelector('.titleLabel').classList.remove('rotated'); 12 ft.classList.remove('toggled'); 13 } 14 }); 15 const description = formTitle.nextElementSibling; 16 description.classList.toggle('show'); 17 formTitle.querySelector('.titleLabel').classList.toggle('rotated'); 18 formTitle.classList.toggle('toggled'); 19 if (description.classList.contains('show')) { 20 description.style.maxHeight = description.scrollHeight + "px"; 21 } else { 22 description.style.maxHeight = null; 23 } 24 } 25 }); 26 27 // Toggle functionality for legends in fieldsets 28 var legends = document.querySelectorAll('fieldset .filterLegend'); 29 legends.forEach(function(legend) { 30 legend.addEventListener('click', function() { 31 var fieldset = legend.parentNode; 32 fieldset.classList.toggle('is-open'); 33 legends.forEach(function(otherLegend) { 34 if (otherLegend !== legend) { 35 otherLegend.parentNode.classList.remove('is-open'); 36 } 37 }); 38 }); 39 }); 40 41 // Reset radio buttons to 'Any' when selecting an option in the other group 42 document.querySelectorAll('input[type="radio"][name="formcat"], input[type="radio"][name="popular"]').forEach(radio => { 43 radio.addEventListener('change', (event) => { 44 if (event.target.name === 'formcat') { 45 // Set Popular Forms to 'Any' 46 document.querySelector('input[type="radio"][name="popular"][value="All"]').checked = true; 47 } else if (event.target.name === 'popular') { 48 // Set Category to 'Any' 49 document.querySelector('input[type="radio"][name="formcat"][value="All"]').checked = true; 50 } 51 }); 52 }); 53}); 54 55 56document.addEventListener('DOMContentLoaded', function() { 57 // Get the search input element 58 var searchInput = document.getElementById('edit-search--2'); 59 60 // Get all category and popular form radio buttons 61 var radioButtons = document.querySelectorAll('[name="formcat"], [name="popular"]'); 62 63 // Add a change event listener to each radio button 64 radioButtons.forEach(function(radioButton) { 65 radioButton.addEventListener('change', function() { 66 // Clear the search input value 67 searchInput.value = ''; 68 }); 69 }); 70 71 // Add a keyup event listener to the search input 72 if( searchInput != null ) { 73 searchInput.addEventListener('keyup', function() { 74 // Reset the category and popular form fields to "- Any -" 75 document.getElementById('edit-formcat-all--2').checked = true; 76 document.getElementById('edit-popular-all--2').checked = true; 77 }); 78 } 79});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.