@@ -17,7 +17,7 @@ var ciDebugBar = {
17
17
ciDebugBar . createListeners ( ) ;
18
18
ciDebugBar . setToolbarState ( ) ;
19
19
ciDebugBar . setToolbarPosition ( ) ;
20
- ciDebugBar . setViewsHints ( ) ;
20
+ ciDebugBar . toogleViewsHints ( ) ;
21
21
} ,
22
22
23
23
//--------------------------------------------------------------------
@@ -35,15 +35,7 @@ var ciDebugBar = {
35
35
//--------------------------------------------------------------------
36
36
37
37
showTab : function ( )
38
- {
39
- // Get the target tab, if any
40
- var tab = this . getAttribute ( 'data-tab' ) ;
41
-
42
- // Check our current state.
43
- var state = document . getElementById ( tab ) . style . display ;
44
-
45
- if ( tab == undefined ) return true ;
46
-
38
+ {
47
39
// Hide all tabs
48
40
var tabs = document . querySelectorAll ( '#debug-bar .tab' ) ;
49
41
@@ -58,14 +50,25 @@ var ciDebugBar = {
58
50
for ( var i = 0 ; i < labels . length ; i ++ )
59
51
{
60
52
ciDebugBar . removeClass ( labels [ i ] , 'active' ) ;
53
+ }
54
+
55
+ // Get the target tab, if any
56
+ var tab = document . getElementById ( this . getAttribute ( 'data-tab' ) ) ;
57
+
58
+ // If the label have not a tab stops here
59
+ if ( ! tab ) {
60
+ return ;
61
61
}
62
62
63
+ // Check our current state.
64
+ var state = tab . style . display ;
65
+
63
66
// Show/hide the selected tab
64
67
if ( state != 'block' )
65
68
{
66
- document . getElementById ( tab ) . style . display = 'block' ;
69
+ tab . style . display = 'block' ;
67
70
ciDebugBar . addClass ( this . parentNode , 'active' ) ;
68
- }
71
+ }
69
72
} ,
70
73
71
74
//--------------------------------------------------------------------
@@ -149,11 +152,20 @@ var ciDebugBar = {
149
152
150
153
//--------------------------------------------------------------------
151
154
152
- setViewsHints : function ( )
155
+ toogleViewsHints : function ( )
153
156
{
154
- var views = document . getElementsByClassName ( 'debug-view' ) ;
155
- var btn = document . getElementById ( 'toogle-debug-views' ) ;
157
+ var btn = document . querySelector ( '[data-tab=ci-views]' ) ;
156
158
159
+ // If the Views Collector is inactive stops here
160
+ if ( ! btn )
161
+ {
162
+ return ;
163
+ }
164
+
165
+ btn = btn . parentNode ;
166
+
167
+ var views = document . getElementsByClassName ( 'debug-view' ) ;
168
+
157
169
if ( ciDebugBar . readCookie ( 'debug-view' ) )
158
170
{
159
171
for ( var i = 0 ; i < views . length ; i ++ )
0 commit comments