www/js/client.js
// and only care about the rest.
and only care about the rest.
and only care about the rest .
function handleKeyDown(event)
  {
    if (!pwMode) {
      var result = macros.keyTrigger(event);
      var doSend = result.send;
      var msg = result.message;
      if (doSend) {
        var cmd = result.cmd;
        if (cmd.length == 0 || cmd.charAt(cmd.length-1) != '\n') cmd += '\n';
        send(cmd, pwMode);
        event.preventDefault();
        return true;
      }
      else {
        var namedKey = macros.getNamedKey(event);
        if (namedKey.length>0) {
          var cmd = document.getElementById('cmd');
          if (cmd.value && cmd.value.substr(0, 4).toLowerCase() == '/def' && cmd.value.substr(cmd.value.length-4) == 'key_') {
            cmd.value += (namedKey.substr(4) + ' = ');
            event.preventDefault();
            return true;
          }
        }
      }
      if (msg.length > 0) writeToScreen(msg);
    }
    if (event.key == 'c' && (event.ctrlKey || event.metaKey)) return true;
    if ($.inArray(event.key, [
      'CapsLock', 
      'Shift',    
      'Tab',      
      'Escape',   
      'Control',  
      'Meta',     
      'Pause',    
      'Alt',      
      'PageUp', 'PageDown', 
      'Home','End','ArrowDown','ArrowLeft','ArrowRight','ArrowUp', 
      'Insert',   
      'F1','F2','F3','F4','F5','F6','F7','F8','F9','F10','F11','F12','F13','F14','F15','F16','F17','F18','F19','F20', 
      'NumLock','ScrollLock' 
      ]) != -1) return true;
    setFocusToInput();
    return true;
  }
function handleKeyDown ( event ) { if ( ! pwMode ) { var result = macros . keyTrigger ( event ) ; var doSend = result . send ; var msg = result . message ; if ( doSend ) { var cmd = result . cmd ; if ( cmd . length == 0 || cmd . charAt ( cmd . length - 1 ) != '\n' ) cmd += '\n' ; send ( cmd , pwMode ) ; event . preventDefault ( ) ; return true ; } else { var namedKey = macros . getNamedKey ( event ) ; if ( namedKey . length > 0 ) { var cmd = document . getElementById ( 'cmd' ) ; if ( cmd . value && cmd . value . substr ( 0 , 4 ) . toLowerCase ( ) == '/def' && cmd . value . substr ( cmd . value . length - 4 ) == 'key_' ) { cmd . value += ( namedKey . substr ( 4 ) + ' = ' ) ; event . preventDefault ( ) ; return true ; } } } if ( msg . length > 0 ) writeToScreen ( msg ) ; } if ( event . key == 'c' && ( event . ctrlKey || event . metaKey ) ) return true ; if ( $ . inArray ( event . key , [ 'CapsLock' , 'Shift' , 'Tab' , 'Escape' , 'Control' , 'Meta' , 'Pause' , 'Alt' , 'PageUp' , 'PageDown' , 'Home' , 'End' , 'ArrowDown' , 'ArrowLeft' , 'ArrowRight' , 'ArrowUp' , 'Insert' , 'F1' , 'F2' , 'F3' , 'F4' , 'F5' , 'F6' , 'F7' , 'F8' , 'F9' , 'F10' , 'F11' , 'F12' , 'F13' , 'F14' , 'F15' , 'F16' , 'F17' , 'F18' , 'F19' , 'F20' , 'NumLock' , 'ScrollLock' ] ) != - 1 ) return true ; setFocusToInput ( ) ; return true ; }
and only care about the rest.
and only care about the rest .
// If macro processor handles the key, don't continue. // Append a LF, if the last character is not a LF yet. // If there is nothing to send, but the input contains '/def key_', append the  // pressed named key now as a convenience function. // Don't intercept Ctrl/Cmd + C  for copy // Don't intercept control/meta/function keys /* Caps lock */ /* Shift */ /* Tab */ /* Escape Key */ /* Control Key */ /* Windows Command Key */ /* Pause Break */ /* Alt Key */ /*Page Down, Page Up */ /* Home, End, Arrow Keys */ /* Insert Key */ /* F1 - F20 */ /* Num Lock, Scroll Lock */ // Everything else is supposed to be input, so focus to the right place.