-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
547 lines (463 loc) · 21.8 KB
/
app.js
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
(function() {
jQuery.noConflict();
var mock = {
data: {
contacts: [{"Id":"003A0000002kPqkIAE","Department":"Finance","Email":"[email protected]","FirstName":"Avi","LastName":"Green","Name":"Avi Green","Phone":"(212) 842-5500","Title":"CFO"},{"Id":"003A0000002kPqlIAE","FirstName":"Siddartha","LastName":"Nedaerk","Name":"Siddartha Nedaerk"},{"Id":"003A0000002kPqmIAE","FirstName":"Jake","LastName":"Llorrac","Name":"Jake Llorrac"},{"Id":"003A0000002kPqTIAU","Department":"Procurement","Email":"[email protected]","FirstName":"Rose","LastName":"Gonzalez","Name":"Rose Gonzalez","Phone":"(512) 757-6000","Title":"SVP, Procurement"},{"Id":"003A0000002kPqUIAU","Department":"Finance","Email":"[email protected]","FirstName":"Sean","LastName":"Forbes","Name":"Sean Forbes","Phone":"(512) 757-6000","Title":"CFO"},{"Id":"003A0000002kPqVIAU","Email":"[email protected]","FirstName":"Jack","LastName":"Rogers","Name":"Jack Rogers","Phone":"(336) 222-7000","Title":"VP, Facilities"},{"Id":"003A0000002kPqWIAU","Department":"Finance","Email":"[email protected]","FirstName":"Pat","LastName":"Stumuller","Name":"Pat Stumuller","Phone":"(014) 427-4427","Title":"SVP, Administration and Finance"},{"Id":"003A0000002kPqXIAU","Department":"Internal Operations","Email":"[email protected]","FirstName":"Andy","LastName":"Young","Name":"Andy Young","Phone":"(785) 241-6200","Title":"SVP, Operations"},{"Id":"003A0000002kPqYIAU","Department":"Finance","Email":"[email protected]","FirstName":"Tim","LastName":"Barr","Name":"Tim Barr","Phone":"(312) 596-1000","Title":"SVP, Administration and Finance"},{"Id":"003A0000002kPqZIAU","Department":"Facilities","Email":"[email protected]","FirstName":"John","LastName":"Bond","Name":"John Bond","Phone":"(312) 596-1000","Title":"VP, Facilities"},{"Id":"003A0000002kPqaIAE","Department":"Production","Email":"[email protected]","FirstName":"Stella","LastName":"Pavlova","Name":"Stella Pavlova","Phone":"(212) 842-5500","Title":"SVP, Production"},{"Id":"003A0000002kPqbIAE","Department":"Technology","Email":"[email protected]","FirstName":"Lauren","LastName":"Boyle","Name":"Lauren Boyle","Phone":"(212) 842-5500","Title":"SVP, Technology"},{"Id":"003A0000002kPqcIAE","Department":"Operations","Email":"b.levy@expressl&t.net","FirstName":"Babara","LastName":"Levy","Name":"Babara Levy","Phone":"(503) 421-7800","Title":"SVP, Operations"},{"Id":"003A0000002kPqdIAE","Department":"Warehouse Mgmt","Email":"j.davis@expressl&t.net","FirstName":"Josh","LastName":"Davis","Name":"Josh Davis","Phone":"(503) 421-7800","Title":"Director, Warehouse Mgmt"},{"Id":"003A0000002kPqeIAE","Department":"Administration","Email":"[email protected]","FirstName":"Jane","LastName":"Grey","Name":"Jane Grey","Phone":"(520) 773-9050","Title":"Dean of Administration"},{"Id":"003A0000002kPqfIAE","Department":"Executive Team","Email":"[email protected]","FirstName":"Arthur","LastName":"Song","Name":"Arthur Song","Phone":"(212) 842-5500","Title":"CEO"},{"Id":"003A0000002kPqgIAE","Department":"Finance","Email":"[email protected]","FirstName":"Ashley","LastName":"James","Name":"Ashley James","Phone":"+44 191 4956203","Title":"VP, Finance"},{"Id":"003A0000002kPqhIAE","Department":"Executive Team","Email":"[email protected]","FirstName":"Tom","LastName":"Ripley","Name":"Tom Ripley","Phone":"(650) 450-8810","Title":"Regional General Manager"},{"Id":"003A0000002kPqiIAE","Department":"Production","Email":"[email protected]","FirstName":"Liz","LastName":"D'Cruz","Name":"Liz D'Cruz","Phone":"(650) 450-8810","Title":"VP, Production"},{"Id":"003A0000002kPqjIAE","Department":"Technology","Email":"[email protected]","FirstName":"Edna","LastName":"Frank","Name":"Edna Frank","Phone":"(650) 867-3450","Title":"VP, Technology"},{"Id":"003A000000qSFd3IAG","Email":"[email protected]","LastName":"[email protected]","Name":"[email protected]"},{"Id":"003A000000juKHqIAM","Email":"[email protected]","FirstName":"Tricia","LastName":"Pfeil","Name":"Tricia Pfeil"},{"Id":"003A000000juKIlIAM","Email":"[email protected]","FirstName":"Wyatt","LastName":"Pfeil","Name":"Wyatt Pfeil"},{"Id":"003A000000juKAXIA2","Department":"Cardiology","Email":"[email protected]","FirstName":"Brian","LastName":"Pfeil","Name":"Brian Pfeil","Phone":"1231231234","Title":"Chief"},{"Id":"003A000000juKf1IAE","FirstName":"Geoffrey","LastName":"Lurie","Name":"Geoffrey Lurie"}],
accounts: [{"Id":"001A0000002wcrYIAQ","AccountNumber":"CC978213","AnnualRevenue":"30000000","Description":"Genomics company engaged in mapping and sequencing of the human genome and developing gene-based drugs","Fax":"(650) 867-9895","Industry":"Biotechnology","Name":"GenePoint","Phone":"(650) 867-3450","Type":"Customer - Channel","Website":"www.genepoint.com"},{"Id":"001A0000002wcrZIAQ","AccountNumber":"CD355119-A","Fax":"+44 191 4956620","Industry":"Energy","Name":"United Oil & Gas, UK","Phone":"+44 191 4956203","TickerSymbol":"UOS","Type":"Customer - Direct","Website":"http://www.uos.com"},{"Id":"001A0000002wcraIAA","AccountNumber":"CD355120-B","Fax":"(650) 450-8820","Industry":"Energy","Name":"United Oil & Gas, Singapore","Phone":"(650) 450-8810","TickerSymbol":"UOS","Type":"Customer - Direct","Website":"http://www.uos.com"},{"Id":"001A0000002wcrbIAA","AccountNumber":"CD451796","AnnualRevenue":"139000000","Description":"Edge, founded in 1998, is a start-up based in Austin, TX. The company designs and manufactures a device to convert music from one digital format to another. Edge sells its product through retailers and its own website.","Fax":"(512) 757-9000","Industry":"Electronics","Name":"Edge Communications","Phone":"(512) 757-6000","TickerSymbol":"EDGE","Type":"Customer - Direct","Website":"http://edgecomm.com"},{"Id":"001A0000002wcrcIAA","AccountNumber":"CD656092","AnnualRevenue":"350000000","Fax":"(336) 222-8000","Industry":"Apparel","Name":"Burlington Textiles Corp of America","Phone":"(336) 222-7000","TickerSymbol":"BTXT","Type":"Customer - Direct","Website":"www.burlington.com"},{"Id":"001A0000002wcrdIAA","AccountNumber":"CC213425","AnnualRevenue":"950000000","Fax":"(014) 427-4428","Industry":"Construction","Name":"Pyramid Construction Inc.","Phone":"(014) 427-4427","TickerSymbol":"PYR","Type":"Customer - Channel","Website":"www.pyramid.com"},{"Id":"001A0000002wcreIAA","AccountNumber":"CC634267","AnnualRevenue":"50000000","Fax":"(785) 241-6201","Industry":"Consulting","Name":"Dickenson plc","Phone":"(785) 241-6200","Type":"Customer - Channel","Website":"dickenson-consulting.com"},{"Id":"001A0000002wcrfIAA","AccountNumber":"CD439877","AnnualRevenue":"500000000","Description":"Chain of hotels and resorts across the US, UK, Eastern Europe, Japan, and SE Asia.","Fax":"(312) 596-1500","Industry":"Hospitality","Name":"Grand Hotels & Resorts Ltd","Phone":"(312) 596-1000","TickerSymbol":"GHTL","Type":"Customer - Direct","Website":"www.grandhotels.com"},{"Id":"001A0000002wcrgIAA","AccountNumber":"CC947211","AnnualRevenue":"950000000","Description":"Commerical logistics and transportation company.","Fax":"(503) 421-7801","Industry":"Transportation","Name":"Express Logistics and Transport","Phone":"(503) 421-7800","TickerSymbol":"EXLT","Type":"Customer - Channel","Website":"www.expressl&t.net"},{"Id":"001A0000002wcrhIAA","AccountNumber":"CD736025","Description":"Leading university in AZ offering undergraduate and graduate programs in arts and humanities, pure sciences, engineering, business, and medicine.","Fax":"(520) 773-9060","Industry":"Education","Name":"University of Arizona","Phone":"(520) 773-9050","Type":"Customer - Direct","Website":"www.universityofarizona.com"},{"Id":"001A0000002wcriIAA","AccountNumber":"CD355118","AnnualRevenue":"5600000000","Description":"World's third largest oil and gas company.","Fax":"(212) 842-5501","Industry":"Energy","Name":"United Oil & Gas Corp.","Phone":"(212) 842-5500","TickerSymbol":"UOS","Type":"Customer - Direct","Website":"http://www.uos.com"},{"Id":"001A0000002wcrjIAA","Fax":"(415) 901-7002","Name":"sForce","Phone":"(415) 901-7000","Website":"www.sforce.com"},{"Id":"001A000000e9jNtIAI","Name":"Northface","Website":"http://thenorthface.com"},{"Id":"001A000000e9jeuIAA","Name":"Pfeil Co.","Website":"http://thepfeils.com"},{"Id":"001A000000e9jgmIAA","Name":"Acme Co.","Website":"http://acme.com"}]
}
};
var makeCompareFunctionFromSortDefs = function(sortDefs) {
// order of sort defs in array drives sort property priority
// e.g.
/*
sortDefs = [
{
"prop": "count",
"order": "desc"
},
{
"prop": "lastLaunched",
"order": "desc"
}
];
*/
var genericCompare = function(item1, item2, sortDefs) {
for (var i = 0; i < sortDefs.length; i++) {
var sortDef = sortDefs[i];
var propName = sortDef["prop"];
var propValue1 = item1[propName];
var propValue2 = item2[propName];
propValue1 = (typeof(propValue1) == 'string') ? propValue1.toUpperCase() : propValue1;
propValue2 = (typeof(propValue2) == 'string') ? propValue2.toUpperCase() : propValue2;
if (propValue1 < propValue2) {
return (sortDef["order"] === "asc") ? -1 : 1;
} else if (propValue1 > propValue2) {
return (sortDef["order"] === "asc") ? 1 : -1;
} else {
// equal at this point, so continue to the next property
}
}
// all properties are equal
return 0;
}
return function(item1, item2) {
return genericCompare(item1, item2, sortDefs);
};
}
jQuery(function($) {
var app = {
'debug': true,
'remoteDebugURLs': ['http://mac01.home:8081/target/target-script-min.js#anonymous', 'http://mac01.merck.com:8081/target/target-script-min.js#anonymous'],
l: function(s) {
//$('body').append("<div>" + s + "</div>");
console.log(s);
},
run: function() {
app.l('begin: run');
if (app.debug) {
// reference: http://phonegap.github.com/weinre/
app.l('attempting to install remote debugging by connecting to ' + app.remoteDebugURL);
var urls = app.remoteDebugURLs.slice();
(function installRemoteDebugging() {
$.ajax({
url: urls.shift(),
dataType: "script",
complete: function(jqXHR, textStatus) {
app.l('complete called');
},
success: function() {
app.l('remote debugging installed by loading URL at' + this.url);
},
error: function() {
app.l('error called');
if (urls.length > 0) {
installRemoteDebugging();
}
}
});
})();
}
app.installSalesforceMockAPI();
if ( app.settings.get('initialDataDownloadComplete') ) {
app.ui.render();
} else {
app.l('loading initial data set')
app.data.load(app.ui.render);
}
},
settings: {
set: function(key, value) {
localStorage.setItem(key, JSON.stringify(value));
},
get: function(key) {
var value = localStorage.getItem(key);
return (value ? JSON.parse(value) : value);
}
},
data: {
meta: {
'contact': {
'type': 'contact',
'fields': [
{
'name': 'LastName',
'label': 'Last Name'
},
{
'name': 'FirstName',
'label': 'First Name'
},
{
'name': 'Title',
'label': 'Title'
},
{
'name': 'Department',
'label': 'Department'
},
{
'name': 'Phone',
'label': 'Phone',
'fmt': 'phone'
},
{
'name': 'Email',
'label': 'Email',
'fmt': 'email'
}
],
'pageTitle': 'Contacts',
'sortFn': makeCompareFunctionFromSortDefs([
{
'prop': 'LastName',
'order': 'asc'
},
{
'prop': 'FirstName',
'order': 'asc'
}
]),
'rowTitleFn': function(obj) {
return obj.LastName + ', ' + obj.FirstName;
}
},
'account': {
'type': 'account',
'fields': [
{
'name': 'Name',
'label': 'Name'
},
{
'name': 'Type',
'label': 'Type'
},
{
'name': 'Industry',
'label': 'Industry'
},
{
'name': 'Phone',
'label': 'Phone',
'fmt': 'phone'
},
{
'name': 'Fax',
'label': 'Fax',
'fmt': 'phone'
},
{
'name': 'Website',
'label': 'Website',
'fmt': 'url'
}
],
'pageTitle': 'Accounts',
'sortFn': makeCompareFunctionFromSortDefs([
{
'prop': 'Name',
'order': 'asc'
}
]),
'rowTitleFn': function(obj) {
return obj.Name;
}
}
},
load: function(cb) {
$.each(app.data.meta, function(idx, meta) {
var webServiceName = 'MyWebService';
var webServiceMethodName = "get" + app.utl.capitalizeFirstLetter(meta.type) + "s";
app.l('calling web service' + webServiceName + '.'+ webServiceMethodName);
var objs = sforce.apex.execute("MyWebService", webServiceMethodName, {});
app.l('retrieved ' + objs.length + ' ' + meta.type + 's');
app.data.saveAll(meta.type, objs);
});
app.settings.set('initialDataDownloadComplete', true);
cb.apply(this);
},
exists: function(type, id) {
return (app.data.getObjByTypeAndId(type, id) != null);
},
all: function(type) {
return JSON.parse(localStorage.getItem(type)).sort(app.data.meta[type].sortFn);
},
saveAll: function(type, objs) {
objs.sort(app.data.meta[type].sortFn);
localStorage.setItem(type, JSON.stringify(objs));
},
save: function(type, obj) {
var o = app.data.getObjByTypeAndId(type, obj.Id);
var objs = app.data.all(type);
// udpate
if (o) {
var idxRemove = -1;
$.each(objs, function(idx, e) {
if (e.Id == o.obj.Id) {
idxRemove = idx;
}
});
objs.splice(idxRemove, 1);
}
objs.push(obj);
app.data.saveAll(type, objs);
},
getObjByTypeAndId: function(type, id) {
var objs = app.data.all(type);
var filtered = $.grep(objs, function(obj, idx) {
return obj.Id == id;
});
if (filtered.length > 0) {
return {'def': app.data.meta[type], 'obj': filtered[0]};
} else {
return null;
}
}
},
ui: {
formatters: {
'phone': function(val) {
return val ? "<a href='tel:" + val + "'>" + val + "</a>" : '';
},
'url': function(val) {
return val ? "<a href='http://" + val + "' rel='external' target='_blank'>" + val + "</a>" : '';
},
'email': function(val) {
return val ? "<a href='mailto:" + val + "'>" + val + "</a>" : '';
}
},
$container: function() {
return $('#container');
},
render: function() {
app.l('begin: render');
app.ui.renderListPages();
$.each(app.ui.eventHandlers, function(idx, handler) {
handler.fn.apply(this);
});
$("#container").show();
$.mobile.initializePage();
app.l('end: render');
},
createListPage: function(type) {
var meta = app.data.meta[type],
$p = $('#object-list-page-template').tmpl(app.data.meta[type]),
$l = $p.find('#' + type + '-list'),
sectionName = '';
$.each(app.data.all(type), function(idx, obj) {
var o = {'obj': obj, 'def': meta};
var rowSectionName = meta.rowTitleFn(obj)[0].toUpperCase();
if (sectionName != rowSectionName) {
sectionName = rowSectionName;
$l.append( $('<li data-role="list-divider">' + sectionName + '</li>') );
}
$l.append( $('#object-row-template').tmpl(o) );
});
return $p;
},
createDetailPage: function(o) {
var $p = $('#object-detail-page-template').tmpl(o);
var fields = [];
$.each(app.data.meta[o.def.type]['fields'], function(idx, obj) {
fields.push({'field': obj, 'o': o, 'fmt':(obj.fmt ? app.ui.formatters[obj.fmt] : null) });
});
$('#object-detail-field-template').tmpl(fields).appendTo($p.find('#' + o.def.type + '-' + o.obj.Id + '-detail-fields'));
return $p;
},
renderDetailPage: function(o) {
var pageId = '#' + o.def.type + '-' + o.obj.Id;
// remove page if it exists
if ($(pageId).size() > 0) {
$(pageId).empty().remove();
}
var $p = app.ui.createDetailPage(o);
app.ui.$container().append( $p );
return $p;
},
createEditPage: function(o) {
var $p = $('#object-edit-page-template').tmpl(o);
var fields = [];
$.each(app.data.meta[o.def.type]['fields'], function(idx, obj) {
fields.push({'field': obj, 'o': o, 'fmt':(obj.fmt ? app.ui.formatters[obj.fmt] : null) });
});
$('#object-edit-field-template').tmpl(fields).appendTo($p.find('#' + o.def.type + '-' + (o.obj.Id ? o.obj.Id : '') + '-edit-fields'));
return $p;
},
renderEditPage: function(o) {
var pageId = '#' + o.def.type + '-' + (o.obj.Id ? o.obj.Id : '') +'-edit-page';
// remove page if it exists
if ($(pageId).size() > 0) {
$(pageId).empty().remove();
}
var $p = app.ui.createEditPage(o);
app.ui.$container().append( $p );
return $p;
},
$listPage: function(type) {
return $('#' + type + '-list-page');
},
renderListPage: function(type) {
var $p = app.ui.$listPage(type);
// if page exists, remove it
if ($p.size() > 0) {
$p.empty();
$p.remove();
}
$p = app.ui.createListPage(type);
app.ui.$container().append( $p );
return $p;
},
renderListPages: function() {
$.each(app.data.meta, function(idx, meta) {
app.ui.renderListPage(meta.type);
});
},
eventHandlers: [
{
'name': 'objListRowClick',
'fn': function() {
$('.list-row').live('click', function(e, info) {
var $e = $(this),
objType = $e.jqmData('obj-type'),
objId = $e.jqmData('obj-id'),
pageId = '#' + objType + '-' + objId;
var o = app.data.getObjByTypeAndId(objType, objId);
var $p = app.ui.renderDetailPage(o);
$.mobile.changePage($p);
e.preventDefault();
});
}
},
{
'name': 'objAddLink',
'fn': function() {
$('.object-add-link').live('click', function(e, info) {
var $e = $(this),
objType = $e.jqmData('obj-type'),
objId = $e.jqmData('obj-id');
var o = app.data.getObjByTypeAndId(objType, objId);
// adding new object
if (!o) {
o = {'def': app.data.meta[objType], 'obj': {}};
}
var $p = app.ui.renderEditPage(o);
$.mobile.changePage($p);
e.preventDefault();
});
}
},
{
'name': 'objSaveLink',
'fn': function() {
$('.object-save-link').live('click', function(e, info) {
app.l('begin: objSaveLink')
var $e = $(this),
objType = $e.jqmData('obj-type'),
objId = $e.jqmData('obj-id'),
pageId = '#' + objType + '-' + (objId ? objId : '') + '-edit-page';
$.mobile.loadingMessage = "Saving ...";
$.mobile.showPageLoadingMsg();
var $form = $(pageId).find('form');
app.l('saving ' + objType +': ' + $form.serializeArray());
setTimeout(function() {
var o = app.utl.formDataToObject($form);
var result = sforce.apex.execute("MyWebService", "upsertObject", {'params': $form.serialize()});
o.Id = result[0];
app.data.save(objType, o);
var $p = app.ui.renderListPage(objType);
$.mobile.hidePageLoadingMsg();
//history.go(-1);
$.mobile.changePage('#' + objType + '-list-page', {'reverse': true});
}, 250);
e.preventDefault();
});
}
}
]
},
installSalesforceMockAPI: function() {
// stub out salesforce web service api if it doesn't exist - useful for development with
// a test data set
if (typeof(sforce) === 'undefined') {
window.sforce = {
'apex': {
'execute': function(name, method, params) {
if (method == 'getContacts') {
return mock.data.contacts;
}
if (method == 'getAccounts') {
return mock.data.accounts;
}
if (method == 'upsertObject') {
var obj = app.utl.queryStringToObject(params.params);
return [obj['Id'] || (Math.floor(Math.random()*10000000000) + '')];
}
}
}
}
}
},
utl: {
// this function depends on the cache.manifest file being correctly setup
// see http://j.mp/r7KlZo for details
connectivityCheck: function(onlineCb, offlineCb) {
$.getScript('online.js', function() {
if (window.combrianpfeil.isOnline) {
onlineCb.apply(this);
} else {
offlineCb.apply(this);
}
});
},
capitalizeFirstLetter: function(s) {
return s.charAt(0).toUpperCase() + s.slice(1);
},
queryStringToObject: function(s) {
var o = {};
s.replace(/\b([^&=]*)=([^&=]*)\b/g, function (m, a, d) {
if (typeof o[a] != 'undefined') {
o[a] += ',' + d;
} else {
o[a] = d;
}
});
return o;
},
formDataToObject: function($f) {
var o = {};
$.each($f.serializeArray(), function(idx, prop) {
o[prop.name] = prop.value;
});
return o;
}
}
};
app.run();
window.app = app;
});
jQuery(document).bind("mobileinit", function(){
console.log('mobileinit');
jQuery.mobile.page.prototype.options.domCache = false;
jQuery.mobile.autoInitializePage = false;
});
})();