| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * Responds to route changes by expanding, collapsing, or scrolling to sections | 6 * Responds to route changes by expanding, collapsing, or scrolling to sections |
| 7 * on the page. Expanded sections take up the full height of the container. At | 7 * on the page. Expanded sections take up the full height of the container. At |
| 8 * most one section should be expanded at any given time. | 8 * most one section should be expanded at any given time. |
| 9 * @polymerBehavior MainPageBehavior | 9 * @polymerBehavior MainPageBehavior |
| 10 */ | 10 */ |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 /** | 282 /** |
| 283 /** | 283 /** |
| 284 * Hides or unhides the sections not being expanded. | 284 * Hides or unhides the sections not being expanded. |
| 285 * @param {string} sectionName The section to keep visible. | 285 * @param {string} sectionName The section to keep visible. |
| 286 * @param {boolean} hidden Whether the sections should be hidden. | 286 * @param {boolean} hidden Whether the sections should be hidden. |
| 287 * @private | 287 * @private |
| 288 */ | 288 */ |
| 289 toggleOtherSectionsHidden_: function(sectionName, hidden) { | 289 toggleOtherSectionsHidden_: function(sectionName, hidden) { |
| 290 var sections = Polymer.dom(this.root).querySelectorAll( | 290 var sections = Polymer.dom(this.root).querySelectorAll( |
| 291 'settings-section'); | 291 'settings-section'); |
| 292 for (var section of sections) | 292 for (var i = 0; i < sections.length; i++) |
| 293 section.hidden = hidden && (section.section != sectionName); | 293 sections[i].hidden = hidden && (sections[i].section != sectionName); |
| 294 }, | 294 }, |
| 295 | 295 |
| 296 /** | 296 /** |
| 297 * Helper function to get a section from the local DOM. | 297 * Helper function to get a section from the local DOM. |
| 298 * @param {string} section Section name of the element to get. | 298 * @param {string} section Section name of the element to get. |
| 299 * @return {?SettingsSectionElement} | 299 * @return {?SettingsSectionElement} |
| 300 */ | 300 */ |
| 301 getSection: function(section) { | 301 getSection: function(section) { |
| 302 if (!section) | 302 if (!section) |
| 303 return null; | 303 return null; |
| 304 return /** @type {?SettingsSectionElement} */( | 304 return /** @type {?SettingsSectionElement} */( |
| 305 this.$$('settings-section[section="' + section + '"]')); | 305 this.$$('settings-section[section="' + section + '"]')); |
| 306 }, | 306 }, |
| 307 }; | 307 }; |
| 308 | 308 |
| 309 /** @polymerBehavior */ | 309 /** @polymerBehavior */ |
| 310 var MainPageBehavior = [ | 310 var MainPageBehavior = [ |
| 311 settings.RouteObserverBehavior, | 311 settings.RouteObserverBehavior, |
| 312 MainPageBehaviorImpl, | 312 MainPageBehaviorImpl, |
| 313 ]; | 313 ]; |
| OLD | NEW |