PageSourceSearch

https://bayareacrosswords.org/api/crossword-search.js?v20220825

js bayareacrosswords.org collected 2026-09-26 20:37:36 UTC 1,365 bytes, 38 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2    //var search_api = 'http://localhost/dictionary/api/index.php';
3    var search_api = 'https://bayareacrosswords.org/api/index.php';
4
5    var search_input = document.querySelector('input.crossword-search');
6    var search_type = search_input.dataset.type || "word";
7    search_api = search_api + "?" + search_type + "=";
8
9    var search_result = document.querySelector('.crossword-result');
10    var search_string = '';
11
12    search_input.addEventListener("keyup", function () {
13        var input_string = this.value.replace(/[^a-zA-Z\.]+/, '');
14        if (input_string != this.value) {
15            this.value = input_string;
16        }
17        if (
18            input_string.length > 2 &&
19            input_string.replace(/\.+/, '').length > 0 &&
20            input_string != search_string
21        ) {
22            search_string = input_string;
23            fetch(search_api+search_string)
24                .then((response) => response.json())
25                .then((data) => {search_result.innerHTML = draw_crossword_result(data)})
26                .catch((error) => {console.log(error)});
27        }
28    });
29});
30
31function draw_crossword_result(data)
32{
33    return data
34        .map(function(word) {
35            return '<div class="crossword-result-word">' + word + '</div>';
36        })
37        .join("\n");
38}

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.