| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 (function() { | 5 (function() { |
| 6 var altKeys = {}; | 6 var altKeys = {}; |
| 7 var idMap = {}; | 7 var idMap = {}; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Creates a unique identifier based on the key provided. | 10 * Creates a unique identifier based on the key provided. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 Polymer('kb-altkey-data', { | 26 Polymer('kb-altkey-data', { |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * Retrieves a list of alternative keys to display on a long-press. | 29 * Retrieves a list of alternative keys to display on a long-press. |
| 30 * @param {string} char The base character. | 30 * @param {string} char The base character. |
| 31 * @param {boolean=} opt_force If true, force the creation of a list | 31 * @param {boolean=} opt_force If true, force the creation of a list |
| 32 * even if empty. Used when constructing a set of alternates for keys | 32 * even if empty. Used when constructing a set of alternates for keys |
| 33 * with hintTexts. | 33 * with hintTexts. |
| 34 * @return {?Object.{id: string, list: string}} | 34 * @return {?{id: string, list: string}} |
| 35 */ | 35 */ |
| 36 getAltkeys: function(char, opt_force) { | 36 getAltkeys: function(char, opt_force) { |
| 37 var id = idMap[char]; | 37 var id = idMap[char]; |
| 38 if (id) { | 38 if (id) { |
| 39 return { | 39 return { |
| 40 'id': id, | 40 'id': id, |
| 41 'keys': altKeys[id] | 41 'keys': altKeys[id] |
| 42 }; | 42 }; |
| 43 } | 43 } |
| 44 if (opt_force) { | 44 if (opt_force) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 prepend = true; | 117 prepend = true; |
| 118 } | 118 } |
| 119 set.id = altKeys.id; | 119 set.id = altKeys.id; |
| 120 set.offset = leftOffset; | 120 set.offset = leftOffset; |
| 121 return set; | 121 return set; |
| 122 } | 122 } |
| 123 }, | 123 }, |
| 124 | 124 |
| 125 }); | 125 }); |
| 126 })(); | 126 })(); |
| OLD | NEW |