diff options
author | Steven Barth <steven@midlink.org> | 2008-03-27 23:14:01 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-03-27 23:14:01 +0000 |
commit | 077db659bbcb7cee6bbc4c4dbaed9776261190a0 (patch) | |
tree | 0128ec76baf8112f2dd6538e0c5a9448cdf7d91a /contrib/media/cbi.js | |
parent | 3f1064b91949741af53eb1d198e228f768abaea8 (diff) |
* Major CBI improvements
Diffstat (limited to 'contrib/media/cbi.js')
-rw-r--r-- | contrib/media/cbi.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/contrib/media/cbi.js b/contrib/media/cbi.js new file mode 100644 index 000000000..f9e463bca --- /dev/null +++ b/contrib/media/cbi.js @@ -0,0 +1,36 @@ +var cbi_d = {}; + +function cbi_d_add(field, target, value) { + if (!cbi_d[target]) { + cbi_d[target] = {}; + } + if (!cbi_d[target][value]) { + cbi_d[target][value] = []; + } + cbi_d[target][value].push(field); +} + +function cbi_d_update(target) { + if (!cbi_d[target]) { + return; + } + + for (var x in cbi_d[target]) { + for (var i=0; i<cbi_d[target][x].length; i++) { + document.getElementById(cbi_d[target][x][i]).style.display = "none"; + } + } + + var t = document.getElementById(target); + if (t && t.value && cbi_d[target][t.value]) { + for (var i=0; i<cbi_d[target][t.value].length; i++) { + document.getElementById(cbi_d[target][t.value][i]).style.display = "block"; + } + } +} + +function cbi_d_init() { + for (var x in cbi_d) { + cbi_d_update(x); + } +}
\ No newline at end of file |