diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2016-01-18 19:34:02 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2016-01-18 19:34:02 +0100 |
commit | 5eaf4cc489c0e8cd1ffdfde4355866cb5a481d96 (patch) | |
tree | 20390f6213de6b9f5340cd97e760db93298f1d0f /modules/luci-base/htdocs/luci-static/resources | |
parent | 808c1b77f9008bc9f4a760ea0629b3fd4e49fbcb (diff) |
luci-base: cbi: refactor event handling js
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/cbi.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index 8bf94a6c50..fcf87adcb6 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -515,6 +515,15 @@ function cbi_init() { } } + nodes = document.querySelectorAll('[data-change]'); + + for (var i = 0, node; (node = nodes[i]) !== undefined; i++) { + var events = node.getAttribute('data-change').split(' '); + for (var j = 0, event; (event = events[j]) !== undefined; j++) { + cbi_bind(node, event, cbi_d_update); + } + } + cbi_d_update(); } |