Indefero

Indefero Commit Details


Date:2011-01-16 18:26:32 (14 years 3 months ago)
Author:Thomas Keller
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:bbc9bd6ef4bad7914847e439c3ab88546c64a992
Parents: d445a65788201aced3ddf64bda2b9588db60d15e
Message:Forgot to add the JS filter file.

Changes:

File differences

src/IDF/templates/idf/list-filter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{**
 * Looks for input fields like
 *  <input type="text" class="filter-list" rel="target" />
 * and filters out anchors below $(target) which do not match
 * the entered input.
 *}
<script type="text/javascript" charset="utf-8">
{literal}
$(document).ready(function() {
  $("input.filter-list").each(function() {
    var lists = $("ul#" + $(this).attr("rel"));
    if (lists.length == 0)
      return;
    var list = $(lists[0]);
    // a list should contain a reasonable amount of items
    // to be filterable - we also give the filter input a
    // special class here so we recognize it later in case
    // we have to hide it when the list view is collapsed
    if (list.children("li").length > 10) {
      $(this).addClass("activated");
      $(this).focus(function() {
        // ensure that the parent of the list keeps activated / opened
        list.parent().addClass("activated");
        if ($(this)[0].value == $(this).attr("title"))
          $(this).attr("value", "").removeClass("default");
      });
      $(this).blur(function() {
        list.parent().removeClass("activated");
        if ($(this)[0].value.length == 0)
          $(this).attr("value", $(this).attr("title")).addClass("default");
      });
      $(this).keyup(function(ev) {
        var filter = $(this)[0];
        list.children("li").css('display', 'block');
        list.children("li").filter(function(index) {
          if (filter.value == "")
            return false;
          if ($(this).text().indexOf(filter.value) > -1)
            return false;
          return true;
        }).css('display', 'none');
      });
      // initialize it with the default
      $(this)[0].value = "";
      $(this).blur();
    }
  });
});
{/literal}
</script>

Archive Download the corresponding diff file

Page rendered in 0.12808s using 13 queries.