PageSourceSearch

https://www.speedpdf.com/js/search.js

js speedpdf.com collected 2026-10-03 19:55:40 UTC 1,573 bytes, 47 lines download raw bytes

1function showDropdown() {
2  document.getElementById("dropdown-search").style.display = "block";
3}
4
5function hideDropdown() {
6  document.getElementById("dropdown-search").style.display = "none";
7}
8
9function search() {
10  let i;
11  const input = document.getElementsByClassName("search-input")[0];
12  const filter = input.value.toUpperCase();
13  const dropdown = document.getElementById("dropdown-search");
14  const a = dropdown.getElementsByTagName("a");
15  const searchResults = [];
16  for (i = 0; i < a.length; i++) {
17    const txtValue = a[i].textContent || a[i].innerText;
18    const imgAlt = a[i].getElementsByTagName("img")[0].alt;
19    const index = txtValue.toUpperCase().indexOf(filter) + imgAlt.toUpperCase().indexOf(filter);
20    if (index > -2) {
21      searchResults.push({element: a[i], index: index});
22    } else {
23      a[i].style.display = "none";
24    }
25  }
26  searchResults.sort(function(a, b) {
27    return a.index - b.index;
28  });
29  for (i = 0; i < searchResults.length; i++) {
30    searchResults[i].element.style.display = "";
31    dropdown.appendChild(searchResults[i].element);
32  }
33  dropdown.style.display = "block";
34}
35
36document.addEventListener("click", function(event) {
37  const isClickInside = document
38      .getElementById("dropdown-search")
39      .contains(event.target) || document.getElementsByClassName("search-input")[0].contains(event.target);
40  if (!isClickInside) {
41    document.getElementById("dropdown-search").style.display = "none";
42  }
43});
44
45document.getElementsByClassName("search-input")[0].addEventListener("input", function() {
46  search();
47});

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.