OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 A simple, English virtual keyboard implementation. | 6 * @fileoverview A simple, English virtual keyboard implementation. |
7 */ | 7 */ |
8 | 8 |
9 var KEY_MODE = 'key'; | 9 var KEY_MODE = 'key'; |
10 var SHIFT_MODE = 'shift'; | 10 var SHIFT_MODE = 'shift'; |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 new Key(C('/'), C('/'), C('\\'), C(' ')), | 552 new Key(C('/'), C('/'), C('\\'), C(' ')), |
553 new ShiftKey(1) | 553 new ShiftKey(1) |
554 ], | 554 ], |
555 [ | 555 [ |
556 new SvgKey(1.3, 'mic', ''), | 556 new SvgKey(1.3, 'mic', ''), |
557 new DotComKey(), | 557 new DotComKey(), |
558 new SpecialKey(1.3, '@', '@'), | 558 new SpecialKey(1.3, '@', '@'), |
559 // TODO(bryeung): the spacebar needs to be a little bit more stretchy, | 559 // TODO(bryeung): the spacebar needs to be a little bit more stretchy, |
560 // since this row has only 7 keys (as opposed to 12), the truncation | 560 // since this row has only 7 keys (as opposed to 12), the truncation |
561 // can cause it to not be wide enough. | 561 // can cause it to not be wide enough. |
562 new SpecialKey(4.8, ' ', 'Spacebar'), | 562 new SpecialKey(4.8, 'US', 'Spacebar'), |
563 new SpecialKey(1.3, ',', ','), | 563 new SpecialKey(1.3, ',', ','), |
564 new SpecialKey(1.3, '.', '.'), | 564 new SpecialKey(1.3, '.', '.'), |
565 new HideKeyboardKey() | 565 new HideKeyboardKey() |
566 ] | 566 ] |
567 ]; | 567 ]; |
568 | 568 |
569 /** | 569 /** |
570 * All of the rows in the keyboard. | 570 * All of the rows in the keyboard. |
571 * @type {Array.<Row>} | 571 * @type {Array.<Row>} |
572 */ | 572 */ |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 // Ref: dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html | 691 // Ref: dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html |
692 document.addEventListener("webkitvisibilitychange", function() { | 692 document.addEventListener("webkitvisibilitychange", function() { |
693 if (document.webkitHidden) { | 693 if (document.webkitHidden) { |
694 currentMode = KEY_MODE; | 694 currentMode = KEY_MODE; |
695 setMode(currentMode); | 695 setMode(currentMode); |
696 } | 696 } |
697 }, false); | 697 }, false); |
698 } | 698 } |
699 // TODO(bryeung): would be nice to leave less gutter (without causing | 699 // TODO(bryeung): would be nice to leave less gutter (without causing |
700 // rendering issues with floated divs wrapping at some sizes). | 700 // rendering issues with floated divs wrapping at some sizes). |
| 701 |
| 702 /** |
| 703 * Switch the keyboard layout e.g. to US-Dvorak. |
| 704 * @return {void} |
| 705 */ |
| 706 window.onhashchange = function() { |
| 707 var layout = location.hash.replace(/^#/, "").toUpperCase(); |
| 708 MODES.forEach(function(e) { |
| 709 allRows[3].keys_[3].modeElements_[e].textContent = layout; |
| 710 }); |
| 711 // TODO(mazda): Switch the keyboard layout using the layout value. |
| 712 } |
OLD | NEW |