Subversion-Projekte lars-tiefland.zeldi.de

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
function suggest(inputString) {
2
    $('#suchbegriff').keyup(function(event) {
3
        if(event.keyCode != 40 && event.keyCode != 38) {
4
            if($('#suchbegriff').val().length < 1) {
5
                $('#suchbegriffs_liste').hide();
6
            } else {
7
                inputString = $('#suchbegriff').val();
8
                $.post("/autosuggest/autosuggest.php", {queryString: ""+inputString+""}, function(data) {
9
 
10
                    if(data.length > 0) {
11
 
12
                        $('#suggestions').show();
13
                        $('#suggestionsList').html(data);
14
                    }
15
                });
16
            }
17
        }
18
    });
19
}
20
 
21
function fill(thisValue) {
22
    thisValue = decodeURIComponent(thisValue);
23
    $('#suchbegriff').val(thisValue);
24
    $('#suchbegriff').val(thisValue);
25
}
26
 
27
function closeBox() {
28
    $('#suggestions').hide();
29
}
30
 
31
 
32
function jump2List(id) {
33
 
34
    if($('#suchbegriff').val().length > 0) {
35
        $('#suchbegriff').keydown(function(event) {
36
            if(event.keyCode == 40) {
37
                $("#suchbegriffs_liste input:first-child").focus();
38
            }
39
            if(event.keyCode == 38) {
40
                target = "sugg_" + (($('#suchbegriffs_liste').children().length / 2) -1);
41
                $('#'+target).focus();
42
            }
43
        });
44
    }
45
}
46
 
47
function jump(target,id,countList) {
48
    $(id).keydown(function(event) {
49
        cutId = target.substr(5);
50
 
51
        // Enter-Taste
52
        if(event.keyCode == 13) {
53
            fill(this.value);
54
            $('#suchbegriff').focus();
55
        }
56
 
57
        // Pfeiltaste nach unten
58
        if(event.keyCode == 40) {
59
            if(cutId >= countList) {
60
                target = "sugg_" + 0;
61
            }
62
            $('#'+target).focus();
63
        }
64
 
65
        // Pfeiltaste nach oben
66
        if(event.keyCode == 38) {
67
            if(cutId > 1) {
68
                target = "sugg_" + (cutId - 2);
69
                $('#'+target).focus();
70
            }
71
            if(cutId == 1) {
72
                $('#suchbegriff').focus();
73
            }
74
        }
75
    });
76
}
77
 
78
 
79
function cssHover(id) {
80
 
81
    $(id).focus(function(event) {
82
        $(".autocomplete_li").css("background-color","#fff");
83
        $(".autocomplete_li").css("color","#666");
84
        $(id).css("background-color","#666");
85
        $(id).css("color","#fff");
86
    });
87
    $(id).mouseover(function(event) {
88
        $(".autocomplete_li").css("background-color","#fff");
89
        $(".autocomplete_li").css("color","#666");
90
        $(id).css("background-color","#666");
91
        $(id).css("color","#fff");
92
    });
93
}