Capcode 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/README +4 -0
  2. data/doc/rdoc/classes/Capcode.html +99 -95
  3. data/doc/rdoc/classes/Capcode/Helpers.html +20 -35
  4. data/doc/rdoc/created.rid +1 -1
  5. data/doc/rdoc/files/README.html +10 -1
  6. data/doc/rdoc/files/lib/capcode_rb.html +1 -1
  7. data/doc/rdoc_iphone/classes/Capcode.html +175 -0
  8. data/doc/rdoc_iphone/classes/Capcode/HTTPError.html +21 -0
  9. data/doc/rdoc_iphone/classes/Capcode/Helpers.html +153 -0
  10. data/doc/rdoc_iphone/classes/Capcode/RenderError.html +21 -0
  11. data/doc/rdoc_iphone/classes/Capcode/Views.html +21 -0
  12. data/doc/rdoc_iphone/classes_index.html +10 -0
  13. data/doc/rdoc_iphone/created.rid +1 -0
  14. data/doc/rdoc_iphone/files/AUTHORS.html +11 -0
  15. data/doc/rdoc_iphone/files/COPYING.html +435 -0
  16. data/doc/rdoc_iphone/files/README.html +325 -0
  17. data/doc/rdoc_iphone/files/lib/capcode_rb.html +435 -0
  18. data/doc/rdoc_iphone/files_index.html +7 -0
  19. data/doc/rdoc_iphone/index.html +51 -0
  20. data/doc/rdoc_iphone/iui/backButton.png +0 -0
  21. data/doc/rdoc_iphone/iui/blueButton.png +0 -0
  22. data/doc/rdoc_iphone/iui/cancel.png +0 -0
  23. data/doc/rdoc_iphone/iui/grayButton.png +0 -0
  24. data/doc/rdoc_iphone/iui/iui-logo-touch-icon.png +0 -0
  25. data/doc/rdoc_iphone/iui/iui.css +386 -0
  26. data/doc/rdoc_iphone/iui/iui.js +442 -0
  27. data/doc/rdoc_iphone/iui/iuix.css +1 -0
  28. data/doc/rdoc_iphone/iui/iuix.js +1 -0
  29. data/doc/rdoc_iphone/iui/listArrow.png +0 -0
  30. data/doc/rdoc_iphone/iui/listArrowSel.png +0 -0
  31. data/doc/rdoc_iphone/iui/listGroup.png +0 -0
  32. data/doc/rdoc_iphone/iui/loading.gif +0 -0
  33. data/doc/rdoc_iphone/iui/pinstripes.png +0 -0
  34. data/doc/rdoc_iphone/iui/selection.png +0 -0
  35. data/doc/rdoc_iphone/iui/thumb.png +0 -0
  36. data/doc/rdoc_iphone/iui/toggle.png +0 -0
  37. data/doc/rdoc_iphone/iui/toggleOn.png +0 -0
  38. data/doc/rdoc_iphone/iui/toolButton.png +0 -0
  39. data/doc/rdoc_iphone/iui/toolbar.png +0 -0
  40. data/doc/rdoc_iphone/iui/whiteButton.png +0 -0
  41. data/doc/rdoc_iphone/rdoc-style.css +0 -0
  42. data/examples/blog-couchdb.rb +4 -0
  43. data/examples/blog-dm.rb +2 -0
  44. data/examples/my_blog.db +0 -0
  45. data/lib/capcode.rb +5 -1
  46. data/lib/capcode/base/couchdb.rb +4 -0
  47. data/lib/capcode/base/dm.rb +2 -1
  48. data/lib/capcode/version.rb +1 -1
  49. metadata +37 -2
