OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 | 7 |
8 ///////////////////////////////////////////////////////////////////////////// | 8 ///////////////////////////////////////////////////////////////////////////// |
9 // AccountsOptions class: | 9 // AccountsOptions class: |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 | 153 |
154 /** | 154 /** |
155 * Update account picture. | 155 * Update account picture. |
156 * @param {string} username User for which to update the image. | 156 * @param {string} username User for which to update the image. |
157 */ | 157 */ |
158 AccountsOptions.updateAccountPicture = function(username) { | 158 AccountsOptions.updateAccountPicture = function(username) { |
159 if (this.showWhitelist_) | 159 if (this.showWhitelist_) |
160 $('userList').updateAccountPicture(username); | 160 $('userList').updateAccountPicture(username); |
161 }; | 161 }; |
162 | 162 |
163 /** | |
164 * Disable and mark page elements that does not make sense in Guest mode. | |
James Hawkins
2012/02/28 20:03:35
s/does/do/
James Hawkins
2012/02/28 20:03:35
Don't use statements about things 'making sense' i
Denis Kuznetsov (DE-MUC)
2012/02/29 08:41:43
Done.
Denis Kuznetsov (DE-MUC)
2012/02/29 08:41:43
Done.
| |
165 */ | |
166 AccountsOptions.disableElementsForGuest = function(element) { | |
James Hawkins
2012/02/28 20:03:35
Document |element|.
Denis Kuznetsov (DE-MUC)
2012/02/29 08:41:43
Done.
| |
167 AccountsOptions.disableElementForGuest_(element); | |
168 | |
169 // Walk the tree, searching each ELEMENT node. | |
170 var walker = document.createTreeWalker(element, | |
171 NodeFilter.SHOW_ELEMENT, | |
172 null, | |
173 false); | |
174 | |
175 var node = walker.nextNode(); | |
176 while (node) { | |
177 AccountsOptions.disableElementForGuest_(node); | |
178 node = walker.nextNode(); | |
179 } | |
180 }; | |
181 | |
182 AccountsOptions.disableElementForGuest_ = function(element) { | |
James Hawkins
2012/02/28 20:03:35
Document method.
Denis Kuznetsov (DE-MUC)
2012/02/29 08:41:43
Done.
| |
183 element.classList.add('guest-disabled') | |
184 if (element.nodeName == 'INPUT' || | |
185 element.nodeName == 'SELECT' || | |
186 element.nodeName == 'BUTTON') | |
187 element.disabled = true; | |
188 if (element.nodeName == 'A') | |
189 element.removeAttribute('href'); | |
190 }; | |
191 | |
163 // Export | 192 // Export |
164 return { | 193 return { |
165 AccountsOptions: AccountsOptions | 194 AccountsOptions: AccountsOptions |
166 }; | 195 }; |
167 | 196 |
168 }); | 197 }); |
OLD | NEW |