4
4
window.addEvent('domready', function()
6
6
var search_box = $('q');
7
if ($defined(search_box))
11
if($('q').value == '')
13
$('search_terms').setStyle('display','none');
17
if (null != global_timeout_id)
19
clearTimeout(global_timeout_id);
21
global_timeout_id = setTimeout('$("q").fireEvent("search",$("q").value)',200);
25
search: function(query)
27
url = global_path + 'search?query=' + query;
29
if ($defined(global_search_request))
31
global_search_request.cancel();
33
global_search_request = new Request({'url':url,'method':'get','onComplete':cool_search});
34
global_search_request.send('');
35
var posicion = search_box.getPosition();
36
var size = search_box.getSize();
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...');
44
new Request({'url':url,'method':'get','onComplete':cool_search}).send('');
9
search_box.removeEvents();
14
if($('q').value == '')
16
$('search_terms').setStyle('display','none');
20
if (null != global_timeout_id)
22
clearTimeout(global_timeout_id);
24
global_timeout_id = setTimeout('$("q").fireEvent("search",$("q").value)',200);
28
search: function(query)
30
url = global_path + 'search?query=' + query;
32
if ($defined(global_search_request))
34
global_search_request.cancel();
36
global_search_request = new Request({'url':url,'method':'get','onComplete':function(response)
38
cool_search(response,query);
41
global_search_request.send('');
42
var posicion = search_box.getPosition();
43
var size = search_box.getSize();
45
$('search_terms').setStyle('position','absolute');
46
$('search_terms').setStyle('left',posicion.x);
47
$('search_terms').setStyle('top',posicion.y + size.y);
48
$('search_terms').setStyle('display','block');
49
$('search_terms').set('html','Loading...');
51
new Request({'url':url,'method':'get','onComplete':cool_search}).send('');
51
function cool_search(response)
59
function cool_search(response, query)
53
61
var posicion = $('q').getPosition();
54
62
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);
63
var current_query = $('q').get('value');
64
if (current_query == query)
66
$('search_terms').set('html',response);
67
$('search_terms').setStyle('display','block');
68
$('search_terms').setStyle('position','absolute');
69
$('search_terms').setStyle('left',posicion.x);
70
$('search_terms').setStyle('top',posicion.y + size.y);
62
74
function hide_search()