PageSourceSearch

https://superbrands.at/img/js_009

js superbrands.at collected 2026-10-08 23:32:16 UTC 1,966 bytes, 68 lines download raw bytes

1(function($) {
2      $(document).ready(function() {
3        $('input[name="keyword"]').search('#search-res li', function(on) {
4          on.all(function(results) {
5            var size = results ? results.size() : 0
6            $('#count').text(size + ' results');
7          });
8
9          on.reset(function() {
10            $('#none').hide();
11            $('#search-res li').show();
12          });
13
14          on.empty(function() {
15            $('#none').show();
16            $('#search-res li').hide();
17          });
18
19          on.results(function(results) {
20            $('#none').hide();
21            $('#search-res li').hide();
22            results.show();
23          });
24        });
25      });
26    })(jQuery);
27
28
29(function($) {
30  var Search = function(block) {
31    this.callbacks = {};
32    block(this);
33  }
34
35  Search.prototype.all = function(fn) { this.callbacks.all = fn; }
36  Search.prototype.reset = function(fn) { this.callbacks.reset = fn; }
37  Search.prototype.empty = function(fn) { this.callbacks.empty = fn; }
38  Search.prototype.results = function(fn) { this.callbacks.results = fn; }
39
40  function query(selector) {
41    if (val = this.val()) {
42      return $(selector + ':contains("' + val + '")');;
43    } else {
44      return false;
45    }
46  }
47
48  $.fn.search = function search(selector, block) {
49    var search = new Search(block);
50    var callbacks = search.callbacks;
51
52    function perform() {
53      if (result = query.call($(this), selector)) {
54        callbacks.all && callbacks.all.call(this, result);
55        var method = result.size() > 0 ? 'results' : 'empty';
56        return callbacks[method] && callbacks[method].call(this, result);
57      } else {
58        callbacks.all && callbacks.all.call(this, $(selector));
59        return callbacks.reset && callbacks.reset.call(this);
60      };
61    }
62
63    $(this).live('keypress', perform);
64    $(this).live('keydown', perform);
65    $(this).live('keyup', perform);
66    $(this).bind('blur', perform);
67  }
68})(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.