| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 const OptionsPage = options.OptionsPage; | 6 const OptionsPage = options.OptionsPage; |
| 7 const ArrayDataModel = cr.ui.ArrayDataModel; | 7 const ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 // The GUID of the loaded address. | 9 // The GUID of the loaded address. |
| 10 var guid; | 10 var guid; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 * Initializes the page. | 29 * Initializes the page. |
| 30 */ | 30 */ |
| 31 initializePage: function() { | 31 initializePage: function() { |
| 32 OptionsPage.prototype.initializePage.call(this); | 32 OptionsPage.prototype.initializePage.call(this); |
| 33 | 33 |
| 34 this.createMultiValueLists_(); | 34 this.createMultiValueLists_(); |
| 35 | 35 |
| 36 var self = this; | 36 var self = this; |
| 37 $('autofill-edit-address-cancel-button').onclick = function(event) { | 37 $('autofill-edit-address-cancel-button').onclick = function(event) { |
| 38 self.dismissOverlay_(); | 38 self.dismissOverlay_(); |
| 39 } | 39 }; |
| 40 $('autofill-edit-address-apply-button').onclick = function(event) { | 40 $('autofill-edit-address-apply-button').onclick = function(event) { |
| 41 self.saveAddress_(); | 41 self.saveAddress_(); |
| 42 self.dismissOverlay_(); | 42 self.dismissOverlay_(); |
| 43 } | 43 }; |
| 44 | 44 |
| 45 self.guid = ''; | 45 self.guid = ''; |
| 46 self.populateCountryList_(); | 46 self.populateCountryList_(); |
| 47 self.clearInputFields_(); | 47 self.clearInputFields_(); |
| 48 self.connectInputEvents_(); | 48 self.connectInputEvents_(); |
| 49 }, | 49 }, |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * Creates, decorates and initializes the multi-value lists for full name, | 52 * Creates, decorates and initializes the multi-value lists for full name, |
| 53 * phone, and email. | 53 * phone, and email. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 * or disables the 'Ok' button based on whether all the fields are empty or | 151 * or disables the 'Ok' button based on whether all the fields are empty or |
| 152 * not. | 152 * not. |
| 153 * @private | 153 * @private |
| 154 */ | 154 */ |
| 155 connectInputEvents_: function() { | 155 connectInputEvents_: function() { |
| 156 var self = this; | 156 var self = this; |
| 157 $('company-name').oninput = $('addr-line-1').oninput = | 157 $('company-name').oninput = $('addr-line-1').oninput = |
| 158 $('addr-line-2').oninput = $('city').oninput = $('state').oninput = | 158 $('addr-line-2').oninput = $('city').oninput = $('state').oninput = |
| 159 $('postal-code').oninput = function(event) { | 159 $('postal-code').oninput = function(event) { |
| 160 self.inputFieldChanged_(); | 160 self.inputFieldChanged_(); |
| 161 } | 161 }; |
| 162 | 162 |
| 163 $('country').onchange = function(event) { | 163 $('country').onchange = function(event) { |
| 164 self.countryChanged_(); | 164 self.countryChanged_(); |
| 165 } | 165 }; |
| 166 }, | 166 }, |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * Checks the values of each of the input fields and disables the 'Ok' | 169 * Checks the values of each of the input fields and disables the 'Ok' |
| 170 * button if all of the fields are empty. | 170 * button if all of the fields are empty. |
| 171 * @private | 171 * @private |
| 172 */ | 172 */ |
| 173 inputFieldChanged_: function() { | 173 inputFieldChanged_: function() { |
| 174 // Length of lists are tested for <= 1 due to the "add" placeholder item | 174 // Length of lists are tested for <= 1 due to the "add" placeholder item |
| 175 // in the list. | 175 // in the list. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 AutofillEditAddressOverlay.setValidatedPhoneNumbers = function(numbers) { | 316 AutofillEditAddressOverlay.setValidatedPhoneNumbers = function(numbers) { |
| 317 AutofillEditAddressOverlay.getInstance().setMultiValueList_('phone-list', | 317 AutofillEditAddressOverlay.getInstance().setMultiValueList_('phone-list', |
| 318 numbers); | 318 numbers); |
| 319 }; | 319 }; |
| 320 | 320 |
| 321 // Export | 321 // Export |
| 322 return { | 322 return { |
| 323 AutofillEditAddressOverlay: AutofillEditAddressOverlay | 323 AutofillEditAddressOverlay: AutofillEditAddressOverlay |
| 324 }; | 324 }; |
| 325 }); | 325 }); |
| OLD | NEW |