PageSourceSearch

https://rubygems.org/assets/controllers/reveal_search_controller-05747f35.js

js rubygems.org collected 2026-09-24 06:44:38 UTC 809 bytes, 37 lines download raw bytes

1import Reveal from "controllers/reveal_controller";
2
3export default class extends Reveal {
4  static targets = ["item", "toggle", "button", "input"];
5
6  focus(event) {
7    if (
8      event.key !== "/" ||
9      event.altKey ||
10      event.ctrlKey ||
11      event.metaKey ||
12      event.shiftKey ||
13      event.target.closest(
14        "input, textarea, select, [contenteditable]:not([contenteditable='false'])",
15      ) ||
16      document.querySelector("dialog[open]")
17    ) {
18      return;
19    }
20
21    event.preventDefault();
22    this.show();
23    this.inputTarget.focus();
24  }
25
26  toggle() {
27    super.toggle();
28    if (!this.itemTarget.classList.contains("hidden")) {
29      this.inputTarget.focus(); // Auto focus the input when revealed
30    }
31  }
32
33  open() {
34    super.open();
35    this.inputTarget.focus();
36  }
37}

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.