@@ -0,0 +1,442 @@
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
+ showPage: function(page, backwards)
29
+ {
30
+ if (page)
31
+ {
32
+ if (currentDialog)
33
+ {
34
+ currentDialog.removeAttribute("selected");
35
+ currentDialog = null;
36
+ }
37
+
38
+ if (hasClass(page, "dialog"))
39
+ showDialog(page);
40
+ else
41
+ {
42
+ var fromPage = currentPage;
43
+ currentPage = page;
44
+
45
+ if (fromPage)
46
+ setTimeout(slidePages, 0, fromPage, page, backwards);
47
+ else
48
+ updatePage(page, fromPage);
49
+ }
50
+ }
51
+ },
52
+
53
+ showPageById: function(pageId)
54
+ {
55
+ var page = $(pageId);
56
+ if (page)
57
+ {
58
+ var index = pageHistory.indexOf(pageId);
59
+ var backwards = index != -1;
60
+ if (backwards)
61
+ pageHistory.splice(index, pageHistory.length);
62
+
63
+ iui.showPage(page, backwards);
64
+ }
65
+ },
66
+
67
+ showPageByHref: function(href, args, method, replace, cb)
68
+ {
69
+ var req = new XMLHttpRequest();
70
+ req.onerror = function()
71
+ {
72
+ if (cb)
73
+ cb(false);
74
+ };
75
+
76
+ req.onreadystatechange = function()
77
+ {
78
+ if (req.readyState == 4)
79
+ {
80
+ if (replace)
81
+ replaceElementWithSource(replace, req.responseText);
82
+ else
83
+ {
84
+ var frag = document.createElement("div");
85
+ frag.innerHTML = req.responseText;
86
+ iui.insertPages(frag.childNodes);
87
+ }
88
+ if (cb)
89
+ setTimeout(cb, 1000, true);
90
+ }
91
+ };
92
+
93
+ if (args)
94
+ {
95
+ req.open(method || "GET", href, true);
96
+ req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
97
+ req.setRequestHeader("Content-Length", args.length);
98
+ req.send(args.join("&"));
99
+ }
100
+ else
101
+ {
102
+ req.open(method || "GET", href, true);
103
+ req.send(null);
104
+ }
105
+ },
106
+
107
+ insertPages: function(nodes)
108
+ {
109
+ var targetPage;
110
+ for (var i = 0; i < nodes.length; ++i)
111
+ {
112
+ var child = nodes[i];
113
+ if (child.nodeType == 1)
114
+ {
115
+ if (!child.id)
116
+ child.id = "__" + (++newPageCount) + "__";
117
+
118
+ var clone = $(child.id);
119
+ if (clone)
120
+ clone.parentNode.replaceChild(child, clone);
121
+ else
122
+ document.body.appendChild(child);
123
+
124
+ if (child.getAttribute("selected") == "true" || !targetPage)
125
+ targetPage = child;
126
+
127
+ --i;
128
+ }
129
+ }
130
+
131
+ if (targetPage)
132
+ iui.showPage(targetPage);
133
+ },
134
+
135
+ getSelectedPage: function()
136
+ {
137
+ for (var child = document.body.firstChild; child; child = child.nextSibling)
138
+ {
139
+ if (child.nodeType == 1 && child.getAttribute("selected") == "true")
140
+ return child;
141
+ }
142
+ },
143
+ isNativeUrl: function(href)
144
+ {
145
+ for(var i = 0; i < iui.nativeUrlPatterns.length; i++)
146
+ {
147
+ if(href.match(iui.nativeUrlPatterns[i])) return true;
148
+ }
149
+ return false;
150
+ },
151
+ nativeUrlPatterns: [
152
+ new RegExp("^http:\/\/maps.google.com\/maps\?"),
153
+ new RegExp("^mailto:"),
154
+ new RegExp("^tel:"),
155
+ new RegExp("^http:\/\/www.youtube.com\/watch\\?v="),
156
+ new RegExp("^http:\/\/www.youtube.com\/v\/")
157
+ ]
158
+ };
159
+
160
+ // *************************************************************************************************
161
+
162
+ addEventListener("load", function(event)
163
+ {
164
+ var page = iui.getSelectedPage();
165
+ if (page)
166
+ iui.showPage(page);
167
+
168
+ setTimeout(preloadImages, 0);
169
+ setTimeout(checkOrientAndLocation, 0);
170
+ checkTimer = setInterval(checkOrientAndLocation, 300);
171
+ }, false);
172
+
173
+ addEventListener("unload", function(event)
174
+ {
175
+ return;
176
+ }, false);
177
+
178
+ addEventListener("click", function(event)
179
+ {
180
+ var link = findParent(event.target, "a");
181
+ if (link)
182
+ {
183
+ function unselect() { link.removeAttribute("selected"); }
184
+
185
+ if (link.href && link.hash && link.hash != "#")
186
+ {
187
+ link.setAttribute("selected", "true");
188
+ iui.showPage($(link.hash.substr(1)));
189
+ setTimeout(unselect, 500);
190
+ }
191
+ else if (link == $("backButton"))
192
+ history.back();
193
+ else if (link.getAttribute("type") == "submit")
194
+ submitForm(findParent(link, "form"));
195
+ else if (link.getAttribute("type") == "cancel")
196
+ cancelDialog(findParent(link, "form"));
197
+ else if (link.target == "_replace")
198
+ {
199
+ link.setAttribute("selected", "progress");
200
+ iui.showPageByHref(link.href, null, null, link, unselect);
201
+ }
202
+ else if (iui.isNativeUrl(link.href))
203
+ {
204
+ return;
205
+ }
206
+ else if (!link.target)
207
+ {
208
+ link.setAttribute("selected", "progress");
209
+ iui.showPageByHref(link.href, null, null, null, unselect);
210
+ }
211
+ else
212
+ return;
213
+
214
+ event.preventDefault();
215
+ }
216
+ }, true);
217
+
218
+ addEventListener("click", function(event)
219
+ {
220
+ var div = findParent(event.target, "div");
221
+ if (div && hasClass(div, "toggle"))
222
+ {
223
+ div.setAttribute("toggled", div.getAttribute("toggled") != "true");
224
+ event.preventDefault();
225
+ }
226
+ }, true);
227
+
228
+ function orientChangeHandler()
229
+ {
230
+ var orientation=window.orientation;
231
+ switch(orientation)
232
+ {
233
+ case 0:
234
+ setOrientation(portraitVal);
235
+ break;
236
+
237
+ case 90:
238
+ case -90:
239
+ setOrientation(landscapeVal);
240
+ break;
241
+ }
242
+ }
243
+
244
+ if (typeof window.onorientationchange == "object")
245
+ {
246
+ window.onorientationchange=orientChangeHandler;
247
+ hasOrientationEvent = true;
248
+ setTimeout(orientChangeHandler, 0);
249
+ }
250
+
251
+ function checkOrientAndLocation()
252
+ {
253
+ if (!hasOrientationEvent)
254
+ {
255
+ if (window.innerWidth != currentWidth)
256
+ {
257
+ currentWidth = window.innerWidth;
258
+ var orient = currentWidth == 320 ? portraitVal : landscapeVal;
259
+ setOrientation(orient);
260
+ }
261
+ }
262
+
263
+ if (location.hash != currentHash)
264
+ {
265
+ var pageId = location.hash.substr(hashPrefix.length);
266
+ iui.showPageById(pageId);
267
+ }
268
+ }
269
+
270
+ function setOrientation(orient)
271
+ {
272
+ document.body.setAttribute("orient", orient);
273
+ setTimeout(scrollTo, 100, 0, 1);
274
+ }
275
+
276
+ function showDialog(page)
277
+ {
278
+ currentDialog = page;
279
+ page.setAttribute("selected", "true");
280
+
281
+ if (hasClass(page, "dialog") && !page.target)
282
+ showForm(page);
283
+ }
284
+
285
+ function showForm(form)
286
+ {
287
+ form.onsubmit = function(event)
288
+ {
289
+ event.preventDefault();
290
+ submitForm(form);
291
+ };
292
+
293
+ form.onclick = function(event)
294
+ {
295
+ if (event.target == form && hasClass(form, "dialog"))
296
+ cancelDialog(form);
297
+ };
298
+ }
299
+
300
+ function cancelDialog(form)
301
+ {
302
+ form.removeAttribute("selected");
303
+ }
304
+
305
+ function updatePage(page, fromPage)
306
+ {
307
+ if (!page.id)
308
+ page.id = "__" + (++newPageCount) + "__";
309
+
310
+ location.href = currentHash = hashPrefix + page.id;
311
+ pageHistory.push(page.id);
312
+
313
+ var pageTitle = $("pageTitle");
314
+ if (page.title)
315
+ pageTitle.innerHTML = page.title;
316
+
317
+ if (page.localName.toLowerCase() == "form" && !page.target)
318
+ showForm(page);
319
+
320
+ var backButton = $("backButton");
321
+ if (backButton)
322
+ {
323
+ var prevPage = $(pageHistory[pageHistory.length-2]);
324
+ if (prevPage && !page.getAttribute("hideBackButton"))
325
+ {
326
+ backButton.style.display = "inline";
327
+ backButton.innerHTML = prevPage.title ? prevPage.title : "Back";
328
+ }
329
+ else
330
+ backButton.style.display = "none";
331
+ }
332
+ }
333
+
334
+ function slidePages(fromPage, toPage, backwards)
335
+ {
336
+ var axis = (backwards ? fromPage : toPage).getAttribute("axis");
337
+ if (axis == "y")
338
+ (backwards ? fromPage : toPage).style.top = "100%";
339
+ else
340
+ toPage.style.left = "100%";
341
+
342
+ toPage.setAttribute("selected", "true");
343
+ scrollTo(0, 1);
344
+ clearInterval(checkTimer);
345
+
346
+ var percent = 100;
347
+ slide();
348
+ var timer = setInterval(slide, slideInterval);
349
+
350
+ function slide()
351
+ {
352
+ percent -= slideSpeed;
353
+ if (percent <= 0)
354
+ {
355
+ percent = 0;
356
+ if (!hasClass(toPage, "dialog"))
357
+ fromPage.removeAttribute("selected");
358
+ clearInterval(timer);
359
+ checkTimer = setInterval(checkOrientAndLocation, 300);
360
+ setTimeout(updatePage, 0, toPage, fromPage);
361
+ }
362
+
363
+ if (axis == "y")
364
+ {
365
+ backwards
366
+ ? fromPage.style.top = (100-percent) + "%"
367
+ : toPage.style.top = percent + "%";
368
+ }
369
+ else
370
+ {
371
+ fromPage.style.left = (backwards ? (100-percent) : (percent-100)) + "%";
372
+ toPage.style.left = (backwards ? -percent : percent) + "%";
373
+ }
374
+ }
375
+ }
376
+
377
+ function preloadImages()
378
+ {
379
+ var preloader = document.createElement("div");
380
+ preloader.id = "preloader";
381
+ document.body.appendChild(preloader);
382
+ }
383
+
384
+ function submitForm(form)
385
+ {
386
+ iui.showPageByHref(form.action || "POST", encodeForm(form), form.method);
387
+ }
388
+
389
+ function encodeForm(form)
390
+ {
391
+ function encode(inputs)
392
+ {
393
+ for (var i = 0; i < inputs.length; ++i)
394
+ {
395
+ if (inputs[i].name)
396
+ args.push(inputs[i].name + "=" + escape(inputs[i].value));
397
+ }
398
+ }
399
+
400
+ var args = [];
401
+ encode(form.getElementsByTagName("input"));
402
+ encode(form.getElementsByTagName("textarea"));
403
+ encode(form.getElementsByTagName("select"));
404
+ return args;
405
+ }
406
+
407
+ function findParent(node, localName)
408
+ {
409
+ while (node && (node.nodeType != 1 || node.localName.toLowerCase() != localName))
410
+ node = node.parentNode;
411
+ return node;
412
+ }
413
+
414
+ function hasClass(self, name)
415
+ {
416
+ var re = new RegExp("(^|\\s)"+name+"($|\\s)");
417
+ return re.exec(self.getAttribute("class")) != null;
418
+ }
419
+
420
+ function replaceElementWithSource(replace, source)
421
+ {
422
+ var page = replace.parentNode;
423
+ var parent = replace;
424
+ while (page.parentNode != document.body)
425
+ {
426
+ page = page.parentNode;
427
+ parent = parent.parentNode;
428
+ }
429
+
430
+ var frag = document.createElement(parent.localName);
431
+ frag.innerHTML = source;
432
+
433
+ page.removeChild(parent);
434
+
435
+ while (frag.firstChild)
436
+ page.appendChild(frag.firstChild);
437
+ }
438
+
439
+ function $(id) { return document.getElementById(id); }
440
+ function ddd() { console.log.apply(console, arguments); }
441
+
442
+ })();
@@ -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;}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,.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;}.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={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/")]};addEventListener("load",function(_24){var _25=iui.getSelectedPage();if(_25){iui.showPage(_25);}setTimeout(preloadImages,0);setTimeout(checkOrientAndLocation,0);_a=setInterval(checkOrientAndLocation,300);},false);addEventListener("unload",function(_26){return;},false);addEventListener("click",function(_27){var _28=findParent(_27.target,"a");if(_28){function unselect(){_28.removeAttribute("selected");}if(_28.href&&_28.hash&&_28.hash!="#"){_28.setAttribute("selected","true");iui.showPage($(_28.hash.substr(1)));setTimeout(unselect,500);}else{if(_28==$("backButton")){history.back();}else{if(_28.getAttribute("type")=="submit"){submitForm(findParent(_28,"form"));}else{if(_28.getAttribute("type")=="cancel"){cancelDialog(findParent(_28,"form"));}else{if(_28.target=="_replace"){_28.setAttribute("selected","progress");iui.showPageByHref(_28.href,null,null,_28,unselect);}else{if(iui.isNativeUrl(_28.href)){return;}else{if(!_28.target){_28.setAttribute("selected","progress");iui.showPageByHref(_28.href,null,null,null,unselect);}else{return;}}}}}}}_27.preventDefault();}},true);addEventListener("click",function(_29){var div=findParent(_29.target,"div");if(div&&hasClass(div,"toggle")){div.setAttribute("toggled",div.getAttribute("toggled")!="true");_29.preventDefault();}},true);function orientChangeHandler(){var _2b=window.orientation;switch(_2b){case 0:setOrientation(_c);break;case 90:case -90:setOrientation(_d);break;}}if(typeof window.onorientationchange=="object"){window.onorientationchange=orientChangeHandler;_b=true;setTimeout(orientChangeHandler,0);}function checkOrientAndLocation(){if(!_b){if(window.innerWidth!=_5){_5=window.innerWidth;var _2c=_5==320?_c:_d;setOrientation(_2c);}}if(location.hash!=_6){var _2d=location.hash.substr(_7.length);iui.showPageById(_2d);}}function setOrientation(_2e){document.body.setAttribute("orient",_2e);setTimeout(scrollTo,100,0,1);}function showDialog(_2f){_4=_2f;_2f.setAttribute("selected","true");if(hasClass(_2f,"dialog")&&!_2f.target){showForm(_2f);}}function showForm(_30){_30.onsubmit=function(_31){_31.preventDefault();submitForm(_30);};_30.onclick=function(_32){if(_32.target==_30&&hasClass(_30,"dialog")){cancelDialog(_30);}};}function cancelDialog(_33){_33.removeAttribute("selected");}function updatePage(_34,_35){if(!_34.id){_34.id="__"+(++_9)+"__";}location.href=_6=_7+_34.id;_8.push(_34.id);var _36=$("pageTitle");if(_34.title){_36.innerHTML=_34.title;}if(_34.localName.toLowerCase()=="form"&&!_34.target){showForm(_34);}var _37=$("backButton");if(_37){var _38=$(_8[_8.length-2]);if(_38&&!_34.getAttribute("hideBackButton")){_37.style.display="inline";_37.innerHTML=_38.title?_38.title:"Back";}else{_37.style.display="none";}}}function slidePages(_39,_3a,_3b){var _3c=(_3b?_39:_3a).getAttribute("axis");if(_3c=="y"){(_3b?_39:_3a).style.top="100%";}else{_3a.style.left="100%";}_3a.setAttribute("selected","true");scrollTo(0,1);clearInterval(_a);var _3d=100;slide();var _3e=setInterval(slide,_2);function slide(){_3d-=_1;if(_3d<=0){_3d=0;if(!hasClass(_3a,"dialog")){_39.removeAttribute("selected");}clearInterval(_3e);_a=setInterval(checkOrientAndLocation,300);setTimeout(updatePage,0,_3a,_39);}if(_3c=="y"){_3b?_39.style.top=(100-_3d)+"%":_3a.style.top=_3d+"%";}else{_39.style.left=(_3b?(100-_3d):(_3d-100))+"%";_3a.style.left=(_3b?-_3d:_3d)+"%";}}}function preloadImages(){var _3f=document.createElement("div");_3f.id="preloader";document.body.appendChild(_3f);}function submitForm(_40){iui.showPageByHref(_40.action||"POST",encodeForm(_40),_40.method);}function encodeForm(_41){function encode(_42){for(var i=0;i<_42.length;++i){if(_42[i].name){args.push(_42[i].name+"="+escape(_42[i].value));}}}var _44=[];encode(_41.getElementsByTagName("input"));encode(_41.getElementsByTagName("textarea"));encode(_41.getElementsByTagName("select"));return _44;}function findParent(_45,_46){while(_45&&(_45.nodeType!=1||_45.localName.toLowerCase()!=_46)){_45=_45.parentNode;}return _45;}function hasClass(_47,_48){var re=new RegExp("(^|\\s)"+_48+"($|\\s)");return re.exec(_47.getAttribute("class"))!=null;}function replaceElementWithSource(_4a,_4b){var _4c=_4a.parentNode;var _4d=_4a;while(_4c.parentNode!=document.body){_4c=_4c.parentNode;_4d=_4d.parentNode;}var _4e=document.createElement(_4d.localName);_4e.innerHTML=_4b;_4c.removeChild(_4d);while(_4e.firstChild){_4c.appendChild(_4e.firstChild);}}function $(id){return document.getElementById(id);}function ddd(){console.log.apply(console,arguments);}})();