1import { Controller } from "@hotwired/stimulus"; 2 3export default class extends Controller { 4 static targets = ["yesButton", "unsureButton", "noButton", "skipLink"]; 5 6 connect() { 7 this.handleKeydown = this.handleKeydown.bind(this); 8 document.addEventListener("keydown", this.handleKeydown); 9 } 10 11 disconnect() { 12 document.removeEventListener("keydown", this.handleKeydown); 13 } 14 15 handleKeydown(event) { 16 if (event.target.tagName === "INPUT" || event.target.tagName === "TEXTAREA") return; 17 18 switch (event.key) { 19 case "y": 20 this.yesButtonTarget.click(); 21 break; 22 case "u": 23 this.unsureButtonTarget.click(); 24 break; 25 case "n": 26 this.noButtonTarget.click(); 27 break; 28 case "s": 29 this.skipLinkTarget.click(); 30 break; 31 } 32 } 33};
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.