1class CatalogSearch { 2 constructor() { 3 this.form = document.querySelector(".k1-catalog-search-form-js"); 4 5 if (this.form) { 6 this.query = ""; 7 this.init(); 8 } 9 10 } 11 getFormAction() { 12 this.query = this.form.querySelector("input[name=q]")?.value; 13 const subcategories = [...this.form.querySelectorAll("input[type=checkbox][name=tag]")]; 14 let tags = 15 subcategories 16 .filter(input => input.checked) 17 .map(input => input.value.trim()) 18 .join(";"); 19 return `/search/catalog/?q=${this.query}&tag=${tags}`; 20 } 21 submitHandler(event) { 22 event.preventDefault(); 23 let action = this.getFormAction(); 24 this.form.action = action; 25 console.log(action); 26 window.location.href=action; 27 } 28 addHandlers() { 29 this.form.addEventListener("submit", this.submitHandlerBind); 30 } 31 init() { 32 this.submitHandlerBind = this.submitHandler.bind(this); 33 this.addHandlers(); 34 } 35} 36 37class K1FormHandler { 38 form = null; 39 fileInput = null; 40 fileInputs = null; 41 constructor() { 42 this.form = document.querySelector(".k1-form form[name=FEEDBACK_FORM]"); 43 if (this.form) { 44 this.init(); 45 } 46 } 47 48 handlerFileInput({target}) { 49 const {files} = target; 50 if (files.length) { 51 let str = ""; 52 const prevElement = target.previousElementSibling; 53 for (let a of files) { 54 str += `<span class="k1-form-file-fake">${a.name}</span><br />`; 55 } 56 prevElement.innerHTML = ""; 57 prevElement.insertAdjacentHTML("afterbegin", str); 58 } 59 } 60 addHandlers() { 61 if (this.fileInput) { 62 this.fileInput.addEventListener("change", this.handlerFileInputBind); 63 } 64 if (this.fileInputs && this.fileInputs.length) { 65 for (let input of this.fileInputs) 66 input.addEventListener("change", this.handlerFileInputBind); 67 } 68 } 69 init() { 70 // this.fileInput = this.form.querySelector("input[type=file]"); 71 this.fileInputs = this.form.querySelectorAll("input[type=file]"); 72 this.handlerFileInputBind = this.handlerFileInput.bind(this); 73 this.addHandlers(); 74 } 75} 76 77 78window.addEventListener("DOMContentLoaded", () => { 79 // new CatalogSearch(); 80 81})
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.