subduino 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. data/.document +5 -0
  2. data/.gitignore +26 -0
  3. data/Rakefile +76 -0
  4. data/Readme.textile +46 -0
  5. data/VERSION +1 -0
  6. data/bin/subduino +34 -0
  7. data/bin/subduino-cli +65 -0
  8. data/duino/.gitignore +2 -0
  9. data/duino/Makefile +401 -0
  10. data/duino/duino.pde +17 -0
  11. data/duino/duino.rb +16 -0
  12. data/duino/methods.pde +5 -0
  13. data/lib/subduino/ard_io.rb +60 -0
  14. data/lib/subduino/ard_ps.rb +38 -0
  15. data/lib/subduino/arduino.rb +30 -0
  16. data/lib/subduino/parse.rb +61 -0
  17. data/lib/subduino/scaffold/Makefile +401 -0
  18. data/lib/subduino/scaffold/Makefile2 +247 -0
  19. data/lib/subduino/scaffold/generator.rb +29 -0
  20. data/lib/subduino/scaffold/scaffold.pde +17 -0
  21. data/lib/subduino/scaffold/scaffold.rb +16 -0
  22. data/lib/subduino/store.rb +65 -0
  23. data/lib/subduino.rb +48 -0
  24. data/node/arduinode.js +68 -0
  25. data/node/server.js +45 -0
  26. data/node/vendor/faye.js +1925 -0
  27. data/spec/spec_helper.rb +10 -0
  28. data/spec/subduino/ard_io_spec.rb +9 -0
  29. data/spec/subduino/parse_spec.rb +21 -0
  30. data/spec/subduino/store_spec.rb +17 -0
  31. data/spec/subduino_spec.rb +20 -0
  32. data/subduino.gemspec +239 -0
  33. data/webapp/Gemfile +8 -0
  34. data/webapp/Gemfile.lock +14 -0
  35. data/webapp/Rakefile +49 -0
  36. data/webapp/Readme.textile +45 -0
  37. data/webapp/VERSION +1 -0
  38. data/webapp/lib/app.rb +103 -0
  39. data/webapp/lib/duino.rb +213 -0
  40. data/webapp/lib/environment.rb +36 -0
  41. data/webapp/lib/messenger.rb +16 -0
  42. data/webapp/public/app.css +119 -0
  43. data/webapp/public/app.js +34 -0
  44. data/webapp/public/faye.js +1 -0
  45. data/webapp/public/icons/alarm-clock-blue.png +0 -0
  46. data/webapp/public/icons/alarm-clock.png +0 -0
  47. data/webapp/public/icons/balloon-left.png +0 -0
  48. data/webapp/public/icons/bandaid.png +0 -0
  49. data/webapp/public/icons/bell-disable.png +0 -0
  50. data/webapp/public/icons/bell.png +0 -0
  51. data/webapp/public/icons/big_icon.png +0 -0
  52. data/webapp/public/icons/bomb.png +0 -0
  53. data/webapp/public/icons/bookmark.png +0 -0
  54. data/webapp/public/icons/box-label.png +0 -0
  55. data/webapp/public/icons/brightness-control-up.png +0 -0
  56. data/webapp/public/icons/brightness-control.png +0 -0
  57. data/webapp/public/icons/brightness-small.png +0 -0
  58. data/webapp/public/icons/broom.png +0 -0
  59. data/webapp/public/icons/bug.png +0 -0
  60. data/webapp/public/icons/calculator.png +0 -0
  61. data/webapp/public/icons/calendar-day.png +0 -0
  62. data/webapp/public/icons/camera.png +0 -0
  63. data/webapp/public/icons/cards-address.png +0 -0
  64. data/webapp/public/icons/chart.png +0 -0
  65. data/webapp/public/icons/clock-select.png +0 -0
  66. data/webapp/public/icons/color.png +0 -0
  67. data/webapp/public/icons/compass.png +0 -0
  68. data/webapp/public/icons/control-power-small.png +0 -0
  69. data/webapp/public/icons/control-power.png +0 -0
  70. data/webapp/public/icons/control-record-small.png +0 -0
  71. data/webapp/public/icons/cpus.png +0 -0
  72. data/webapp/public/icons/credit-card.png +0 -0
  73. data/webapp/public/icons/cross-small.png +0 -0
  74. data/webapp/public/icons/dashboard.png +0 -0
  75. data/webapp/public/icons/database.png +0 -0
  76. data/webapp/public/icons/databases.png +0 -0
  77. data/webapp/public/icons/door-open-in.png +0 -0
  78. data/webapp/public/icons/door-open-out.png +0 -0
  79. data/webapp/public/icons/door-open.png +0 -0
  80. data/webapp/public/icons/door.png +0 -0
  81. data/webapp/public/icons/drive-globe.png +0 -0
  82. data/webapp/public/icons/equalizer.png +0 -0
  83. data/webapp/public/icons/exclamation-diamond.png +0 -0
  84. data/webapp/public/icons/exclamation.png +0 -0
  85. data/webapp/public/icons/eye-disable.png +0 -0
  86. data/webapp/public/icons/eye.png +0 -0
  87. data/webapp/public/icons/false.png +0 -0
  88. data/webapp/public/icons/gear-small.png +0 -0
  89. data/webapp/public/icons/gear.png +0 -0
  90. data/webapp/public/icons/groups.png +0 -0
  91. data/webapp/public/icons/heart.png +0 -0
  92. data/webapp/public/icons/heart_empty.png +0 -0
  93. data/webapp/public/icons/info.png +0 -0
  94. data/webapp/public/icons/key.png +0 -0
  95. data/webapp/public/icons/lightbulb.png +0 -0
  96. data/webapp/public/icons/lightbulb_off.png +0 -0
  97. data/webapp/public/icons/lightning-disable.png +0 -0
  98. data/webapp/public/icons/lightning-small.png +0 -0
  99. data/webapp/public/icons/lightning.png +0 -0
  100. data/webapp/public/icons/lock-unlock.png +0 -0
  101. data/webapp/public/icons/lock.png +0 -0
  102. data/webapp/public/icons/marker.png +0 -0
  103. data/webapp/public/icons/media-player-phone.png +0 -0
  104. data/webapp/public/icons/megaphone.png +0 -0
  105. data/webapp/public/icons/mem.png +0 -0
  106. data/webapp/public/icons/microphone.png +0 -0
  107. data/webapp/public/icons/monitor.png +0 -0
  108. data/webapp/public/icons/navigation.png +0 -0
  109. data/webapp/public/icons/off.png +0 -0
  110. data/webapp/public/icons/on.png +0 -0
  111. data/webapp/public/icons/pin.png +0 -0
  112. data/webapp/public/icons/plug--exclamation.png +0 -0
  113. data/webapp/public/icons/plug-disable.png +0 -0
  114. data/webapp/public/icons/plug.png +0 -0
  115. data/webapp/public/icons/restart.png +0 -0
  116. data/webapp/public/icons/ruby.png +0 -0
  117. data/webapp/public/icons/server.png +0 -0
  118. data/webapp/public/icons/shield-disable.png +0 -0
  119. data/webapp/public/icons/shield.png +0 -0
  120. data/webapp/public/icons/socket--exclamation.png +0 -0
  121. data/webapp/public/icons/socket-disable.png +0 -0
  122. data/webapp/public/icons/socket.png +0 -0
  123. data/webapp/public/icons/start.png +0 -0
  124. data/webapp/public/icons/stop.png +0 -0
  125. data/webapp/public/icons/switch--exclamation.png +0 -0
  126. data/webapp/public/icons/switch-disable.png +0 -0
  127. data/webapp/public/icons/switch-small.png +0 -0
  128. data/webapp/public/icons/switch.png +0 -0
  129. data/webapp/public/icons/target.png +0 -0
  130. data/webapp/public/icons/television-off.png +0 -0
  131. data/webapp/public/icons/television.png +0 -0
  132. data/webapp/public/icons/terminal.png +0 -0
  133. data/webapp/public/icons/tick-small.png +0 -0
  134. data/webapp/public/icons/traffic-light-off.png +0 -0
  135. data/webapp/public/icons/traffic-light.png +0 -0
  136. data/webapp/public/icons/traffic.png +0 -0
  137. data/webapp/public/icons/true.png +0 -0
  138. data/webapp/public/icons/umbrella.png +0 -0
  139. data/webapp/public/icons/unmonitor.png +0 -0
  140. data/webapp/public/icons/unmonitored.png +0 -0
  141. data/webapp/public/icons/users.png +0 -0
  142. data/webapp/public/icons/vcard.png +0 -0
  143. data/webapp/public/icons/wall.png +0 -0
  144. data/webapp/public/icons/wall_brick.png +0 -0
  145. data/webapp/public/icons/wall_disable.png +0 -0
  146. data/webapp/public/icons/wand-disable.png +0 -0
  147. data/webapp/public/icons/wand.png +0 -0
  148. data/webapp/public/icons/warn.png +0 -0
  149. data/webapp/public/icons/weather_clouds.png +0 -0
  150. data/webapp/public/icons/weather_cloudy.png +0 -0
  151. data/webapp/public/icons/weather_lightning.png +0 -0
  152. data/webapp/public/icons/weather_rain.png +0 -0
  153. data/webapp/public/icons/weather_snow.png +0 -0
  154. data/webapp/public/icons/weather_sun.png +0 -0
  155. data/webapp/public/icons/wrench-screwdriver.png +0 -0
  156. data/webapp/public/icons/wrench.png +0 -0
  157. data/webapp/public/iui/backButton.png +0 -0
  158. data/webapp/public/iui/blueButton.png +0 -0
  159. data/webapp/public/iui/cancel.png +0 -0
  160. data/webapp/public/iui/grayButton.png +0 -0
  161. data/webapp/public/iui/greenButton.png +0 -0
  162. data/webapp/public/iui/iui-logo-touch-icon.png +0 -0
  163. data/webapp/public/iui/iui.css +396 -0
  164. data/webapp/public/iui/iui.js +511 -0
  165. data/webapp/public/iui/iuix.css +1 -0
  166. data/webapp/public/iui/iuix.js +1 -0
  167. data/webapp/public/iui/listArrow.png +0 -0
  168. data/webapp/public/iui/listArrowSel.png +0 -0
  169. data/webapp/public/iui/listGroup.png +0 -0
  170. data/webapp/public/iui/loading.gif +0 -0
  171. data/webapp/public/iui/pinstripes.png +0 -0
  172. data/webapp/public/iui/redButton.png +0 -0
  173. data/webapp/public/iui/selection.png +0 -0
  174. data/webapp/public/iui/thumb.png +0 -0
  175. data/webapp/public/iui/toggle.png +0 -0
  176. data/webapp/public/iui/toggleOn.png +0 -0
  177. data/webapp/public/iui/toolButton.png +0 -0
  178. data/webapp/public/iui/toolbar.png +0 -0
  179. data/webapp/public/iui/whiteButton.png +0 -0
  180. data/webapp/public/iui/yellowButton.png +0 -0
  181. data/webapp/public/jquery.js +154 -0
  182. data/webapp/public/layout.css +33 -0
  183. data/webapp/public/right.js +9 -0
  184. data/webapp/public/rt.js +7 -0
  185. data/webapp/public/sparkline.js +85 -0
  186. data/webapp/spec/duino_spec.rb +8 -0
  187. data/webapp/spec/spec_helper.rb +10 -0
  188. data/webapp/views/command.haml +4 -0
  189. data/webapp/views/icon.haml +6 -0
  190. data/webapp/views/index.haml +51 -0
  191. data/webapp/views/layout.haml +17 -0
  192. data/webapp/views/mobile.haml +21 -0
  193. data/webapp/views/switch.haml +56 -0
  194. data/webapp/views/top.haml +4 -0
  195. data/webapp/views/watch.haml +26 -0
  196. metadata +277 -0
