Debian Codegraph @

example/demo-hockey_v1.html

raw
1 <!doctype html>
2
3 <html lang="en">
4 <head>
5 <meta charset="utf-8">
6
7 <title></title>
8 <meta name="description" content="">
9 <meta name="author" content="">
10
11 <link rel="stylesheet" href="../src/jquery.typeahead.css">
12
13 <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
14 <!--script src="../dist/jquery.typeahead.min.js"></script-->
15 <script src="../src/jquery.typeahead.js"></script>
16
17 </head>
18 <body>
19
20 <div style="width: 100%; max-width: 800px; margin: 0 auto;">
21
22 <h1>Hockey_v1 Demo</h1>
23
24 <ul>
25 <li>
26 <a href="http://www.runningcoder.org/jquerytypeahead/documentation/">Documentation</a>
27 </li>
28 <li>
29 <a href="http://www.runningcoder.org/jquerytypeahead/demo/">Demos</a>
30 </li>
31 </ul>
32
33 <form>
34 <div class="typeahead__container">
35 <div class="typeahead__field">
36 <div class="typeahead__query">
37 <input class="js-typeahead"
38 name="q"
39 autofocus
40 autocomplete="off">
41 </div>
42 <div class="typeahead__button">
43 <button type="submit">
44 <span class="typeahead__search-icon"></span>
45 </button>
46 </div>
47 </div>
48 </div>
49 </form>
50
51 <script>
52
53 var data = [{
54 "name": "Ducks",
55 "img": "ducks",
56 "city": "Anaheim",
57 "id": "ANA",
58 "conference": "Western",
59 "division": "Pacific"
60 }, {
61 "name": "Thrashers",
62 "img": "thrashers",
63 "city": "Atlanta",
64 "id": "ATL",
65 "conference": "Eastern",
66 "division": "Southeast"
67 }, {
68 "name": "Bruins",
69 "img": "bruins",
70 "city": "Boston",
71 "id": "BOS",
72 "conference": "Eastern",
73 "division": "Northeast"
74 }, {
75 "name": "Sabres",
76 "img": "sabres",
77 "city": "Buffalo",
78 "id": "BUF",
79 "conference": "Eastern",
80 "division": "Northeast"
81 }, {
82 "name": "Flames",
83 "img": "flames",
84 "city": "Calgary",
85 "id": "CGY",
86 "conference": "Western",
87 "division": "Northwest"
88 }, {
89 "name": "Hurricanes",
90 "img": "hurricanes",
91 "city": "Carolina",
92 "id": "CAR",
93 "conference": "Eastern",
94 "division": "Southeast"
95 }, {
96 "name": "Blackhawks",
97 "img": "blackhawks",
98 "city": "Chicago",
99 "id": "CHI",
100 "conference": "Western",
101 "division": "Central"
102 }, {
103 "name": "Avalanche",
104 "img": "avalanche",
105 "city": "Colorado",
106 "id": "COL",
107 "conference": "Western",
108 "division": "Northwest"
109 }, {
110 "name": "Bluejackets",
111 "img": "bluejackets",
112 "city": "Columbus",
113 "id": "CBJ",
114 "conference": "Western",
115 "division": "Central"
116 }, {
117 "name": "Stars",
118 "img": "stars",
119 "city": "Dallas",
120 "id": "DAL",
121 "conference": "Western",
122 "division": "Pacific"
123 }, {
124 "name": "Red Wings",
125 "img": "redwings",
126 "city": "Detroit",
127 "id": "DET",
128 "conference": "Western",
129 "division": "Central"
130 }, {
131 "name": "Oilers",
132 "img": "oilers",
133 "city": "Edmonton",
134 "id": "EDM",
135 "conference": "Western",
136 "division": "Northwest"
137 }, {
138 "name": "Panthers",
139 "img": "panthers",
140 "city": "Florida",
141 "id": "FLA",
142 "conference": "Eastern",
143 "division": "Southeast"
144 }, {
145 "name": "Kings",
146 "img": "kings",
147 "city": "Los Angeles",
148 "id": "LAK",
149 "conference": "Western",
150 "division": "Pacific"
151 }, {
152 "name": "Wild",
153 "img": "wild",
154 "city": "Minnesota",
155 "id": "MIN",
156 "conference": "Western",
157 "division": "Northwest"
158 }, {
159 "name": "Canadiens",
160 "img": "canadiens",
161 "city": "Montreal",
162 "id": "MTL",
163 "conference": "Eastern",
164 "division": "Northeast"
165 }, {
166 "name": "Predators",
167 "img": "predators",
168 "city": "Nashville",
169 "id": "NSH",
170 "conference": "Western",
171 "division": "Central"
172 }, {
173 "name": "Devils",
174 "img": "devils",
175 "city": "New Jersey",
176 "id": "NJD",
177 "conference": "Eastern",
178 "division": "Atlantic"
179 }, {
180 "name": "Islanders",
181 "img": "islanders",
182 "city": "New York",
183 "id": "NYI",
184 "conference": "Eastern",
185 "division": "Atlantic"
186 }, {
187 "name": "Rangers",
188 "img": "rangers",
189 "city": "New York",
190 "id": "NYR",
191 "conference": "Eastern",
192 "division": "Atlantic"
193 }, {
194 "name": "Senators",
195 "img": "senators",
196 "city": "Ottawa",
197 "id": "OTT",
198 "conference": "Eastern",
199 "division": "Northeast"
200 }, {
201 "name": "Flyers",
202 "img": "flyers",
203 "city": "Philadelphia",
204 "id": "PHI",
205 "conference": "Eastern",
206 "division": "Atlantic"
207 }, {
208 "name": "Coyotes",
209 "img": "coyotes",
210 "city": "Phoenix",
211 "id": "PHX",
212 "conference": "Western",
213 "division": "Pacific"
214 }, {
215 "name": "Penguins",
216 "img": "penguins",
217 "city": "Pittsburgh",
218 "id": "PIT",
219 "conference": "Eastern",
220 "division": "Atlantic"
221 }, {
222 "name": "Sharks",
223 "img": "sharks",
224 "city": "San Jose",
225 "id": "SJS",
226 "conference": "Western",
227 "division": "Pacific"
228 }, {
229 "name": "Blues",
230 "img": "blues",
231 "city": "St. Louis",
232 "id": "STL",
233 "conference": "Western",
234 "division": "Central"
235 }, {
236 "name": "Lightning",
237 "img": "lightning",
238 "city": "Tampa Bay",
239 "id": "TBL",
240 "conference": "Eastern",
241 "division": "Southeast"
242 }, {
243 "name": "Maple Leafs",
244 "img": "mapleleafs",
245 "city": "Toronto",
246 "id": "TOR",
247 "conference": "Eastern",
248 "division": "Northeast"
249 }, {
250 "name": "Canucks",
251 "img": "canucks",
252 "city": "Vancouver",
253 "id": "VAN",
254 "conference": "Western",
255 "division": "Northwest"
256 }, {
257 "name": "Capitals",
258 "img": "capitals",
259 "city": "Washington",
260 "id": "WSH",
261 "conference": "Eastern",
262 "division": "Southeast"
263 }, {
264 "name": "Jets",
265 "img": "jets",
266 "city": "Winnipeg",
267 "id": "WPG",
268 "conference": "Eastern",
269 "division": "Southeast"
270 }];
271
272 typeof $.typeahead === 'function' && $.typeahead({
273 input: ".js-typeahead",
274 minLength: 0,
275 maxItem: 8,
276 maxItemPerGroup: 6,
277 order: "asc",
278 hint: true,
279 //cache: true,
280 blurOnTab: false,
281 searchOnFocus: true,
282 //group: ["division", "{{group}} division"],
283 group: {
284 key: "conference",
285 template: function (item) {
286
287 var conference = item.conference;
288 if (conference.toLowerCase() === "eastern") {
289 conference += " Yay!123";
290 }
291
292 return conference;
293 }
294 },
295 emptyTemplate: 'no result for {{query}}',
296 groupOrder: ["Eastern", "Western"],
297 display: ["name", "city", "division"],
298 correlativeTemplate: true,
299 // dropdownFilter: true,
300 // dropdownFilter: 'All Teams',
301 dropdownFilter: [{
302 key: 'conference',
303 template: '<strong>{{conference}}</strong> Conference',
304 all: 'All Teams'
305 }, {
306 key: 'division',
307 value: 'Northeast',
308 template: '<strong>{{division}}</strong> Division'
309 }],
310 // dropdownFilter: [
311 // {
312 // key: 'conference',
313 // value: 'Western',
314 // template: '<strong>Western</strong> Conference',
315 //
316 // },
317 // {
318 // key: 'conference',
319 // value: 'Eastern',
320 // template: '<strong>Eastern</strong> Conference',
321 // all: 'All Teams'
322 //
323 // }
324 // ],
325 template: '<span>' +
326 '<span class="name">{{name}}</span>' +
327 '<span class="division">({{city}}, {{division}} division, {{conference}} conference)</span>' +
328 '</span>',
329 source: {
330 teams: {
331 data: data
332 }
333 },
334 debug: true
335 });
336
337 </script>
338
339 </div>
340
341 </body>
342 </html>