OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /////////////////////////////////////////////////////////////////////////////// | 5 /////////////////////////////////////////////////////////////////////////////// |
6 // OptionsPage class: | 6 // OptionsPage class: |
7 | 7 |
8 /** | 8 /** |
9 * Base class for options page. | 9 * Base class for options page. |
10 * @constructor | 10 * @constructor |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 }; | 84 }; |
85 | 85 |
86 /** | 86 /** |
87 * Registers a new Sub tab page. | 87 * Registers a new Sub tab page. |
88 * @param {OptionsPage} page Page to register. | 88 * @param {OptionsPage} page Page to register. |
89 */ | 89 */ |
90 OptionsPage.registerSubPage = function(page) { | 90 OptionsPage.registerSubPage = function(page) { |
91 OptionsPage.registeredPages_[page.name] = page; | 91 OptionsPage.registeredPages_[page.name] = page; |
92 var pageNav = document.createElement('li'); | 92 var pageNav = document.createElement('li'); |
93 pageNav.id = page.name + 'PageNav'; | 93 pageNav.id = page.name + 'PageNav'; |
94 pageNav.className = 'navbar-item subpage-nav'; | 94 pageNav.className = 'navbar-item hidden'; |
95 pageNav.setAttribute('pageName', page.name); | 95 pageNav.setAttribute('pageName', page.name); |
96 pageNav.textContent = page.title; | 96 pageNav.textContent = page.title; |
97 var subpagesnav = $('subpagesnav'); | 97 var subpagesnav = $('subpagesnav'); |
98 subpagesnav.appendChild(pageNav); | 98 subpagesnav.appendChild(pageNav); |
99 page.tab = pageNav; | 99 page.tab = pageNav; |
100 page.initializePage(); | 100 page.initializePage(); |
101 }; | 101 }; |
102 | 102 |
103 /** | 103 /** |
104 * Registers a new Overlay page. | 104 * Registers a new Overlay page. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 this.title, | 139 this.title, |
140 '/' + this.name); | 140 '/' + this.name); |
141 this.pageDiv.style.display = 'block'; | 141 this.pageDiv.style.display = 'block'; |
142 if (this.isOverlay) { | 142 if (this.isOverlay) { |
143 var overlay = $('overlay'); | 143 var overlay = $('overlay'); |
144 overlay.classList.remove('hidden'); | 144 overlay.classList.remove('hidden'); |
145 overlay.classList.add('overlay-visible'); | 145 overlay.classList.add('overlay-visible'); |
146 } | 146 } |
147 if (this.tab) { | 147 if (this.tab) { |
148 this.tab.classList.add('navbar-item-selected'); | 148 this.tab.classList.add('navbar-item-selected'); |
| 149 if (this.tab.parentNode && this.tab.parentNode.id == 'subpagesnav') |
| 150 this.tab.classList.remove('hidden'); |
149 } | 151 } |
150 } else { | 152 } else { |
151 if (this.isOverlay) { | 153 if (this.isOverlay) { |
152 var overlay = $('overlay'); | 154 var overlay = $('overlay'); |
153 overlay.classList.add('hidden'); | 155 overlay.classList.add('hidden'); |
154 overlay.classList.remove('overlay-visible'); | 156 overlay.classList.remove('overlay-visible'); |
155 } | 157 } |
156 this.pageDiv.style.display = 'none'; | 158 this.pageDiv.style.display = 'none'; |
157 if (this.tab) { | 159 if (this.tab) { |
158 this.tab.classList.remove('navbar-item-selected'); | 160 this.tab.classList.remove('navbar-item-selected'); |
| 161 if (this.tab.parentNode && this.tab.parentNode.id == 'subpagesnav') |
| 162 this.tab.classList.add('hidden'); |
159 } | 163 } |
160 } | 164 } |
161 } | 165 } |
162 }; | 166 }; |
OLD | NEW |