OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 7 |
8 // The GUID of the loaded credit card. | 8 // The GUID of the loaded credit card. |
9 var guid_; | 9 var guid_; |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... | |
39 OptionsPage.prototype.initializePage.call(this); | 39 OptionsPage.prototype.initializePage.call(this); |
40 | 40 |
41 var self = this; | 41 var self = this; |
42 $('autoFillEditCreditCardCancelButton').onclick = function(event) { | 42 $('autoFillEditCreditCardCancelButton').onclick = function(event) { |
43 self.dismissOverlay_(); | 43 self.dismissOverlay_(); |
44 } | 44 } |
45 $('autoFillEditCreditCardApplyButton').onclick = function(event) { | 45 $('autoFillEditCreditCardApplyButton').onclick = function(event) { |
46 self.saveCreditCard_(); | 46 self.saveCreditCard_(); |
47 self.dismissOverlay_(); | 47 self.dismissOverlay_(); |
48 } | 48 } |
49 $('creditCardNumber').onkeydown = this.onKeyDown_.bind(this); | 49 $('creditCardNumber').onkeydown = this.onTextInput_.bind(this); |
50 $('creditCardNumber').addEventListener('textInput', | |
51 this.onTextInput_.bind(this)); | |
50 | 52 |
51 self.guid_ = ''; | 53 self.guid_ = ''; |
52 self.storedCCNumber_ = ''; | 54 self.storedCCNumber_ = ''; |
53 self.hasEditedNumber_ = false; | 55 self.hasEditedNumber_ = false; |
54 self.clearInputFields_(); | 56 self.clearInputFields_(); |
55 self.connectInputEvents_(); | 57 self.connectInputEvents_(); |
56 self.setDefaultSelectOptions_(); | 58 self.setDefaultSelectOptions_(); |
57 }, | 59 }, |
58 | 60 |
59 /** | 61 /** |
60 * Handles the keydown event. | 62 * Handles the textInput and keydown events. |
61 * @private | 63 * @private |
62 */ | 64 */ |
63 onKeyDown_: function(event) { | 65 onTextInput_: function(event) { |
66 if (event.type == 'keydown' && event.keyCode != '8') | |
dhollowa
2011/01/26 01:57:04
What is keyCode '8'? Is there an existing constan
James Hawkins
2011/01/26 01:59:47
Documented in patch set 2.
| |
67 return; | |
68 | |
64 // If the user hasn't edited the text yet, delete it all on edit. | 69 // If the user hasn't edited the text yet, delete it all on edit. |
65 if (!this.hasEditedNumber_ && | 70 if (!this.hasEditedNumber_ && |
66 $('creditCardNumber').value != this.storedCCNumber_) { | 71 $('creditCardNumber').value != this.storedCCNumber_) { |
67 this.hasEditedNumber_ = true; | 72 this.hasEditedNumber_ = true; |
68 $('creditCardNumber').value = ''; | 73 $('creditCardNumber').value = ''; |
69 } | 74 } |
70 }, | 75 }, |
71 | 76 |
72 /** | 77 /** |
73 * Clears any uncommitted input, and dismisses the overlay. | 78 * Clears any uncommitted input, and dismisses the overlay. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 AutoFillEditCreditCardOverlay.setTitle = function(title) { | 230 AutoFillEditCreditCardOverlay.setTitle = function(title) { |
226 $('autoFillCreditCardTitle').textContent = title; | 231 $('autoFillCreditCardTitle').textContent = title; |
227 }; | 232 }; |
228 | 233 |
229 // Export | 234 // Export |
230 return { | 235 return { |
231 AutoFillEditCreditCardOverlay: AutoFillEditCreditCardOverlay | 236 AutoFillEditCreditCardOverlay: AutoFillEditCreditCardOverlay |
232 }; | 237 }; |
233 | 238 |
234 }); | 239 }); |
OLD | NEW |