@@ -0,0 +1,511 @@
1
+ /*
2
+ Copyright (c) 2007-9, iUI Project Members
3
+ See LICENSE.txt for licensing terms
4
+ */
5
+
6
+
7
+ (function() {
8
+
9
+ var slideSpeed = 20;
10
+ var slideInterval = 0;
11
+
12
+ var currentPage = null;
13
+ var currentDialog = null;
14
+ var currentWidth = 0;
15
+ var currentHash = location.hash;
16
+ var hashPrefix = "#_";
17
+ var pageHistory = [];
18
+ var newPageCount = 0;
19
+ var checkTimer;
20
+ var hasOrientationEvent = false;
21
+ var portraitVal = "portrait";
22
+ var landscapeVal = "landscape";
23
+
24
+ // *************************************************************************************************
25
+
26
+ window.iui =
27
+ {
28
+ animOn: false, // Experimental slide animation with CSS transition disabled by default
29
+
30
+ showPage: function(page, backwards)
31
+ {
32
+ if (page)
33
+ {
34
+ if (currentDialog)
35
+ {
36
+ currentDialog.removeAttribute("selected");
37
+ currentDialog = null;
38
+ }
39
+
40
+ if (hasClass(page, "dialog"))
41
+ showDialog(page);
42
+ else
43
+ {
44
+ var fromPage = currentPage;
45
+ currentPage = page;
46
+
47
+ if (fromPage)
48
+ setTimeout(slidePages, 0, fromPage, page, backwards);
49
+ else
50
+ updatePage(page, fromPage);
51
+ }
52
+ }
53
+ },
54
+
55
+ showPageById: function(pageId)
56
+ {
57
+ var page = $(pageId);
58
+ if (page)
59
+ {
60
+ var index = pageHistory.indexOf(pageId);
61
+ var backwards = index != -1;
62
+ if (backwards)
63
+ pageHistory.splice(index, pageHistory.length);
64
+
65
+ iui.showPage(page, backwards);
66
+ }
67
+ },
68
+
69
+ showPageByHref: function(href, args, method, replace, cb)
70
+ {
71
+ var req = new XMLHttpRequest();
72
+ req.onerror = function()
73
+ {
74
+ if (cb)
75
+ cb(false);
76
+ };
77
+
78
+ req.onreadystatechange = function()
79
+ {
80
+ if (req.readyState == 4)
81
+ {
82
+ if (replace)
83
+ replaceElementWithSource(replace, req.responseText);
84
+ else
85
+ {
86
+ var frag = document.createElement("div");
87
+ frag.innerHTML = req.responseText;
88
+ iui.insertPages(frag.childNodes);
89
+ }
90
+ if (cb)
91
+ setTimeout(cb, 1000, true);
92
+ }
93
+ };
94
+
95
+ if (args)
96
+ {
97
+ req.open(method || "GET", href, true);
98
+ req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
99
+ req.setRequestHeader("Content-Length", args.length);
100
+ req.send(args.join("&"));
101
+ }
102
+ else
103
+ {
104
+ req.open(method || "GET", href, true);
105
+ req.setRequestHeader("XHR", true);
106
+ req.send(null);
107
+ }
108
+ },
109
+
110
+ insertPages: function(nodes)
111
+ {
112
+ var targetPage;
113
+ for (var i = 0; i < nodes.length; ++i)
114
+ {
115
+ var child = nodes[i];
116
+ if (child.nodeType == 1)
117
+ {
118
+ if (!child.id)
119
+ child.id = "__" + (++newPageCount) + "__";
120
+
121
+ var clone = $(child.id);
122
+ if (clone)
123
+ clone.parentNode.replaceChild(child, clone);
124
+ else
125
+ document.body.appendChild(child);
126
+
127
+ if (child.getAttribute("selected") == "true" || !targetPage)
128
+ targetPage = child;
129
+
130
+ --i;
131
+ }
132
+ }
133
+
134
+ if (targetPage)
135
+ iui.showPage(targetPage);
136
+ },
137
+
138
+ getSelectedPage: function()
139
+ {
140
+ for (var child = document.body.firstChild; child; child = child.nextSibling)
141
+ {
142
+ if (child.nodeType == 1 && child.getAttribute("selected") == "true")
143
+ return child;
144
+ }
145
+ },
146
+ isNativeUrl: function(href)
147
+ {
148
+ for(var i = 0; i < iui.nativeUrlPatterns.length; i++)
149
+ {
150
+ if(href.match(iui.nativeUrlPatterns[i])) return true;
151
+ }
152
+ return false;
153
+ },
154
+ nativeUrlPatterns: [
155
+ new RegExp("^http:\/\/maps.google.com\/maps\?"),
156
+ new RegExp("^mailto:"),
157
+ new RegExp("^tel:"),
158
+ new RegExp("^http:\/\/www.youtube.com\/watch\\?v="),
159
+ new RegExp("^http:\/\/www.youtube.com\/v\/"),
160
+ new RegExp("^javascript:"),
161
+
162
+ ]
163
+ };
164
+
165
+ // *************************************************************************************************
166
+
167
+ addEventListener("load", function(event)
168
+ {
169
+ var page = iui.getSelectedPage();
170
+ var locPage = getPageFromLoc();
171
+
172
+ if (page)
173
+ iui.showPage(page);
174
+
175
+ if (locPage && (locPage != page))
176
+ iui.showPage(locPage);
177
+
178
+ setTimeout(preloadImages, 0);
179
+ if (typeof window.onorientationchange == "object")
180
+ {
181
+ window.onorientationchange=orientChangeHandler;
182
+ hasOrientationEvent = true;
183
+ setTimeout(orientChangeHandler, 0);
184
+ }
185
+ setTimeout(checkOrientAndLocation, 0);
186
+ checkTimer = setInterval(checkOrientAndLocation, 300);
187
+ }, false);
188
+
189
+ addEventListener("unload", function(event)
190
+ {
191
+ return;
192
+ }, false);
193
+
194
+ addEventListener("click", function(event)
195
+ {
196
+ var link = findParent(event.target, "a");
197
+ if (link)
198
+ {
199
+ function unselect() { link.removeAttribute("selected"); }
200
+
201
+ if (link.href && link.hash && link.hash != "#" && !link.target)
202
+ {
203
+ link.setAttribute("selected", "true");
204
+ iui.showPage($(link.hash.substr(1)));
205
+ setTimeout(unselect, 500);
206
+ }
207
+ else if (link == $("backButton"))
208
+ history.back();
209
+ else if (link.getAttribute("type") == "submit")
210
+ submitForm(findParent(link, "form"));
211
+ else if (link.getAttribute("type") == "cancel")
212
+ cancelDialog(findParent(link, "form"));
213
+ else if (link.target == "_replace")
214
+ {
215
+ link.setAttribute("selected", "progress");
216
+ iui.showPageByHref(link.href, null, null, link, unselect);
217
+ }
218
+ else if (iui.isNativeUrl(link.href))
219
+ {
220
+ return;
221
+ }
222
+ else if (link.target == "_webapp")
223
+ {
224
+ location.href = link.href;
225
+ }
226
+ else if (!link.target)
227
+ {
228
+ link.setAttribute("selected", "progress");
229
+ iui.showPageByHref(link.href, null, null, null, unselect);
230
+ }
231
+ else
232
+ return;
233
+
234
+ event.preventDefault();
235
+ }
236
+ }, true);
237
+
238
+ addEventListener("click", function(event)
239
+ {
240
+ var div = findParent(event.target, "div");
241
+ if (div && hasClass(div, "toggle"))
242
+ {
243
+ div.setAttribute("toggled", div.getAttribute("toggled") != "true");
244
+ event.preventDefault();
245
+ }
246
+ }, true);
247
+
248
+ function getPageFromLoc()
249
+ {
250
+ var page;
251
+ var result = location.hash.match(/#_([^\?_]+)/);
252
+ if (result)
253
+ page = result[1];
254
+ if (page)
255
+ page = $(page);
256
+ return page;
257
+ }
258
+
259
+ function orientChangeHandler()
260
+ {
261
+ var orientation=window.orientation;
262
+ switch(orientation)
263
+ {
264
+ case 0:
265
+ setOrientation(portraitVal);
266
+ break;
267
+
268
+ case 90:
269
+ case -90:
270
+ setOrientation(landscapeVal);
271
+ break;
272
+ }
273
+ }
274
+
275
+
276
+ function checkOrientAndLocation()
277
+ {
278
+ if (!hasOrientationEvent)
279
+ {
280
+ if (window.innerWidth != currentWidth)
281
+ {
282
+ currentWidth = window.innerWidth;
283
+ var orient = currentWidth == 320 ? portraitVal : landscapeVal;
284
+ setOrientation(orient);
285
+ }
286
+ }
287
+
288
+ if (location.hash != currentHash)
289
+ {
290
+ var pageId = location.hash.substr(hashPrefix.length);
291
+ iui.showPageById(pageId);
292
+ }
293
+ }
294
+
295
+ function setOrientation(orient)
296
+ {
297
+ document.body.setAttribute("orient", orient);
298
+ setTimeout(scrollTo, 100, 0, 1);
299
+ }
300
+
301
+ function showDialog(page)
302
+ {
303
+ currentDialog = page;
304
+ page.setAttribute("selected", "true");
305
+
306
+ if (hasClass(page, "dialog") && !page.target)
307
+ showForm(page);
308
+ }
309
+
310
+ function showForm(form)
311
+ {
312
+ form.onsubmit = function(event)
313
+ {
314
+ event.preventDefault();
315
+ submitForm(form);
316
+ };
317
+
318
+ form.onclick = function(event)
319
+ {
320
+ if (event.target == form && hasClass(form, "dialog"))
321
+ cancelDialog(form);
322
+ };
323
+ }
324
+
325
+ function cancelDialog(form)
326
+ {
327
+ form.removeAttribute("selected");
328
+ }
329
+
330
+ function updatePage(page, fromPage)
331
+ {
332
+ if (!page.id)
333
+ page.id = "__" + (++newPageCount) + "__";
334
+
335
+ location.hash = currentHash = hashPrefix + page.id;
336
+ pageHistory.push(page.id);
337
+
338
+ var pageTitle = $("pageTitle");
339
+ if (page.title)
340
+ pageTitle.innerHTML = page.title;
341
+
342
+ if (page.localName.toLowerCase() == "form" && !page.target)
343
+ showForm(page);
344
+
345
+ var backButton = $("backButton");
346
+ if (backButton)
347
+ {
348
+ var prevPage = $(pageHistory[pageHistory.length-2]);
349
+ if (prevPage && !page.getAttribute("hideBackButton"))
350
+ {
351
+ backButton.style.display = "inline";
352
+ backButton.innerHTML = prevPage.title ? prevPage.title : "Back";
353
+ }
354
+ else
355
+ backButton.style.display = "none";
356
+ }
357
+ }
358
+
359
+ function slidePages(fromPage, toPage, backwards)
360
+ {
361
+ var axis = (backwards ? fromPage : toPage).getAttribute("axis");
362
+
363
+ clearInterval(checkTimer);
364
+
365
+ if (canDoSlideAnim() && axis != 'y')
366
+ {
367
+ slide2(fromPage, toPage, backwards, slideDone);
368
+ }
369
+ else
370
+ {
371
+ slide1(fromPage, toPage, backwards, axis, slideDone);
372
+ }
373
+
374
+ function slideDone()
375
+ {
376
+ if (!hasClass(toPage, "dialog"))
377
+ fromPage.removeAttribute("selected");
378
+ checkTimer = setInterval(checkOrientAndLocation, 300);
379
+ setTimeout(updatePage, 0, toPage, fromPage);
380
+ fromPage.removeEventListener('webkitTransitionEnd', slideDone, false);
381
+ }
382
+ }
383
+
384
+ function canDoSlideAnim()
385
+ {
386
+ return (iui.animOn) && (typeof WebKitCSSMatrix == "object");
387
+ }
388
+
389
+ function slide1(fromPage, toPage, backwards, axis, cb)
390
+ {
391
+ if (axis == "y")
392
+ (backwards ? fromPage : toPage).style.top = "100%";
393
+ else
394
+ toPage.style.left = "100%";
395
+
396
+ scrollTo(0, 1);
397
+ toPage.setAttribute("selected", "true");
398
+ var percent = 100;
399
+ slide();
400
+ var timer = setInterval(slide, slideInterval);
401
+
402
+ function slide()
403
+ {
404
+ percent -= slideSpeed;
405
+ if (percent <= 0)
406
+ {
407
+ percent = 0;
408
+ clearInterval(timer);
409
+ cb();
410
+ }
411
+
412
+ if (axis == "y")
413
+ {
414
+ backwards
415
+ ? fromPage.style.top = (100-percent) + "%"
416
+ : toPage.style.top = percent + "%";
417
+ }
418
+ else
419
+ {
420
+ fromPage.style.left = (backwards ? (100-percent) : (percent-100)) + "%";
421
+ toPage.style.left = (backwards ? -percent : percent) + "%";
422
+ }
423
+ }
424
+ }
425
+
426
+
427
+ function slide2(fromPage, toPage, backwards, cb)
428
+ {
429
+ toPage.style.webkitTransitionDuration = '0ms'; // Turn off transitions to set toPage start offset
430
+ // fromStart is always 0% and toEnd is always 0%
431
+ // iPhone won't take % width on toPage
432
+ var toStart = 'translateX(' + (backwards ? '-' : '') + window.innerWidth + 'px)';
433
+ var fromEnd = 'translateX(' + (backwards ? '100%' : '-100%') + ')';
434
+ toPage.style.webkitTransform = toStart;
435
+ toPage.setAttribute("selected", "true");
436
+ toPage.style.webkitTransitionDuration = ''; // Turn transitions back on
437
+ function startTrans()
438
+ {
439
+ fromPage.style.webkitTransform = fromEnd;
440
+ toPage.style.webkitTransform = 'translateX(0%)'; //toEnd
441
+ }
442
+ fromPage.addEventListener('webkitTransitionEnd', cb, false);
443
+ setTimeout(startTrans, 0);
444
+ }
445
+
446
+ function preloadImages()
447
+ {
448
+ var preloader = document.createElement("div");
449
+ preloader.id = "preloader";
450
+ document.body.appendChild(preloader);
451
+ }
452
+
453
+ function submitForm(form)
454
+ {
455
+ iui.showPageByHref(form.action || "POST", encodeForm(form), form.method);
456
+ }
457
+
458
+ function encodeForm(form)
459
+ {
460
+ function encode(inputs)
461
+ {
462
+ for (var i = 0; i < inputs.length; ++i)
463
+ {
464
+ if (inputs[i].name)
465
+ args.push(inputs[i].name + "=" + escape(inputs[i].value));
466
+ }
467
+ }
468
+
469
+ var args = [];
470
+ encode(form.getElementsByTagName("input"));
471
+ encode(form.getElementsByTagName("textarea"));
472
+ encode(form.getElementsByTagName("select"));
473
+ return args;
474
+ }
475
+
476
+ function findParent(node, localName)
477
+ {
478
+ while (node && (node.nodeType != 1 || node.localName.toLowerCase() != localName))
479
+ node = node.parentNode;
480
+ return node;
481
+ }
482
+
483
+ function hasClass(self, name)
484
+ {
485
+ var re = new RegExp("(^|\\s)"+name+"($|\\s)");
486
+ return re.exec(self.getAttribute("class")) != null;
487
+ }
488
+
489
+ function replaceElementWithSource(replace, source)
490
+ {
491
+ var page = replace.parentNode;
492
+ var parent = replace;
493
+ while (page.parentNode != document.body)
494
+ {
495
+ page = page.parentNode;
496
+ parent = parent.parentNode;
497
+ }
498
+
499
+ var frag = document.createElement(parent.localName);
500
+ frag.innerHTML = source;
501
+
502
+ page.removeChild(parent);
503
+
504
+ while (frag.firstChild)
505
+ page.appendChild(frag.firstChild);
506
+ }
507
+
508
+ function $(id) { return document.getElementById(id); }
509
+ function ddd() { console.log.apply(console, arguments); }
510
+
511
+ })();
@@ -0,0 +1 @@
1
+ body{margin:0;font-family:Helvetica;background:#FFF;color:#000;overflow-x:hidden;-webkit-user-select:none;-webkit-text-size-adjust:none;}body>*:not(.toolbar){display:none;position:absolute;margin:0;padding:0;left:0;top:45px;width:100%;min-height:372px;-webkit-transition-duration:300ms;-webkit-transition-property:-webkit-transform;-webkit-transform:translateX(0%);}body[orient="landscape"]>*:not(.toolbar){min-height:268px;}body>*[selected="true"]{display:block;}a[selected],a:active{background-color:#194fdb!important;background-image:url(listArrowSel.png),url(selection.png)!important;background-repeat:no-repeat,repeat-x;background-position:right center,left top;color:#FFF!important;}a[selected="progress"]{background-image:url(loading.gif),url(selection.png)!important;}body>.toolbar{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border-bottom:1px solid #2d3642;border-top:1px solid #6d84a2;padding:10px;height:45px;background:url(toolbar.png) #6d84a2 repeat-x;}.toolbar>h1{position:absolute;overflow:hidden;left:50%;margin:1px 0 0 -75px;height:45px;font-size:20px;width:150px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;text-overflow:ellipsis;white-space:nowrap;color:#FFF;}body[orient="landscape"]>.toolbar>h1{margin-left:-125px;width:250px;}.button{position:absolute;overflow:hidden;top:8px;right:6px;margin:0;border-width:0 5px;padding:0 3px;width:auto;height:30px;line-height:30px;font-family:inherit;font-size:12px;font-weight:bold;color:#FFF;text-shadow:rgba(0,0,0,0.6) 0 -1px 0;text-overflow:ellipsis;text-decoration:none;white-space:nowrap;background:none;-webkit-border-image:url(toolButton.png) 0 5 0 5;}.blueButton{-webkit-border-image:url(blueButton.png) 0 5 0 5;border-width:0 5px;}.leftButton{left:6px;right:auto;}#backButton{display:none;left:6px;right:auto;padding:0;max-width:55px;border-width:0 8px 0 14px;-webkit-border-image:url(backButton.png) 0 8 0 14;}.whiteButton,.redButton,.grayButton{display:block;border-width:0 12px;padding:10px;text-align:center;font-size:20px;font-weight:bold;text-decoration:inherit;color:inherit;}.whiteButton{-webkit-border-image:url(whiteButton.png) 0 12 0 12;text-shadow:rgba(255,255,255,0.7) 0 1px 0;}.redButton{-webkit-border-image:url(redButton.png) 0 12 0 12;color:#fff;text-shadow:#7a0001 0 -1px 0;}.grayButton{-webkit-border-image:url(grayButton.png) 0 12 0 12;color:#FFF;}body>ul>li{position:relative;margin:0;border-bottom:1px solid #E0E0E0;padding:8px 0 8px 10px;font-size:20px;font-weight:bold;list-style:none;}body>ul>li.group{position:relative;top:-1px;margin-bottom:-2px;border-top:1px solid #7d7d7d;border-bottom:1px solid #999;padding:1px 10px;background:url(listGroup.png) repeat-x;font-size:17px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 1px 0;color:#FFF;}body>ul>li.group:first-child{top:0;border-top:none;}body>ul>li>a{display:block;margin:-8px 0 -8px -10px;padding:8px 32px 8px 10px;text-decoration:none;color:inherit;background:url(listArrow.png) no-repeat right center;}a[target="_replace"]{box-sizing:border-box;-webkit-box-sizing:border-box;padding-top:25px;padding-bottom:25px;font-size:18px;color:cornflowerblue;background-color:#FFF;background-image:none;}body>.dialog{top:0;width:100%;min-height:417px;z-index:2;background:rgba(0,0,0,0.8);padding:0;text-align:right;}.dialog>fieldset{box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;margin:0;border:none;border-top:1px solid #6d84a2;padding:10px 6px;background:url(toolbar.png) #7388a5 repeat-x;}.dialog>fieldset>h1{margin:0 10px 0 10px;padding:0;font-size:20px;font-weight:bold;color:#FFF;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;}.dialog>fieldset>label{position:absolute;margin:16px 0 0 6px;font-size:14px;color:#999;}input:not(input[type|=radio]):not(input[type|=checkbox]){box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;margin:8px 0 0 0;padding:6px 6px 6px 44px;font-size:16px;font-weight:normal;}body>.panel{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:10px;background:#c8c8c8 url(pinstripes.png);}.panel>fieldset{position:relative;margin:0 0 20px 0;padding:0;background:#FFF;-webkit-border-radius:10px;-moz-border-radius:10px;border:1px solid #999;text-align:right;font-size:16px;}.row{position:relative;min-height:42px;border-bottom:1px solid #999;-webkit-border-radius:0;text-align:right;}fieldset>.row:last-child{border-bottom:none!important;}.row>input:not(input[type|=radio]):not(input[type|=checkbox]){box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin:0;border:none;padding:12px 10px 0 110px;height:42px;background:none;}.row>input[type|=radio],.row>input[type|=checkbox]{margin:7px 7px 0 0;height:25px;width:25px;}.row>label{position:absolute;margin:0 0 0 14px;line-height:42px;font-weight:bold;}.row>span{position:absolute;padding:12px 10px 0 110px;margin:0;}.row>.toggle{position:absolute;top:6px;right:6px;width:100px;height:28px;}.toggle{border:1px solid #888;-webkit-border-radius:6px;background:#FFF url(toggle.png) repeat-x;font-size:19px;font-weight:bold;line-height:30px;}.toggle[toggled="true"]{border:1px solid #143fae;background:#194fdb url(toggleOn.png) repeat-x;}.toggleOn{display:none;position:absolute;width:60px;text-align:center;left:0;top:0;color:#FFF;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;}.toggleOff{position:absolute;width:60px;text-align:center;right:0;top:0;color:#666;}.toggle[toggled="true"]>.toggleOn{display:block;}.toggle[toggled="true"]>.toggleOff{display:none;}.thumb{position:absolute;top:-1px;left:-1px;width:40px;height:28px;border:1px solid #888;-webkit-border-radius:6px;background:#fff url(thumb.png) repeat-x;}.toggle[toggled="true"]>.thumb{left:auto;right:-1px;}.panel>h2{margin:0 0 8px 14px;font-size:inherit;font-weight:bold;color:#4d4d70;text-shadow:rgba(255,255,255,0.75) 2px 2px 0;}#preloader{display:none;background-image:url(loading.gif),url(selection.png),url(blueButton.png),url(listArrowSel.png),url(listGroup.png);}
@@ -0,0 +1 @@
1
+ (function(){var _1=20;var _2=0;var _3=null;var _4=null;var _5=0;var _6=location.hash;var _7="#_";var _8=[];var _9=0;var _a;var _b=false;var _c="portrait";var _d="landscape";window.iui={animOn:false,showPage:function(_e,_f){if(_e){if(_4){_4.removeAttribute("selected");_4=null;}if(hasClass(_e,"dialog")){showDialog(_e);}else{var _10=_3;_3=_e;if(_10){setTimeout(slidePages,0,_10,_e,_f);}else{updatePage(_e,_10);}}}},showPageById:function(_11){var _12=$(_11);if(_12){var _13=_8.indexOf(_11);var _14=_13!=-1;if(_14){_8.splice(_13,_8.length);}iui.showPage(_12,_14);}},showPageByHref:function(_15,_16,_17,_18,cb){var req=new XMLHttpRequest();req.onerror=function(){if(cb){cb(false);}};req.onreadystatechange=function(){if(req.readyState==4){if(_18){replaceElementWithSource(_18,req.responseText);}else{var _1b=document.createElement("div");_1b.innerHTML=req.responseText;iui.insertPages(_1b.childNodes);}if(cb){setTimeout(cb,1000,true);}}};if(_16){req.open(_17||"GET",_15,true);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");req.setRequestHeader("Content-Length",_16.length);req.send(_16.join("&"));}else{req.open(_17||"GET",_15,true);req.send(null);}},insertPages:function(_1c){var _1d;for(var i=0;i<_1c.length;++i){var _1f=_1c[i];if(_1f.nodeType==1){if(!_1f.id){_1f.id="__"+(++_9)+"__";}var _20=$(_1f.id);if(_20){_20.parentNode.replaceChild(_1f,_20);}else{document.body.appendChild(_1f);}if(_1f.getAttribute("selected")=="true"||!_1d){_1d=_1f;}--i;}}if(_1d){iui.showPage(_1d);}},getSelectedPage:function(){for(var _21=document.body.firstChild;_21;_21=_21.nextSibling){if(_21.nodeType==1&&_21.getAttribute("selected")=="true"){return _21;}}},isNativeUrl:function(_22){for(var i=0;i<iui.nativeUrlPatterns.length;i++){if(_22.match(iui.nativeUrlPatterns[i])){return true;}}return false;},nativeUrlPatterns:[new RegExp("^http://maps.google.com/maps?"),new RegExp("^mailto:"),new RegExp("^tel:"),new RegExp("^http://www.youtube.com/watch\\?v="),new RegExp("^http://www.youtube.com/v/"),new RegExp("^javascript:"),]};addEventListener("load",function(_24){var _25=iui.getSelectedPage();var _26=getPageFromLoc();if(_25){iui.showPage(_25);}if(_26&&(_26!=_25)){iui.showPage(_26);}setTimeout(preloadImages,0);if(typeof window.onorientationchange=="object"){window.onorientationchange=orientChangeHandler;_b=true;setTimeout(orientChangeHandler,0);}setTimeout(checkOrientAndLocation,0);_a=setInterval(checkOrientAndLocation,300);},false);addEventListener("unload",function(_27){return;},false);addEventListener("click",function(_28){var _29=findParent(_28.target,"a");if(_29){function unselect(){_29.removeAttribute("selected");}if(_29.href&&_29.hash&&_29.hash!="#"&&!_29.target){_29.setAttribute("selected","true");iui.showPage($(_29.hash.substr(1)));setTimeout(unselect,500);}else{if(_29==$("backButton")){history.back();}else{if(_29.getAttribute("type")=="submit"){submitForm(findParent(_29,"form"));}else{if(_29.getAttribute("type")=="cancel"){cancelDialog(findParent(_29,"form"));}else{if(_29.target=="_replace"){_29.setAttribute("selected","progress");iui.showPageByHref(_29.href,null,null,_29,unselect);}else{if(iui.isNativeUrl(_29.href)){return;}else{if(_29.target=="_webapp"){location.href=_29.href;}else{if(!_29.target){_29.setAttribute("selected","progress");iui.showPageByHref(_29.href,null,null,null,unselect);}else{return;}}}}}}}}_28.preventDefault();}},true);addEventListener("click",function(_2a){var div=findParent(_2a.target,"div");if(div&&hasClass(div,"toggle")){div.setAttribute("toggled",div.getAttribute("toggled")!="true");_2a.preventDefault();}},true);function getPageFromLoc(){var _2c;var _2d=location.hash.match(/#_([^\?_]+)/);if(_2d){_2c=_2d[1];}if(_2c){_2c=$(_2c);}return _2c;}function orientChangeHandler(){var _2e=window.orientation;switch(_2e){case 0:setOrientation(_c);break;case 90:case -90:setOrientation(_d);break;}}function checkOrientAndLocation(){if(!_b){if(window.innerWidth!=_5){_5=window.innerWidth;var _2f=_5==320?_c:_d;setOrientation(_2f);}}if(location.hash!=_6){var _30=location.hash.substr(_7.length);iui.showPageById(_30);}}function setOrientation(_31){document.body.setAttribute("orient",_31);setTimeout(scrollTo,100,0,1);}function showDialog(_32){_4=_32;_32.setAttribute("selected","true");if(hasClass(_32,"dialog")&&!_32.target){showForm(_32);}}function showForm(_33){_33.onsubmit=function(_34){_34.preventDefault();submitForm(_33);};_33.onclick=function(_35){if(_35.target==_33&&hasClass(_33,"dialog")){cancelDialog(_33);}};}function cancelDialog(_36){_36.removeAttribute("selected");}function updatePage(_37,_38){if(!_37.id){_37.id="__"+(++_9)+"__";}location.hash=_6=_7+_37.id;_8.push(_37.id);var _39=$("pageTitle");if(_37.title){_39.innerHTML=_37.title;}if(_37.localName.toLowerCase()=="form"&&!_37.target){showForm(_37);}var _3a=$("backButton");if(_3a){var _3b=$(_8[_8.length-2]);if(_3b&&!_37.getAttribute("hideBackButton")){_3a.style.display="inline";_3a.innerHTML=_3b.title?_3b.title:"Back";}else{_3a.style.display="none";}}}function slidePages(_3c,_3d,_3e){var _3f=(_3e?_3c:_3d).getAttribute("axis");clearInterval(_a);if(canDoSlideAnim()&&_3f!="y"){slide2(_3c,_3d,_3e,slideDone);}else{slide1(_3c,_3d,_3e,_3f,slideDone);}function slideDone(){if(!hasClass(_3d,"dialog")){_3c.removeAttribute("selected");}_a=setInterval(checkOrientAndLocation,300);setTimeout(updatePage,0,_3d,_3c);_3c.removeEventListener("webkitTransitionEnd",slideDone,false);}}function canDoSlideAnim(){return (iui.animOn)&&(typeof WebKitCSSMatrix=="object");}function slide1(_40,_41,_42,_43,cb){if(_43=="y"){(_42?_40:_41).style.top="100%";}else{_41.style.left="100%";}scrollTo(0,1);_41.setAttribute("selected","true");var _45=100;slide();var _46=setInterval(slide,_2);function slide(){_45-=_1;if(_45<=0){_45=0;clearInterval(_46);cb();}if(_43=="y"){_42?_40.style.top=(100-_45)+"%":_41.style.top=_45+"%";}else{_40.style.left=(_42?(100-_45):(_45-100))+"%";_41.style.left=(_42?-_45:_45)+"%";}}}function slide2(_47,_48,_49,cb){_48.style.webkitTransitionDuration="0ms";var _4b="translateX("+(_49?"-":"")+window.innerWidth+"px)";var _4c="translateX("+(_49?"100%":"-100%")+")";_48.style.webkitTransform=_4b;_48.setAttribute("selected","true");_48.style.webkitTransitionDuration="";function startTrans(){_47.style.webkitTransform=_4c;_48.style.webkitTransform="translateX(0%)";}_47.addEventListener("webkitTransitionEnd",cb,false);setTimeout(startTrans,0);}function preloadImages(){var _4d=document.createElement("div");_4d.id="preloader";document.body.appendChild(_4d);}function submitForm(_4e){iui.showPageByHref(_4e.action||"POST",encodeForm(_4e),_4e.method);}function encodeForm(_4f){function encode(_50){for(var i=0;i<_50.length;++i){if(_50[i].name){args.push(_50[i].name+"="+escape(_50[i].value));}}}var _52=[];encode(_4f.getElementsByTagName("input"));encode(_4f.getElementsByTagName("textarea"));encode(_4f.getElementsByTagName("select"));return _52;}function findParent(_53,_54){while(_53&&(_53.nodeType!=1||_53.localName.toLowerCase()!=_54)){_53=_53.parentNode;}return _53;}function hasClass(_55,_56){var re=new RegExp("(^|\\s)"+_56+"($|\\s)");return re.exec(_55.getAttribute("class"))!=null;}function replaceElementWithSource(_58,_59){var _5a=_58.parentNode;var _5b=_58;while(_5a.parentNode!=document.body){_5a=_5a.parentNode;_5b=_5b.parentNode;}var _5c=document.createElement(_5b.localName);_5c.innerHTML=_59;_5a.removeChild(_5b);while(_5c.firstChild){_5a.appendChild(_5c.firstChild);}}function $(id){return document.getElementById(id);}function ddd(){console.log.apply(console,arguments);}})();
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file