Changeset 2453


Ignore:
Timestamp:
Aug 21, 2009, 12:13:45 PM (15 years ago)
Author:
ecprice
Message:

Update focus rules to failback in safari

Location:
package_branches/invirt-web/cherrypy/code
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/cherrypy/code/static/ajaxterm/ajaxterm.js

    r2452 r2453  
    254254                        opt_paste.attachEvent("onclick", do_paste);
    255255                }
    256                 $('term').onkeypress=keypress;
    257                 $('term').onkeydown=keydown;
     256                // If tabIndex works, only grab keyboard events when terminal is focused
     257                // Otherwise, grab from whole document (e.g. in Safari).
     258                var focus_element = document;
     259                if(typeof $('term').tabIndex != "undefined") {
     260                    focus_element = $('term');
     261                    focus_element.focus();
     262                }
     263                focus_element.onkeypress=keypress;
     264                focus_element.onkeydown=keydown;
    258265                force=true;
    259266                timeout=window.setTimeout(update,100);
  • package_branches/invirt-web/cherrypy/code/templates/terminal.mako

    r2451 r2453  
    2222window.onload=function() {
    2323        t=ajaxterm.Terminal("term", ${machine.machine_id});
    24         $('term').focus();
    2524}
    2625</script>
Note: See TracChangeset for help on using the changeset viewer.