-
Notifications
You must be signed in to change notification settings - Fork 186
/
Copy pathtest_typematic.html
68 lines (63 loc) · 1.98 KB
/
test_typematic.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Typematic Test</title>
<style type="text/css">
@import "../themes/claro/document.css";
@import "../themes/claro/claro.css";
@import "css/dijitTests.css";
</style>
<script type="text/javascript" src="../../dojo/dojo.js"
data-dojo-config="isDebug: true"></script>
<script type="text/javascript">
dojo.require("dijit.typematic");
var lastCount = 0;
function typematicCallBack(count, node, evt){
var inputNode = dojo.byId('typematicInput');
if(node == inputNode){
key = "a";
}else{
key = "b";
}
if(-1 == count){
console.debug((lastCount + 1) + ' ' + key + ' events');
}else{
lastCount = count;
inputNode.value += key;
}
inputNode.focus();
}
dojo.ready(function(){
var keyNode = dojo.byId('typematicInput');
var mouseNode = dojo.byId('typematicButton');
dijit.typematic.addKeyListener(keyNode,
{
keyCode: dojo.keys.F11,
shiftKey: false,
metaKey: false,
ctrlKey: true // ALT is optional since its unspecified
},
this, typematicCallBack, 200, 200);
dijit.typematic.addMouseListener(mouseNode,
this, typematicCallBack, 0.9, 200);
try{
// Focus the input so it's easier for user to start typing.
// Doesn't work well in IE6 though, when this test is loaded from robot/typematic.html,
// Apparently the robot code sets up a cover <div> over this page and IE doesn't want to focus
// the input since it's hidden.
keyNode.focus();
}catch(e){
}
});
</script>
</head>
<body class="claro">
<h2>Dijit typematic tests</h2>
Press and hold the <b>ctrl+F11</b> keys (ALT optional, but not Shift or Meta) to see a's typed (constant rate) in the
input field,<br>
or left-mouse click the button and hold down to see b's typed (increasing rate) in the input field.<br>
<input id="typematicInput" size="500">
<button id="typematicButton">to B or not to B</button>
</body>
</html>