| 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 /** @const */ var Page = cr.ui.pageManager.Page; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
| 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * AutofillEditCreditCardOverlay class | 10 * AutofillEditCreditCardOverlay class |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 option.text = text; | 120 option.text = text; |
| 121 option.value = text; | 121 option.value = text; |
| 122 expirationMonth.add(option, null); | 122 expirationMonth.add(option, null); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // Set the 'Expiration year' default options. | 125 // Set the 'Expiration year' default options. |
| 126 var expirationYear = $('expiration-year'); | 126 var expirationYear = $('expiration-year'); |
| 127 expirationYear.options.length = 0; | 127 expirationYear.options.length = 0; |
| 128 | 128 |
| 129 var date = new Date(); | 129 var date = new Date(); |
| 130 var year = parseInt(date.getFullYear()); | 130 var year = parseInt(date.getFullYear(), 10); |
| 131 for (var i = 0; i < 10; ++i) { | 131 for (var i = 0; i < 10; ++i) { |
| 132 var text = year + i; | 132 var text = year + i; |
| 133 var option = document.createElement('option'); | 133 var option = document.createElement('option'); |
| 134 option.text = text; | 134 option.text = text; |
| 135 option.value = text; | 135 option.value = text; |
| 136 expirationYear.add(option, null); | 136 expirationYear.add(option, null); |
| 137 } | 137 } |
| 138 }, | 138 }, |
| 139 | 139 |
| 140 /** | 140 /** |
| (...skipping 22 matching lines...) Expand all Loading... |
| 163 // e.g. the user opened the options page before midnight on New Year's Eve | 163 // e.g. the user opened the options page before midnight on New Year's Eve |
| 164 // and then loaded a credit card profile to edit in the new year, so | 164 // and then loaded a credit card profile to edit in the new year, so |
| 165 // reload the select options just to be safe. | 165 // reload the select options just to be safe. |
| 166 this.setDefaultSelectOptions_(); | 166 this.setDefaultSelectOptions_(); |
| 167 | 167 |
| 168 var idx = parseInt(creditCard.expirationMonth, 10); | 168 var idx = parseInt(creditCard.expirationMonth, 10); |
| 169 $('expiration-month').selectedIndex = idx - 1; | 169 $('expiration-month').selectedIndex = idx - 1; |
| 170 | 170 |
| 171 expYear = creditCard.expirationYear; | 171 expYear = creditCard.expirationYear; |
| 172 var date = new Date(); | 172 var date = new Date(); |
| 173 var year = parseInt(date.getFullYear()); | 173 var year = parseInt(date.getFullYear(), 10); |
| 174 for (var i = 0; i < 10; ++i) { | 174 for (var i = 0; i < 10; ++i) { |
| 175 var text = year + i; | 175 var text = year + i; |
| 176 if (expYear == String(text)) | 176 if (expYear == String(text)) |
| 177 $('expiration-year').selectedIndex = i; | 177 $('expiration-year').selectedIndex = i; |
| 178 } | 178 } |
| 179 }, | 179 }, |
| 180 | 180 |
| 181 /** | 181 /** |
| 182 * Called to prepare the overlay when a new card is being added. | 182 * Called to prepare the overlay when a new card is being added. |
| 183 * @private | 183 * @private |
| (...skipping 25 matching lines...) Expand all Loading... |
| 209 | 209 |
| 210 AutofillEditCreditCardOverlay.setTitle = function(title) { | 210 AutofillEditCreditCardOverlay.setTitle = function(title) { |
| 211 $('autofill-credit-card-title').textContent = title; | 211 $('autofill-credit-card-title').textContent = title; |
| 212 }; | 212 }; |
| 213 | 213 |
| 214 // Export | 214 // Export |
| 215 return { | 215 return { |
| 216 AutofillEditCreditCardOverlay: AutofillEditCreditCardOverlay | 216 AutofillEditCreditCardOverlay: AutofillEditCreditCardOverlay |
| 217 }; | 217 }; |
| 218 }); | 218 }); |
| OLD | NEW |