1import { Controller } from "../stimulus.js"; 2import { DEFAULTS, SHOW_SPINNER_ACTION, readFilterCookie, buildFilterParams } from 'searchFilterUtils'; 3 4export default class extends Controller { 5 static targets = ["input"]; 6 7 connect() { 8 const match = window.location.pathname.match(/^\/search\/(.+)$/); 9 if (match) { 10 this.inputTarget.value = decodeURIComponent(match[1]); 11 } 12 } 13 14 performSearch(e) { 15 e.preventDefault(); 16 const query = this.inputTarget.value.trim(); 17 if (query) { 18 this.dispatch(SHOW_SPINNER_ACTION); 19 window.Turbo.visit('/search/' + encodeURIComponent(query) + this.#filterParams()); 20 } 21 } 22 23 #filterParams() { 24 const filters = readFilterCookie() ?? DEFAULTS; 25 const queryString = buildFilterParams(filters).toString(); 26 return queryString ? '?' + queryString : ''; 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.