* Added IPKG-configuration
[project/luci.git] / contrib / media / cbi.js
1 var cbi_d = {};
2
3 function cbi_d_add(field, target, value) {
4 if (!cbi_d[target]) {
5 cbi_d[target] = {};
6 }
7 if (!cbi_d[target][value]) {
8 cbi_d[target][value] = [];
9 }
10 cbi_d[target][value].push(field);
11 }
12
13 function cbi_d_update(target) {
14 if (!cbi_d[target]) {
15 return;
16 }
17
18 for (var x in cbi_d[target]) {
19 for (var i=0; i<cbi_d[target][x].length; i++) {
20 document.getElementById(cbi_d[target][x][i]).style.display = "none";
21 }
22 }
23
24 var t = document.getElementById(target);
25 if (t && t.value && cbi_d[target][t.value]) {
26 for (var i=0; i<cbi_d[target][t.value].length; i++) {
27 document.getElementById(cbi_d[target][t.value][i]).style.display = "block";
28 }
29 }
30 }
31
32 function cbi_d_init() {
33 for (var x in cbi_d) {
34 cbi_d_update(x);
35 }
36 }