changeset 29:8615b4b2de0c

Added sample HTML/JS code.
author Atul Varma <avarma@mozilla.com>
date Mon, 12 Apr 2010 11:08:06 -0700
parents 2c8d987416b3
children 9aa3c2fd0baf
files html/sample.html html/sample.js
diffstat 2 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/html/sample.html	Mon Apr 12 11:08:06 2010 -0700
@@ -0,0 +1,8 @@
+<html>
+<head>
+<title>Sample Quasimode Code</title>
+</head>
+<body>
+<h1>Hi.</h1>
+<script src="sample.js"></script>
+</body> </html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/html/sample.js	Mon Apr 12 11:08:06 2010 -0700
@@ -0,0 +1,24 @@
+var QUASIMODE_EVENTS = ["quasimodestart",
+                        "quasimodeend",
+                        "quasimodekeyup",
+                        "quasimodekeydown"];
+
+quasimode.setPosition(0, 0);
+quasimode.setSize(320, 240);
+quasimode.log("Hello. window.quasimode is " + window.quasimode + ".");
+
+QUASIMODE_EVENTS.forEach(
+  function(name) {
+    document.addEventListener(
+      name,
+      function(event) {
+        quasimode.log(event.type +
+                      " ctrl:" + event.ctrlKey +
+                      " alt:" + event.altKey +
+                      " meta:" + event.metaKey +
+                      " shift:" + event.shiftKey +
+                      " keyLocation:" + event.keyLocation);
+      },
+      false
+    );
+  });