1import { Controller } from '@hotwired/stimulus' 2 3/* stimulusFetch: 'lazy' */ 4export default class extends Controller { 5 static targets = ['map'] 6 7 events = [ 8 'shown.bs.collapse', 9 'shown.bs.modal', 10 'shown.bs.tab' 11 ] 12 13 connect() { 14 this.events.forEach(event => 15 document.addEventListener(event, this.dispatchViewShown.bind(this)) 16 ) 17 } 18 19 disconnect() { 20 this.events.forEach(event => 21 document.removeEventListener(event, this.dispatchViewShown.bind(this)) 22 ) 23 } 24 25 dispatchViewShown(e) { 26 this.hasMapTarget && this.mapTarget.dispatchEvent( 27 new CustomEvent('viewshown') 28 ) 29 30 const header = 31 e.target.closest('.accordion-item')?.querySelector('.accordion-header') 32 33 if ( !header ) { 34 return 35 } 36 37 const headerTop = header.getBoundingClientRect().top + window.scrollY 38 header.setAttribute('tabindex', '-1') 39 header.focus() 40 41 window.scrollTo({ 42 top: headerTop - 120, 43 behavior: 'smooth' 44 }) 45 } 46}
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.