From 5e45e4107b6f944942cfc31a4f408395a3361835 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 20 Oct 2010 22:43:29 +0000 Subject: libs/web: fix tab highlighting with multiple tabs --- libs/web/htdocs/luci-static/resources/cbi.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'libs/web') diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js index a00254c76..7c5dd4ef4 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -437,6 +437,8 @@ function cbi_t_switch(section, tab) { } function cbi_t_update() { + var hl_tabs = [ ]; + for( var sid in cbi_t ) for( var tid in cbi_t[sid] ) if( cbi_c[cbi_t[sid][tid].cid] == 0 ) { @@ -446,9 +448,15 @@ function cbi_t_update() { cbi_t[sid][tid].tab.style.display = ''; var t = cbi_t[sid][tid].tab; - window.setTimeout(function() { t.className = t.className.replace(/ cbi-tab-highlighted/g, '') }, 750); - cbi_t[sid][tid].tab.className += ' cbi-tab-highlighted'; + t.className += ' cbi-tab-highlighted'; + hl_tabs.push(t); } + + if( hl_tabs.length > 0 ) + window.setTimeout(function() { + for( var i = 0; i < hl_tabs.length; i++ ) + hl_tabs[i].className = hl_tabs[i].className.replace(/ cbi-tab-highlighted/g, ''); + }, 750); } -- cgit v1.2.3