~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

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

  • Committer: Michael Hudson
  • Date: 2008-09-30 03:05:31 UTC
  • mfrom: (226.1.3 fix-breadcrumbs)
  • Revision ID: michael.hudson@canonical.com-20080930030531-at8220tnkx9pvqcw
small fixes to the breadcrumbs in the --prefix case.
(thanks Matt Nordhoff for the prods)

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();
7
8
    search_box.addEvents(
8
9
    {
9
10
        keyup: function()
14
15
            }
15
16
            else
16
17
            {
17
 
                    if (null != global_timeout_id)
18
 
                    {
19
 
                        clearTimeout(global_timeout_id);
20
 
                    }
 
18
                if (null != global_timeout_id)
 
19
                {
 
20
                    clearTimeout(global_timeout_id);
 
21
                }
21
22
                    global_timeout_id = setTimeout('$("q").fireEvent("search",$("q").value)',200);
22
23
            }
23
24
        },
25
26
        search: function(query)
26
27
        {
27
28
            url = global_path + 'search?query=' + query;
28
 
        
 
29
 
29
30
            if ($defined(global_search_request))
30
31
            {
31
32
                global_search_request.cancel();
32
33
            }
33
 
            global_search_request = new Request({'url':url,'method':'get','onComplete':cool_search});
 
34
            global_search_request = new Request({'url':url,'method':'get','onComplete':function(response)
 
35
              {
 
36
                 cool_search(response,query);
 
37
             }});
 
38
 
34
39
            global_search_request.send('');
35
 
                var posicion = search_box.getPosition();
36
 
                var size     = search_box.getSize();
 
40
            var posicion = search_box.getPosition();
 
41
            var size     = search_box.getSize();
37
42
 
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...');
 
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...');
43
48
 
44
49
            new Request({'url':url,'method':'get','onComplete':cool_search}).send('');
45
50
 
48
53
    });
49
54
});
50
55
 
51
 
function cool_search(response)
 
56
function cool_search(response, query)
52
57
{
53
58
        var posicion = $('q').getPosition();
54
59
        var size     = $('q').getSize();
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);
 
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
    }
60
69
}
61
70
 
62
71
function hide_search()