diff options
Diffstat (limited to 'libs/cbi/htdocs/luci-static')
-rw-r--r-- | libs/cbi/htdocs/luci-static/resources/cbi.js | 41 | ||||
-rw-r--r-- | libs/cbi/htdocs/luci-static/resources/cbi/download.gif | bin | 0 -> 189 bytes | |||
-rw-r--r-- | libs/cbi/htdocs/luci-static/resources/cbi/key.gif | bin | 0 -> 230 bytes | |||
-rw-r--r-- | libs/cbi/htdocs/luci-static/resources/cbi/link.gif | bin | 0 -> 291 bytes | |||
-rw-r--r-- | libs/cbi/htdocs/luci-static/resources/cbi/user.gif | bin | 0 -> 246 bytes |
5 files changed, 34 insertions, 7 deletions
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index e42193cff..78a9e90bf 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -7,7 +7,16 @@ function cbi_d_add(field, target, value) { if (!cbi_d[target][value]) { cbi_d[target][value] = []; } - cbi_d[target][value].push(field); + + var obj = document.getElementById(field); + if (obj) { + var entry = { + "node": obj, + "parent": obj.parentNode, + "next": obj.nextSibling + } + cbi_d[target][value].unshift(entry); + } } function cbi_d_update(target) { @@ -17,16 +26,34 @@ function cbi_d_update(target) { for (var x in cbi_d[target]) { for (var i=0; i<cbi_d[target][x].length; i++) { - var y = document.getElementById(cbi_d[target][x][i]) - y.style.display = "none"; + var entry = cbi_d[target][x][i]; + if (entry.node.parentNode) { + entry.parent.removeChild(entry.node) + } } } 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++) { - var y = document.getElementById(cbi_d[target][t.value][i]) - y.style.display = "block"; + var value + + if (!t || !t.value) { + value = ""; + } else { + value = t.value; + + if (t.type == "checkbox") { + value = t.checked ? value : ""; + } + } + + if (cbi_d[target][value]) { + for (var i=0; i<cbi_d[target][value].length; i++) { + var entry = cbi_d[target][value][i]; + if (!entry.next) { + entry.parent.appendChild(entry.node); + } else { + entry.parent.insertBefore(entry.node, entry.next); + } } } } diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/download.gif b/libs/cbi/htdocs/luci-static/resources/cbi/download.gif Binary files differnew file mode 100644 index 000000000..f99a5383b --- /dev/null +++ b/libs/cbi/htdocs/luci-static/resources/cbi/download.gif diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/key.gif b/libs/cbi/htdocs/luci-static/resources/cbi/key.gif Binary files differnew file mode 100644 index 000000000..e3853e5af --- /dev/null +++ b/libs/cbi/htdocs/luci-static/resources/cbi/key.gif diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/link.gif b/libs/cbi/htdocs/luci-static/resources/cbi/link.gif Binary files differnew file mode 100644 index 000000000..1b2a923a5 --- /dev/null +++ b/libs/cbi/htdocs/luci-static/resources/cbi/link.gif diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/user.gif b/libs/cbi/htdocs/luci-static/resources/cbi/user.gif Binary files differnew file mode 100644 index 000000000..dcb5c2a89 --- /dev/null +++ b/libs/cbi/htdocs/luci-static/resources/cbi/user.gif |