| 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 * @fileoverview | 6 * @fileoverview |
| 7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally | 7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally |
| 8 * numeric values. | 8 * numeric values. |
| 9 * | 9 * |
| 10 * Properties: | 10 * Properties: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 /** The value stored in the keyboard's input element. */ | 42 /** The value stored in the keyboard's input element. */ |
| 43 value: { | 43 value: { |
| 44 type: String, | 44 type: String, |
| 45 notify: true, | 45 notify: true, |
| 46 value: '', | 46 value: '', |
| 47 observer: 'onPinValueChange_' | 47 observer: 'onPinValueChange_' |
| 48 } | 48 } |
| 49 }, | 49 }, |
| 50 | 50 |
| 51 /** |
| 52 * Gets the container holding the password field. |
| 53 * @type {!HTMLInputElement} |
| 54 */ |
| 55 get inputElement() { |
| 56 return this.$$('#pin-input'); |
| 57 }, |
| 58 |
| 59 /** |
| 60 * Gets the submit button. |
| 61 * @type {!HTMLElement} |
| 62 */ |
| 63 get submitButton() { |
| 64 return this.$$('.submit-button'); |
| 65 }, |
| 66 |
| 51 /** Transfers focus to the input element. */ | 67 /** Transfers focus to the input element. */ |
| 52 focus: function() { | 68 focus: function() { |
| 53 this.$$('#pin-input').focus(); | 69 this.$$('#pin-input').focus(); |
| 54 }, | 70 }, |
| 55 | 71 |
| 56 /** Called when a keypad number has been tapped. */ | 72 /** Called when a keypad number has been tapped. */ |
| 57 onNumberTap_: function(event, detail) { | 73 onNumberTap_: function(event, detail) { |
| 58 var numberValue = event.target.getAttribute('value'); | 74 var numberValue = event.target.getAttribute('value'); |
| 59 this.value += numberValue; | 75 this.value += numberValue; |
| 60 }, | 76 }, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // does not contain decimals. | 151 // does not contain decimals. |
| 136 // This heuristic will fail for inputs like '1.0'. | 152 // This heuristic will fail for inputs like '1.0'. |
| 137 // | 153 // |
| 138 // Since we still support users entering their passwords through the PIN | 154 // Since we still support users entering their passwords through the PIN |
| 139 // keyboard, we swap the input box to rtl when we think it is a password | 155 // keyboard, we swap the input box to rtl when we think it is a password |
| 140 // (just numbers), if the document direction is rtl. | 156 // (just numbers), if the document direction is rtl. |
| 141 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); | 157 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); |
| 142 return enableRtl ? 'input-non-pin' : ''; | 158 return enableRtl ? 'input-non-pin' : ''; |
| 143 } | 159 } |
| 144 }); | 160 }); |
| OLD | NEW |