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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 | 120 |
121 // Enter pressed. | 121 // Enter pressed. |
122 if (event.keyCode == 13) { | 122 if (event.keyCode == 13) { |
123 this.firePinSubmitEvent_(); | 123 this.firePinSubmitEvent_(); |
124 event.preventDefault(); | 124 event.preventDefault(); |
125 return; | 125 return; |
126 } | 126 } |
127 }, | 127 }, |
128 | 128 |
129 /** | 129 /** |
130 * Changes the color of the submit button if PIN is ready. | 130 * Changes the color of input text if it is not empty. |
jdufault
2016/08/08 21:12:42
of the* input
sammiequon
2016/08/08 23:36:12
Done.
| |
131 * @param {string} value | 131 * @param {string} value |
132 * @private | 132 * @private |
133 */ | 133 */ |
134 getSubmitClass_: function(value) { | 134 getPasswordReadyClass_: function(value) { |
135 return value.length > 0 ? 'ready-background' : ''; | 135 return value.length > 0 ? 'ready-background' : ''; |
136 }, | 136 }, |
137 | 137 |
138 /** | 138 /** |
139 * Disables the submit and backspace button if nothing is entered. | |
140 * @param {string} value | |
141 * @private | |
142 */ | |
143 hasNoInput_: function(value) { | |
144 return value.length == 0; | |
145 }, | |
146 | |
147 /** | |
139 * Computes whether the input type for the pin input should be password or | 148 * Computes whether the input type for the pin input should be password or |
140 * numerical. | 149 * numerical. |
141 * @param {boolean} enablePassword | 150 * @param {boolean} enablePassword |
142 * @private | 151 * @private |
143 */ | 152 */ |
144 getInputType_: function(enablePassword) { | 153 getInputType_: function(enablePassword) { |
145 return enablePassword ? 'password' : 'number'; | 154 return enablePassword ? 'password' : 'number'; |
146 }, | 155 }, |
147 | 156 |
148 /** | 157 /** |
(...skipping 22 matching lines...) Expand all Loading... | |
171 // (just numbers), if the document direction is rtl. | 180 // (just numbers), if the document direction is rtl. |
172 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); | 181 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); |
173 return enableRtl ? 'input-non-pin' : ''; | 182 return enableRtl ? 'input-non-pin' : ''; |
174 }, | 183 }, |
175 | 184 |
176 /** | 185 /** |
177 * Computes if the submit button is visible. | 186 * Computes if the submit button is visible. |
178 * @param {boolean} submitEnabled | 187 * @param {boolean} submitEnabled |
179 * @private | 188 * @private |
180 */ | 189 */ |
181 getSubmitHiddenClass_: function(submitEnabled) { | 190 getSubmitClass_: function(submitEnabled) { |
182 return submitEnabled ? '' : 'submit-button-hidden'; | 191 return submitEnabled ? '' : 'submit-button-hidden'; |
183 } | 192 } |
184 }); | 193 }); |
OLD | NEW |