51 |
headlines.min_len = 2; |
headlines.min_len = 2; |
52 |
headlines.length = 4; |
headlines.length = 4; |
53 |
|
|
54 |
|
var combo_active = 1; |
55 |
|
|
56 |
|
function combo_onKeyDown(event) { |
57 |
|
//debug("event: "+event.keyCode); |
58 |
|
if (event.keyCode == 13) { |
59 |
|
var el = document.myfilter.element_id('textfilter'); |
60 |
|
if (el) el.focus(); |
61 |
|
|
62 |
|
el = document.myfilter.element_id('results'); |
63 |
|
if (el) el.innerHTML = ''; |
64 |
|
|
65 |
|
combo_active = 0; |
66 |
|
} |
67 |
|
|
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
function myfilter() { |
function myfilter() { |
72 |
|
|
73 |
document.getElementById('textfilter').focus(); |
document.getElementById('textfilter').focus(); |
74 |
document.getElementById('textfilter').caretPos=1; |
document.getElementById('textfilter').caretPos=1; |
75 |
// document.getElementById('textfilter').select(); |
// document.getElementById('textfilter').select(); |
78 |
document.myfilter.html_pre = '<option value="'; |
document.myfilter.html_pre = '<option value="'; |
79 |
document.myfilter.html_mid = '">'; |
document.myfilter.html_mid = '">'; |
80 |
document.myfilter.html_post = '</option>'; |
document.myfilter.html_post = '</option>'; |
81 |
document.myfilter.html_full_pre = '<select id="sel" size="5" onkeydown="if (event.keyCode==13) document.getElementById(\'textfilter\').focus();" onchange="document.getElementById(\'textfilter\').value = this.options[this.selectedIndex].text;">'; |
document.myfilter.html_full_pre = '<select id="sel" size="5" onKeyDown="combo_onKeyDown(event);" onChange="document.getElementById(\'textfilter\').value = this.options[this.selectedIndex].text;">'; |
82 |
document.myfilter.html_full_post = '</select>'; |
document.myfilter.html_full_post = '</select>'; |
83 |
} |
} |
84 |
|
|
85 |
|
function combo_filter(document,value) { |
86 |
|
|
87 |
|
if (! combo_active) { |
88 |
|
return; |
89 |
|
} |
90 |
|
|
91 |
|
return document.myfilter.filter(document, value, headlines); |
92 |
|
} |
93 |
|
|
94 |
function keypress(e) { |
function keypress(e) { |
95 |
var d = e.keyCode; |
var d = e.keyCode; |
96 |
if ((d == 37) || (d == 38) || (d == 39) || (d == 40)) { |
if ((d == 37) || (d == 38) || (d == 39) || (d == 40)) { |
97 |
if (document.getElementById('sel')) document.getElementById('sel').focus(); |
if (document.getElementById('sel')) document.getElementById('sel').focus(); |
98 |
} |
} |
99 |
|
|
100 |
|
if (d != 13) combo_active = 1; |
101 |
} |
} |
102 |
|
|
103 |
</script> |
</script> |
110 |
<BODY onload="myfilter();"> |
<BODY onload="myfilter();"> |
111 |
|
|
112 |
<div id="filterholder"> |
<div id="filterholder"> |
113 |
<div id="textfilterholder"><input autocomplete="off" id="textfilter" name="textfilter" type="text" onkeyup="document.myfilter.filter(document, this.value, headlines);" onKeyDown="keypress(event);" value=""></div> |
<div id="textfilterholder"> |
114 |
|
<input autocomplete="off" id="textfilter" name="textfilter" type="text" |
115 |
|
onKeyDown="keypress(event);" |
116 |
|
onKeyUp="combo_filter(document, this.value);" |
117 |
|
value=""></div> |
118 |
|
|
119 |
<div id="results"> |
<div id="results"> |
120 |
</div> |
</div> |