1let initialized = false; 2 3export default function init(){ 4 if (!initialized){ 5 document.addEventListener('click.offselect', closeAll); 6 } 7 document.querySelectorAll('.select.fresh').forEach(initCustomSelect); 8 initialized = true; 9} 10 11function initCustomSelect(e){ 12 let select = e.querySelector('select'); 13 select.container = e; 14 select.addEventListener('focus', selectOpen); 15 select.addEventListener('blur', selectClosed); 16 select.addEventListener('change', selectClosed); 17 e.classList.remove('fresh'); 18 styleSelection(select); 19} 20 21function selectOpen(){ 22 this.container.classList.add('open'); 23} 24 25function selectClosed(){ 26 this.container.classList.remove('open'); 27 styleSelection(this); 28} 29 30function closeAll(e){ 31 if (!(e.target.tagName == 'SELECT' && e.target.classNames && e.target.classNames.contains('styled'))){ 32 document.querySelectorAll('.select.open').forEach((e) => { e.classList.remove('open'); }); 33 } 34} 35 36function styleSelection(select){ 37 if (select.value.toString().trim() == ''){ 38 select.classList.add('blank'); 39 } else { 40 select.classList.remove('blank'); 41 } 42};
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.