From: Jo-Philipp Wich Date: Mon, 18 Jan 2016 18:34:02 +0000 (+0100) Subject: luci-base: cbi: refactor event handling js X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=5eaf4cc489c0e8cd1ffdfde4355866cb5a481d96 luci-base: cbi: refactor event handling js Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index 8bf94a6c5..fcf87adcb 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(); } diff --git a/modules/luci-base/luasrc/view/cbi/dynlist.htm b/modules/luci-base/luasrc/view/cbi/dynlist.htm index e936c0c39..80cbee839 100644 --- a/modules/luci-base/luasrc/view/cbi/dynlist.htm +++ b/modules/luci-base/luasrc/view/cbi/dynlist.htm @@ -6,7 +6,7 @@ local val = vals[i] if (val and #val > 0) or (i == 1) then %> - />
diff --git a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm b/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm index 7973437f4..b3b454008 100644 --- a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm +++ b/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm @@ -27,7 +27,7 @@