blob: 27e9a3a282ea56314f4e50d4a2c98b20f4f773e4 (
plain)
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
|
function load_search_box(){
if (!search_url) return;
$.ajax({url: search_url}).done(function( data ) {
$("#search-box").html(data);
});
}
function haystack_search(evt, page){
search_result = new Array();
$('#categories').find('#ul_categories > li > input').attr("checked", false);
if (!$('#id_q').val()){
$('.ac-results').remove();
$('#search-result').html('').show('slow');
return false;
}
var c_url = search_url + "?q=" + $('#id_q').val();
if (page){
c_url += '&page=' + page;
}
$.get(c_url).done(function( data ) {
$('.ac-results').remove();
$('#search-result').html(data).show('slow');
});
return false;
}
function welcome_search(){
if ($("#welcome").is(":visible") && $("#id_welcome_search").val()) {
$("#id_q").val($("#id_welcome_search").val());
$("#action-search").click();
$('#welcome').dialog('close');
$("#haystack-search").click();
return true;
}
}
// disable enter
$(window).keydown(function(event){
if (event.keyCode == 13) {
event.preventDefault();
if (!welcome_search()){
$("#haystack-search").click();
}
return false;
}
});
|