| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-main' displays the selected settings page. | 7 * 'settings-main' displays the selected settings page. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-main', | 10 is: 'settings-main', |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 attached: function() { | 68 attached: function() { |
| 69 document.addEventListener('toggle-advanced-page', function(e) { | 69 document.addEventListener('toggle-advanced-page', function(e) { |
| 70 this.showAdvancedPage_ = e.detail; | 70 this.showAdvancedPage_ = e.detail; |
| 71 this.isAdvancedMenuOpen_ = e.detail; | 71 this.isAdvancedMenuOpen_ = e.detail; |
| 72 this.currentRoute = { | 72 this.currentRoute = { |
| 73 page: this.isAdvancedMenuOpen_ ? 'advanced' : 'basic', | 73 page: this.isAdvancedMenuOpen_ ? 'advanced' : 'basic', |
| 74 section: '', | 74 section: '', |
| 75 subpage: [], | 75 subpage: [], |
| 76 }; | 76 }; |
| 77 if (this.showAdvancedPage_) { | |
| 78 doWhenReady( | |
| 79 function() { | |
| 80 var advancedPage = this.$$('settings-advanced-page'); | |
| 81 return !!advancedPage && advancedPage.scrollHeight > 0; | |
| 82 }.bind(this), | |
| 83 function() { | |
| 84 this.$$('#toggleContainer').scrollIntoView(); | |
| 85 }.bind(this)); | |
| 86 } | |
| 87 }.bind(this)); | 77 }.bind(this)); |
| 88 | 78 |
| 89 doWhenReady( | 79 doWhenReady( |
| 90 function() { | 80 function() { |
| 91 var basicPage = this.$$('settings-basic-page'); | 81 var basicPage = this.$$('settings-basic-page'); |
| 92 return !!basicPage && basicPage.scrollHeight > 0; | 82 return !!basicPage && basicPage.scrollHeight > 0; |
| 93 }.bind(this), | 83 }.bind(this), |
| 94 function() { | 84 function() { |
| 95 this.resolver_.resolve(); | 85 this.resolver_.resolve(); |
| 96 }.bind(this)); | 86 }.bind(this)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 123 newRoute.page == 'advanced'; | 113 newRoute.page == 'advanced'; |
| 124 | 114 |
| 125 this.style.height = isSubpage ? '100%' : ''; | 115 this.style.height = isSubpage ? '100%' : ''; |
| 126 }, | 116 }, |
| 127 | 117 |
| 128 /** @private */ | 118 /** @private */ |
| 129 toggleAdvancedPage_: function() { | 119 toggleAdvancedPage_: function() { |
| 130 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); | 120 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); |
| 131 }, | 121 }, |
| 132 }); | 122 }); |
| OLD | NEW |