comparison web-zui.js @ 72:9c96d374aaae

We now properly pass-through hotkey keypresses.
author Atul Varma <varmaa@toolness.com>
date Sun, 18 May 2008 23:47:15 -0700
parents 65a960c019bb
children 5c35e18a9d1a
comparison
equal deleted inserted replaced
71:65a960c019bb 72:9c96d374aaae
62 // when I start typing" feature--doesn't think that we're not 62 // when I start typing" feature--doesn't think that we're not
63 // doing anything with the keypresses. If we don't do this, such 63 // doing anything with the keypresses. If we don't do this, such
64 // listeners may think that they can intervene and capture 64 // listeners may think that they can intervene and capture
65 // keystrokes before they get to us in the future. 65 // keystrokes before they get to us in the future.
66 66
67 _isHotKey: function(event) {
68 return (event.altKey || event.ctrlKey || event.metaKey);
69 },
70
67 _windowKeyup: function(event) { 71 _windowKeyup: function(event) {
68 return false; 72 return self._isHotKey(event);
69 }, 73 },
70 74
71 _windowKeydown: function(event) { 75 _windowKeydown: function(event) {
72 return false; 76 return self._isHotKey(event);
73 }, 77 },
74 78
75 _windowKeypress: function(event) { 79 _windowKeypress: function(event) {
80 if (self._isHotKey(event))
81 return true;
82
76 if ($("#current-input").length == 0) { 83 if ($("#current-input").length == 0) {
77 // We're not waiting for a line of input, but we may 84 // We're not waiting for a line of input, but we may
78 // be waiting for a character of input. 85 // be waiting for a character of input.
79 86
80 // Note that we have to return a ZSCII keycode here. 87 // Note that we have to return a ZSCII keycode here.
140 $("#current-input").html( 147 $("#current-input").html(
141 self._inputString.entityify() + 148 self._inputString.entityify() +
142 '<span id="cursor">_</span>' 149 '<span id="cursor">_</span>'
143 ); 150 );
144 } 151 }
152 return false;
145 }, 153 },
146 154
147 _windowResize: function() { 155 _windowResize: function() {
148 var contentLeft = $("#content").get(0).offsetLeft + "px"; 156 var contentLeft = $("#content").get(0).offsetLeft + "px";
149 $(".buffered-window").css({left: contentLeft}); 157 $(".buffered-window").css({left: contentLeft});