OLD | NEW |
---|---|
1 /* Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 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 | 5 |
6 /** | 6 /** |
7 * @constructor | 7 * @constructor |
8 * @param {HTMLElement} parentDiv | 8 * @param {HTMLElement} parentDiv |
9 */ | 9 */ |
10 var ChordTracker = function(parentDiv) { | 10 var ChordTracker = function(parentDiv) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 | 44 |
45 /** | 45 /** |
46 * @private | 46 * @private |
47 */ | 47 */ |
48 ChordTracker.prototype.begin_ = function() { | 48 ChordTracker.prototype.begin_ = function() { |
49 if (this.currentDiv_) { | 49 if (this.currentDiv_) { |
50 return; | 50 return; |
51 } | 51 } |
52 this.currentDiv_ = document.createElement('div'); | 52 this.currentDiv_ = document.createElement('div'); |
53 this.currentDiv_.classList.add('chord-div'); | 53 this.currentDiv_.classList.add('chord-div'); |
54 this.parentDiv_.appendChild(this.currentDiv_); | 54 this.parentDiv_.insertBefore(this.currentDiv_, this.parentDiv_.firstChild); |
Łukasz Anforowicz
2015/01/28 22:15:35
By prepending, rather than appending, one doesn't
Jamie
2015/01/28 22:31:27
Acknowledged.
| |
55 }; | 55 }; |
56 | 56 |
57 /** | 57 /** |
58 * @private | 58 * @private |
59 */ | 59 */ |
60 ChordTracker.prototype.end_ = function() { | 60 ChordTracker.prototype.end_ = function() { |
61 if (!this.currentDiv_) { | 61 if (!this.currentDiv_) { |
62 return; | 62 return; |
63 } | 63 } |
64 if (this.keysPressed_()) { | 64 if (this.keysPressed_()) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 return 'type: ' + event.type + '\n' + | 101 return 'type: ' + event.type + '\n' + |
102 'alt: ' + event.altKey + '\n' + | 102 'alt: ' + event.altKey + '\n' + |
103 'shift: ' + event.shiftKey + '\n' + | 103 'shift: ' + event.shiftKey + '\n' + |
104 'control: ' + event.controlKey + '\n' + | 104 'control: ' + event.controlKey + '\n' + |
105 'meta: ' + event.metaKey + '\n' + | 105 'meta: ' + event.metaKey + '\n' + |
106 'charCode: ' + event.charCode + '\n' + | 106 'charCode: ' + event.charCode + '\n' + |
107 'keyCode: ' + event.keyCode + '\n' + | 107 'keyCode: ' + event.keyCode + '\n' + |
108 'keyIdentifier: ' + event.keyIdentifier + '\n' + | 108 'keyIdentifier: ' + event.keyIdentifier + '\n' + |
109 'repeat: ' + event.repeat + '\n'; | 109 'repeat: ' + event.repeat + '\n'; |
110 }; | 110 }; |
OLD | NEW |