1import {Controller} from '@hotwired/stimulus' 2import {SearchControlBinding} from "sites/search_control" 3 4export default class extends Controller { 5 static values= {autocompleteCategories: String} 6 connect() { 7 SearchControlBinding.setupEasyAutocomplete({ 8 cssIdentifier: '.job-search-control', 9 categories: JSON.parse(this.autocompleteCategoriesValue), 10 list: { 11 maxNumberOfElements: 16, 12 sort: {enabled: true} 13 }, 14 listItemTemplate: (value, item, index) => { 15 return `<a href="${item.url}"><span id="${SearchControlBinding.cssIdFromItem(item, index)}"><span class="autocomplete-value">${value}</span><span class="autocomplete-count">${item.count ? item.count : ''}</span></span></a>`; 16 }, 17 }) 18 } 19 20 submit(e) { 21 e.preventDefault() 22 const form = e.target 23 const queryElement = form.querySelector('input[name="query"]') 24 if (queryElement) { 25 window.location.href = SearchControlBinding.buildUrl(form.action, queryElement.value) 26 } 27 } 28}
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.