diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-08-16 03:29:46 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-08-16 03:29:46 +0000 |
commit | 7c0ea176236eb4232303fbc60aabb2e0448a169f (patch) | |
tree | 57185548c3f430aee98f86dedfebc2634d0a83d4 /libs/cbi/htdocs/luci-static/resources/cbi.js | |
parent | 892ed55ba08d3d5553e621e57d69a3eb8ffa4efc (diff) |
libs/cbi: implement tabbing to split large sections and group options in tabs
Diffstat (limited to 'libs/cbi/htdocs/luci-static/resources/cbi.js')
-rw-r--r-- | libs/cbi/htdocs/luci-static/resources/cbi.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index 77c59e511..24f929c9b 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -2,7 +2,7 @@ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> + Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ */ var cbi_d = []; +var cbi_t = []; function cbi_d_add(field, dep, next) { var obj = document.getElementById(field); @@ -219,3 +220,32 @@ function cbi_hijack_forms(layer, win, fail, load) { }); } } + + +function cbi_t_add(section, tab) { + var t = document.getElementById('tab.' + section + '.' + tab); + var c = document.getElementById('container.' + section + '.' + tab); + + if( t && c ) { + cbi_t[section] = (cbi_t[section] || [ ]); + cbi_t[section][tab] = { 'tab': t, 'container': c }; + } +} + +function cbi_t_switch(section, tab) { + if( cbi_t[section] && cbi_t[section][tab] ) { + var o = cbi_t[section][tab]; + for( var tid in cbi_t[section] ) { + var o2 = cbi_t[section][tid]; + if( o.tab.id != o2.tab.id ) { + o2.tab.className = o2.tab.className.replace(/(^| )cbi-tab( |$)/, " cbi-tab-disabled "); + o2.container.style.display = 'none'; + } + else { + o2.tab.className = o2.tab.className.replace(/(^| )cbi-tab-disabled( |$)/, " cbi-tab "); + o2.container.style.display = 'block'; + } + } + } + return false +} |