~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/custom.js

  • Committer: Martin Albisetti
  • Author(s): Jelmer Vernooij
  • Date: 2008-08-05 17:31:23 UTC
  • mfrom: (197.1.1 trunk)
  • Revision ID: argentina@gmail.com-20080805173123-srwhfyqbinpz2ol3
Add manual page for serve-branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
window.addEvent('domready', function() 
5
5
{
6
6
    var search_box = $('q');
7
 
    search_box.removeEvents();
8
7
    search_box.addEvents(
9
8
    {
10
9
        keyup: function()
15
14
            }
16
15
            else
17
16
            {
18
 
                if (null != global_timeout_id)
19
 
                {
20
 
                    clearTimeout(global_timeout_id);
21
 
                }
 
17
                    if (null != global_timeout_id)
 
18
                    {
 
19
                        clearTimeout(global_timeout_id);
 
20
                    }
22
21
                    global_timeout_id = setTimeout('$("q").fireEvent("search",$("q").value)',200);
23
22
            }
24
23
        },
26
25
        search: function(query)
27
26
        {
28
27
            url = global_path + 'search?query=' + query;
29
 
 
 
28
        
30
29
            if ($defined(global_search_request))
31
30
            {
32
31
                global_search_request.cancel();
33
32
            }
34
 
            global_search_request = new Request({'url':url,'method':'get','onComplete':function(response)
35
 
              {
36
 
                 cool_search(response,query);
37
 
             }});
38
 
 
 
33
            global_search_request = new Request({'url':url,'method':'get','onComplete':cool_search});
39
34
            global_search_request.send('');
40
 
            var posicion = search_box.getPosition();
41
 
            var size     = search_box.getSize();
 
35
                var posicion = search_box.getPosition();
 
36
                var size     = search_box.getSize();
42
37
 
43
 
            $('search_terms').setStyle('position','absolute');
44
 
            $('search_terms').setStyle('left',posicion.x);
45
 
            $('search_terms').setStyle('top',posicion.y + size.y);
46
 
            $('search_terms').setStyle('display','block');
47
 
            $('search_terms').set('html','Loading...');
 
38
                $('search_terms').setStyle('position','absolute');
 
39
                $('search_terms').setStyle('left',posicion.x);
 
40
                $('search_terms').setStyle('top',posicion.y + size.y);
 
41
                $('search_terms').setStyle('display','block');
 
42
                $('search_terms').set('html','Loading...');
48
43
 
49
44
            new Request({'url':url,'method':'get','onComplete':cool_search}).send('');
50
45
 
53
48
    });
54
49
});
55
50
 
56
 
function cool_search(response, query)
 
51
function cool_search(response)
57
52
{
58
53
        var posicion = $('q').getPosition();
59
54
        var size     = $('q').getSize();
60
 
    var current_query = $('q').get('value');
61
 
    if (current_query == query)
62
 
    {
63
 
            $('search_terms').set('html',response);
64
 
            $('search_terms').setStyle('display','block');
65
 
            $('search_terms').setStyle('position','absolute');
66
 
            $('search_terms').setStyle('left',posicion.x);
67
 
            $('search_terms').setStyle('top',posicion.y + size.y);
68
 
    }
 
55
        $('search_terms').set('html',response);
 
56
        $('search_terms').setStyle('display','block');
 
57
        $('search_terms').setStyle('position','absolute');
 
58
        $('search_terms').setStyle('left',posicion.x);
 
59
        $('search_terms').setStyle('top',posicion.y + size.y);
69
60
}
70
61
 
71
62
function hide_search()