PageSourceSearch

https://krokom.se/download/18.445caceb169d81d22b014201/1559718396394/auto-search-client.js

js krokom.se collected 2026-10-02 11:06:04 UTC 1,432 bytes, 47 lines download raw bytes

1/**
2 * Creates a fake input field for a facetted search module to create 
3 * an illusion of a filter function instead of a search.
4 */
5(function (window, document, $) {
6  function onFakeInput ($realInput, event) {
7    var val = event.target.value;
8
9    if (val) {
10      $realInput.val(val);
11    } else {
12      $realInput.val('*:*');
13    }
14    $realInput.trigger('keyup');
15  }
16
17  function setupInput ($input) {
18    var $fakeInput = $input.clone(false);
19
20    $fakeInput
21      .attr({
22        'id': $input.attr('id') + '-fake',
23        'name': $input.attr('name') + '-fake'
24      })
25      .val('')
26      .on('input', onFakeInput.bind($fakeInput, $input));
27
28    $input
29      .before($fakeInput)
30      .hide();
31  }
32
33  $(function () {
34    $('.sv-facetedsearch-portlet').each(function (i, portlet) {
35      var $portlet = $(portlet);
36      var $input   = $portlet.find('form input[name="query"]');
37
38      // We only initializes auto search when the faceted search portlet is in a view.
39      // This is mostly to ignore other faceted search portlets such as the one on the main search page.
40      // An alternative solution could be to add a decoration or css class to the portlets which 
41      // should have this functionality and filter by that instead.
42      if ($input.length && $portlet.is('.lp-content .sv-view .sv-facetedsearch-portlet')) {
43        setupInput($input);
44      }
45    });
46  });
47})(this, this.document, $svjq || jQuery);

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.