//$('.accordion-element:first-of-type').not(':first').collapse(); // Collapse all but the first row on the page. // This section makes the search work. (function() { var searchTerm, panelContainerId, matchCount; var faqStatusRegion = document.getElementById('faq-search-status-{data.uid}'); var faqResultsFoundLabel = {faqResultsFoundLabel -> f:format.json()}; var faqResultFoundLabel = {faqResultFoundLabel -> f:format.json()}; var faqNoResultsFoundLabel = {faqNoResultsFoundLabel -> f:format.json()}; $('#accordion_search').on('change keyup', function() { searchTerm = $(this).val(); matchCount = 0; $('{data.searchAreaLimited}') $('.accordion-wrapper > .accordion-element') .each(function() { panelContainerId = '#' + $(this).attr('id'); // Makes search to be case insesitive $.extend($.expr[':'], { 'contains': function(elem, i, match, array) { return (elem.textContent || elem.innerText || '').toLowerCase() .indexOf((match[3] || "").toLowerCase()) >= 0; } }); // END Makes search to be case insensitive // Count how many panels match the current search term, so the // result total can be announced to assistive technology below. if ((this.textContent || this.innerText || '').toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { matchCount++; } // Show and Hide Triggers $(panelContainerId + ':not(:contains(' + searchTerm + '))').hide(); //Hide the rows that done contain the search query. $(panelContainerId + ':contains(' + searchTerm + ')').show(); //Show the rows that do! $(panelContainerId + ':not(:contains(' + searchTerm + '))').slideToggle(); //Hide the rows that done contain the search query. $(panelContainerId + ':contains(' + searchTerm + ')').slideToggle(); //Show the rows that do! $(panelContainerId + ':not(:contains(' + searchTerm + '))').fadeOut('slow'); //Hide the rows that done contain the search query. $(panelContainerId + ':contains(' + searchTerm + ')').fadeIn('slow'); //Show the rows that do! }); // Announce the live result count to screen reader users. Updating // textContent (rather than just show/hide) is what triggers the // aria-live announcement. if (faqStatusRegion) { if (searchTerm === '') { faqStatusRegion.textContent = ''; } else if (matchCount === 0) { faqStatusRegion.textContent = faqNoResultsFoundLabel; } else if (matchCount === 1) { faqStatusRegion.textContent = faqResultFoundLabel.replace('{0}', matchCount); } else { faqStatusRegion.textContent = faqResultsFoundLabel.replace('{0}', matchCount); } } }); }()); #ce-uid-{data.uid} input { background-color: {data.colorInput}!important; } #ce-uid-{data.uid} input:active, #ce-uid-{data.uid} input:focus { background-color: {data.colorInputFocus}!important; }