-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsingle_value_local_example.html
192 lines (175 loc) · 8.18 KB
/
single_value_local_example.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
185
186
187
188
189
190
191
192
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="autocomplete.css" type="text/css" media="screen" charset="utf-8">
<title>example</title>
<script type="text/javascript" charset="utf-8" src="lib/prototype.js"></script>
<script type="text/javascript" charset="utf-8" src="lib/scriptaculous.js"></script>
<script type="text/javascript" charset="utf-8" src="lib/effects.js"></script>
<script type="text/javascript" charset="utf-8" src="src/fast_autocompleter.js"></script>
<script type="text/javascript" charset="utf-8">
var names = ["Shaylee Armstrong",
"Melyna McKenzie",
"Jaime Waelchi",
"Ellis Rogahn",
"Selina Steuber",
"Cristal Runolfsson",
"Rhianna Jenkins",
"Leatha Bechtelar",
"Wilber Denesik",
"Lilla Fadel",
"Ms. Lionel Brakus",
"Colt Mertz",
"Eleazar Howell DVM",
"Lewis Nicolas",
"Jarrell Rempel",
"Anais Gerhold",
"Kristofer Conroy",
"Gennaro Reynolds",
"Travon Gerlach",
"Alden Connelly",
"Francisca Nicolas",
"Letha Runte",
"Marion Ondricka",
"Ken Heaney",
"Emilio Baumbach",
"Brody Barton",
"Ahmad Moore",
"Mrs. Marge Fisher",
"Dedrick Kiehn",
"Evans Fritsch",
"Dedrick Kessler",
"Jammie Mohr",
"Lessie Kiehn",
"Briana Goldner",
"Celestine Crist",
"Jonathan Ruecker",
"Dario Bergnaum",
"Gideon Hickle",
"Cydney Schowalter",
"Okey Jenkins",
"Eden Stokes",
"Malcolm Rempel Sr.",
"Russel Rohan",
"Mr. Alberta Murray",
"Burley Kozey",
"Alford Paucek",
"Adelle Vandervort V",
"Golda Nader",
"Marisa Klocko",
"Mireya Greenfelder",
"Waylon O'Kon",
"Magali Rippin",
"Mr. Barbara Kirlin",
"Nat Graham",
"Lexus Wunsch",
"Mr. Manuela Gutmann",
"Spencer Altenwerth",
"Reese Crona",
"Dianna Franecki",
"Nova McKenzie",
"Carolyn Rohan",
"Mina Wyman",
"Maximillia Fisher V",
"Triston Brakus Jr.",
"Mabelle Kreiger",
"Antonetta Emard",
"Miss Sheila Daugherty",
"Tyrique Erdman",
"Reymundo Renner",
"Sarai Hackett",
"Shawna Jacobs",
"Maximus Langosh",
"Tito Champlin",
"Clair Kris",
"Abigail Parker",
"Felipa DuBuque",
"Margaretta Connelly",
"Una Boehm",
"Leora Herzog",
"Tracey Keeling",
"Alexa Bode",
"Everette Klocko",
"Felix Ritchie",
"Ms. Myriam Sauer",
"Geovanni Reinger",
"Garry Kertzmann",
"Gloria Moen",
"Rebecca Koch",
"Angie Yundt",
"Ms. Pablo Gutmann",
"Euna Wisozk",
"Emery Langworth",
"Emmet Bashirian",
"Emmitt Schmidt",
"Madaline Legros",
"Emil Grant",
"Mona Schaden MD",
"Alice Effertz",
"Margarette Smitham",
"Jacquelyn Cremin"];
function lookup(searchString, callback) {
var exp = new RegExp(searchString, 'i');
$('log').insert('lookup ' + searchString + '<br/>');
callback(names.select(function(name) {return exp.test(name);}));
}
var cachedBackend = new Autocompleter.Cache(lookup, {choices: 10});
var cachedLookup = cachedBackend.lookup.bind(cachedBackend);
</script>
<style type="text/css" media="screen">
#form, #log {
float: left;
margin: 25px;
}
input {
width: 300px;
}
</style>
</head>
<body>
<div id="form">
<form action="single_value_local_example.html" method="get" accept-charset="utf-8">
<p>
This field has no cache:<br/>
<input type="text" id="autocomplete" name="autocomplete_parameter" autocomplete="off"/>
<div id="autocomplete_choices" class="autocomplete"></div>
</p>
<p>
This field uses the cache:<br/>
<input type="text" id="caching_autocomplete" name="caching_autocomplete_parameter" autocomplete="off"/>
<div id="caching_autocomplete_choices" class="autocomplete"></div>
</p>
<p>
<input type="submit" value="Continue →">
</p>
</form>
</div>
<div id="log">
<strong>Log:</strong><br/>
</div>
<p style="clear: left;">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<script type="text/javascript" charset="utf-8">
var myAutocompleter = new Autocompleter.Json("autocomplete", "autocomplete_choices", lookup, {frequency: 0.1, choices: 10});
var myCachedAutocompleter = new Autocompleter.Json("caching_autocomplete", "caching_autocomplete_choices", cachedLookup, {frequency: 0.1});
</script>
</body>
</html>