Renamed FFLuCI to LuCI, ffluci to luci and Freifunk Lua Configuration Interface to...
[project/luci.git] / themes / fledermaus / root / www / luci / 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                         var y = document.getElementById(cbi_d[target][x][i])    
21                         y.style.display = "none";
22                 }
23         }
24         
25         var t = document.getElementById(target);
26         if (t && t.value && cbi_d[target][t.value]) {
27                 for (var i=0; i<cbi_d[target][t.value].length; i++) {                   
28                         var y = document.getElementById(cbi_d[target][t.value][i])
29                         if (!y.value) { 
30                                 y.style.display = "table-row";
31                         } else {
32                                 y.style.display = "block";
33                         }
34                 }
35         }
36 }
37
38 function cbi_d_init() {
39         for (var x in cbi_d) {
40                 cbi_d_update(x);
41         }
42 }