1var addressCollapse = function(selector) { 2 this.selector = selector; 3 this.collapseId = selector.dataset.addressCollapse; 4 this.button = selector.querySelector('.address-group-collapse-btn'); 5 this.hidableItems = null 6 7 this.toggle = (e) => { 8 const element = document.querySelector('#collapse-' + this.collapseId) 9 10 let state = dkSlideToggle( 11 element, 12 400, 13 { 14 classToggleElement: selector, 15 classToggle: 'open', 16 } 17 ) 18 19 if (state) { 20 //open -> allow tab 21 this.allowTabindex(true) 22 } else { 23 //closed -> deny tab 24 this.allowTabindex(false) 25 } 26 27 this.toggleButtonAriaPressed(this.button); 28 } 29 30 this.init = () => { 31 this.hidableItems = this.selector.querySelectorAll('.address-group--infos--table--item:not(:nth-of-type(-n+3)) a') 32 this.allowTabindex(false) 33 34 this.button.addEventListener('click', e => { 35 this.toggle(e); 36 }) 37 38 this.button.addEventListener('keydown', e => { 39 if (e.key === ' ') { 40 // Prevent space 41 e.preventDefault(); 42 } else if (e.key === 'Enter') { 43 // If enter is pressed, activate the button 44 e.preventDefault(); 45 this.toggle(e); 46 } 47 }) 48 } 49 50 51 this.allowTabindex = (allow) => { 52 if (allow) { 53 this.hidableItems.forEach(item => item.removeAttribute('tabindex')) 54 } 55 if (!allow) { 56 this.hidableItems.forEach(item => item.setAttribute('tabindex', '-1')) 57 } 58 } 59 60 this.init(); 61 62 this.toggleButtonAriaPressed = function(button) { 63 let isAriaPressed = button.getAttribute('aria-pressed') === 'true'; 64 button.setAttribute('aria-pressed', isAriaPressed ? 'false' : 'true'); 65 } 66} 67addressCollapseItems = document.querySelectorAll('[data-address-collapse]'); 68if (addressCollapseItems.length > 0) { 69 addressCollapseItems.forEach((item) => { 70 new addressCollapse(item); 71 }) 72} 73
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.