1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | ;(function() {
|
22 | var PLATFORM_VERSION_BUILD_LABEL = '4.5.5';
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | var require;
|
29 | var define;
|
30 |
|
31 | (function () {
|
32 | var modules = {};
|
33 |
|
34 | var requireStack = [];
|
35 |
|
36 | var inProgressModules = {};
|
37 | var SEPARATOR = '.';
|
38 |
|
39 | function build (module) {
|
40 | var factory = module.factory;
|
41 | var localRequire = function (id) {
|
42 | var resultantId = id;
|
43 |
|
44 | if (id.charAt(0) === '.') {
|
45 | resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2);
|
46 | }
|
47 | return require(resultantId);
|
48 | };
|
49 | module.exports = {};
|
50 | delete module.factory;
|
51 | factory(localRequire, module.exports, module);
|
52 | return module.exports;
|
53 | }
|
54 |
|
55 | require = function (id) {
|
56 | if (!modules[id]) {
|
57 | throw 'module ' + id + ' not found';
|
58 | } else if (id in inProgressModules) {
|
59 | var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
|
60 | throw 'Cycle in require graph: ' + cycle;
|
61 | }
|
62 | if (modules[id].factory) {
|
63 | try {
|
64 | inProgressModules[id] = requireStack.length;
|
65 | requireStack.push(id);
|
66 | return build(modules[id]);
|
67 | } finally {
|
68 | delete inProgressModules[id];
|
69 | requireStack.pop();
|
70 | }
|
71 | }
|
72 | return modules[id].exports;
|
73 | };
|
74 |
|
75 | define = function (id, factory) {
|
76 | if (modules[id]) {
|
77 | throw 'module ' + id + ' already defined';
|
78 | }
|
79 |
|
80 | modules[id] = {
|
81 | id: id,
|
82 | factory: factory
|
83 | };
|
84 | };
|
85 |
|
86 | define.remove = function (id) {
|
87 | delete modules[id];
|
88 | };
|
89 |
|
90 | define.moduleMap = modules;
|
91 | })();
|
92 |
|
93 |
|
94 | if (typeof module === 'object' && typeof require === 'function') {
|
95 | module.exports.require = require;
|
96 | module.exports.define = define;
|
97 | }
|
98 |
|
99 |
|
100 | define("cordova", function(require, exports, module) {
|
101 |
|
102 |
|
103 |
|
104 | if (window.cordova && !(window.cordova instanceof HTMLElement)) {
|
105 | throw new Error('cordova already defined');
|
106 | }
|
107 |
|
108 | var channel = require('cordova/channel');
|
109 | var platform = require('cordova/platform');
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | var m_document_addEventListener = document.addEventListener;
|
116 | var m_document_removeEventListener = document.removeEventListener;
|
117 | var m_window_addEventListener = window.addEventListener;
|
118 | var m_window_removeEventListener = window.removeEventListener;
|
119 |
|
120 |
|
121 |
|
122 |
|
123 | var documentEventHandlers = {};
|
124 | var windowEventHandlers = {};
|
125 |
|
126 | document.addEventListener = function (evt, handler, capture) {
|
127 | var e = evt.toLowerCase();
|
128 | if (typeof documentEventHandlers[e] !== 'undefined') {
|
129 | documentEventHandlers[e].subscribe(handler);
|
130 | } else {
|
131 | m_document_addEventListener.call(document, evt, handler, capture);
|
132 | }
|
133 | };
|
134 |
|
135 | window.addEventListener = function (evt, handler, capture) {
|
136 | var e = evt.toLowerCase();
|
137 | if (typeof windowEventHandlers[e] !== 'undefined') {
|
138 | windowEventHandlers[e].subscribe(handler);
|
139 | } else {
|
140 | m_window_addEventListener.call(window, evt, handler, capture);
|
141 | }
|
142 | };
|
143 |
|
144 | document.removeEventListener = function (evt, handler, capture) {
|
145 | var e = evt.toLowerCase();
|
146 |
|
147 | if (typeof documentEventHandlers[e] !== 'undefined') {
|
148 | documentEventHandlers[e].unsubscribe(handler);
|
149 | } else {
|
150 | m_document_removeEventListener.call(document, evt, handler, capture);
|
151 | }
|
152 | };
|
153 |
|
154 | window.removeEventListener = function (evt, handler, capture) {
|
155 | var e = evt.toLowerCase();
|
156 |
|
157 | if (typeof windowEventHandlers[e] !== 'undefined') {
|
158 | windowEventHandlers[e].unsubscribe(handler);
|
159 | } else {
|
160 | m_window_removeEventListener.call(window, evt, handler, capture);
|
161 | }
|
162 | };
|
163 |
|
164 | function createEvent (type, data) {
|
165 | var event = document.createEvent('Events');
|
166 | event.initEvent(type, false, false);
|
167 | if (data) {
|
168 | for (var i in data) {
|
169 | if (data.hasOwnProperty(i)) {
|
170 | event[i] = data[i];
|
171 | }
|
172 | }
|
173 | }
|
174 | return event;
|
175 | }
|
176 |
|
177 |
|
178 | var cordova = {
|
179 | define: define,
|
180 | require: require,
|
181 | version: PLATFORM_VERSION_BUILD_LABEL,
|
182 | platformVersion: PLATFORM_VERSION_BUILD_LABEL,
|
183 | platformId: platform.id,
|
184 |
|
185 |
|
186 |
|
187 | |
188 |
|
189 |
|
190 | addWindowEventHandler: function (event) {
|
191 | return (windowEventHandlers[event] = channel.create(event));
|
192 | },
|
193 | addStickyDocumentEventHandler: function (event) {
|
194 | return (documentEventHandlers[event] = channel.createSticky(event));
|
195 | },
|
196 | addDocumentEventHandler: function (event) {
|
197 | return (documentEventHandlers[event] = channel.create(event));
|
198 | },
|
199 | removeWindowEventHandler: function (event) {
|
200 | delete windowEventHandlers[event];
|
201 | },
|
202 | removeDocumentEventHandler: function (event) {
|
203 | delete documentEventHandlers[event];
|
204 | },
|
205 | |
206 |
|
207 |
|
208 |
|
209 |
|
210 | getOriginalHandlers: function () {
|
211 | return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener},
|
212 | 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}};
|
213 | },
|
214 | |
215 |
|
216 |
|
217 |
|
218 | fireDocumentEvent: function (type, data, bNoDetach) {
|
219 | var evt = createEvent(type, data);
|
220 | if (typeof documentEventHandlers[type] !== 'undefined') {
|
221 | if (bNoDetach) {
|
222 | documentEventHandlers[type].fire(evt);
|
223 | } else {
|
224 | setTimeout(function () {
|
225 |
|
226 | if (type === 'deviceready') {
|
227 | document.dispatchEvent(evt);
|
228 | }
|
229 | documentEventHandlers[type].fire(evt);
|
230 | }, 0);
|
231 | }
|
232 | } else {
|
233 | document.dispatchEvent(evt);
|
234 | }
|
235 | },
|
236 | fireWindowEvent: function (type, data) {
|
237 | var evt = createEvent(type, data);
|
238 | if (typeof windowEventHandlers[type] !== 'undefined') {
|
239 | setTimeout(function () {
|
240 | windowEventHandlers[type].fire(evt);
|
241 | }, 0);
|
242 | } else {
|
243 | window.dispatchEvent(evt);
|
244 | }
|
245 | },
|
246 |
|
247 | |
248 |
|
249 |
|
250 |
|
251 |
|
252 | callbackId: Math.floor(Math.random() * 2000000000),
|
253 | callbacks: {},
|
254 | callbackStatus: {
|
255 | NO_RESULT: 0,
|
256 | OK: 1,
|
257 | CLASS_NOT_FOUND_EXCEPTION: 2,
|
258 | ILLEGAL_ACCESS_EXCEPTION: 3,
|
259 | INSTANTIATION_EXCEPTION: 4,
|
260 | MALFORMED_URL_EXCEPTION: 5,
|
261 | IO_EXCEPTION: 6,
|
262 | INVALID_ACTION: 7,
|
263 | JSON_EXCEPTION: 8,
|
264 | ERROR: 9
|
265 | },
|
266 |
|
267 | |
268 |
|
269 |
|
270 | callbackSuccess: function (callbackId, args) {
|
271 | cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback);
|
272 | },
|
273 |
|
274 | |
275 |
|
276 |
|
277 | callbackError: function (callbackId, args) {
|
278 |
|
279 |
|
280 | cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback);
|
281 | },
|
282 |
|
283 | |
284 |
|
285 |
|
286 | callbackFromNative: function (callbackId, isSuccess, status, args, keepCallback) {
|
287 | try {
|
288 | var callback = cordova.callbacks[callbackId];
|
289 | if (callback) {
|
290 | if (isSuccess && status === cordova.callbackStatus.OK) {
|
291 | callback.success && callback.success.apply(null, args);
|
292 | } else if (!isSuccess) {
|
293 | callback.fail && callback.fail.apply(null, args);
|
294 | }
|
295 | |
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 | if (!keepCallback) {
|
304 | delete cordova.callbacks[callbackId];
|
305 | }
|
306 | }
|
307 | } catch (err) {
|
308 | var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
|
309 | console && console.log && console.log(msg);
|
310 | console && console.log && err.stack && console.log(err.stack);
|
311 | cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg });
|
312 | throw err;
|
313 | }
|
314 | },
|
315 | addConstructor: function (func) {
|
316 | channel.onCordovaReady.subscribe(function () {
|
317 | try {
|
318 | func();
|
319 | } catch (e) {
|
320 | console.log('Failed to run constructor: ' + e);
|
321 | }
|
322 | });
|
323 | }
|
324 | };
|
325 |
|
326 | module.exports = cordova;
|
327 |
|
328 | });
|
329 |
|
330 |
|
331 | define("cordova/argscheck", function(require, exports, module) {
|
332 |
|
333 | var utils = require('cordova/utils');
|
334 |
|
335 | var moduleExports = module.exports;
|
336 |
|
337 | var typeMap = {
|
338 | 'A': 'Array',
|
339 | 'D': 'Date',
|
340 | 'N': 'Number',
|
341 | 'S': 'String',
|
342 | 'F': 'Function',
|
343 | 'O': 'Object'
|
344 | };
|
345 |
|
346 | function extractParamName (callee, argIndex) {
|
347 | return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex];
|
348 | }
|
349 |
|
350 | function checkArgs (spec, functionName, args, opt_callee) {
|
351 | if (!moduleExports.enableChecks) {
|
352 | return;
|
353 | }
|
354 | var errMsg = null;
|
355 | var typeName;
|
356 | for (var i = 0; i < spec.length; ++i) {
|
357 | var c = spec.charAt(i);
|
358 | var cUpper = c.toUpperCase();
|
359 | var arg = args[i];
|
360 |
|
361 | if (c === '*') {
|
362 | continue;
|
363 | }
|
364 | typeName = utils.typeName(arg);
|
365 | if ((arg === null || arg === undefined) && c === cUpper) {
|
366 | continue;
|
367 | }
|
368 | if (typeName !== typeMap[cUpper]) {
|
369 | errMsg = 'Expected ' + typeMap[cUpper];
|
370 | break;
|
371 | }
|
372 | }
|
373 | if (errMsg) {
|
374 | errMsg += ', but got ' + typeName + '.';
|
375 | errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
|
376 |
|
377 | if (typeof jasmine === 'undefined') {
|
378 | console.error(errMsg);
|
379 | }
|
380 | throw TypeError(errMsg);
|
381 | }
|
382 | }
|
383 |
|
384 | function getValue (value, defaultValue) {
|
385 | return value === undefined ? defaultValue : value;
|
386 | }
|
387 |
|
388 | moduleExports.checkArgs = checkArgs;
|
389 | moduleExports.getValue = getValue;
|
390 | moduleExports.enableChecks = true;
|
391 |
|
392 | });
|
393 |
|
394 |
|
395 | define("cordova/base64", function(require, exports, module) {
|
396 |
|
397 | var base64 = exports;
|
398 |
|
399 | base64.fromArrayBuffer = function (arrayBuffer) {
|
400 | var array = new Uint8Array(arrayBuffer);
|
401 | return uint8ToBase64(array);
|
402 | };
|
403 |
|
404 | base64.toArrayBuffer = function (str) {
|
405 | var decodedStr = typeof atob !== 'undefined' ? atob(str) : Buffer.from(str, 'base64').toString('binary');
|
406 | var arrayBuffer = new ArrayBuffer(decodedStr.length);
|
407 | var array = new Uint8Array(arrayBuffer);
|
408 | for (var i = 0, len = decodedStr.length; i < len; i++) {
|
409 | array[i] = decodedStr.charCodeAt(i);
|
410 | }
|
411 | return arrayBuffer;
|
412 | };
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 | var b64_6bit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
422 | var b64_12bit;
|
423 |
|
424 | var b64_12bitTable = function () {
|
425 | b64_12bit = [];
|
426 | for (var i = 0; i < 64; i++) {
|
427 | for (var j = 0; j < 64; j++) {
|
428 | b64_12bit[i * 64 + j] = b64_6bit[i] + b64_6bit[j];
|
429 | }
|
430 | }
|
431 | b64_12bitTable = function () { return b64_12bit; };
|
432 | return b64_12bit;
|
433 | };
|
434 |
|
435 | function uint8ToBase64 (rawData) {
|
436 | var numBytes = rawData.byteLength;
|
437 | var output = '';
|
438 | var segment;
|
439 | var table = b64_12bitTable();
|
440 | for (var i = 0; i < numBytes - 2; i += 3) {
|
441 | segment = (rawData[i] << 16) + (rawData[i + 1] << 8) + rawData[i + 2];
|
442 | output += table[segment >> 12];
|
443 | output += table[segment & 0xfff];
|
444 | }
|
445 | if (numBytes - i === 2) {
|
446 | segment = (rawData[i] << 16) + (rawData[i + 1] << 8);
|
447 | output += table[segment >> 12];
|
448 | output += b64_6bit[(segment & 0xfff) >> 6];
|
449 | output += '=';
|
450 | } else if (numBytes - i === 1) {
|
451 | segment = (rawData[i] << 16);
|
452 | output += table[segment >> 12];
|
453 | output += '==';
|
454 | }
|
455 | return output;
|
456 | }
|
457 |
|
458 | });
|
459 |
|
460 |
|
461 | define("cordova/builder", function(require, exports, module) {
|
462 |
|
463 | var utils = require('cordova/utils');
|
464 |
|
465 | function each (objects, func, context) {
|
466 | for (var prop in objects) {
|
467 | if (objects.hasOwnProperty(prop)) {
|
468 | func.apply(context, [objects[prop], prop]);
|
469 | }
|
470 | }
|
471 | }
|
472 |
|
473 | function clobber (obj, key, value) {
|
474 | exports.replaceHookForTesting(obj, key);
|
475 | var needsProperty = false;
|
476 | try {
|
477 | obj[key] = value;
|
478 | } catch (e) {
|
479 | needsProperty = true;
|
480 | }
|
481 |
|
482 | if (needsProperty || obj[key] !== value) {
|
483 | utils.defineGetter(obj, key, function () {
|
484 | return value;
|
485 | });
|
486 | }
|
487 | }
|
488 |
|
489 | function assignOrWrapInDeprecateGetter (obj, key, value, message) {
|
490 | if (message) {
|
491 | utils.defineGetter(obj, key, function () {
|
492 | console.log(message);
|
493 | delete obj[key];
|
494 | clobber(obj, key, value);
|
495 | return value;
|
496 | });
|
497 | } else {
|
498 | clobber(obj, key, value);
|
499 | }
|
500 | }
|
501 |
|
502 | function include (parent, objects, clobber, merge) {
|
503 | each(objects, function (obj, key) {
|
504 | try {
|
505 | var result = obj.path ? require(obj.path) : {};
|
506 |
|
507 | if (clobber) {
|
508 |
|
509 | if (typeof parent[key] === 'undefined') {
|
510 | assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
|
511 | } else if (typeof obj.path !== 'undefined') {
|
512 |
|
513 | if (merge) {
|
514 | recursiveMerge(parent[key], result);
|
515 | } else {
|
516 | assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
|
517 | }
|
518 | }
|
519 | result = parent[key];
|
520 | } else {
|
521 |
|
522 | if (typeof parent[key] === 'undefined') {
|
523 | assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
|
524 | } else {
|
525 |
|
526 | result = parent[key];
|
527 | }
|
528 | }
|
529 |
|
530 | if (obj.children) {
|
531 | include(result, obj.children, clobber, merge);
|
532 | }
|
533 | } catch (e) {
|
534 | utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"');
|
535 | }
|
536 | });
|
537 | }
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 | function recursiveMerge (target, src) {
|
547 | for (var prop in src) {
|
548 | if (src.hasOwnProperty(prop)) {
|
549 | if (target.prototype && target.prototype.constructor === target) {
|
550 |
|
551 | clobber(target.prototype, prop, src[prop]);
|
552 | } else {
|
553 | if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
|
554 | recursiveMerge(target[prop], src[prop]);
|
555 | } else {
|
556 | clobber(target, prop, src[prop]);
|
557 | }
|
558 | }
|
559 | }
|
560 | }
|
561 | }
|
562 |
|
563 | exports.buildIntoButDoNotClobber = function (objects, target) {
|
564 | include(target, objects, false, false);
|
565 | };
|
566 | exports.buildIntoAndClobber = function (objects, target) {
|
567 | include(target, objects, true, false);
|
568 | };
|
569 | exports.buildIntoAndMerge = function (objects, target) {
|
570 | include(target, objects, true, true);
|
571 | };
|
572 | exports.recursiveMerge = recursiveMerge;
|
573 | exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter;
|
574 | exports.replaceHookForTesting = function () {};
|
575 |
|
576 | });
|
577 |
|
578 |
|
579 | define("cordova/channel", function(require, exports, module) {
|
580 |
|
581 | var utils = require('cordova/utils');
|
582 | var nextGuid = 1;
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 | var Channel = function (type, sticky) {
|
623 | this.type = type;
|
624 |
|
625 | this.handlers = {};
|
626 |
|
627 | this.state = sticky ? 1 : 0;
|
628 |
|
629 | this.fireArgs = null;
|
630 |
|
631 | this.numHandlers = 0;
|
632 |
|
633 |
|
634 | this.onHasSubscribersChange = null;
|
635 | };
|
636 | var channel = {
|
637 | |
638 |
|
639 |
|
640 |
|
641 | join: function (h, c) {
|
642 | var len = c.length;
|
643 | var i = len;
|
644 | var f = function () {
|
645 | if (!(--i)) h();
|
646 | };
|
647 | for (var j = 0; j < len; j++) {
|
648 | if (c[j].state === 0) {
|
649 | throw Error('Can only use join with sticky channels.');
|
650 | }
|
651 | c[j].subscribe(f);
|
652 | }
|
653 | if (!len) h();
|
654 | },
|
655 |
|
656 | create: function (type) {
|
657 | return channel[type] = new Channel(type, false);
|
658 | },
|
659 | createSticky: function (type) {
|
660 | return channel[type] = new Channel(type, true);
|
661 | },
|
662 |
|
663 | |
664 |
|
665 |
|
666 | deviceReadyChannelsArray: [],
|
667 | deviceReadyChannelsMap: {},
|
668 |
|
669 | |
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 | waitForInitialization: function (feature) {
|
677 | if (feature) {
|
678 | var c = channel[feature] || this.createSticky(feature);
|
679 | this.deviceReadyChannelsMap[feature] = c;
|
680 | this.deviceReadyChannelsArray.push(c);
|
681 | }
|
682 | },
|
683 |
|
684 | |
685 |
|
686 |
|
687 |
|
688 |
|
689 | initializationComplete: function (feature) {
|
690 | var c = this.deviceReadyChannelsMap[feature];
|
691 | if (c) {
|
692 | c.fire();
|
693 | }
|
694 | }
|
695 | };
|
696 |
|
697 | function checkSubscriptionArgument (argument) {
|
698 | if (typeof argument !== 'function' && typeof argument.handleEvent !== 'function') {
|
699 | throw new Error(
|
700 | 'Must provide a function or an EventListener object ' +
|
701 | 'implementing the handleEvent interface.'
|
702 | );
|
703 | }
|
704 | }
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 | Channel.prototype.subscribe = function (eventListenerOrFunction, eventListener) {
|
714 | checkSubscriptionArgument(eventListenerOrFunction);
|
715 | var handleEvent, guid;
|
716 |
|
717 | if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
|
718 |
|
719 | handleEvent = eventListenerOrFunction.handleEvent;
|
720 | eventListener = eventListenerOrFunction;
|
721 | } else {
|
722 |
|
723 | handleEvent = eventListenerOrFunction;
|
724 | }
|
725 |
|
726 | if (this.state === 2) {
|
727 | handleEvent.apply(eventListener || this, this.fireArgs);
|
728 | return;
|
729 | }
|
730 |
|
731 | guid = eventListenerOrFunction.observer_guid;
|
732 | if (typeof eventListener === 'object') {
|
733 | handleEvent = utils.close(eventListener, handleEvent);
|
734 | }
|
735 |
|
736 | if (!guid) {
|
737 |
|
738 | guid = '' + nextGuid++;
|
739 | }
|
740 | handleEvent.observer_guid = guid;
|
741 | eventListenerOrFunction.observer_guid = guid;
|
742 |
|
743 |
|
744 | if (!this.handlers[guid]) {
|
745 | this.handlers[guid] = handleEvent;
|
746 | this.numHandlers++;
|
747 | if (this.numHandlers === 1) {
|
748 | this.onHasSubscribersChange && this.onHasSubscribersChange();
|
749 | }
|
750 | }
|
751 | };
|
752 |
|
753 |
|
754 |
|
755 |
|
756 | Channel.prototype.unsubscribe = function (eventListenerOrFunction) {
|
757 | checkSubscriptionArgument(eventListenerOrFunction);
|
758 | var handleEvent, guid, handler;
|
759 |
|
760 | if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
|
761 |
|
762 | handleEvent = eventListenerOrFunction.handleEvent;
|
763 | } else {
|
764 |
|
765 | handleEvent = eventListenerOrFunction;
|
766 | }
|
767 |
|
768 | guid = handleEvent.observer_guid;
|
769 | handler = this.handlers[guid];
|
770 | if (handler) {
|
771 | delete this.handlers[guid];
|
772 | this.numHandlers--;
|
773 | if (this.numHandlers === 0) {
|
774 | this.onHasSubscribersChange && this.onHasSubscribersChange();
|
775 | }
|
776 | }
|
777 | };
|
778 |
|
779 |
|
780 |
|
781 |
|
782 | Channel.prototype.fire = function (e) {
|
783 | var fail = false;
|
784 | var fireArgs = Array.prototype.slice.call(arguments);
|
785 |
|
786 | if (this.state === 1) {
|
787 | this.state = 2;
|
788 | this.fireArgs = fireArgs;
|
789 | }
|
790 | if (this.numHandlers) {
|
791 |
|
792 |
|
793 | var toCall = [];
|
794 | for (var item in this.handlers) {
|
795 | toCall.push(this.handlers[item]);
|
796 | }
|
797 | for (var i = 0; i < toCall.length; ++i) {
|
798 | toCall[i].apply(this, fireArgs);
|
799 | }
|
800 | if (this.state === 2 && this.numHandlers) {
|
801 | this.numHandlers = 0;
|
802 | this.handlers = {};
|
803 | this.onHasSubscribersChange && this.onHasSubscribersChange();
|
804 | }
|
805 | }
|
806 | };
|
807 |
|
808 |
|
809 |
|
810 | channel.createSticky('onDOMContentLoaded');
|
811 |
|
812 |
|
813 | channel.createSticky('onNativeReady');
|
814 |
|
815 |
|
816 |
|
817 | channel.createSticky('onCordovaReady');
|
818 |
|
819 |
|
820 |
|
821 | channel.createSticky('onPluginsReady');
|
822 |
|
823 |
|
824 | channel.createSticky('onDeviceReady');
|
825 |
|
826 |
|
827 | channel.create('onResume');
|
828 |
|
829 |
|
830 | channel.create('onPause');
|
831 |
|
832 |
|
833 | channel.waitForInitialization('onCordovaReady');
|
834 | channel.waitForInitialization('onDOMContentLoaded');
|
835 |
|
836 | module.exports = channel;
|
837 |
|
838 | });
|
839 |
|
840 |
|
841 | define("cordova/exec", function(require, exports, module) {
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 | var cordova = require('cordova'),
|
850 | utils = require('cordova/utils'),
|
851 | base64 = require('cordova/base64'),
|
852 | execIframe,
|
853 | commandQueue = [],
|
854 | isInContextOfEvalJs = 0,
|
855 | failSafeTimerId = 0;
|
856 |
|
857 | function massageArgsJsToNative(args) {
|
858 | if (!args || utils.typeName(args) != 'Array') {
|
859 | return args;
|
860 | }
|
861 | var ret = [];
|
862 | args.forEach(function(arg, i) {
|
863 | if (utils.typeName(arg) == 'ArrayBuffer') {
|
864 | ret.push({
|
865 | 'CDVType': 'ArrayBuffer',
|
866 | 'data': base64.fromArrayBuffer(arg)
|
867 | });
|
868 | } else {
|
869 | ret.push(arg);
|
870 | }
|
871 | });
|
872 | return ret;
|
873 | }
|
874 |
|
875 | function massageMessageNativeToJs(message) {
|
876 | if (message.CDVType == 'ArrayBuffer') {
|
877 | var stringToArrayBuffer = function(str) {
|
878 | var ret = new Uint8Array(str.length);
|
879 | for (var i = 0; i < str.length; i++) {
|
880 | ret[i] = str.charCodeAt(i);
|
881 | }
|
882 | return ret.buffer;
|
883 | };
|
884 | var base64ToArrayBuffer = function(b64) {
|
885 | return stringToArrayBuffer(atob(b64));
|
886 | };
|
887 | message = base64ToArrayBuffer(message.data);
|
888 | }
|
889 | return message;
|
890 | }
|
891 |
|
892 | function convertMessageToArgsNativeToJs(message) {
|
893 | var args = [];
|
894 | if (!message || !message.hasOwnProperty('CDVType')) {
|
895 | args.push(message);
|
896 | } else if (message.CDVType == 'MultiPart') {
|
897 | message.messages.forEach(function(e) {
|
898 | args.push(massageMessageNativeToJs(e));
|
899 | });
|
900 | } else {
|
901 | args.push(massageMessageNativeToJs(message));
|
902 | }
|
903 | return args;
|
904 | }
|
905 |
|
906 | function iOSExec() {
|
907 |
|
908 | var successCallback, failCallback, service, action, actionArgs;
|
909 | var callbackId = null;
|
910 | if (typeof arguments[0] !== 'string') {
|
911 |
|
912 | successCallback = arguments[0];
|
913 | failCallback = arguments[1];
|
914 | service = arguments[2];
|
915 | action = arguments[3];
|
916 | actionArgs = arguments[4];
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 | callbackId = 'INVALID';
|
923 | } else {
|
924 | throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' +
|
925 | 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);'
|
926 | );
|
927 | }
|
928 |
|
929 |
|
930 | actionArgs = actionArgs || [];
|
931 |
|
932 |
|
933 |
|
934 | if (successCallback || failCallback) {
|
935 | callbackId = service + cordova.callbackId++;
|
936 | cordova.callbacks[callbackId] =
|
937 | {success:successCallback, fail:failCallback};
|
938 | }
|
939 |
|
940 | actionArgs = massageArgsJsToNative(actionArgs);
|
941 |
|
942 | var command = [callbackId, service, action, actionArgs];
|
943 |
|
944 |
|
945 |
|
946 |
|
947 | commandQueue.push(JSON.stringify(command));
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 | if (!isInContextOfEvalJs && commandQueue.length == 1) {
|
954 | pokeNative();
|
955 | }
|
956 | }
|
957 |
|
958 |
|
959 | function proxyChanged() {
|
960 | var cexec = cordovaExec();
|
961 |
|
962 | return (execProxy !== cexec &&
|
963 | iOSExec !== cexec
|
964 | );
|
965 | }
|
966 |
|
967 |
|
968 | function handleBridgeChange() {
|
969 | if (proxyChanged()) {
|
970 | var commandString = commandQueue.shift();
|
971 | while(commandString) {
|
972 | var command = JSON.parse(commandString);
|
973 | var callbackId = command[0];
|
974 | var service = command[1];
|
975 | var action = command[2];
|
976 | var actionArgs = command[3];
|
977 | var callbacks = cordova.callbacks[callbackId] || {};
|
978 |
|
979 | execProxy(callbacks.success, callbacks.fail, service, action, actionArgs);
|
980 |
|
981 | commandString = commandQueue.shift();
|
982 | };
|
983 | return true;
|
984 | }
|
985 |
|
986 | return false;
|
987 | }
|
988 |
|
989 | function pokeNative() {
|
990 |
|
991 | if (!document.body) {
|
992 | setTimeout(pokeNative);
|
993 | return;
|
994 | }
|
995 |
|
996 |
|
997 | if (execIframe && execIframe.contentWindow) {
|
998 | execIframe.contentWindow.location = 'gap://ready';
|
999 | } else {
|
1000 | execIframe = document.createElement('iframe');
|
1001 | execIframe.style.display = 'none';
|
1002 | execIframe.src = 'gap://ready';
|
1003 | document.body.appendChild(execIframe);
|
1004 | }
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 | failSafeTimerId = setTimeout(function() {
|
1013 | if (commandQueue.length) {
|
1014 |
|
1015 | if (!handleBridgeChange()) {
|
1016 | pokeNative();
|
1017 | }
|
1018 | }
|
1019 | }, 50);
|
1020 | }
|
1021 |
|
1022 | iOSExec.nativeFetchMessages = function() {
|
1023 |
|
1024 | if (failSafeTimerId) {
|
1025 | clearTimeout(failSafeTimerId);
|
1026 | failSafeTimerId = 0;
|
1027 | }
|
1028 |
|
1029 | if (!commandQueue.length) {
|
1030 | return '';
|
1031 | }
|
1032 | var json = '[' + commandQueue.join(',') + ']';
|
1033 | commandQueue.length = 0;
|
1034 | return json;
|
1035 | };
|
1036 |
|
1037 | iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) {
|
1038 | return iOSExec.nativeEvalAndFetch(function() {
|
1039 | var success = status === 0 || status === 1;
|
1040 | var args = convertMessageToArgsNativeToJs(message);
|
1041 | function nc2() {
|
1042 | cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
|
1043 | }
|
1044 | setTimeout(nc2, 0);
|
1045 | });
|
1046 | };
|
1047 |
|
1048 | iOSExec.nativeEvalAndFetch = function(func) {
|
1049 |
|
1050 | isInContextOfEvalJs++;
|
1051 | try {
|
1052 | func();
|
1053 | return iOSExec.nativeFetchMessages();
|
1054 | } finally {
|
1055 | isInContextOfEvalJs--;
|
1056 | }
|
1057 | };
|
1058 |
|
1059 |
|
1060 |
|
1061 | function cordovaExec() {
|
1062 | var cexec = require('cordova/exec');
|
1063 | var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function');
|
1064 | return (cexec_valid && execProxy !== cexec)? cexec : iOSExec;
|
1065 | }
|
1066 |
|
1067 | function execProxy() {
|
1068 | cordovaExec().apply(null, arguments);
|
1069 | };
|
1070 |
|
1071 | execProxy.nativeFetchMessages = function() {
|
1072 | return cordovaExec().nativeFetchMessages.apply(null, arguments);
|
1073 | };
|
1074 |
|
1075 | execProxy.nativeEvalAndFetch = function() {
|
1076 | return cordovaExec().nativeEvalAndFetch.apply(null, arguments);
|
1077 | };
|
1078 |
|
1079 | execProxy.nativeCallback = function() {
|
1080 | return cordovaExec().nativeCallback.apply(null, arguments);
|
1081 | };
|
1082 |
|
1083 | module.exports = execProxy;
|
1084 |
|
1085 | });
|
1086 |
|
1087 |
|
1088 | define("cordova/exec/proxy", function(require, exports, module) {
|
1089 |
|
1090 |
|
1091 | var CommandProxyMap = {};
|
1092 |
|
1093 | module.exports = {
|
1094 |
|
1095 |
|
1096 | add: function (id, proxyObj) {
|
1097 | console.log('adding proxy for ' + id);
|
1098 | CommandProxyMap[id] = proxyObj;
|
1099 | return proxyObj;
|
1100 | },
|
1101 |
|
1102 |
|
1103 | remove: function (id) {
|
1104 | var proxy = CommandProxyMap[id];
|
1105 | delete CommandProxyMap[id];
|
1106 | CommandProxyMap[id] = null;
|
1107 | return proxy;
|
1108 | },
|
1109 |
|
1110 | get: function (service, action) {
|
1111 | return (CommandProxyMap[service] ? CommandProxyMap[service][action] : null);
|
1112 | }
|
1113 | };
|
1114 |
|
1115 | });
|
1116 |
|
1117 |
|
1118 | define("cordova/init", function(require, exports, module) {
|
1119 |
|
1120 | var channel = require('cordova/channel');
|
1121 | var cordova = require('cordova');
|
1122 | var modulemapper = require('cordova/modulemapper');
|
1123 | var platform = require('cordova/platform');
|
1124 | var pluginloader = require('cordova/pluginloader');
|
1125 | var utils = require('cordova/utils');
|
1126 |
|
1127 | var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
|
1128 |
|
1129 | function logUnfiredChannels (arr) {
|
1130 | for (var i = 0; i < arr.length; ++i) {
|
1131 | if (arr[i].state !== 2) {
|
1132 | console.log('Channel not fired: ' + arr[i].type);
|
1133 | }
|
1134 | }
|
1135 | }
|
1136 |
|
1137 | window.setTimeout(function () {
|
1138 | if (channel.onDeviceReady.state !== 2) {
|
1139 | console.log('deviceready has not fired after 5 seconds.');
|
1140 | logUnfiredChannels(platformInitChannelsArray);
|
1141 | logUnfiredChannels(channel.deviceReadyChannelsArray);
|
1142 | }
|
1143 | }, 5000);
|
1144 |
|
1145 |
|
1146 |
|
1147 | function replaceNavigator (origNavigator) {
|
1148 | var CordovaNavigator = function () {};
|
1149 | CordovaNavigator.prototype = origNavigator;
|
1150 | var newNavigator = new CordovaNavigator();
|
1151 |
|
1152 |
|
1153 | if (CordovaNavigator.bind) {
|
1154 | for (var key in origNavigator) {
|
1155 | if (typeof origNavigator[key] === 'function') {
|
1156 | newNavigator[key] = origNavigator[key].bind(origNavigator);
|
1157 | } else {
|
1158 | (function (k) {
|
1159 | utils.defineGetterSetter(newNavigator, key, function () {
|
1160 | return origNavigator[k];
|
1161 | });
|
1162 | })(key);
|
1163 | }
|
1164 | }
|
1165 | }
|
1166 | return newNavigator;
|
1167 | }
|
1168 |
|
1169 | if (window.navigator) {
|
1170 | window.navigator = replaceNavigator(window.navigator);
|
1171 | }
|
1172 |
|
1173 | if (!window.console) {
|
1174 | window.console = {
|
1175 | log: function () {}
|
1176 | };
|
1177 | }
|
1178 | if (!window.console.warn) {
|
1179 | window.console.warn = function (msg) {
|
1180 | this.log('warn: ' + msg);
|
1181 | };
|
1182 | }
|
1183 |
|
1184 |
|
1185 | channel.onPause = cordova.addDocumentEventHandler('pause');
|
1186 | channel.onResume = cordova.addDocumentEventHandler('resume');
|
1187 | channel.onActivated = cordova.addDocumentEventHandler('activated');
|
1188 | channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
|
1189 |
|
1190 |
|
1191 | if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
1192 | channel.onDOMContentLoaded.fire();
|
1193 | } else {
|
1194 | document.addEventListener('DOMContentLoaded', function () {
|
1195 | channel.onDOMContentLoaded.fire();
|
1196 | }, false);
|
1197 | }
|
1198 |
|
1199 |
|
1200 |
|
1201 |
|
1202 | if (window._nativeReady) {
|
1203 | channel.onNativeReady.fire();
|
1204 | }
|
1205 |
|
1206 | modulemapper.clobbers('cordova', 'cordova');
|
1207 | modulemapper.clobbers('cordova/exec', 'cordova.exec');
|
1208 | modulemapper.clobbers('cordova/exec', 'Cordova.exec');
|
1209 |
|
1210 |
|
1211 | platform.bootstrap && platform.bootstrap();
|
1212 |
|
1213 |
|
1214 |
|
1215 | setTimeout(function () {
|
1216 | pluginloader.load(function () {
|
1217 | channel.onPluginsReady.fire();
|
1218 | });
|
1219 | }, 0);
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 | channel.join(function () {
|
1225 | modulemapper.mapModules(window);
|
1226 |
|
1227 | platform.initialize && platform.initialize();
|
1228 |
|
1229 |
|
1230 | channel.onCordovaReady.fire();
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 | channel.join(function () {
|
1236 | require('cordova').fireDocumentEvent('deviceready');
|
1237 | }, channel.deviceReadyChannelsArray);
|
1238 |
|
1239 | }, platformInitChannelsArray);
|
1240 |
|
1241 | });
|
1242 |
|
1243 |
|
1244 | define("cordova/init_b", function(require, exports, module) {
|
1245 |
|
1246 | var channel = require('cordova/channel');
|
1247 | var cordova = require('cordova');
|
1248 | var modulemapper = require('cordova/modulemapper');
|
1249 | var platform = require('cordova/platform');
|
1250 | var pluginloader = require('cordova/pluginloader');
|
1251 | var utils = require('cordova/utils');
|
1252 |
|
1253 | var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady];
|
1254 |
|
1255 |
|
1256 | cordova.exec = require('cordova/exec');
|
1257 |
|
1258 | function logUnfiredChannels (arr) {
|
1259 | for (var i = 0; i < arr.length; ++i) {
|
1260 | if (arr[i].state !== 2) {
|
1261 | console.log('Channel not fired: ' + arr[i].type);
|
1262 | }
|
1263 | }
|
1264 | }
|
1265 |
|
1266 | window.setTimeout(function () {
|
1267 | if (channel.onDeviceReady.state !== 2) {
|
1268 | console.log('deviceready has not fired after 5 seconds.');
|
1269 | logUnfiredChannels(platformInitChannelsArray);
|
1270 | logUnfiredChannels(channel.deviceReadyChannelsArray);
|
1271 | }
|
1272 | }, 5000);
|
1273 |
|
1274 |
|
1275 |
|
1276 | function replaceNavigator (origNavigator) {
|
1277 | var CordovaNavigator = function () {};
|
1278 | CordovaNavigator.prototype = origNavigator;
|
1279 | var newNavigator = new CordovaNavigator();
|
1280 |
|
1281 |
|
1282 | if (CordovaNavigator.bind) {
|
1283 | for (var key in origNavigator) {
|
1284 | if (typeof origNavigator[key] === 'function') {
|
1285 | newNavigator[key] = origNavigator[key].bind(origNavigator);
|
1286 | } else {
|
1287 | (function (k) {
|
1288 | utils.defineGetterSetter(newNavigator, key, function () {
|
1289 | return origNavigator[k];
|
1290 | });
|
1291 | })(key);
|
1292 | }
|
1293 | }
|
1294 | }
|
1295 | return newNavigator;
|
1296 | }
|
1297 | if (window.navigator) {
|
1298 | window.navigator = replaceNavigator(window.navigator);
|
1299 | }
|
1300 |
|
1301 | if (!window.console) {
|
1302 | window.console = {
|
1303 | log: function () {}
|
1304 | };
|
1305 | }
|
1306 | if (!window.console.warn) {
|
1307 | window.console.warn = function (msg) {
|
1308 | this.log('warn: ' + msg);
|
1309 | };
|
1310 | }
|
1311 |
|
1312 |
|
1313 | channel.onPause = cordova.addDocumentEventHandler('pause');
|
1314 | channel.onResume = cordova.addDocumentEventHandler('resume');
|
1315 | channel.onActivated = cordova.addDocumentEventHandler('activated');
|
1316 | channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
|
1317 |
|
1318 |
|
1319 | if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
1320 | channel.onDOMContentLoaded.fire();
|
1321 | } else {
|
1322 | document.addEventListener('DOMContentLoaded', function () {
|
1323 | channel.onDOMContentLoaded.fire();
|
1324 | }, false);
|
1325 | }
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 | if (window._nativeReady) {
|
1331 | channel.onNativeReady.fire();
|
1332 | }
|
1333 |
|
1334 |
|
1335 | platform.bootstrap && platform.bootstrap();
|
1336 |
|
1337 |
|
1338 |
|
1339 | setTimeout(function () {
|
1340 | pluginloader.load(function () {
|
1341 | channel.onPluginsReady.fire();
|
1342 | });
|
1343 | }, 0);
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 | channel.join(function () {
|
1349 | modulemapper.mapModules(window);
|
1350 |
|
1351 | platform.initialize && platform.initialize();
|
1352 |
|
1353 |
|
1354 | channel.onCordovaReady.fire();
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 | channel.join(function () {
|
1360 | require('cordova').fireDocumentEvent('deviceready');
|
1361 | }, channel.deviceReadyChannelsArray);
|
1362 |
|
1363 | }, platformInitChannelsArray);
|
1364 |
|
1365 | });
|
1366 |
|
1367 |
|
1368 | define("cordova/modulemapper", function(require, exports, module) {
|
1369 |
|
1370 | var builder = require('cordova/builder');
|
1371 | var moduleMap = define.moduleMap;
|
1372 | var symbolList;
|
1373 | var deprecationMap;
|
1374 |
|
1375 | exports.reset = function () {
|
1376 | symbolList = [];
|
1377 | deprecationMap = {};
|
1378 | };
|
1379 |
|
1380 | function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) {
|
1381 | if (!(moduleName in moduleMap)) {
|
1382 | throw new Error('Module ' + moduleName + ' does not exist.');
|
1383 | }
|
1384 | symbolList.push(strategy, moduleName, symbolPath);
|
1385 | if (opt_deprecationMessage) {
|
1386 | deprecationMap[symbolPath] = opt_deprecationMessage;
|
1387 | }
|
1388 | }
|
1389 |
|
1390 |
|
1391 | exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) {
|
1392 | addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
|
1393 | };
|
1394 |
|
1395 | exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) {
|
1396 | addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
|
1397 | };
|
1398 |
|
1399 | exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) {
|
1400 | addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
|
1401 | };
|
1402 |
|
1403 | exports.runs = function (moduleName) {
|
1404 | addEntry('r', moduleName, null);
|
1405 | };
|
1406 |
|
1407 | function prepareNamespace (symbolPath, context) {
|
1408 | if (!symbolPath) {
|
1409 | return context;
|
1410 | }
|
1411 | var parts = symbolPath.split('.');
|
1412 | var cur = context;
|
1413 | for (var i = 0, part; part = parts[i]; ++i) {
|
1414 | cur = cur[part] = cur[part] || {};
|
1415 | }
|
1416 | return cur;
|
1417 | }
|
1418 |
|
1419 | exports.mapModules = function (context) {
|
1420 | var origSymbols = {};
|
1421 | context.CDV_origSymbols = origSymbols;
|
1422 | for (var i = 0, len = symbolList.length; i < len; i += 3) {
|
1423 | var strategy = symbolList[i];
|
1424 | var moduleName = symbolList[i + 1];
|
1425 | var module = require(moduleName);
|
1426 |
|
1427 | if (strategy === 'r') {
|
1428 | continue;
|
1429 | }
|
1430 | var symbolPath = symbolList[i + 2];
|
1431 | var lastDot = symbolPath.lastIndexOf('.');
|
1432 | var namespace = symbolPath.substr(0, lastDot);
|
1433 | var lastName = symbolPath.substr(lastDot + 1);
|
1434 |
|
1435 | var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
|
1436 | var parentObj = prepareNamespace(namespace, context);
|
1437 | var target = parentObj[lastName];
|
1438 |
|
1439 | if (strategy === 'm' && target) {
|
1440 | builder.recursiveMerge(target, module);
|
1441 | } else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
|
1442 | if (!(symbolPath in origSymbols)) {
|
1443 | origSymbols[symbolPath] = target;
|
1444 | }
|
1445 | builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
|
1446 | }
|
1447 | }
|
1448 | };
|
1449 |
|
1450 | exports.getOriginalSymbol = function (context, symbolPath) {
|
1451 | var origSymbols = context.CDV_origSymbols;
|
1452 | if (origSymbols && (symbolPath in origSymbols)) {
|
1453 | return origSymbols[symbolPath];
|
1454 | }
|
1455 | var parts = symbolPath.split('.');
|
1456 | var obj = context;
|
1457 | for (var i = 0; i < parts.length; ++i) {
|
1458 | obj = obj && obj[parts[i]];
|
1459 | }
|
1460 | return obj;
|
1461 | };
|
1462 |
|
1463 | exports.reset();
|
1464 |
|
1465 | });
|
1466 |
|
1467 |
|
1468 | define("cordova/modulemapper_b", function(require, exports, module) {
|
1469 |
|
1470 | var builder = require('cordova/builder');
|
1471 | var symbolList = [];
|
1472 | var deprecationMap;
|
1473 |
|
1474 | exports.reset = function () {
|
1475 | symbolList = [];
|
1476 | deprecationMap = {};
|
1477 | };
|
1478 |
|
1479 | function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) {
|
1480 | symbolList.push(strategy, moduleName, symbolPath);
|
1481 | if (opt_deprecationMessage) {
|
1482 | deprecationMap[symbolPath] = opt_deprecationMessage;
|
1483 | }
|
1484 | }
|
1485 |
|
1486 |
|
1487 | exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) {
|
1488 | addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
|
1489 | };
|
1490 |
|
1491 | exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) {
|
1492 | addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
|
1493 | };
|
1494 |
|
1495 | exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) {
|
1496 | addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
|
1497 | };
|
1498 |
|
1499 | exports.runs = function (moduleName) {
|
1500 | addEntry('r', moduleName, null);
|
1501 | };
|
1502 |
|
1503 | function prepareNamespace (symbolPath, context) {
|
1504 | if (!symbolPath) {
|
1505 | return context;
|
1506 | }
|
1507 | var parts = symbolPath.split('.');
|
1508 | var cur = context;
|
1509 | for (var i = 0, part; part = parts[i]; ++i) {
|
1510 | cur = cur[part] = cur[part] || {};
|
1511 | }
|
1512 | return cur;
|
1513 | }
|
1514 |
|
1515 | exports.mapModules = function (context) {
|
1516 | var origSymbols = {};
|
1517 | context.CDV_origSymbols = origSymbols;
|
1518 | for (var i = 0, len = symbolList.length; i < len; i += 3) {
|
1519 | var strategy = symbolList[i];
|
1520 | var moduleName = symbolList[i + 1];
|
1521 | var module = require(moduleName);
|
1522 |
|
1523 | if (strategy === 'r') {
|
1524 | continue;
|
1525 | }
|
1526 | var symbolPath = symbolList[i + 2];
|
1527 | var lastDot = symbolPath.lastIndexOf('.');
|
1528 | var namespace = symbolPath.substr(0, lastDot);
|
1529 | var lastName = symbolPath.substr(lastDot + 1);
|
1530 |
|
1531 | var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
|
1532 | var parentObj = prepareNamespace(namespace, context);
|
1533 | var target = parentObj[lastName];
|
1534 |
|
1535 | if (strategy === 'm' && target) {
|
1536 | builder.recursiveMerge(target, module);
|
1537 | } else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
|
1538 | if (!(symbolPath in origSymbols)) {
|
1539 | origSymbols[symbolPath] = target;
|
1540 | }
|
1541 | builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
|
1542 | }
|
1543 | }
|
1544 | };
|
1545 |
|
1546 | exports.getOriginalSymbol = function (context, symbolPath) {
|
1547 | var origSymbols = context.CDV_origSymbols;
|
1548 | if (origSymbols && (symbolPath in origSymbols)) {
|
1549 | return origSymbols[symbolPath];
|
1550 | }
|
1551 | var parts = symbolPath.split('.');
|
1552 | var obj = context;
|
1553 | for (var i = 0; i < parts.length; ++i) {
|
1554 | obj = obj && obj[parts[i]];
|
1555 | }
|
1556 | return obj;
|
1557 | };
|
1558 |
|
1559 | exports.reset();
|
1560 |
|
1561 | });
|
1562 |
|
1563 |
|
1564 | define("cordova/platform", function(require, exports, module) {
|
1565 |
|
1566 | module.exports = {
|
1567 | id: 'ios',
|
1568 | bootstrap: function () {
|
1569 |
|
1570 |
|
1571 | require('cordova/modulemapper').clobbers('cordova/plugin/ios/console', 'window.console');
|
1572 |
|
1573 | require('cordova/channel').onNativeReady.fire();
|
1574 | }
|
1575 | };
|
1576 |
|
1577 | });
|
1578 |
|
1579 |
|
1580 | define("cordova/plugin/ios/console", function(require, exports, module) {
|
1581 |
|
1582 |
|
1583 |
|
1584 | var logger = require('cordova/plugin/ios/logger');
|
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 | var console = module.exports;
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 | var WinConsole = window.console;
|
1595 |
|
1596 |
|
1597 |
|
1598 |
|
1599 | var UseLogger = false;
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 | var Timers = {};
|
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 | function noop() {}
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 | console.useLogger = function (value) {
|
1615 | if (arguments.length) UseLogger = !!value;
|
1616 |
|
1617 | if (UseLogger) {
|
1618 | if (logger.useConsole()) {
|
1619 | throw new Error("console and logger are too intertwingly");
|
1620 | }
|
1621 | }
|
1622 |
|
1623 | return UseLogger;
|
1624 | };
|
1625 |
|
1626 |
|
1627 | console.log = function() {
|
1628 | if (logger.useConsole()) return;
|
1629 | logger.log.apply(logger, [].slice.call(arguments));
|
1630 | };
|
1631 |
|
1632 |
|
1633 | console.error = function() {
|
1634 | if (logger.useConsole()) return;
|
1635 | logger.error.apply(logger, [].slice.call(arguments));
|
1636 | };
|
1637 |
|
1638 |
|
1639 | console.warn = function() {
|
1640 | if (logger.useConsole()) return;
|
1641 | logger.warn.apply(logger, [].slice.call(arguments));
|
1642 | };
|
1643 |
|
1644 |
|
1645 | console.info = function() {
|
1646 | if (logger.useConsole()) return;
|
1647 | logger.info.apply(logger, [].slice.call(arguments));
|
1648 | };
|
1649 |
|
1650 |
|
1651 | console.debug = function() {
|
1652 | if (logger.useConsole()) return;
|
1653 | logger.debug.apply(logger, [].slice.call(arguments));
|
1654 | };
|
1655 |
|
1656 |
|
1657 | console.assert = function(expression) {
|
1658 | if (expression) return;
|
1659 |
|
1660 | var message = logger.format.apply(logger.format, [].slice.call(arguments, 1));
|
1661 | console.log("ASSERT: " + message);
|
1662 | };
|
1663 |
|
1664 |
|
1665 | console.clear = function() {};
|
1666 |
|
1667 |
|
1668 | console.dir = function(object) {
|
1669 | console.log("%o", object);
|
1670 | };
|
1671 |
|
1672 |
|
1673 | console.dirxml = function(node) {
|
1674 | console.log(node.innerHTML);
|
1675 | };
|
1676 |
|
1677 |
|
1678 | console.trace = noop;
|
1679 |
|
1680 |
|
1681 | console.group = console.log;
|
1682 |
|
1683 |
|
1684 | console.groupCollapsed = console.log;
|
1685 |
|
1686 |
|
1687 | console.groupEnd = noop;
|
1688 |
|
1689 |
|
1690 | console.time = function(name) {
|
1691 | Timers[name] = new Date().valueOf();
|
1692 | };
|
1693 |
|
1694 |
|
1695 | console.timeEnd = function(name) {
|
1696 | var timeStart = Timers[name];
|
1697 | if (!timeStart) {
|
1698 | console.warn("unknown timer: " + name);
|
1699 | return;
|
1700 | }
|
1701 |
|
1702 | var timeElapsed = new Date().valueOf() - timeStart;
|
1703 | console.log(name + ": " + timeElapsed + "ms");
|
1704 | };
|
1705 |
|
1706 |
|
1707 | console.timeStamp = noop;
|
1708 |
|
1709 |
|
1710 | console.profile = noop;
|
1711 |
|
1712 |
|
1713 | console.profileEnd = noop;
|
1714 |
|
1715 |
|
1716 | console.count = noop;
|
1717 |
|
1718 |
|
1719 | console.exception = console.log;
|
1720 |
|
1721 |
|
1722 | console.table = function(data, columns) {
|
1723 | console.log("%o", data);
|
1724 | };
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 | function wrappedOrigCall(orgFunc, newFunc) {
|
1730 | return function() {
|
1731 | var args = [].slice.call(arguments);
|
1732 | try { orgFunc.apply(WinConsole, args); } catch (e) {}
|
1733 | try { newFunc.apply(console, args); } catch (e) {}
|
1734 | };
|
1735 | }
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 | for (var key in console) {
|
1743 | if (typeof WinConsole[key] == "function") {
|
1744 | console[key] = wrappedOrigCall(WinConsole[key], console[key]);
|
1745 | }
|
1746 | }
|
1747 |
|
1748 | });
|
1749 |
|
1750 |
|
1751 | define("cordova/plugin/ios/logger", function(require, exports, module) {
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 | var logger = exports;
|
1775 |
|
1776 | var exec = require('cordova/exec');
|
1777 |
|
1778 | var UseConsole = false;
|
1779 | var UseLogger = true;
|
1780 | var Queued = [];
|
1781 | var DeviceReady = false;
|
1782 | var CurrentLevel;
|
1783 |
|
1784 | var originalConsole = console;
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 |
|
1790 | var Levels = [
|
1791 | "LOG",
|
1792 | "ERROR",
|
1793 | "WARN",
|
1794 | "INFO",
|
1795 | "DEBUG"
|
1796 | ];
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 | var LevelsMap = {};
|
1804 | for (var i=0; i<Levels.length; i++) {
|
1805 | var level = Levels[i];
|
1806 | LevelsMap[level] = i;
|
1807 | logger[level] = level;
|
1808 | }
|
1809 |
|
1810 | CurrentLevel = LevelsMap.WARN;
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 | logger.level = function (value) {
|
1832 | if (arguments.length) {
|
1833 | if (LevelsMap[value] === null) {
|
1834 | throw new Error("invalid logging level: " + value);
|
1835 | }
|
1836 | CurrentLevel = LevelsMap[value];
|
1837 | }
|
1838 |
|
1839 | return Levels[CurrentLevel];
|
1840 | };
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 | logger.useConsole = function (value) {
|
1849 | if (arguments.length) UseConsole = !!value;
|
1850 |
|
1851 | if (UseConsole) {
|
1852 | if (typeof console == "undefined") {
|
1853 | throw new Error("global console object is not defined");
|
1854 | }
|
1855 |
|
1856 | if (typeof console.log != "function") {
|
1857 | throw new Error("global console object does not have a log function");
|
1858 | }
|
1859 |
|
1860 | if (typeof console.useLogger == "function") {
|
1861 | if (console.useLogger()) {
|
1862 | throw new Error("console and logger are too intertwingly");
|
1863 | }
|
1864 | }
|
1865 | }
|
1866 |
|
1867 | return UseConsole;
|
1868 | };
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 | logger.useLogger = function (value) {
|
1877 |
|
1878 | if (arguments.length) UseLogger = !!value;
|
1879 | return UseLogger;
|
1880 | };
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 | logger.log = function(message) { logWithArgs("LOG", arguments); };
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 | logger.error = function(message) { logWithArgs("ERROR", arguments); };
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 | logger.warn = function(message) { logWithArgs("WARN", arguments); };
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 | logger.info = function(message) { logWithArgs("INFO", arguments); };
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 | logger.debug = function(message) { logWithArgs("DEBUG", arguments); };
|
1921 |
|
1922 |
|
1923 | function logWithArgs(level, args) {
|
1924 | args = [level].concat([].slice.call(args));
|
1925 | logger.logLevel.apply(logger, args);
|
1926 | }
|
1927 |
|
1928 |
|
1929 | function formatStringForMessage(message) {
|
1930 | return (typeof message === "string") ? "" : "%o";
|
1931 | }
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 | logger.logLevel = function(level /* , ... */) {
|
1940 |
|
1941 | var formatArgs = [].slice.call(arguments, 1);
|
1942 | var fmtString = formatStringForMessage(formatArgs[0]);
|
1943 | if (fmtString.length > 0){
|
1944 | formatArgs.unshift(fmtString);
|
1945 | }
|
1946 |
|
1947 | var message = logger.format.apply(logger.format, formatArgs);
|
1948 |
|
1949 | if (LevelsMap[level] === null) {
|
1950 | throw new Error("invalid logging level: " + level);
|
1951 | }
|
1952 |
|
1953 | if (LevelsMap[level] > CurrentLevel) return;
|
1954 |
|
1955 |
|
1956 | if (!DeviceReady && !UseConsole) {
|
1957 | Queued.push([level, message]);
|
1958 | return;
|
1959 | }
|
1960 |
|
1961 |
|
1962 | if (UseLogger) {
|
1963 | exec(null, null, "Console", "logLevel", [level, message]);
|
1964 | }
|
1965 |
|
1966 |
|
1967 | if (UseConsole) {
|
1968 |
|
1969 | if (console.useLogger()) {
|
1970 | throw new Error("console and logger are too intertwingly");
|
1971 | }
|
1972 |
|
1973 |
|
1974 | switch (level) {
|
1975 | case logger.LOG: originalConsole.log(message); break;
|
1976 | case logger.ERROR: originalConsole.log("ERROR: " + message); break;
|
1977 | case logger.WARN: originalConsole.log("WARN: " + message); break;
|
1978 | case logger.INFO: originalConsole.log("INFO: " + message); break;
|
1979 | case logger.DEBUG: originalConsole.log("DEBUG: " + message); break;
|
1980 | }
|
1981 | }
|
1982 | };
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 |
|
1992 |
|
1993 | logger.format = function(formatString, args) {
|
1994 | return __format(arguments[0], [].slice.call(arguments,1)).join(' ');
|
1995 | };
|
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 |
|
2013 | function __format(formatString, args) {
|
2014 | if (formatString === null || formatString === undefined) return [""];
|
2015 | if (arguments.length == 1) return [formatString.toString()];
|
2016 |
|
2017 | if (typeof formatString != "string")
|
2018 | formatString = formatString.toString();
|
2019 |
|
2020 | var pattern = /(.*?)%(.)(.*)/;
|
2021 | var rest = formatString;
|
2022 | var result = [];
|
2023 |
|
2024 | while (args.length) {
|
2025 | var match = pattern.exec(rest);
|
2026 | if (!match) break;
|
2027 |
|
2028 | var arg = args.shift();
|
2029 | rest = match[3];
|
2030 | result.push(match[1]);
|
2031 |
|
2032 | if (match[2] == '%') {
|
2033 | result.push('%');
|
2034 | args.unshift(arg);
|
2035 | continue;
|
2036 | }
|
2037 |
|
2038 | result.push(__formatted(arg, match[2]));
|
2039 | }
|
2040 |
|
2041 | result.push(rest);
|
2042 |
|
2043 | var remainingArgs = [].slice.call(args);
|
2044 | remainingArgs.unshift(result.join(''));
|
2045 | return remainingArgs;
|
2046 | }
|
2047 |
|
2048 | function __formatted(object, formatChar) {
|
2049 |
|
2050 | try {
|
2051 | switch(formatChar) {
|
2052 | case 'j':
|
2053 | case 'o': return JSON.stringify(object);
|
2054 | case 'c': return '';
|
2055 | }
|
2056 | }
|
2057 | catch (e) {
|
2058 | return "error JSON.stringify()ing argument: " + e;
|
2059 | }
|
2060 |
|
2061 | if ((object === null) || (object === undefined)) {
|
2062 | return Object.prototype.toString.call(object);
|
2063 | }
|
2064 |
|
2065 | return object.toString();
|
2066 | }
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 | logger.__onDeviceReady = function() {
|
2072 | if (DeviceReady) return;
|
2073 |
|
2074 | DeviceReady = true;
|
2075 |
|
2076 | for (var i=0; i<Queued.length; i++) {
|
2077 | var messageArgs = Queued[i];
|
2078 | logger.logLevel(messageArgs[0], messageArgs[1]);
|
2079 | }
|
2080 |
|
2081 | Queued = null;
|
2082 | };
|
2083 |
|
2084 |
|
2085 | document.addEventListener("deviceready", logger.__onDeviceReady, false);
|
2086 |
|
2087 | });
|
2088 |
|
2089 |
|
2090 | define("cordova/pluginloader", function(require, exports, module) {
|
2091 |
|
2092 | var modulemapper = require('cordova/modulemapper');
|
2093 |
|
2094 |
|
2095 |
|
2096 | exports.injectScript = function (url, onload, onerror) {
|
2097 | var script = document.createElement('script');
|
2098 |
|
2099 | script.onload = onload;
|
2100 |
|
2101 | script.onerror = onerror;
|
2102 | script.src = url;
|
2103 | document.head.appendChild(script);
|
2104 | };
|
2105 |
|
2106 | function injectIfNecessary (id, url, onload, onerror) {
|
2107 | onerror = onerror || onload;
|
2108 | if (id in define.moduleMap) {
|
2109 | onload();
|
2110 | } else {
|
2111 | exports.injectScript(url, function () {
|
2112 | if (id in define.moduleMap) {
|
2113 | onload();
|
2114 | } else {
|
2115 | onerror();
|
2116 | }
|
2117 | }, onerror);
|
2118 | }
|
2119 | }
|
2120 |
|
2121 | function onScriptLoadingComplete (moduleList, finishPluginLoading) {
|
2122 |
|
2123 | for (var i = 0, module; module = moduleList[i]; i++) {
|
2124 | if (module.clobbers && module.clobbers.length) {
|
2125 | for (var j = 0; j < module.clobbers.length; j++) {
|
2126 | modulemapper.clobbers(module.id, module.clobbers[j]);
|
2127 | }
|
2128 | }
|
2129 |
|
2130 | if (module.merges && module.merges.length) {
|
2131 | for (var k = 0; k < module.merges.length; k++) {
|
2132 | modulemapper.merges(module.id, module.merges[k]);
|
2133 | }
|
2134 | }
|
2135 |
|
2136 |
|
2137 | if (module.runs) {
|
2138 | modulemapper.runs(module.id);
|
2139 | }
|
2140 | }
|
2141 |
|
2142 | finishPluginLoading();
|
2143 | }
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 |
|
2149 | function handlePluginsObject (path, moduleList, finishPluginLoading) {
|
2150 |
|
2151 | var scriptCounter = moduleList.length;
|
2152 |
|
2153 | if (!scriptCounter) {
|
2154 | finishPluginLoading();
|
2155 | return;
|
2156 | }
|
2157 | function scriptLoadedCallback () {
|
2158 | if (!--scriptCounter) {
|
2159 | onScriptLoadingComplete(moduleList, finishPluginLoading);
|
2160 | }
|
2161 | }
|
2162 |
|
2163 | for (var i = 0; i < moduleList.length; i++) {
|
2164 | injectIfNecessary(moduleList[i].id, path + moduleList[i].file, scriptLoadedCallback);
|
2165 | }
|
2166 | }
|
2167 |
|
2168 | function findCordovaPath () {
|
2169 | var path = null;
|
2170 | var scripts = document.getElementsByTagName('script');
|
2171 | var term = '/cordova.js';
|
2172 | for (var n = scripts.length - 1; n > -1; n--) {
|
2173 | var src = scripts[n].src.replace(/\?.*$/, '');
|
2174 | if (src.indexOf(term) === (src.length - term.length)) {
|
2175 | path = src.substring(0, src.length - term.length) + '/';
|
2176 | break;
|
2177 | }
|
2178 | }
|
2179 | return path;
|
2180 | }
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 | exports.load = function (callback) {
|
2186 | var pathPrefix = findCordovaPath();
|
2187 | if (pathPrefix === null) {
|
2188 | console.log('Could not find cordova.js script tag. Plugin loading may fail.');
|
2189 | pathPrefix = '';
|
2190 | }
|
2191 | injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function () {
|
2192 | var moduleList = require('cordova/plugin_list');
|
2193 | handlePluginsObject(pathPrefix, moduleList, callback);
|
2194 | }, callback);
|
2195 | };
|
2196 |
|
2197 | });
|
2198 |
|
2199 |
|
2200 | define("cordova/pluginloader_b", function(require, exports, module) {
|
2201 |
|
2202 | var modulemapper = require('cordova/modulemapper');
|
2203 |
|
2204 |
|
2205 |
|
2206 | function handlePluginsObject (moduleList) {
|
2207 |
|
2208 | if (!moduleList || !moduleList.length) {
|
2209 | return;
|
2210 | }
|
2211 |
|
2212 |
|
2213 | for (var i = 0, module; module = moduleList[i]; i++) {
|
2214 | if (module.clobbers && module.clobbers.length) {
|
2215 | for (var j = 0; j < module.clobbers.length; j++) {
|
2216 | modulemapper.clobbers(module.id, module.clobbers[j]);
|
2217 | }
|
2218 | }
|
2219 |
|
2220 | if (module.merges && module.merges.length) {
|
2221 | for (var k = 0; k < module.merges.length; k++) {
|
2222 | modulemapper.merges(module.id, module.merges[k]);
|
2223 | }
|
2224 | }
|
2225 |
|
2226 |
|
2227 | if (module.runs) {
|
2228 | modulemapper.runs(module.id);
|
2229 | }
|
2230 | }
|
2231 | }
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 | exports.load = function (callback) {
|
2238 | var moduleList = require('cordova/plugin_list');
|
2239 | handlePluginsObject(moduleList);
|
2240 |
|
2241 | callback();
|
2242 | };
|
2243 |
|
2244 | });
|
2245 |
|
2246 |
|
2247 | define("cordova/urlutil", function(require, exports, module) {
|
2248 |
|
2249 |
|
2250 |
|
2251 |
|
2252 |
|
2253 | exports.makeAbsolute = function makeAbsolute (url) {
|
2254 | var anchorEl = document.createElement('a');
|
2255 | anchorEl.href = url;
|
2256 | return anchorEl.href;
|
2257 | };
|
2258 |
|
2259 | });
|
2260 |
|
2261 |
|
2262 | define("cordova/utils", function(require, exports, module) {
|
2263 |
|
2264 | var utils = exports;
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 | utils.defineGetterSetter = function (obj, key, getFunc, opt_setFunc) {
|
2270 | if (Object.defineProperty) {
|
2271 | var desc = {
|
2272 | get: getFunc,
|
2273 | configurable: true
|
2274 | };
|
2275 | if (opt_setFunc) {
|
2276 | desc.set = opt_setFunc;
|
2277 | }
|
2278 | Object.defineProperty(obj, key, desc);
|
2279 | } else {
|
2280 | obj.__defineGetter__(key, getFunc);
|
2281 | if (opt_setFunc) {
|
2282 | obj.__defineSetter__(key, opt_setFunc);
|
2283 | }
|
2284 | }
|
2285 | };
|
2286 |
|
2287 |
|
2288 |
|
2289 |
|
2290 | utils.defineGetter = utils.defineGetterSetter;
|
2291 |
|
2292 | utils.arrayIndexOf = function (a, item) {
|
2293 | if (a.indexOf) {
|
2294 | return a.indexOf(item);
|
2295 | }
|
2296 | var len = a.length;
|
2297 | for (var i = 0; i < len; ++i) {
|
2298 | if (a[i] === item) {
|
2299 | return i;
|
2300 | }
|
2301 | }
|
2302 | return -1;
|
2303 | };
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 | utils.arrayRemove = function (a, item) {
|
2309 | var index = utils.arrayIndexOf(a, item);
|
2310 | if (index !== -1) {
|
2311 | a.splice(index, 1);
|
2312 | }
|
2313 | return index !== -1;
|
2314 | };
|
2315 |
|
2316 | utils.typeName = function (val) {
|
2317 | return Object.prototype.toString.call(val).slice(8, -1);
|
2318 | };
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 | utils.isArray = Array.isArray ||
|
2324 | function (a) { return utils.typeName(a) === 'Array'; };
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 | utils.isDate = function (d) {
|
2330 | return (d instanceof Date);
|
2331 | };
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 | utils.clone = function (obj) {
|
2337 | if (!obj || typeof obj === 'function' || utils.isDate(obj) || typeof obj !== 'object') {
|
2338 | return obj;
|
2339 | }
|
2340 |
|
2341 | var retVal, i;
|
2342 |
|
2343 | if (utils.isArray(obj)) {
|
2344 | retVal = [];
|
2345 | for (i = 0; i < obj.length; ++i) {
|
2346 | retVal.push(utils.clone(obj[i]));
|
2347 | }
|
2348 | return retVal;
|
2349 | }
|
2350 |
|
2351 | retVal = {};
|
2352 | for (i in obj) {
|
2353 |
|
2354 |
|
2355 |
|
2356 | if ((!(i in retVal) || retVal[i] !== obj[i]) && typeof obj[i] !== 'undefined' && typeof obj[i] !== 'unknown') {
|
2357 | retVal[i] = utils.clone(obj[i]);
|
2358 | }
|
2359 | }
|
2360 | return retVal;
|
2361 | };
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 | utils.close = function (context, func, params) {
|
2367 | return function () {
|
2368 | var args = params || arguments;
|
2369 | return func.apply(context, args);
|
2370 | };
|
2371 | };
|
2372 |
|
2373 |
|
2374 | function UUIDcreatePart (length) {
|
2375 | var uuidpart = '';
|
2376 | for (var i = 0; i < length; i++) {
|
2377 | var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
|
2378 | if (uuidchar.length === 1) {
|
2379 | uuidchar = '0' + uuidchar;
|
2380 | }
|
2381 | uuidpart += uuidchar;
|
2382 | }
|
2383 | return uuidpart;
|
2384 | }
|
2385 |
|
2386 |
|
2387 |
|
2388 |
|
2389 | utils.createUUID = function () {
|
2390 | return UUIDcreatePart(4) + '-' +
|
2391 | UUIDcreatePart(2) + '-' +
|
2392 | UUIDcreatePart(2) + '-' +
|
2393 | UUIDcreatePart(2) + '-' +
|
2394 | UUIDcreatePart(6);
|
2395 | };
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 | utils.extend = (function () {
|
2402 |
|
2403 | var F = function () {};
|
2404 |
|
2405 | return function (Child, Parent) {
|
2406 |
|
2407 | F.prototype = Parent.prototype;
|
2408 | Child.prototype = new F();
|
2409 | Child.__super__ = Parent.prototype;
|
2410 | Child.prototype.constructor = Child;
|
2411 | };
|
2412 | }());
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 | utils.alert = function (msg) {
|
2418 | if (window.alert) {
|
2419 | window.alert(msg);
|
2420 | } else if (console && console.log) {
|
2421 | console.log(msg);
|
2422 | }
|
2423 | };
|
2424 |
|
2425 | });
|
2426 |
|
2427 | window.cordova = require('cordova');
|
2428 |
|
2429 |
|
2430 | require('cordova/init');
|
2431 |
|
2432 | })(); |
\ | No newline at end of file |