summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-02-12 08:14:22 +0100
committerJo-Philipp Wich <jo@mein.io>2020-02-12 11:59:41 +0100
commitbf774e4c2a6a03aa01d4bcd9f5ce4f960cd91874 (patch)
treecfaded772cb0c1ef6387cf0d2cebe86304329dff /modules/luci-base/htdocs/luci-static/resources
parente7d22dce50b4a0c50c9f8ae8c18eeb5a37a51b3e (diff)
luci-base: ui.js: dispatch "cbi-tab-active" event when a tab is selected
This is useful to lazy-load tab contents. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/ui.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js
index 7cf4f4102..445857360 100644
--- a/modules/luci-base/htdocs/luci-static/resources/ui.js
+++ b/modules/luci-base/htdocs/luci-static/resources/ui.js
@@ -2244,6 +2244,10 @@ return L.Class.extend({
this.setActiveTabId(panes[selected], selected);
}
+ panes[selected].dispatchEvent(new CustomEvent('cbi-tab-active', {
+ detail: { tab: panes[selected].getAttribute('data-tab') }
+ }));
+
this.updateTabs(group);
},
@@ -2354,6 +2358,7 @@ return L.Class.extend({
if (L.dom.matches(pane, '[data-tab]')) {
if (pane.getAttribute('data-tab') === name) {
pane.setAttribute('data-tab-active', 'true');
+ pane.dispatchEvent(new CustomEvent('cbi-tab-active', { detail: { tab: name } }));
L.ui.tabs.setActiveTabId(pane, index);
}
else {