From 5eaf4cc489c0e8cd1ffdfde4355866cb5a481d96 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 18 Jan 2016 19:34:02 +0100 Subject: luci-base: cbi: refactor event handling js Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/cbi.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/luci-base/htdocs/luci-static/resources') 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(); } -- cgit v1.2.3