1import { Controller } from "@hotwired/stimulus" 2 3// Connects to data-controller="admin--search" 4export default class extends Controller { 5 static targets = ['inputStr', 'modalElem'] 6 7 connect() { 8 let adminSearchModalEl = document.querySelector('#adminSearchModal'); 9 if (adminSearchModalEl) { 10 document.addEventListener('keydown', (event) => { 11 if (event.metaKey && event.key === 'k') { 12 event.preventDefault(); 13 event.stopPropagation(); 14 document.querySelector('[data-bs-target="#adminSearchModal"]').click() 15 } 16 }); 17 adminSearchModalEl.addEventListener('shown.bs.modal', (_event) => { 18 this.inputStrTarget.focus(); 19 }) 20 adminSearchModalEl.addEventListener('hide.bs.modal', (_event) => { 21 this.inputStrTarget.value =''; 22 document.querySelector("#admin-search-results").innerHTML = ''; 23 }) 24 } 25 } 26 27 search() { 28 clearTimeout(this.timeout) 29 this.timeout = setTimeout(() => { 30 if (this.inputStrTarget.value.length > 1) { 31 this.element.requestSubmit() 32 } 33 }, 200) 34 } 35}
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.