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