summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Donald2026-02-20 01:28:43 +0000
committerPaul Donald2026-02-20 01:38:02 +0000
commitf55831e83a8a41119760a0db31dc06a63e96f2c7 (patch)
treec69e02decd38a13c1c75ccd05d1411aa0a5d5dc5
parenta8db14e2cfe1d35128e3253b2956706f197340a6 (diff)
downloadluci-f55831e83a8a41119760a0db31dc06a63e96f2c7.tar.gz
luci-base: cbi improvements and loop var fix
mainly for downstream consumers who still use Lua. Signed-off-by: Paul Donald <newtwen+github@gmail.com>
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index e2c9e4e924..9b8604251f 100644
--- a/modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js
@@ -20,7 +20,11 @@
* @module LuCI.cbi
*/
const cbi_d = [];
+if (typeof window !== 'undefined')
+ window.cbi_d = cbi_d;
const cbi_strings = { path: {}, label: {} };
+if (typeof window !== 'undefined')
+ window.cbi_strings = cbi_strings;
/**
* Read signed 8-bit integer from a byte array at the given offset.
@@ -326,7 +330,7 @@ function cbi_init() {
const depends = JSON.parse(n.getAttribute('data-depends'));
if (!isNaN(index) && depends.length > 0) {
for (let a of depends)
- cbi_d_add(n, depends[a], index);
+ cbi_d_add(n, a, index);
}
}
@@ -445,7 +449,8 @@ function cbi_validate_form(form, errmsg)
const validator = fv;
if (!validator() && errmsg) {
- alert(errmsg);
+ if (typeof window !== 'undefined' && typeof window.alert === 'function')
+ window.alert(errmsg);
return false;
}
}