-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkui_list.js
More file actions
33 lines (33 loc) · 1.14 KB
/
Copy pathkui_list.js
File metadata and controls
33 lines (33 loc) · 1.14 KB
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
function kui_list_show(p_listbox) {
document.getElementById(p_listbox+"kui_list").style.display = "block";
document.getElementById(p_listbox).focus();
document.getElementById(p_listbox).select();
}
function kui_list_onClick(p_listbox, p_input) {
document.getElementById(p_listbox).value = p_input;
document.getElementById(p_listbox+"kui_list").style.display = "none";
}
function kui_list_filter(e, p_listbox) {
if (e.code == "Escape") {
document.getElementById(p_listbox+"kui_list").style.display = "none";
return;
}
var input, filter, a, i;
input = document.getElementById(p_listbox);
filter = input.value.toUpperCase();
a = document.getElementById(p_listbox+"kui_list").getElementsByTagName("a");
var hidden = 0;
for (i = 0; i < a.length; i++) {
txtValue = a[i].textContent || a[i].innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
a[i].style.display = "block";
} else {
a[i].style.display = "none";
++hidden;
}
}
document.getElementById(p_listbox+"kui_list").style.display = "block";
if (hidden == a.length) {
document.getElementById(p_listbox+"kui_list").style.display = "none";
}
}