d469a1032db24fdfe8a35db6b923c1d075f0306a.svn-base 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html>
  4. <head>
  5. <title>Typematic Test</title>
  6. <style type="text/css">
  7. @import "../../../dojo/resources/dojo.css";
  8. @import "../../themes/tundra/tundra.css";
  9. @import "../css/dijitTests.css";
  10. </style>
  11. <script type="text/javascript" src="../../../dojo/dojo.js"
  12. djConfig="isDebug: true, debugAtAllCosts: true"></script>
  13. <script type="text/javascript">
  14. dojo.require("dijit._base.typematic");
  15. var lastCount = 0;
  16. function typematicCallBack(count, node, evt){
  17. var inputNode = dojo.byId('typematicInput');
  18. if (node == inputNode){
  19. key = "a";
  20. }else{
  21. key = "b";
  22. }
  23. if(-1 == count){
  24. console.debug((lastCount+1) + ' ' + key + ' events');
  25. }else{
  26. lastCount = count;
  27. inputNode.value += key;
  28. }
  29. inputNode.focus();
  30. }
  31. dojo.addOnLoad(function(){
  32. var keyNode = dojo.byId('typematicInput');
  33. var mouseNode = dojo.byId('typematicButton');
  34. dijit.typematic.addKeyListener(keyNode,
  35. {
  36. keyCode:dojo.keys.F10,
  37. ctrlKey:true
  38. },
  39. this, typematicCallBack, 200, 200);
  40. dijit.typematic.addMouseListener(mouseNode,
  41. this, typematicCallBack, 0.9, 200);
  42. keyNode.focus(); // make it easier to type
  43. });
  44. </script>
  45. </head>
  46. <body class="tundra">
  47. <h2>Dijit typematic tests</h2>
  48. Press and hold the <b>ctrl+F10</b> keys to see a's typed (constant rate) in the input field,<br>
  49. or left-mouse click the button and hold down to see b's typed (increasing rate) in the input field.<br>
  50. <input id="typematicInput" size="500"><button id="typematicButton">to B or not to B</button>
  51. </body>
  52. </html>