1//-------------------------------------------------------------------------------- 2// ACCESSIBILITY SCRIPTS 3//-------------------------------------------------------------------------------- 4// Adds click even on enter/return key for tab navigating slider revolution bullets 5//-------------------------------------------------------------------------------- 6document.addEventListener('DOMContentLoaded', function() { 7 // Stores attempts 8 var attempts = 0; 9 10 // Adds keypress listener to Revolution Slider bullet navigation if module wrapper is found and bullets exist, retries to find bullets up to 3 times 11 function sliderBulletTabNav() { 12 // Revolution Slider module wrapper 13 var moduleWrap = document.querySelector('rs-module-wrap'); 14 15 // If module exists, try to find bullet paginators 16 if (moduleWrap) { 17 // Get all bullets 18 var rs_bullets = document.querySelectorAll('rs-bullet'); 19 20 // If navigation bullets found, add keypress listener to enable enter/return click on focused bullet 21 if (rs_bullets.length > 0) { 22 rs_bullets.forEach(function(rs_bullets) { 23 // Add listener to each found bullet 24 rs_bullets.addEventListener('keypress', function(event) { 25 // Check if the key pressed is Enter (key code 13) 26 if (event.keyCode === 13 || event.which === 13) { 27 // Trigger a click on the keyboard focused bullet 28 rs_bullets.click(); 29 } 30 }); 31 }); 32 } else { 33 // retry up to 3 times, for handling the bullets loading after DOM usually 34 attempts++; 35 if (attempts <= 3) { 36 setTimeout(sliderBulletTabNav, 500); 37 } 38 } 39 } 40 } 41 // Start initial search 42 sliderBulletTabNav(); 43}); 44//--------------------------------------------------------------------------------------------------------------- 45// Closes the last main nav menu item for tab browsers when tabbing off the last sub menu item 46//--------------------------------------------------------------------------------------------------------------- 47document.addEventListener('DOMContentLoaded', function (){ 48 // Find last menu item 49 var lastMenuItem = document.querySelector('#primary-menu > li:last-child'); 50 var ulElement = lastMenuItem.querySelector('ul'); 51 function updateVisibility() { 52 // Tracks if last menu item has hover or focus-within states 53 let isHoveredOrFocused = lastMenuItem.matches(':hover, :focus-within'); 54 // Sets opacity and visibility on the last menu item ul based on if it's hovered or focused 55 ulElement.style.opacity = isHoveredOrFocused ? '1' : '0'; 56 ulElement.style.visibility = isHoveredOrFocused ? 'visible' : 'hidden'; 57 } 58 // Event listeners for updating visibility on focus in or out 59 lastMenuItem.addEventListener('focusin', updateVisibility); 60 lastMenuItem.addEventListener('focusout', updateVisibility); 61});
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.