Debian Codegraph @

dojox/gesture/tests/test_gesture.html

raw symbols SCIP
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="viewport" content="width=device-width,maximum-scale=1,minimum-scale=1,user-scalable=no" />
6 <title>Dojo Gesture Testing</title>
7 <style type="text/css">
8 #outer {
9 width: 350px;
10 height: 180px;
11 border: 1px solid #54A201;
12 background-color: #54A201;
13 }
14 #inner {
15 width: 250px;
16 height: 140px;
17 border: 1px solid #7FB0DB;
18 background-color: #7FB0DB
19 }
20 #log1, #log2 {
21 width: 350px;
22 height: 50px;
23 }
24 </style>
25 <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="parseOnLoad: true"></script>
26 <script>
27 require([
28 "dojo/_base/kernel",
29 "dojo/_base/connect",
30 "dojo/_base/html",
31 "dojo/_base/event",
32 "dojo/on",
33 "dojo/touch",
34 "dojo/ready",
35 "dojox/gesture/tap",
36 "dojox/gesture/swipe"
37 ], function(dojo, conn, html, evt, on, touch, ready, tap, swipe){
38
39 ready(function(){
40 var action = function(e){
41 html.byId("log1").innerHTML = "";
42 var info = " e.target.id=" + e.target.id + " | e.type=" + e.type + " | e.currentTarget.id="+ e.currentTarget.id;
43 /*
44 for(var i in e){
45 if(typeof e[i] != "function"){
46 info += "- " + i + ": " + e[i] + (e[i] && e[i]['id'] ? ' id = '+e[i]['id'] : '') + "<br/>";
47 }
48 }*/
49 html.byId("log1").innerHTML += info;
50 //evt.stop(e);
51 };
52
53 var swipeAction = function(e){
54 html.byId("log2").innerHTML = "";
55 var info = " e.target.id=" + e.target.id + " | e.type=" + e.type + " | e.currentTarget.id="+ e.currentTarget.id +
56 " e.dx=" + e.dx + " e.dy=" + e.dy + " e.time=" + e.time + "<br/>";
57 html.byId("log2").innerHTML += info;
58 //evt.stop(e);
59 };
60
61 //tap and swipe gestures both work well both on PC and touch devices
62 var inner = html.byId("inner");
63 on(inner, tap, action);
64 on(inner, tap.hold, action);
65 on(inner, tap.doubletap, action);
66 on(inner, swipe, swipeAction);
67
68 //test gesture events bubbling from inner div
69 var outer = html.byId("outer");
70 conn.connect(outer, tap, action);
71 conn.connect(outer, tap.hold, action);
72 conn.connect(outer, tap.doubletap, action);
73 conn.connect(outer, swipe, swipeAction);
74 conn.connect(outer, swipe.end, swipeAction);
75
76 //conn.connect(outer, touch.press, function(){console.log('outer.touch.press!');});
77
78 on(dojo.doc, "orientationchange", function(e){
79 html.byId("log1").innerHTML="";
80 html.byId("log2").innerHTML="";
81 });
82 });
83 });
84 </script>
85 </head>
86 <body>
87 <div id="outer">
88 outer
89 <div id="inner">inner
90 <br/>
91 <input id="input" type="text" placeholder="type here"/>input
92 <br/>
93 <input id="pwd" type="password" name="pwd" placeholder="type here"/>password
94 <br/>
95 <textarea id="textarea" rows="3" cols="20" style="width: 150px; height:30px" placeholder="type here" ></textarea>textarea
96 </div>
97 </div>
98 <div id="log1"></div>
99 <hr/>
100 <div id="log2"></div>
101 </body>
102 </html>