| <!DOCTYPE html> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| <html> |
| |
| <head> |
| <title>Guacamole Keyboard Test</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi"/> |
| <link rel="stylesheet" type="text/css" href="../log/log.css"/> |
| </head> |
| |
| <body> |
| |
| <textarea id="field"></textarea> |
| |
| <div id="log"></div> |
| |
| <!-- Base dependencies --> |
| <script type="text/javascript" src="../log/log.js"></script> |
| <script type="text/javascript" src="gitguac.js"></script> |
| <script type="text/javascript" src="keysyms.js"></script> |
| |
| <!-- Load required guacamole-common-js modules from git --> |
| <script type="text/javascript"> |
| GIT_GUAC.loadModule('InputSink.js'); |
| GIT_GUAC.loadModule('Keyboard.js'); |
| GIT_GUAC.loadModule('Version.js'); |
| </script> |
| |
| <!-- Execute test after all modules have loaded --> |
| <script type="text/javascript"> |
| window.onload = function documentLoaded() { |
| |
| var log = new Log(); |
| document.getElementById("log").appendChild(log.getElement()); |
| |
| log.log("Guacamole.Keyboard tester", |
| "git: " + GIT_GUAC.COMMIT, |
| "API: " + Guacamole.API_VERSION); |
| |
| log.log("Please press some keys..."); |
| |
| var keyboard = new Guacamole.Keyboard(document); |
| |
| // Listen to additional elements if version of API being |
| // tested defines listenTo() |
| if (keyboard.listenTo) { |
| |
| keyboard.listenTo(document.getElementById('field')); |
| |
| // Use Guacamole.InputSink if available in version of API |
| // being tested |
| if (Guacamole.InputSink) { |
| var sink = new Guacamole.InputSink(); |
| document.body.appendChild(sink.getElement()); |
| keyboard.listenTo(sink.getElement()); |
| } |
| |
| } |
| |
| keyboard.onkeydown = function(keysym) { |
| log.log("guacamole", "keydown", |
| "0x" + keysym.toString(16), X11_KEYSYM[keysym]); |
| }; |
| |
| keyboard.onkeyup = function(keysym) { |
| log.log("guacamole", "keyup", |
| "0x" + keysym.toString(16), X11_KEYSYM[keysym]); |
| }; |
| |
| }; |
| </script> |
| |
| </body> |
| </html> |