PageSourceSearch

https://teilauto.net/files/js/geno-faq-search.js

js teilauto.net collected 2026-10-01 11:54:27 UTC 3,350 bytes, 87 lines download raw bytes

1var submitButton
2
3$(function () {
4    var xhr
5    var lastSearch
6    submitButton = $('.widget input.submit')
7
8    function searchFaq() {
9        var searchString = $('.geno-suchfeld-faq input[type="text"]').val()
10
11        if (searchString != '' && searchString != lastSearch) {
12            setTimeout(() => {
13                xhr = $.ajax({
14                    type: 'POST',
15                    cache: false,
16                    url: '/ajax_geno_faq_search.php',
17                    data: { searchString },
18                    success: (html) => {
19                        if (html !== '' && html !== '--no results--') {
20                            $('.faq-search-results').remove()
21                            $('.faq-content').hide()
22                            $('.no-results').hide()
23                            $('.faq-wrapper').prepend(
24                                `<div class="faq-search-results">
25                                    <h5>Deine Suche nach <span>„${searchString}“</span></h5>
26                                    ${html}
27                                    <a href="/genossenschaft-faq" class="button white" aria-label="Suche zurücksetzen">Zurück</a>
28                                </div>`,
29                            )
30                        } else {
31                            $('.faq-search-results').remove()
32                            $('.faq-content').show()
33                            $('.no-results').hide()
34                            $('.faq-content').hide()
35                            $('.faq-wrapper').prepend(
36                                `<div class="no-results">
37                                    <h5>Keine Suchergebnisse für <span>„${searchString}“</span></h5>
38                                    <a href="/genossenschaft-faq" class="button white" aria-label="Suche zurücksetzen">Zurück</a>
39                                </div>`,
40                            )
41                        }
42
43                        if (window.innerWidth <= 900) {
44                            $('.faq-navi').hide()
45                        }
46
47                        $('.widget input.submit').replaceWith(
48                            '<button type="button" class="reset" onclick="resetInput()" style="margin: 0; padding: 6px 25px 0 0; background: none;" aria-label="Suche zurücksetzen"><img src="files/teilauto/Geno/icon-ta-geno-search-cancel.svg" /></button>',
49                        )
50                    },
51                })
52            })
53
54            lastSearch = searchString
55        }
56    }
57
58    $('.geno-suchfeld-faq input[type="text"]').on('input', (e) => {
59        if ($('.widget button.reset')) {
60            $('.widget button.reset').replaceWith(submitButton)
61        }
62    })
63
64    $('.geno-suchfeld-faq').submit(function (e) {
65        e.preventDefault()
66
67        if (xhr && xhr.readyState != 4) {
68            xhr.abort()
69        }
70
71        searchFaq()
72    })
73
74    document.querySelectorAll('.faq-navi').forEach((it) => {
75        it.onclick = () => {
76            $('.faq-search-results').remove()
77            $('.faq-content').show()
78            $('.no-results').hide()
79            $('.geno-suchfeld-faq input[type="text"]').val('')
80        }
81    })
82})
83
84function resetInput() {
85    $('.geno-suchfeld-faq input[type="text"]').val('')
86    $('.widget button.reset').replaceWith(submitButton)
87}

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.