-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmylib-touch.html
184 lines (170 loc) · 8.79 KB
/
mylib-touch.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Last-Modified" content="20 Jul 2010 22:29:00 GMT">
<meta name="description" content="Examples of My Library, a cross-browser scripting library, written in Javascript">
<meta name="keywords" content="My Library, Javascript, library, project, repository, builder, browser scripting, Ajax, comp.lang.javascript, newsgroup, touch">
<meta name="author" content="David Mark">
<title>My Library Touch</title>
<link rel="home" href="mylib.html" title="Home">
<link rel="bookmark" href="#content" title="Content">
<link rel="stylesheet" type="text/css" href="style/mylib.css" media="all">
<link rel="stylesheet" type="text/css" href="style/mylib-handheld.css" media="handheld">
<link rel="stylesheet" type="text/css" href="style/mylib-print.css" media="print">
<style type="text/css" media="all">
.test {
color: inherit;
background-color: #fff;
border: solid .25em #000;
width: 10em;
padding: 1em;
text-align:center;
margin-bottom: 1em;
border-radius:1em;
-khtml-border-radius:1em;
-moz-border-radius:1em;
-webkit-border-radius:1em;
box-shadow: .25em .25em 0 #CCCC99;
-moz-box-shadow: .25em .25em 0 #CCCC99;
-webkit-box-shadow: .25em .25em 0 #CCCC99
}
.animated {
transition-property:transform;
-webkit-transition-property:-webkit-transform;
-moz-transition-property:-moz-transform;
-o-transition-property:o-transform;
transition-duration:.4s;
-webkit-transition-duration:.4s;
-moz-transition-duration:.4s;
-o-transition-duration:.4s
}
#taptest.test { border-color: #ff0000 }
#taptest.tapped {
border-color: #ee0000;
color: inherit;
background-color: #eee
}
</style>
<script type="text/javascript">
var API = { deferAudio:true };
</script>
</head>
<body>
<div id="sidebar">
<a href="#content" id="skipnav">Skip Navigation</a>
<h2>Resources</h2>
<h3>Contents</h3>
<ul><li><a href="mylib.html" accesskey="1" title="Home [1]">Home</a></li><li><a href="mylib-downloads.html">Downloads</a></li><li><a href="mylib-doc0.html">Documentation</a></li><li><span id="current">Examples</span></li><li><a href="mylib-builder.asp">Builder</a></li><li><a href="mylib-test.asp?version=1.0&requester=on&array=on&script=on&mouseposition=on&drag=on&every=on&cookie=on&contextclick=on&adjacent=on&ajaxlink=on&ajax=on&event=on&audio=on&statusbar=on&position=on&scrollfx=on&filter=on&dispatch=on&help=on&flash=on&opacity=on&maximize=on&ashtml=on&foreach=on&query=on&serialize=on&region=on&class=on&show=on&map=on&bookmark=on&collections=on&html=on&offset=on&size=on&fx=on&ajaxform=on&overlay=on&some=on&crumb=on&text=on&dom0=on&mousewheel=on&preload=on&margin=on&ease=on&dom=on&setattribute=on&stylesheets=on&style=on&coverdocument=on&dollar=on&objects=on&import=on&rollover=on&locationquery=on&border=on&updater=on&form=on&image=on&plugin=on&directx=on&present=on&viewport=on&fullscreen=on&scroll=on&center=on&gethtml=on&mode=HTML" title="Test full build">Build Test</a></li><li><a href="mylib-testspeed.html" title="Compare the performance of the query feature to three popular libraries">Speed Tests</a></li><li><a href="mylib-sponsors.html" title="List of our benefactors">Sponsors</a></li></ul>
<h3>Related Links</h3>
<ul><li><a href="http://www.pledgie.com/campaigns/9768" title="Please make a donation today!">Donations</a></li><li><a href="http://groups.google.com/group/my-library-general-discussion/">Discussion</a></li><li><a href="http://code.google.com/p/ourlibrary/source/checkout">Repository</a></li></ul>
<h3>Primers</h3>
<ul><li><a href="attributes.html" title="A is for Attributes primer">Attributes</a></li><li><a href="host.html" title="H is for Host primer">Host</a></li><li><a href="keyboard.html" title="K is for Keyboard primer">Keyboard</a></li><li><a href="position.html" title="P is for Position primer">Position</a></li><li><a href="size.html" title="S is for Size primer">Size</a></li><li><a href="viewport.asp" title="V is for Viewport primer">Viewport</a></li></ul>
<h3>Bookmark</h3>
<ul><li><a title="Digg this" href="http://digg.com/submit?phase=2&url=http%3A%2F%2Fwww.cinsoft.net%2Fmylib-downloads.html&title=My%20Library&bodytext=Build%20your%20own%20browser%20scripting%20library&topic=programming">Digg This</a></li><li><a title="Add bookmark to deli.cio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.cinsoft.net%2Fmylib-downloads.html">Add to deli.cio.us</a></li></ul>
<h3>Javascript Help</h3>
<ul><li><a href="http://groups.google.com/group/comp.lang.javascript/topics" title="comp.lang.javascript newsgroup">Newsgroup</a></li><li><a href="http://jibbering.com/faq/index.html" title="comp.lang.javascript newsgroup FAQ">FAQ</a></li></ul>
<script type="text/javascript">
google_ad_client = "pub-0919891272636534";
google_ad_slot = "6037707224";
google_ad_width = 120;
google_ad_height = 90;
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div>
<a name="content"></a>
<h1><span class="redundant">My Library </span> Touch</h1>
<p>This is a test of the My Library Touch add-on.<p>
<p><strong>Note</strong> that this is a work in progress. This initial version only supports <em>single finger</em> touches (and provide equivalent mouse listeners for non-touch browsers).</p>
<p><strong>Note</strong> that at the time of posting, this version is has been tested only on one iPhone.</p>
<p><strong>Note</strong> the tap test is using an element that is not tappable on the iPhone, so it falls back to using the click event. A proper test will follow.</p>
<div id="touchtest">
</div>
<div id="taptest">
</div>
</div>
<div id="logo"><a href="mylib.html" title="Home"><img src="images/mylibrarylogo.jpg" height="108" width="260" alt="My Library" title="Home"></a></div>
<p class="meta">Last Modified: 20 Jul 2010 22:58:00 GMT</p>
<address>By <a title="Send email to David Mark" href="mailto:[email protected]">David Mark</a></address>
<div class="legal">Copyright © 2007-2010 by <a href="mailto:[email protected]">David Mark</a>. All Rights Reserved.</div>
<script type="text/javascript" src="mylib-event-foreach-map-mouseposition-style-text-min.js"></script>
<script type="text/javascript" src="mylib-touch-min.js"></script>
<script type="text/javascript" src="mylib-transform-min.js"></script>
<script type="text/javascript">
var API, global = this;
if (API && API.areFeatures && API.areFeatures('attachDocumentReadyListener', 'attachTouchListeners', 'getEBI', 'setElementText')) {
API.attachDocumentReadyListener(function() {
var setElementText = API.setElementText, cancelDefault = API.cancelDefault;
var setElementTransform = API.setElementTransform;
var startPosition, el = API.getEBI('touchtest');
var fnStart = function(e, el, pos) {
startPosition = pos;
setElementText(this, 'Touching');
cancelDefault(e);
};
var fnMove = function(e, el, pos) {
var deltaX, deltaY;
if (startPosition) {
deltaY = pos[0] - startPosition[0];
deltaX = pos[1] - startPosition[1];
}
setElementText(this, 'Moving');
if (setElementTransform) {
setElementTransform(this, {
skewX: Math.min(deltaX, 45),
skewY: Math.min(deltaY, 45)
});
}
cancelDefault(e);
};
var fnEnd = function(e) {
startPosition = null;
setElementText(this, 'Touch me again!');
if (setElementTransform) {
setElementTransform(this, {
skewX: 0,
skewY: 0
});
};
cancelDefault(e);
};
var fnTap = function() {
setElementText(this, 'Tapped!');
if (setElementTransform) {
setElementTransform(this, {
scale: 1.1
});
}
var that = this;
this.className = 'test animated tapped';
window.setTimeout(function() {
if (setElementTransform) {
setElementTransform(that, {
scale: 1
}); }
that.className = 'test animated';
setElementText(that, 'Tap me again!');
}, 200);
};
if (el) {
el.className = 'test';
API.attachTouchListeners(el, fnStart, fnMove, fnEnd);
API.setElementText(el, 'Touch Me!');
el = API.getEBI('taptest');
if (el) {
el.className = 'test';
API.attachTapListener(el, fnTap);
API.setElementText(el, 'Tap Me!');
}
el = null;
}
});
}
</script>
<script type="text/javascript" src="mylib-domready.js"></script>
</body>
</html>