+ // If tabIndex works, only grab keyboard events when terminal is focused
+ // Otherwise, grab from whole document (e.g. in Safari).
+ var focus_element = document;
+ if(typeof $('term').tabIndex != "undefined") {
+ focus_element = $('term');
+ focus_element.focus();
+ }
+ focus_element.onkeypress=keypress;
+ focus_element.onkeydown=keydown;
+ force=true;