mobile_template 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +28 -0
  5. data/Rakefile +3 -0
  6. data/bin/mobile_template +71 -0
  7. data/lib/mobile_template/version.rb +4 -0
  8. data/lib/mobile_template.rb +5 -0
  9. data/mobile_template.gemspec +21 -0
  10. data/templates/assets/Gemfile +4 -0
  11. data/templates/assets/config.rb +96 -0
  12. data/templates/assets/config.ru +4 -0
  13. data/templates/assets/source/images/vendor/ajax-loader.gif +0 -0
  14. data/templates/assets/source/images/vendor/ajax-loader.png +0 -0
  15. data/templates/assets/source/images/vendor/icons-18-black.png +0 -0
  16. data/templates/assets/source/images/vendor/icons-18-white.png +0 -0
  17. data/templates/assets/source/images/vendor/icons-36-black.png +0 -0
  18. data/templates/assets/source/images/vendor/icons-36-white.png +0 -0
  19. data/templates/assets/source/index.html.erb +2 -0
  20. data/templates/assets/source/javascripts/app/index.js.coffee +2 -0
  21. data/templates/assets/source/javascripts/application.js.coffee +5 -0
  22. data/templates/assets/source/javascripts/vendor/cordova.js +4841 -0
  23. data/templates/assets/source/javascripts/vendor/jquery.js +9267 -0
  24. data/templates/assets/source/javascripts/vendor/jquery.mobile.js +7410 -0
  25. data/templates/assets/source/layout.erb +24 -0
  26. data/templates/assets/source/stylesheets/application.css.scss +2 -0
  27. data/templates/assets/source/stylesheets/vendor/jquery.mobile.css.scss +1872 -0
  28. data/templates/cordova_android/.gitignore +18 -0
  29. data/templates/cordova_android/LICENSE +202 -0
  30. data/templates/cordova_android/NOTICE +5 -0
  31. data/templates/cordova_android/README.md +95 -0
  32. data/templates/cordova_android/VERSION +1 -0
  33. data/templates/cordova_android/bin/BOOM +4 -0
  34. data/templates/cordova_android/bin/autotest +2 -0
  35. data/templates/cordova_android/bin/bench +29 -0
  36. data/templates/cordova_android/bin/create +46 -0
  37. data/templates/cordova_android/bin/create.bat +1 -0
  38. data/templates/cordova_android/bin/create.js +88 -0
  39. data/templates/cordova_android/bin/create.xml +79 -0
  40. data/templates/cordova_android/bin/node_modules/.bin/cake +7 -0
  41. data/templates/cordova_android/bin/node_modules/.bin/coffee +7 -0
  42. data/templates/cordova_android/bin/node_modules/.bin/nodeunit +120 -0
  43. data/templates/cordova_android/bin/node_modules/coffee-script/.npmignore +11 -0
  44. data/templates/cordova_android/bin/node_modules/coffee-script/LICENSE +22 -0
  45. data/templates/cordova_android/bin/node_modules/coffee-script/README +48 -0
  46. data/templates/cordova_android/bin/node_modules/coffee-script/Rakefile +78 -0
  47. data/templates/cordova_android/bin/node_modules/coffee-script/bin/cake +7 -0
  48. data/templates/cordova_android/bin/node_modules/coffee-script/bin/coffee +7 -0
  49. data/templates/cordova_android/bin/node_modules/coffee-script/extras/jsl.conf +44 -0
  50. data/templates/cordova_android/bin/node_modules/coffee-script/lib/browser.js +75 -0
  51. data/templates/cordova_android/bin/node_modules/coffee-script/lib/cake.js +76 -0
  52. data/templates/cordova_android/bin/node_modules/coffee-script/lib/coffee-script.js +135 -0
  53. data/templates/cordova_android/bin/node_modules/coffee-script/lib/command.js +301 -0
  54. data/templates/cordova_android/bin/node_modules/coffee-script/lib/grammar.js +591 -0
  55. data/templates/cordova_android/bin/node_modules/coffee-script/lib/helpers.js +66 -0
  56. data/templates/cordova_android/bin/node_modules/coffee-script/lib/index.js +8 -0
  57. data/templates/cordova_android/bin/node_modules/coffee-script/lib/lexer.js +656 -0
  58. data/templates/cordova_android/bin/node_modules/coffee-script/lib/nodes.js +2289 -0
  59. data/templates/cordova_android/bin/node_modules/coffee-script/lib/optparse.js +111 -0
  60. data/templates/cordova_android/bin/node_modules/coffee-script/lib/parser.js +676 -0
  61. data/templates/cordova_android/bin/node_modules/coffee-script/lib/repl.js +123 -0
  62. data/templates/cordova_android/bin/node_modules/coffee-script/lib/rewriter.js +363 -0
  63. data/templates/cordova_android/bin/node_modules/coffee-script/lib/scope.js +120 -0
  64. data/templates/cordova_android/bin/node_modules/coffee-script/package.json +27 -0
  65. data/templates/cordova_android/bin/node_modules/nodeunit/.gitignore +5 -0
  66. data/templates/cordova_android/bin/node_modules/nodeunit/.npmignore +3 -0
  67. data/templates/cordova_android/bin/node_modules/nodeunit/CONTRIBUTORS.md +60 -0
  68. data/templates/cordova_android/bin/node_modules/nodeunit/LICENSE +19 -0
  69. data/templates/cordova_android/bin/node_modules/nodeunit/Makefile +126 -0
  70. data/templates/cordova_android/bin/node_modules/nodeunit/README.md +432 -0
  71. data/templates/cordova_android/bin/node_modules/nodeunit/bin/nodeunit +120 -0
  72. data/templates/cordova_android/bin/node_modules/nodeunit/bin/nodeunit.json +10 -0
  73. data/templates/cordova_android/bin/node_modules/nodeunit/deps/async.js +623 -0
  74. data/templates/cordova_android/bin/node_modules/nodeunit/deps/console.log.js +55 -0
  75. data/templates/cordova_android/bin/node_modules/nodeunit/deps/ejs.js +125 -0
  76. data/templates/cordova_android/bin/node_modules/nodeunit/deps/json2.js +483 -0
  77. data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/nodeunit.js +1757 -0
  78. data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/suite1.js +12 -0
  79. data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/suite2.js +13 -0
  80. data/templates/cordova_android/bin/node_modules/nodeunit/examples/browser/test.html +16 -0
  81. data/templates/cordova_android/bin/node_modules/nodeunit/img/example_fail.png +0 -0
  82. data/templates/cordova_android/bin/node_modules/nodeunit/img/example_pass.png +0 -0
  83. data/templates/cordova_android/bin/node_modules/nodeunit/index.js +3 -0
  84. data/templates/cordova_android/bin/node_modules/nodeunit/lib/assert.js +316 -0
  85. data/templates/cordova_android/bin/node_modules/nodeunit/lib/core.js +260 -0
  86. data/templates/cordova_android/bin/node_modules/nodeunit/lib/nodeunit.js +82 -0
  87. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/browser.js +119 -0
  88. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/default.js +123 -0
  89. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/html.js +107 -0
  90. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/index.js +9 -0
  91. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/junit.js +183 -0
  92. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/minimal.js +112 -0
  93. data/templates/cordova_android/bin/node_modules/nodeunit/lib/reporters/skip_passed.js +105 -0
  94. data/templates/cordova_android/bin/node_modules/nodeunit/lib/track.js +48 -0
  95. data/templates/cordova_android/bin/node_modules/nodeunit/lib/types.js +187 -0
  96. data/templates/cordova_android/bin/node_modules/nodeunit/lib/utils.js +209 -0
  97. data/templates/cordova_android/bin/node_modules/nodeunit/man1/nodeunit.1 +95 -0
  98. data/templates/cordova_android/bin/node_modules/nodeunit/nodelint.cfg +4 -0
  99. data/templates/cordova_android/bin/node_modules/nodeunit/package.json +56 -0
  100. data/templates/cordova_android/bin/node_modules/nodeunit/share/junit.xml.ejs +19 -0
  101. data/templates/cordova_android/bin/node_modules/nodeunit/share/license.js +11 -0
  102. data/templates/cordova_android/bin/node_modules/nodeunit/share/nodeunit.css +70 -0
  103. data/templates/cordova_android/bin/templates/project/.cordova/android/readme.md +1 -0
  104. data/templates/cordova_android/bin/templates/project/.cordova/readme.md +3 -0
  105. data/templates/cordova_android/bin/templates/project/cordova/create +36 -0
  106. data/templates/cordova_android/bin/templates/project/cordova/debug +9 -0
  107. data/templates/cordova_android/bin/templates/project/cordova/emulate +12 -0
  108. data/templates/cordova_android/bin/templates/project/cordova/log +3 -0
  109. data/templates/cordova_android/bin/templates/project/cordova/templates/Activity.java +16 -0
  110. data/templates/cordova_android/bin/templates/project/cordova/templates/project/AndroidManifest.xml +50 -0
  111. data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/index.html +42 -0
  112. data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/main.js +146 -0
  113. data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/master.css +96 -0
  114. data/templates/cordova_android/bin/templates/project/cordova/templates/project/res/drawable/icon.png +0 -0
  115. data/templates/cordova_android/bin/templates/project/cordova/templates/project/res/xml/cordova.xml +5 -0
  116. data/templates/cordova_android/bin/templates/project/cordova/templates/project/res/xml/plugins.xml +19 -0
  117. data/templates/cordova_android/bin/test +26 -0
  118. data/templates/cordova_android/bin/tests/autotest.coffee +4 -0
  119. data/templates/cordova_android/bin/tests/create.coffee +21 -0
  120. data/templates/cordova_android/bin/tests/debug.coffee +0 -0
  121. data/templates/cordova_android/bin/tests/test.coffee +0 -0
  122. data/templates/cordova_android/framework/.classpath +8 -0
  123. data/templates/cordova_android/framework/.project +33 -0
  124. data/templates/cordova_android/framework/AndroidManifest.xml +68 -0
  125. data/templates/cordova_android/framework/ant.properties +34 -0
  126. data/templates/cordova_android/framework/assets/js/accelerometer.js +137 -0
  127. data/templates/cordova_android/framework/assets/js/app.js +89 -0
  128. data/templates/cordova_android/framework/assets/js/battery.js +134 -0
  129. data/templates/cordova_android/framework/assets/js/camera.js +168 -0
  130. data/templates/cordova_android/framework/assets/js/capture.js +203 -0
  131. data/templates/cordova_android/framework/assets/js/compass.js +168 -0
  132. data/templates/cordova_android/framework/assets/js/contact.js +310 -0
  133. data/templates/cordova_android/framework/assets/js/cordova.android.js +4841 -0
  134. data/templates/cordova_android/framework/assets/js/cordova.js.base +924 -0
  135. data/templates/cordova_android/framework/assets/js/crypto.js +54 -0
  136. data/templates/cordova_android/framework/assets/js/device.js +83 -0
  137. data/templates/cordova_android/framework/assets/js/file.js +1082 -0
  138. data/templates/cordova_android/framework/assets/js/filetransfer.js +125 -0
  139. data/templates/cordova_android/framework/assets/js/geolocation.js +209 -0
  140. data/templates/cordova_android/framework/assets/js/header.txt +19 -0
  141. data/templates/cordova_android/framework/assets/js/media.js +233 -0
  142. data/templates/cordova_android/framework/assets/js/network.js +100 -0
  143. data/templates/cordova_android/framework/assets/js/notification.js +133 -0
  144. data/templates/cordova_android/framework/assets/js/position.js +100 -0
  145. data/templates/cordova_android/framework/assets/js/storage.js +439 -0
  146. data/templates/cordova_android/framework/assets/www/index.html +27 -0
  147. data/templates/cordova_android/framework/build.xml +216 -0
  148. data/templates/cordova_android/framework/libs/commons-codec-1.3.jar +0 -0
  149. data/templates/cordova_android/framework/proguard-project.txt +20 -0
  150. data/templates/cordova_android/framework/project.properties +14 -0
  151. data/templates/cordova_android/framework/res/drawable/icon.png +0 -0
  152. data/templates/cordova_android/framework/res/drawable/splash.png +0 -0
  153. data/templates/cordova_android/framework/res/layout/main.xml +29 -0
  154. data/templates/cordova_android/framework/res/values/strings.xml +23 -0
  155. data/templates/cordova_android/framework/res/xml/cordova.xml +37 -0
  156. data/templates/cordova_android/framework/res/xml/plugins.xml +37 -0
  157. data/templates/cordova_android/framework/src/com/phonegap/api/IPlugin.java +27 -0
  158. data/templates/cordova_android/framework/src/com/phonegap/api/LOG.java +28 -0
  159. data/templates/cordova_android/framework/src/com/phonegap/api/PhonegapActivity.java +28 -0
  160. data/templates/cordova_android/framework/src/com/phonegap/api/Plugin.java +27 -0
  161. data/templates/cordova_android/framework/src/com/phonegap/api/PluginManager.java +35 -0
  162. data/templates/cordova_android/framework/src/com/phonegap/api/PluginResult.java +53 -0
  163. data/templates/cordova_android/framework/src/org/apache/cordova/AccelListener.java +311 -0
  164. data/templates/cordova_android/framework/src/org/apache/cordova/App.java +198 -0
  165. data/templates/cordova_android/framework/src/org/apache/cordova/AudioHandler.java +364 -0
  166. data/templates/cordova_android/framework/src/org/apache/cordova/AudioPlayer.java +450 -0
  167. data/templates/cordova_android/framework/src/org/apache/cordova/AuthenticationToken.java +69 -0
  168. data/templates/cordova_android/framework/src/org/apache/cordova/BatteryListener.java +156 -0
  169. data/templates/cordova_android/framework/src/org/apache/cordova/CallbackServer.java +431 -0
  170. data/templates/cordova_android/framework/src/org/apache/cordova/CameraLauncher.java +500 -0
  171. data/templates/cordova_android/framework/src/org/apache/cordova/Capture.java +400 -0
  172. data/templates/cordova_android/framework/src/org/apache/cordova/CompassListener.java +308 -0
  173. data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessor.java +198 -0
  174. data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessorSdk5.java +1934 -0
  175. data/templates/cordova_android/framework/src/org/apache/cordova/ContactManager.java +113 -0
  176. data/templates/cordova_android/framework/src/org/apache/cordova/CordovaChromeClient.java +314 -0
  177. data/templates/cordova_android/framework/src/org/apache/cordova/CordovaWebViewClient.java +306 -0
  178. data/templates/cordova_android/framework/src/org/apache/cordova/Device.java +219 -0
  179. data/templates/cordova_android/framework/src/org/apache/cordova/DirectoryManager.java +161 -0
  180. data/templates/cordova_android/framework/src/org/apache/cordova/DroidGap.java +1417 -0
  181. data/templates/cordova_android/framework/src/org/apache/cordova/ExifHelper.java +165 -0
  182. data/templates/cordova_android/framework/src/org/apache/cordova/FileTransfer.java +458 -0
  183. data/templates/cordova_android/framework/src/org/apache/cordova/FileUploadResult.java +63 -0
  184. data/templates/cordova_android/framework/src/org/apache/cordova/FileUtils.java +1048 -0
  185. data/templates/cordova_android/framework/src/org/apache/cordova/GeoBroker.java +165 -0
  186. data/templates/cordova_android/framework/src/org/apache/cordova/GeoListener.java +133 -0
  187. data/templates/cordova_android/framework/src/org/apache/cordova/GpsListener.java +163 -0
  188. data/templates/cordova_android/framework/src/org/apache/cordova/HttpHandler.java +80 -0
  189. data/templates/cordova_android/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java +104 -0
  190. data/templates/cordova_android/framework/src/org/apache/cordova/NetworkListener.java +153 -0
  191. data/templates/cordova_android/framework/src/org/apache/cordova/NetworkManager.java +248 -0
  192. data/templates/cordova_android/framework/src/org/apache/cordova/Notification.java +366 -0
  193. data/templates/cordova_android/framework/src/org/apache/cordova/PreferenceNode.java +34 -0
  194. data/templates/cordova_android/framework/src/org/apache/cordova/PreferenceSet.java +62 -0
  195. data/templates/cordova_android/framework/src/org/apache/cordova/StandAlone.java +35 -0
  196. data/templates/cordova_android/framework/src/org/apache/cordova/Storage.java +239 -0
  197. data/templates/cordova_android/framework/src/org/apache/cordova/TempListener.java +112 -0
  198. data/templates/cordova_android/framework/src/org/apache/cordova/api/CordovaInterface.java +145 -0
  199. data/templates/cordova_android/framework/src/org/apache/cordova/api/IPlugin.java +116 -0
  200. data/templates/cordova_android/framework/src/org/apache/cordova/api/LOG.java +234 -0
  201. data/templates/cordova_android/framework/src/org/apache/cordova/api/Plugin.java +210 -0
  202. data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginManager.java +359 -0
  203. data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginResult.java +119 -0
  204. data/templates/cordova_android/framework/src/org/apache/cordova/file/EncodingException.java +28 -0
  205. data/templates/cordova_android/framework/src/org/apache/cordova/file/FileExistsException.java +28 -0
  206. data/templates/cordova_android/framework/src/org/apache/cordova/file/InvalidModificationException.java +29 -0
  207. data/templates/cordova_android/framework/src/org/apache/cordova/file/NoModificationAllowedException.java +28 -0
  208. data/templates/cordova_android/framework/src/org/apache/cordova/file/TypeMismatchException.java +29 -0
  209. data/templates/cordova_android/framework/test/org/apache/cordova/PreferenceNodeTest.java +53 -0
  210. data/templates/cordova_android/framework/test/org/apache/cordova/PreferenceSetTest.java +73 -0
  211. metadata +279 -0
@@ -0,0 +1,4841 @@
1
+ /*
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
204
+
205
+ ==============================================================
206
+ This product also include the following software:
207
+ ==============================================================
208
+
209
+ --------------------------------------------------------------
210
+ jasmine from GitHub
211
+
212
+ https://github.com/pivotal/jasmine
213
+
214
+ MIT-style license
215
+
216
+ license available from:
217
+
218
+ https://github.com/pivotal/jasmine/blob/master/MIT.LICENSE
219
+
220
+ -----------------------------
221
+
222
+ Copyright (c) 2008-2011 Pivotal Labs
223
+
224
+ Permission is hereby granted, free of charge, to any person obtaining
225
+ a copy of this software and associated documentation files (the
226
+ "Software"), to deal in the Software without restriction, including
227
+ without limitation the rights to use, copy, modify, merge, publish,
228
+ distribute, sublicense, and/or sell copies of the Software, and to
229
+ permit persons to whom the Software is furnished to do so, subject to
230
+ the following conditions:
231
+
232
+ The above copyright notice and this permission notice shall be
233
+ included in all copies or substantial portions of the Software.
234
+
235
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
236
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
237
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
238
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
239
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
240
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
241
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
242
+
243
+
244
+ --------------------------------------------------------------
245
+ commonjs tests from the commonjs organization at GitHub
246
+
247
+ https://github.com/commonjs/commonjs
248
+
249
+ MIT-style license
250
+
251
+ license available from:
252
+
253
+ https://github.com/commonjs/commonjs/blob/master/docs/license.html.markdown
254
+
255
+ contributor list available from:
256
+
257
+ https://github.com/commonjs/commonjs/blob/master/docs/contributors.html.markdown
258
+
259
+ -----------------------------
260
+
261
+ Copyright 2009 Kevin Dangoor
262
+ Copyright 2009 Ihab Awad
263
+ Copyright 2009 Ash Berlin
264
+ Copyright 2009 Aristid Breitkreuz
265
+ Copyright 2009 Kevin Dangoor
266
+ Copyright 2009 Daniel Friesen
267
+ Copyright 2009 Wes Garland
268
+ Copyright 2009 Kris Kowal
269
+ Copyright 2009 Dean Landolt
270
+ Copyright 2009 Peter Michaux
271
+ Copyright 2009 George Moschovitis
272
+ Copyright 2009 Michael O'Brien
273
+ Copyright 2009 Tom Robinson
274
+ Copyright 2009 Hannes Wallnoefer
275
+ Copyright 2009 Mike Wilson
276
+ Copyright 2009 Ondrej Zara
277
+ Copyright 2009 Chris Zumbrunn
278
+ Copyright 2009 Kris Zyp
279
+
280
+ Permission is hereby granted, free of charge, to any person obtaining a copy
281
+ of this software and associated documentation files (the "Software"), to deal
282
+ in the Software without restriction, including without limitation the rights
283
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
284
+ copies of the Software, and to permit persons to whom the Software is
285
+ furnished to do so, subject to the following conditions:
286
+
287
+ The above copyright notice and this permission notice shall be included in
288
+ all copies or substantial portions of the Software.
289
+
290
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
291
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
292
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
293
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
294
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
295
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
296
+ THE SOFTWARE.
297
+
298
+ */
299
+ var require,
300
+ define;
301
+
302
+ (function () {
303
+ var modules = {};
304
+
305
+ function build(module) {
306
+ var factory = module.factory;
307
+ module.exports = {};
308
+ delete module.factory;
309
+ factory(require, module.exports, module);
310
+ return module.exports;
311
+ }
312
+
313
+ require = function (id) {
314
+ if (!modules[id]) {
315
+ throw "module " + id + " not found";
316
+ }
317
+ return modules[id].factory ? build(modules[id]) : modules[id].exports;
318
+ }
319
+
320
+ define = function (id, factory) {
321
+ if (modules[id]) {
322
+ throw "module " + id + " already defined";
323
+ }
324
+
325
+ modules[id] = {
326
+ id: id,
327
+ factory: factory
328
+ };
329
+ }
330
+
331
+ define.remove = function (id) {
332
+ delete modules[id];
333
+ };
334
+
335
+ })();
336
+
337
+ //Export for use in node
338
+ if (typeof module === "object" && typeof require === "function") {
339
+ module.exports.require = require;
340
+ module.exports.define = define;
341
+ }
342
+
343
+ define('cordova/channel', function(require, exports, module) {
344
+ /**
345
+ * Custom pub-sub channel that can have functions subscribed to it
346
+ * @constructor
347
+ * @param type String the channel name
348
+ * @param opts Object options to pass into the channel, currently
349
+ * supports:
350
+ * onSubscribe: callback that fires when
351
+ * something subscribes to the Channel. Sets
352
+ * context to the Channel.
353
+ * onUnsubscribe: callback that fires when
354
+ * something unsubscribes to the Channel. Sets
355
+ * context to the Channel.
356
+ */
357
+ var Channel = function(type, opts) {
358
+ this.type = type;
359
+ this.handlers = {};
360
+ this.numHandlers = 0;
361
+ this.guid = 0;
362
+ this.fired = false;
363
+ this.enabled = true;
364
+ this.events = {
365
+ onSubscribe:null,
366
+ onUnsubscribe:null
367
+ };
368
+ if (opts) {
369
+ if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe;
370
+ if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe;
371
+ }
372
+ },
373
+ channel = {
374
+ /**
375
+ * Calls the provided function only after all of the channels specified
376
+ * have been fired.
377
+ */
378
+ join: function (h, c) {
379
+ var i = c.length;
380
+ var len = i;
381
+ var f = function() {
382
+ if (!(--i)) h();
383
+ };
384
+ for (var j=0; j<len; j++) {
385
+ !c[j].fired?c[j].subscribeOnce(f):i--;
386
+ }
387
+ if (!i) h();
388
+ },
389
+ create: function (type, opts) {
390
+ channel[type] = new Channel(type, opts);
391
+ return channel[type];
392
+ }
393
+ },
394
+ utils = require('cordova/utils');
395
+
396
+ /**
397
+ * Subscribes the given function to the channel. Any time that
398
+ * Channel.fire is called so too will the function.
399
+ * Optionally specify an execution context for the function
400
+ * and a guid that can be used to stop subscribing to the channel.
401
+ * Returns the guid.
402
+ */
403
+ Channel.prototype.subscribe = function(f, c, g) {
404
+ // need a function to call
405
+ if (f === null || f === undefined) { return; }
406
+
407
+ var func = f;
408
+ if (typeof c == "object" && f instanceof Function) { func = utils.close(c, f); }
409
+
410
+ g = g || func.observer_guid || f.observer_guid || this.guid++;
411
+ func.observer_guid = g;
412
+ f.observer_guid = g;
413
+ this.handlers[g] = func;
414
+ this.numHandlers++;
415
+ if (this.events.onSubscribe) this.events.onSubscribe.call(this);
416
+ return g;
417
+ };
418
+
419
+ /**
420
+ * Like subscribe but the function is only called once and then it
421
+ * auto-unsubscribes itself.
422
+ */
423
+ Channel.prototype.subscribeOnce = function(f, c) {
424
+ // need a function to call
425
+ if (f === null || f === undefined) { return; }
426
+
427
+ var g = null;
428
+ var _this = this;
429
+ var m = function() {
430
+ f.apply(c || null, arguments);
431
+ _this.unsubscribe(g);
432
+ };
433
+ if (this.fired) {
434
+ if (typeof c == "object" && f instanceof Function) { f = utils.close(c, f); }
435
+ f.apply(this, this.fireArgs);
436
+ } else {
437
+ g = this.subscribe(m);
438
+ }
439
+ return g;
440
+ };
441
+
442
+ /**
443
+ * Unsubscribes the function with the given guid from the channel.
444
+ */
445
+ Channel.prototype.unsubscribe = function(g) {
446
+ // need a function to unsubscribe
447
+ if (g === null || g === undefined) { return; }
448
+
449
+ if (g instanceof Function) { g = g.observer_guid; }
450
+ this.handlers[g] = null;
451
+ delete this.handlers[g];
452
+ this.numHandlers--;
453
+ if (this.events.onUnsubscribe) this.events.onUnsubscribe.call(this);
454
+ };
455
+
456
+ /**
457
+ * Calls all functions subscribed to this channel.
458
+ */
459
+ Channel.prototype.fire = function(e) {
460
+ if (this.enabled) {
461
+ var fail = false;
462
+ this.fired = true;
463
+ for (var item in this.handlers) {
464
+ var handler = this.handlers[item];
465
+ if (handler instanceof Function) {
466
+ var rv = (handler.apply(this, arguments)===false);
467
+ fail = fail || rv;
468
+ }
469
+ }
470
+ this.fireArgs = arguments;
471
+ return !fail;
472
+ }
473
+ return true;
474
+ };
475
+
476
+ //HACK: defining them here so they are ready super fast!
477
+ channel.create('onDOMContentLoaded');
478
+ channel.create('onNativeReady');
479
+ channel.create('onCordovaReady');
480
+ channel.create('onCordovaInfoReady');
481
+ channel.create('onCordovaConnectionReady');
482
+ channel.create('onResume');
483
+ channel.create('onPause');
484
+ channel.create('onDeviceReady');
485
+ channel.create('onDestroy');
486
+
487
+ module.exports = channel;
488
+
489
+ });
490
+ define('cordova', function(require, exports, module) {
491
+ var channel = require('cordova/channel');
492
+ /**
493
+ * Intercept calls to addEventListener + removeEventListener and handle deviceready,
494
+ * resume, and pause events.
495
+ */
496
+ var m_document_addEventListener = document.addEventListener;
497
+ var m_document_removeEventListener = document.removeEventListener;
498
+ var m_window_addEventListener = window.addEventListener;
499
+ var m_window_removeEventListener = window.removeEventListener;
500
+
501
+ /**
502
+ * Houses custom event handlers to intercept on document + window event listeners.
503
+ */
504
+ var documentEventHandlers = {},
505
+ windowEventHandlers = {};
506
+
507
+ document.addEventListener = function(evt, handler, capture) {
508
+ var e = evt.toLowerCase();
509
+ if (e == 'deviceready') {
510
+ channel.onDeviceReady.subscribeOnce(handler);
511
+ } else if (e == 'resume') {
512
+ channel.onResume.subscribe(handler);
513
+ // if subscribing listener after event has already fired, invoke the handler
514
+ if (channel.onResume.fired && handler instanceof Function) {
515
+ handler();
516
+ }
517
+ } else if (e == 'pause') {
518
+ channel.onPause.subscribe(handler);
519
+ } else if (typeof documentEventHandlers[e] != 'undefined') {
520
+ documentEventHandlers[e].subscribe(handler);
521
+ } else {
522
+ m_document_addEventListener.call(document, evt, handler, capture);
523
+ }
524
+ };
525
+
526
+ window.addEventListener = function(evt, handler, capture) {
527
+ var e = evt.toLowerCase();
528
+ if (typeof windowEventHandlers[e] != 'undefined') {
529
+ windowEventHandlers[e].subscribe(handler);
530
+ } else {
531
+ m_window_addEventListener.call(window, evt, handler, capture);
532
+ }
533
+ };
534
+
535
+ document.removeEventListener = function(evt, handler, capture) {
536
+ var e = evt.toLowerCase();
537
+ // If unsubcribing from an event that is handled by a plugin
538
+ if (typeof documentEventHandlers[e] != "undefined") {
539
+ documentEventHandlers[e].unsubscribe(handler);
540
+ } else {
541
+ m_document_removeEventListener.call(document, evt, handler, capture);
542
+ }
543
+ };
544
+
545
+ window.removeEventListener = function(evt, handler, capture) {
546
+ var e = evt.toLowerCase();
547
+ // If unsubcribing from an event that is handled by a plugin
548
+ if (typeof windowEventHandlers[e] != "undefined") {
549
+ windowEventHandlers[e].unsubscribe(handler);
550
+ } else {
551
+ m_window_removeEventListener.call(window, evt, handler, capture);
552
+ }
553
+ };
554
+
555
+ function createEvent(type, data) {
556
+ var event = document.createEvent('Events');
557
+ event.initEvent(type, false, false);
558
+ if (data) {
559
+ for (var i in data) {
560
+ if (data.hasOwnProperty(i)) {
561
+ event[i] = data[i];
562
+ }
563
+ }
564
+ }
565
+ return event;
566
+ }
567
+
568
+ var cordova = {
569
+ /**
570
+ * Methods to add/remove your own addEventListener hijacking on document + window.
571
+ */
572
+ addWindowEventHandler:function(event, opts) {
573
+ return (windowEventHandlers[event] = channel.create(event, opts));
574
+ },
575
+ addDocumentEventHandler:function(event, opts) {
576
+ return (documentEventHandlers[event] = channel.create(event, opts));
577
+ },
578
+ removeWindowEventHandler:function(event) {
579
+ delete windowEventHandlers[event];
580
+ },
581
+ removeDocumentEventHandler:function(event) {
582
+ delete documentEventHandlers[event];
583
+ },
584
+ /**
585
+ * Method to fire event from native code
586
+ */
587
+ fireDocumentEvent: function(type, data) {
588
+ var evt = createEvent(type, data);
589
+ if (typeof documentEventHandlers[type] != 'undefined') {
590
+ documentEventHandlers[type].fire(evt);
591
+ } else {
592
+ document.dispatchEvent(evt);
593
+ }
594
+ },
595
+ fireWindowEvent: function(type, data) {
596
+ var evt = createEvent(type,data);
597
+ if (typeof windowEventHandlers[type] != 'undefined') {
598
+ windowEventHandlers[type].fire(evt);
599
+ } else {
600
+ window.dispatchEvent(evt);
601
+ }
602
+ },
603
+ // TODO: this is Android only; think about how to do this better
604
+ shuttingDown:false,
605
+ UsePolling:false,
606
+ // END TODO
607
+
608
+ // TODO: iOS only
609
+ // This queue holds the currently executing command and all pending
610
+ // commands executed with cordova.exec().
611
+ commandQueue:[],
612
+ // Indicates if we're currently in the middle of flushing the command
613
+ // queue on the native side.
614
+ commandQueueFlushing:false,
615
+ // END TODO
616
+ /**
617
+ * Plugin callback mechanism.
618
+ */
619
+ callbackId: 0,
620
+ callbacks: {},
621
+ callbackStatus: {
622
+ NO_RESULT: 0,
623
+ OK: 1,
624
+ CLASS_NOT_FOUND_EXCEPTION: 2,
625
+ ILLEGAL_ACCESS_EXCEPTION: 3,
626
+ INSTANTIATION_EXCEPTION: 4,
627
+ MALFORMED_URL_EXCEPTION: 5,
628
+ IO_EXCEPTION: 6,
629
+ INVALID_ACTION: 7,
630
+ JSON_EXCEPTION: 8,
631
+ ERROR: 9
632
+ },
633
+
634
+ /**
635
+ * Called by native code when returning successful result from an action.
636
+ *
637
+ * @param callbackId
638
+ * @param args
639
+ */
640
+ callbackSuccess: function(callbackId, args) {
641
+ if (cordova.callbacks[callbackId]) {
642
+
643
+ // If result is to be sent to callback
644
+ if (args.status == cordova.callbackStatus.OK) {
645
+ try {
646
+ if (cordova.callbacks[callbackId].success) {
647
+ cordova.callbacks[callbackId].success(args.message);
648
+ }
649
+ }
650
+ catch (e) {
651
+ console.log("Error in success callback: "+callbackId+" = "+e);
652
+ }
653
+ }
654
+
655
+ // Clear callback if not expecting any more results
656
+ if (!args.keepCallback) {
657
+ delete cordova.callbacks[callbackId];
658
+ }
659
+ }
660
+ },
661
+
662
+ /**
663
+ * Called by native code when returning error result from an action.
664
+ *
665
+ * @param callbackId
666
+ * @param args
667
+ */
668
+ callbackError: function(callbackId, args) {
669
+ if (cordova.callbacks[callbackId]) {
670
+ try {
671
+ if (cordova.callbacks[callbackId].fail) {
672
+ cordova.callbacks[callbackId].fail(args.message);
673
+ }
674
+ }
675
+ catch (e) {
676
+ console.log("Error in error callback: "+callbackId+" = "+e);
677
+ }
678
+
679
+ // Clear callback if not expecting any more results
680
+ if (!args.keepCallback) {
681
+ delete cordova.callbacks[callbackId];
682
+ }
683
+ }
684
+ },
685
+
686
+ addPlugin: function(name, obj) {
687
+ if (!window.plugins[name]) {
688
+ window.plugins[name] = obj;
689
+ }
690
+ else {
691
+ console.log("Error: Plugin "+name+" already exists.");
692
+ }
693
+ },
694
+
695
+ addConstructor: function(func) {
696
+ channel.onCordovaReady.subscribeOnce(function() {
697
+ try {
698
+ func();
699
+ } catch(e) {
700
+ console.log("Failed to run constructor: " + e);
701
+ }
702
+ });
703
+ }
704
+ };
705
+
706
+ /**
707
+ * Legacy variable for plugin support
708
+ */
709
+ if (!window.PhoneGap) {
710
+ window.PhoneGap = cordova;
711
+ }
712
+
713
+ /**
714
+ * Plugins object
715
+ */
716
+ if (!window.plugins) {
717
+ window.plugins = {};
718
+ }
719
+
720
+ module.exports = cordova;
721
+
722
+ });
723
+ define('cordova/exec', function(require, exports, module) {
724
+ /**
725
+ * Execute a cordova command. It is up to the native side whether this action
726
+ * is synchronous or asynchronous. The native side can return:
727
+ * Synchronous: PluginResult object as a JSON string
728
+ * Asynchrounous: Empty string ""
729
+ * If async, the native side will cordova.callbackSuccess or cordova.callbackError,
730
+ * depending upon the result of the action.
731
+ *
732
+ * @param {Function} success The success callback
733
+ * @param {Function} fail The fail callback
734
+ * @param {String} service The name of the service to use
735
+ * @param {String} action Action to be run in cordova
736
+ * @param {String[]} [args] Zero or more arguments to pass to the method
737
+ */
738
+ var cordova = require('cordova');
739
+
740
+ module.exports = function(success, fail, service, action, args) {
741
+ try {
742
+ var callbackId = service + cordova.callbackId++;
743
+ if (success || fail) {
744
+ cordova.callbacks[callbackId] = {success:success, fail:fail};
745
+ }
746
+
747
+ var r = prompt(JSON.stringify(args), "gap:"+JSON.stringify([service, action, callbackId, true]));
748
+
749
+ // If a result was returned
750
+ if (r.length > 0) {
751
+ eval("var v="+r+";");
752
+
753
+ // If status is OK, then return value back to caller
754
+ if (v.status === cordova.callbackStatus.OK) {
755
+
756
+ // If there is a success callback, then call it now with
757
+ // returned value
758
+ if (success) {
759
+ try {
760
+ success(v.message);
761
+ } catch (e) {
762
+ console.log("Error in success callback: " + callbackId + " = " + e);
763
+ }
764
+
765
+ // Clear callback if not expecting any more results
766
+ if (!v.keepCallback) {
767
+ delete cordova.callbacks[callbackId];
768
+ }
769
+ }
770
+ return v.message;
771
+ }
772
+
773
+ // If no result
774
+ else if (v.status === cordova.callbackStatus.NO_RESULT) {
775
+ // Clear callback if not expecting any more results
776
+ if (!v.keepCallback) {
777
+ delete cordova.callbacks[callbackId];
778
+ }
779
+ }
780
+
781
+ // If error, then display error
782
+ else {
783
+ console.log("Error: Status="+v.status+" Message="+v.message);
784
+
785
+ // If there is a fail callback, then call it now with returned value
786
+ if (fail) {
787
+ try {
788
+ fail(v.message);
789
+ }
790
+ catch (e1) {
791
+ console.log("Error in error callback: "+callbackId+" = "+e1);
792
+ }
793
+
794
+ // Clear callback if not expecting any more results
795
+ if (!v.keepCallback) {
796
+ delete cordova.callbacks[callbackId];
797
+ }
798
+ }
799
+ return null;
800
+ }
801
+ }
802
+ } catch (e2) {
803
+ console.log("Error: "+e2);
804
+ }
805
+ };
806
+
807
+ });
808
+ define('cordova/common', function(require, exports, module) {
809
+ module.exports = {
810
+ objects: {
811
+ cordova: {
812
+ path: 'cordova',
813
+ children: {
814
+ exec: {
815
+ path: 'cordova/exec'
816
+ }
817
+ }
818
+ },
819
+ navigator: {
820
+ children: {
821
+ notification: {
822
+ path: 'cordova/plugin/notification'
823
+ },
824
+ accelerometer: {
825
+ path: 'cordova/plugin/accelerometer'
826
+ },
827
+ battery: {
828
+ path: 'cordova/plugin/battery'
829
+ },
830
+ camera:{
831
+ path: 'cordova/plugin/Camera'
832
+ },
833
+ compass:{
834
+ path: 'cordova/plugin/compass'
835
+ },
836
+ contacts: {
837
+ path: 'cordova/plugin/contacts'
838
+ },
839
+ device:{
840
+ children:{
841
+ capture: {
842
+ path: 'cordova/plugin/capture'
843
+ }
844
+ }
845
+ },
846
+ geolocation: {
847
+ path: 'cordova/plugin/geolocation'
848
+ },
849
+ network: {
850
+ children: {
851
+ connection: {
852
+ path: 'cordova/plugin/network'
853
+ }
854
+ }
855
+ }
856
+ }
857
+ },
858
+ Acceleration: {
859
+ path: 'cordova/plugin/Acceleration'
860
+ },
861
+ Camera:{
862
+ path: 'cordova/plugin/CameraConstants'
863
+ },
864
+ CaptureError: {
865
+ path: 'cordova/plugin/CaptureError'
866
+ },
867
+ CaptureAudioOptions:{
868
+ path: 'cordova/plugin/CaptureAudioOptions'
869
+ },
870
+ CaptureImageOptions: {
871
+ path: 'cordova/plugin/CaptureImageOptions'
872
+ },
873
+ CaptureVideoOptions: {
874
+ path: 'cordova/plugin/CaptureVideoOptions'
875
+ },
876
+ CompassHeading:{
877
+ path: 'cordova/plugin/CompassHeading'
878
+ },
879
+ CompassError:{
880
+ path: 'cordova/plugin/CompassError'
881
+ },
882
+ ConfigurationData: {
883
+ path: 'cordova/plugin/ConfigurationData'
884
+ },
885
+ Connection: {
886
+ path: 'cordova/plugin/Connection'
887
+ },
888
+ Contact: {
889
+ path: 'cordova/plugin/Contact'
890
+ },
891
+ ContactAddress: {
892
+ path: 'cordova/plugin/ContactAddress'
893
+ },
894
+ ContactError: {
895
+ path: 'cordova/plugin/ContactError'
896
+ },
897
+ ContactField: {
898
+ path: 'cordova/plugin/ContactField'
899
+ },
900
+ ContactFindOptions: {
901
+ path: 'cordova/plugin/ContactFindOptions'
902
+ },
903
+ ContactName: {
904
+ path: 'cordova/plugin/ContactName'
905
+ },
906
+ ContactOrganization: {
907
+ path: 'cordova/plugin/ContactOrganization'
908
+ },
909
+ Coordinates: {
910
+ path: 'cordova/plugin/Coordinates'
911
+ },
912
+ DirectoryEntry: {
913
+ path: 'cordova/plugin/DirectoryEntry'
914
+ },
915
+ DirectoryReader: {
916
+ path: 'cordova/plugin/DirectoryReader'
917
+ },
918
+ Entry: {
919
+ path: 'cordova/plugin/Entry'
920
+ },
921
+ File: {
922
+ path: 'cordova/plugin/File'
923
+ },
924
+ FileEntry: {
925
+ path: 'cordova/plugin/FileEntry'
926
+ },
927
+ FileError: {
928
+ path: 'cordova/plugin/FileError'
929
+ },
930
+ FileReader: {
931
+ path: 'cordova/plugin/FileReader'
932
+ },
933
+ FileSystem: {
934
+ path: 'cordova/plugin/FileSystem'
935
+ },
936
+ FileTransfer: {
937
+ path: 'cordova/plugin/FileTransfer'
938
+ },
939
+ FileTransferError: {
940
+ path: 'cordova/plugin/FileTransferError'
941
+ },
942
+ FileUploadOptions: {
943
+ path: 'cordova/plugin/FileUploadOptions'
944
+ },
945
+ FileUploadResult: {
946
+ path: 'cordova/plugin/FileUploadResult'
947
+ },
948
+ FileWriter: {
949
+ path: 'cordova/plugin/FileWriter'
950
+ },
951
+ Flags: {
952
+ path: 'cordova/plugin/Flags'
953
+ },
954
+ LocalFileSystem: {
955
+ path: 'cordova/plugin/LocalFileSystem'
956
+ },
957
+ Media: {
958
+ path: 'cordova/plugin/Media'
959
+ },
960
+ MediaError: {
961
+ path: 'cordova/plugin/MediaError'
962
+ },
963
+ MediaFile: {
964
+ path: 'cordova/plugin/MediaFile'
965
+ },
966
+ MediaFileData:{
967
+ path: 'cordova/plugin/MediaFileData'
968
+ },
969
+ Metadata:{
970
+ path: 'cordova/plugin/Metadata'
971
+ },
972
+ Position: {
973
+ path: 'cordova/plugin/Position'
974
+ },
975
+ PositionError: {
976
+ path: 'cordova/plugin/PositionError'
977
+ },
978
+ ProgressEvent: {
979
+ path: 'cordova/plugin/ProgressEvent'
980
+ },
981
+ requestFileSystem:{
982
+ path: 'cordova/plugin/requestFileSystem'
983
+ },
984
+ resolveLocalFileSystemURI:{
985
+ path: 'cordova/plugin/resolveLocalFileSystemURI'
986
+ }
987
+ }
988
+ };
989
+
990
+ });
991
+ define('cordova/platform', function(require, exports, module) {
992
+ module.exports = {
993
+ id: "android",
994
+ initialize:function() {
995
+ var channel = require("cordova/channel"),
996
+ cordova = require('cordova'),
997
+ callback = require('cordova/plugin/android/callback'),
998
+ polling = require('cordova/plugin/android/polling'),
999
+ exec = require('cordova/exec');
1000
+
1001
+ channel.onDestroy.subscribe(function() {
1002
+ cordova.shuttingDown = true;
1003
+ });
1004
+
1005
+ // Start listening for XHR callbacks
1006
+ // Figure out which bridge approach will work on this Android
1007
+ // device: polling or XHR-based callbacks
1008
+ setTimeout(function() {
1009
+ if (cordova.UsePolling) {
1010
+ polling();
1011
+ }
1012
+ else {
1013
+ var isPolling = prompt("usePolling", "gap_callbackServer:");
1014
+ cordova.UsePolling = isPolling;
1015
+ if (isPolling == "true") {
1016
+ cordova.UsePolling = true;
1017
+ polling();
1018
+ } else {
1019
+ cordova.UsePolling = false;
1020
+ callback();
1021
+ }
1022
+ }
1023
+ }, 1);
1024
+
1025
+ // Inject a listener for the backbutton on the document.
1026
+ var backButtonChannel = cordova.addDocumentEventHandler('backbutton', {
1027
+ onSubscribe:function() {
1028
+ // If we just attached the first handler, let native know we need to override the back button.
1029
+ if (this.numHandlers === 1) {
1030
+ exec(null, null, "App", "overrideBackbutton", [true]);
1031
+ }
1032
+ },
1033
+ onUnsubscribe:function() {
1034
+ // If we just detached the last handler, let native know we no longer override the back button.
1035
+ if (this.numHandlers === 0) {
1036
+ exec(null, null, "App", "overrideBackbutton", [false]);
1037
+ }
1038
+ }
1039
+ });
1040
+
1041
+ // Add hardware MENU and SEARCH button handlers
1042
+ cordova.addDocumentEventHandler('menubutton');
1043
+ cordova.addDocumentEventHandler('searchbutton');
1044
+
1045
+ // Let native code know we are all done on the JS side.
1046
+ // Native code will then un-hide the WebView.
1047
+ channel.join(function() {
1048
+ prompt("", "gap_init:");
1049
+ }, [channel.onCordovaReady]);
1050
+
1051
+ // Figure out if we need to shim-in localStorage and WebSQL
1052
+ // support from the native side.
1053
+ var storage = require('cordova/plugin/android/storage');
1054
+
1055
+ // First patch WebSQL if necessary
1056
+ if (typeof window.openDatabase == 'undefined') {
1057
+ // Not defined, create an openDatabase function for all to use!
1058
+ window.openDatabase = storage.openDatabase;
1059
+ } else {
1060
+ // Defined, but some Android devices will throw a SECURITY_ERR -
1061
+ // so we wrap the whole thing in a try-catch and shim in our own
1062
+ // if the device has Android bug 16175.
1063
+ var originalOpenDatabase = window.openDatabase;
1064
+ window.openDatabase = function(name, version, desc, size) {
1065
+ var db = null;
1066
+ try {
1067
+ db = originalOpenDatabase(name, version, desc, size);
1068
+ }
1069
+ catch (ex) {
1070
+ db = null;
1071
+ }
1072
+
1073
+ if (db === null) {
1074
+ return storage.openDatabase(name, version, desc, size);
1075
+ }
1076
+ else {
1077
+ return db;
1078
+ }
1079
+
1080
+ };
1081
+ }
1082
+
1083
+ // Patch localStorage if necessary
1084
+ if (typeof window.localStorage == 'undefined' || window.localStorage === null) {
1085
+ window.localStorage = new storage.CupCakeLocalStorage();
1086
+ }
1087
+ },
1088
+ objects: {
1089
+ cordova: {
1090
+ children: {
1091
+ JSCallback:{
1092
+ path:"cordova/plugin/android/callback"
1093
+ },
1094
+ JSCallbackPolling:{
1095
+ path:"cordova/plugin/android/polling"
1096
+ }
1097
+ }
1098
+ },
1099
+ navigator: {
1100
+ children: {
1101
+ app:{
1102
+ path: "cordova/plugin/android/app"
1103
+ }
1104
+ }
1105
+ },
1106
+ device:{
1107
+ path: "cordova/plugin/android/device"
1108
+ },
1109
+ File: { // exists natively on Android WebView, override
1110
+ path: "cordova/plugin/File"
1111
+ },
1112
+ FileReader: { // exists natively on Android WebView, override
1113
+ path: "cordova/plugin/FileReader"
1114
+ },
1115
+ FileError: { //exists natively on Android WebView on Android 4.x
1116
+ path: "cordova/plugin/FileError"
1117
+ }
1118
+ }
1119
+ };
1120
+
1121
+ });
1122
+ define('cordova/utils', function(require, exports, module) {
1123
+ function UUIDcreatePart(length) {
1124
+ var uuidpart = "";
1125
+ for (var i=0; i<length; i++) {
1126
+ var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
1127
+ if (uuidchar.length == 1) {
1128
+ uuidchar = "0" + uuidchar;
1129
+ }
1130
+ uuidpart += uuidchar;
1131
+ }
1132
+ return uuidpart;
1133
+ }
1134
+
1135
+ var _self = {
1136
+ /**
1137
+ * Does a deep clone of the object.
1138
+ */
1139
+ clone: function(obj) {
1140
+ if(!obj) {
1141
+ return obj;
1142
+ }
1143
+
1144
+ var retVal, i;
1145
+
1146
+ if(obj instanceof Array){
1147
+ retVal = [];
1148
+ for(i = 0; i < obj.length; ++i){
1149
+ retVal.push(_self.clone(obj[i]));
1150
+ }
1151
+ return retVal;
1152
+ }
1153
+
1154
+ if (obj instanceof Function) {
1155
+ return obj;
1156
+ }
1157
+
1158
+ if(!(obj instanceof Object)){
1159
+ return obj;
1160
+ }
1161
+
1162
+ if(obj instanceof Date){
1163
+ return obj;
1164
+ }
1165
+
1166
+ retVal = {};
1167
+ for(i in obj){
1168
+ if(!(i in retVal) || retVal[i] != obj[i]) {
1169
+ retVal[i] = _self.clone(obj[i]);
1170
+ }
1171
+ }
1172
+ return retVal;
1173
+ },
1174
+
1175
+ close: function(context, func, params) {
1176
+ if (typeof params === 'undefined') {
1177
+ return function() {
1178
+ return func.apply(context, arguments);
1179
+ };
1180
+ } else {
1181
+ return function() {
1182
+ return func.apply(context, params);
1183
+ };
1184
+ }
1185
+ },
1186
+
1187
+ /**
1188
+ * Create a UUID
1189
+ */
1190
+ createUUID: function() {
1191
+ return UUIDcreatePart(4) + '-' +
1192
+ UUIDcreatePart(2) + '-' +
1193
+ UUIDcreatePart(2) + '-' +
1194
+ UUIDcreatePart(2) + '-' +
1195
+ UUIDcreatePart(6);
1196
+ },
1197
+
1198
+ /**
1199
+ * Extends a child object from a parent object using classical inheritance
1200
+ * pattern.
1201
+ */
1202
+ extend: (function() {
1203
+ // proxy used to establish prototype chain
1204
+ var F = function() {};
1205
+ // extend Child from Parent
1206
+ return function(Child, Parent) {
1207
+ F.prototype = Parent.prototype;
1208
+ Child.prototype = new F();
1209
+ Child.__super__ = Parent.prototype;
1210
+ Child.prototype.constructor = Child;
1211
+ };
1212
+ }())
1213
+
1214
+ };
1215
+
1216
+ module.exports = _self;
1217
+
1218
+ });
1219
+
1220
+ define('cordova/builder', function(require, exports, module) {
1221
+ function each(objects, func, context) {
1222
+ for (var prop in objects) {
1223
+ if (objects.hasOwnProperty(prop)) {
1224
+ func.apply(context, [objects[prop], prop]);
1225
+ }
1226
+ }
1227
+ }
1228
+
1229
+ function include(parent, objects, clobber) {
1230
+ each(objects, function (obj, key) {
1231
+ try {
1232
+ var result = obj.path ? require(obj.path) : {};
1233
+
1234
+ if (clobber) {
1235
+ // Clobber if it doesn't exist or if an override is specified.
1236
+ if (typeof parent[key] === 'undefined' || typeof obj.path !== 'undefined') {
1237
+ parent[key] = result;
1238
+ }
1239
+ result = parent[key];
1240
+ } else {
1241
+ // Don't clobber if something already exists there
1242
+ if (typeof parent[key] == 'undefined') {
1243
+ parent[key] = result;
1244
+ } else {
1245
+ // Set result to what already exists, so we can build children into it if they exist.
1246
+ result = parent[key];
1247
+ }
1248
+ }
1249
+
1250
+ if (obj.children) {
1251
+ include(result, obj.children, clobber);
1252
+ }
1253
+ } catch(e) {
1254
+ alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"');
1255
+ }
1256
+ });
1257
+ }
1258
+
1259
+ module.exports = {
1260
+ build: function (objects) {
1261
+ return {
1262
+ intoButDontClobber: function (target) {
1263
+ include(target, objects, false);
1264
+ },
1265
+ intoAndClobberTheFOutOf: function(target) {
1266
+ include(target, objects, true);
1267
+ }
1268
+ };
1269
+ }
1270
+ };
1271
+
1272
+ });
1273
+
1274
+ define('cordova/plugin/Acceleration', function(require, exports, module) {
1275
+ var Acceleration = function(x, y, z) {
1276
+ this.x = x;
1277
+ this.y = y;
1278
+ this.z = z;
1279
+ this.timestamp = new Date().getTime();
1280
+ };
1281
+
1282
+ module.exports = Acceleration;
1283
+
1284
+ });
1285
+
1286
+ define('cordova/plugin/accelerometer', function(require, exports, module) {
1287
+ /**
1288
+ * This class provides access to device accelerometer data.
1289
+ * @constructor
1290
+ */
1291
+ var utils = require("cordova/utils"),
1292
+ exec = require("cordova/exec");
1293
+
1294
+ // Local singleton variables.
1295
+ var timers = {};
1296
+
1297
+ var accelerometer = {
1298
+ /**
1299
+ * Asynchronously aquires the current acceleration.
1300
+ *
1301
+ * @param {Function} successCallback The function to call when the acceleration data is available
1302
+ * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL)
1303
+ * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
1304
+ */
1305
+ getCurrentAcceleration: function(successCallback, errorCallback, options) {
1306
+
1307
+ // successCallback required
1308
+ if (typeof successCallback !== "function") {
1309
+ console.log("Accelerometer Error: successCallback is not a function");
1310
+ return;
1311
+ }
1312
+
1313
+ // errorCallback optional
1314
+ if (errorCallback && (typeof errorCallback !== "function")) {
1315
+ console.log("Accelerometer Error: errorCallback is not a function");
1316
+ return;
1317
+ }
1318
+
1319
+ // Get acceleration
1320
+ exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []);
1321
+ },
1322
+
1323
+ /**
1324
+ * Asynchronously aquires the acceleration repeatedly at a given interval.
1325
+ *
1326
+ * @param {Function} successCallback The function to call each time the acceleration data is available
1327
+ * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL)
1328
+ * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
1329
+ * @return String The watch id that must be passed to #clearWatch to stop watching.
1330
+ */
1331
+ watchAcceleration: function(successCallback, errorCallback, options) {
1332
+
1333
+ // Default interval (10 sec)
1334
+ var frequency = (options !== undefined && options.frequency !== undefined)? options.frequency : 10000;
1335
+
1336
+ // successCallback required
1337
+ if (typeof successCallback !== "function") {
1338
+ console.log("Accelerometer Error: successCallback is not a function");
1339
+ return;
1340
+ }
1341
+
1342
+ // errorCallback optional
1343
+ if (errorCallback && (typeof errorCallback !== "function")) {
1344
+ console.log("Accelerometer Error: errorCallback is not a function");
1345
+ return;
1346
+ }
1347
+
1348
+ // Make sure accelerometer timeout > frequency + 10 sec
1349
+ exec(
1350
+ function(timeout) {
1351
+ if (timeout < (frequency + 10000)) {
1352
+ exec(null, null, "Accelerometer", "setTimeout", [frequency + 10000]);
1353
+ }
1354
+ },
1355
+ function(e) { }, "Accelerometer", "getTimeout", []);
1356
+
1357
+ // Start watch timer
1358
+ var id = utils.createUUID();
1359
+ timers[id] = window.setInterval(function() {
1360
+ exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []);
1361
+ }, (frequency ? frequency : 1));
1362
+
1363
+ return id;
1364
+ },
1365
+
1366
+ /**
1367
+ * Clears the specified accelerometer watch.
1368
+ *
1369
+ * @param {String} id The id of the watch returned from #watchAcceleration.
1370
+ */
1371
+ clearWatch: function(id) {
1372
+
1373
+ // Stop javascript timer & remove from timer list
1374
+ if (id && timers[id] !== undefined) {
1375
+ window.clearInterval(timers[id]);
1376
+ delete timers[id];
1377
+ }
1378
+ }
1379
+ };
1380
+
1381
+ module.exports = accelerometer;
1382
+
1383
+ });
1384
+
1385
+
1386
+ define('cordova/plugin/battery', function(require, exports, module) {
1387
+ /**
1388
+ * This class contains information about the current battery status.
1389
+ * @constructor
1390
+ */
1391
+ var cordova = require('cordova'),
1392
+ exec = require('cordova/exec');
1393
+
1394
+ function handlers() {
1395
+ return battery.channels.batterystatus.numHandlers +
1396
+ battery.channels.batterylow.numHandlers +
1397
+ battery.channels.batterycritical.numHandlers;
1398
+ }
1399
+
1400
+ var Battery = function() {
1401
+ this._level = null;
1402
+ this._isPlugged = null;
1403
+ // Create new event handlers on the window (returns a channel instance)
1404
+ var subscriptionEvents = {
1405
+ onSubscribe:this.onSubscribe,
1406
+ onUnsubscribe:this.onUnsubscribe
1407
+ };
1408
+ this.channels = {
1409
+ batterystatus:cordova.addWindowEventHandler("batterystatus", subscriptionEvents),
1410
+ batterylow:cordova.addWindowEventHandler("batterylow", subscriptionEvents),
1411
+ batterycritical:cordova.addWindowEventHandler("batterycritical", subscriptionEvents)
1412
+ };
1413
+ };
1414
+ /**
1415
+ * Event handlers for when callbacks get registered for the battery.
1416
+ * Keep track of how many handlers we have so we can start and stop the native battery listener
1417
+ * appropriately (and hopefully save on battery life!).
1418
+ */
1419
+ Battery.prototype.onSubscribe = function() {
1420
+ var me = battery;
1421
+ // If we just registered the first handler, make sure native listener is started.
1422
+ if (handlers() === 1) {
1423
+ exec(me._status, me._error, "Battery", "start", []);
1424
+ }
1425
+ };
1426
+
1427
+ Battery.prototype.onUnsubscribe = function() {
1428
+ var me = battery;
1429
+
1430
+ // If we just unregistered the last handler, make sure native listener is stopped.
1431
+ if (handlers() === 0) {
1432
+ exec(null, null, "Battery", "stop", []);
1433
+ }
1434
+ };
1435
+
1436
+ /**
1437
+ * Callback for battery status
1438
+ *
1439
+ * @param {Object} info keys: level, isPlugged
1440
+ */
1441
+ Battery.prototype._status = function(info) {
1442
+ if (info) {
1443
+ var me = battery;
1444
+ var level = info.level;
1445
+ if (me._level !== level || me._isPlugged !== info.isPlugged) {
1446
+ // Fire batterystatus event
1447
+ cordova.fireWindowEvent("batterystatus", info);
1448
+
1449
+ // Fire low battery event
1450
+ if (level === 20 || level === 5) {
1451
+ if (level === 20) {
1452
+ cordova.fireWindowEvent("batterylow", info);
1453
+ }
1454
+ else {
1455
+ cordova.fireWindowEvent("batterycritical", info);
1456
+ }
1457
+ }
1458
+ }
1459
+ me._level = level;
1460
+ me._isPlugged = info.isPlugged;
1461
+ }
1462
+ };
1463
+
1464
+ /**
1465
+ * Error callback for battery start
1466
+ */
1467
+ Battery.prototype._error = function(e) {
1468
+ console.log("Error initializing Battery: " + e);
1469
+ };
1470
+
1471
+ var battery = new Battery();
1472
+
1473
+ module.exports = battery;
1474
+
1475
+ });
1476
+
1477
+
1478
+ define('cordova/plugin/Camera', function(require, exports, module) {
1479
+ var exec = require('cordova/exec'),
1480
+ Camera = require('cordova/plugin/CameraConstants');
1481
+
1482
+ var cameraExport = {};
1483
+
1484
+ // Tack on the Camera Constants to the base camera plugin.
1485
+ for (var key in Camera) {
1486
+ cameraExport[key] = Camera[key];
1487
+ }
1488
+
1489
+ /**
1490
+ * Gets a picture from source defined by "options.sourceType", and returns the
1491
+ * image as defined by the "options.destinationType" option.
1492
+
1493
+ * The defaults are sourceType=CAMERA and destinationType=FILE_URL.
1494
+ *
1495
+ * @param {Function} successCallback
1496
+ * @param {Function} errorCallback
1497
+ * @param {Object} options
1498
+ */
1499
+ cameraExport.getPicture = function(successCallback, errorCallback, options) {
1500
+ // successCallback required
1501
+ if (typeof successCallback != "function") {
1502
+ console.log("Camera Error: successCallback is not a function");
1503
+ return;
1504
+ }
1505
+
1506
+ // errorCallback optional
1507
+ if (errorCallback && (typeof errorCallback != "function")) {
1508
+ console.log("Camera Error: errorCallback is not a function");
1509
+ return;
1510
+ }
1511
+
1512
+ var quality = 50;
1513
+ if (options && typeof options.quality == "number") {
1514
+ quality = options.quality;
1515
+ } else if (options && typeof options.quality == "string") {
1516
+ var qlity = parseInt(options.quality, 10);
1517
+ if (isNaN(qlity) === false) {
1518
+ quality = qlity.valueOf();
1519
+ }
1520
+ }
1521
+
1522
+ var destinationType = Camera.DestinationType.FILE_URL;
1523
+ if (typeof options.destinationType == "number") {
1524
+ destinationType = options.destinationType;
1525
+ }
1526
+
1527
+ var sourceType = Camera.PictureSourceType.CAMERA;
1528
+ if (typeof options.sourceType == "number") {
1529
+ sourceType = options.sourceType;
1530
+ }
1531
+
1532
+ var targetWidth = -1;
1533
+ if (typeof options.targetWidth == "number") {
1534
+ targetWidth = options.targetWidth;
1535
+ } else if (typeof options.targetWidth == "string") {
1536
+ var width = parseInt(options.targetWidth, 10);
1537
+ if (isNaN(width) === false) {
1538
+ targetWidth = width.valueOf();
1539
+ }
1540
+ }
1541
+
1542
+ var targetHeight = -1;
1543
+ if (typeof options.targetHeight == "number") {
1544
+ targetHeight = options.targetHeight;
1545
+ } else if (typeof options.targetHeight == "string") {
1546
+ var height = parseInt(options.targetHeight, 10);
1547
+ if (isNaN(height) === false) {
1548
+ targetHeight = height.valueOf();
1549
+ }
1550
+ }
1551
+
1552
+ var encodingType = Camera.EncodingType.JPEG;
1553
+ if (typeof options.encodingType == "number") {
1554
+ encodingType = options.encodingType;
1555
+ }
1556
+ // TODO: parse MediaType
1557
+ // TODO: enable allow edit?
1558
+
1559
+ exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType]);
1560
+ }
1561
+
1562
+ module.exports = cameraExport;
1563
+
1564
+ });
1565
+
1566
+ define('cordova/plugin/CameraConstants', function(require, exports, module) {
1567
+ module.exports = {
1568
+ DestinationType:{
1569
+ DATA_URL: 0, // Return base64 encoded string
1570
+ FILE_URI: 1 // Return file uri (content://media/external/images/media/2 for Android)
1571
+ },
1572
+ EncodingType:{
1573
+ JPEG: 0, // Return JPEG encoded image
1574
+ PNG: 1 // Return PNG encoded image
1575
+ },
1576
+ MediaType:{
1577
+ PICTURE: 0, // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType
1578
+ VIDEO: 1, // allow selection of video only, ONLY RETURNS URL
1579
+ ALLMEDIA : 2 // allow selection from all media types
1580
+ },
1581
+ PictureSourceType:{
1582
+ PHOTOLIBRARY : 0, // Choose image from picture library (same as SAVEDPHOTOALBUM for Android)
1583
+ CAMERA : 1, // Take picture from camera
1584
+ SAVEDPHOTOALBUM : 2 // Choose image from picture library (same as PHOTOLIBRARY for Android)
1585
+ }
1586
+ };
1587
+
1588
+ });
1589
+
1590
+ define('cordova/plugin/capture', function(require, exports, module) {
1591
+ var exec = require('cordova/exec'),
1592
+ MediaFile = require('cordova/plugin/MediaFile');
1593
+
1594
+ /**
1595
+ * Launches a capture of different types.
1596
+ *
1597
+ * @param (DOMString} type
1598
+ * @param {Function} successCB
1599
+ * @param {Function} errorCB
1600
+ * @param {CaptureVideoOptions} options
1601
+ */
1602
+ function _capture(type, successCallback, errorCallback, options) {
1603
+ var win = function(pluginResult) {
1604
+ var mediaFiles = [];
1605
+ var i;
1606
+ for (i = 0; i < pluginResult.length; i++) {
1607
+ var mediaFile = new MediaFile();
1608
+ mediaFile.name = pluginResult[i].name;
1609
+ mediaFile.fullPath = pluginResult[i].fullPath;
1610
+ mediaFile.type = pluginResult[i].type;
1611
+ mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate;
1612
+ mediaFile.size = pluginResult[i].size;
1613
+ mediaFiles.push(mediaFile);
1614
+ }
1615
+ successCallback(mediaFiles);
1616
+ };
1617
+ exec(win, errorCallback, "Capture", type, [options]);
1618
+ }
1619
+ /**
1620
+ * The Capture interface exposes an interface to the camera and microphone of the hosting device.
1621
+ */
1622
+ function Capture() {
1623
+ this.supportedAudioModes = [];
1624
+ this.supportedImageModes = [];
1625
+ this.supportedVideoModes = [];
1626
+ }
1627
+
1628
+ /**
1629
+ * Launch audio recorder application for recording audio clip(s).
1630
+ *
1631
+ * @param {Function} successCB
1632
+ * @param {Function} errorCB
1633
+ * @param {CaptureAudioOptions} options
1634
+ */
1635
+ Capture.prototype.captureAudio = function(successCallback, errorCallback, options){
1636
+ _capture("captureAudio", successCallback, errorCallback, options);
1637
+ };
1638
+
1639
+ /**
1640
+ * Launch camera application for taking image(s).
1641
+ *
1642
+ * @param {Function} successCB
1643
+ * @param {Function} errorCB
1644
+ * @param {CaptureImageOptions} options
1645
+ */
1646
+ Capture.prototype.captureImage = function(successCallback, errorCallback, options){
1647
+ _capture("captureImage", successCallback, errorCallback, options);
1648
+ };
1649
+
1650
+ /**
1651
+ * Launch device camera application for recording video(s).
1652
+ *
1653
+ * @param {Function} successCB
1654
+ * @param {Function} errorCB
1655
+ * @param {CaptureVideoOptions} options
1656
+ */
1657
+ Capture.prototype.captureVideo = function(successCallback, errorCallback, options){
1658
+ _capture("captureVideo", successCallback, errorCallback, options);
1659
+ };
1660
+
1661
+
1662
+ module.exports = new Capture();
1663
+
1664
+ });
1665
+
1666
+ define('cordova/plugin/CaptureAudioOptions', function(require, exports, module) {
1667
+ /**
1668
+ * Encapsulates all audio capture operation configuration options.
1669
+ */
1670
+ var CaptureAudioOptions = function(){
1671
+ // Upper limit of sound clips user can record. Value must be equal or greater than 1.
1672
+ this.limit = 1;
1673
+ // Maximum duration of a single sound clip in seconds.
1674
+ this.duration = 0;
1675
+ // The selected audio mode. Must match with one of the elements in supportedAudioModes array.
1676
+ this.mode = null;
1677
+ };
1678
+
1679
+ module.exports = CaptureAudioOptions;
1680
+
1681
+ });
1682
+
1683
+ define('cordova/plugin/CaptureError', function(require, exports, module) {
1684
+ /**
1685
+ * The CaptureError interface encapsulates all errors in the Capture API.
1686
+ */
1687
+ var CaptureError = function(c) {
1688
+ this.code = c || null;
1689
+ };
1690
+
1691
+ // Camera or microphone failed to capture image or sound.
1692
+ CaptureError.CAPTURE_INTERNAL_ERR = 0;
1693
+ // Camera application or audio capture application is currently serving other capture request.
1694
+ CaptureError.CAPTURE_APPLICATION_BUSY = 1;
1695
+ // Invalid use of the API (e.g. limit parameter has value less than one).
1696
+ CaptureError.CAPTURE_INVALID_ARGUMENT = 2;
1697
+ // User exited camera application or audio capture application before capturing anything.
1698
+ CaptureError.CAPTURE_NO_MEDIA_FILES = 3;
1699
+ // The requested capture operation is not supported.
1700
+ CaptureError.CAPTURE_NOT_SUPPORTED = 20;
1701
+
1702
+ module.exports = CaptureError;
1703
+
1704
+ });
1705
+
1706
+ define('cordova/plugin/CaptureImageOptions', function(require, exports, module) {
1707
+ /**
1708
+ * Encapsulates all image capture operation configuration options.
1709
+ */
1710
+ var CaptureImageOptions = function(){
1711
+ // Upper limit of images user can take. Value must be equal or greater than 1.
1712
+ this.limit = 1;
1713
+ // The selected image mode. Must match with one of the elements in supportedImageModes array.
1714
+ this.mode = null;
1715
+ };
1716
+
1717
+ module.exports = CaptureImageOptions;
1718
+
1719
+ });
1720
+
1721
+ define('cordova/plugin/CaptureVideoOptions', function(require, exports, module) {
1722
+ /**
1723
+ * Encapsulates all video capture operation configuration options.
1724
+ */
1725
+ var CaptureVideoOptions = function(){
1726
+ // Upper limit of videos user can record. Value must be equal or greater than 1.
1727
+ this.limit = 1;
1728
+ // Maximum duration of a single video clip in seconds.
1729
+ this.duration = 0;
1730
+ // The selected video mode. Must match with one of the elements in supportedVideoModes array.
1731
+ this.mode = null;
1732
+ };
1733
+
1734
+ module.exports = CaptureVideoOptions;
1735
+
1736
+ });
1737
+
1738
+ define('cordova/plugin/compass', function(require, exports, module) {
1739
+ var exec = require('cordova/exec'),
1740
+ utils = require('cordova/utils'),
1741
+ CompassHeading = require('cordova/plugin/CompassHeading'),
1742
+ CompassError = require('cordova/plugin/CompassError'),
1743
+ timers = {},
1744
+ compass = {
1745
+ /**
1746
+ * Asynchronously acquires the current heading.
1747
+ * @param {Function} successCallback The function to call when the heading
1748
+ * data is available
1749
+ * @param {Function} errorCallback The function to call when there is an error
1750
+ * getting the heading data.
1751
+ * @param {CompassOptions} options The options for getting the heading data (not used).
1752
+ */
1753
+ getCurrentHeading:function(successCallback, errorCallback, options) {
1754
+ // successCallback required
1755
+ if (typeof successCallback !== "function") {
1756
+ console.log("Compass Error: successCallback is not a function");
1757
+ return;
1758
+ }
1759
+
1760
+ // errorCallback optional
1761
+ if (errorCallback && (typeof errorCallback !== "function")) {
1762
+ console.log("Compass Error: errorCallback is not a function");
1763
+ return;
1764
+ }
1765
+
1766
+ var win = function(result) {
1767
+ var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
1768
+ successCallback(ch);
1769
+ };
1770
+ var fail = function(code) {
1771
+ var ce = new CompassError(code);
1772
+ errorCallback(ce);
1773
+ }
1774
+
1775
+ // Get heading
1776
+ exec(win, fail, "Compass", "getHeading", []);
1777
+ },
1778
+
1779
+ /**
1780
+ * Asynchronously acquires the heading repeatedly at a given interval.
1781
+ * @param {Function} successCallback The function to call each time the heading
1782
+ * data is available
1783
+ * @param {Function} errorCallback The function to call when there is an error
1784
+ * getting the heading data.
1785
+ * @param {HeadingOptions} options The options for getting the heading data
1786
+ * such as timeout and the frequency of the watch.
1787
+ */
1788
+ watchHeading:function(successCallback, errorCallback, options) {
1789
+ // Default interval (100 msec)
1790
+ var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
1791
+
1792
+ // successCallback required
1793
+ if (typeof successCallback !== "function") {
1794
+ console.log("Compass Error: successCallback is not a function");
1795
+ return;
1796
+ }
1797
+
1798
+ // errorCallback optional
1799
+ if (errorCallback && (typeof errorCallback !== "function")) {
1800
+ console.log("Compass Error: errorCallback is not a function");
1801
+ return;
1802
+ }
1803
+
1804
+ // Start watch timer to get headings
1805
+ var id = utils.createUUID();
1806
+ var win = function(result) {
1807
+ var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
1808
+ successCallback(ch);
1809
+ };
1810
+ var fail = function(code) {
1811
+ var ce = new CompassError(code);
1812
+ errorCallback(ce);
1813
+ };
1814
+
1815
+ timers[id] = window.setInterval(function() {
1816
+ exec(win, fail, "Compass", "getHeading", []);
1817
+ }, frequency);
1818
+
1819
+ return id;
1820
+ },
1821
+
1822
+ /**
1823
+ * Clears the specified heading watch.
1824
+ * @param {String} watchId The ID of the watch returned from #watchHeading.
1825
+ */
1826
+ clearWatch:function(id) {
1827
+ // Stop javascript timer & remove from timer list
1828
+ if (id && timers[id]) {
1829
+ clearInterval(timers[id]);
1830
+ delete timers[id];
1831
+ }
1832
+ }
1833
+ // TODO: add the filter-based iOS-only methods
1834
+ };
1835
+
1836
+ module.exports = compass;
1837
+
1838
+ });
1839
+
1840
+ define('cordova/plugin/CompassError', function(require, exports, module) {
1841
+ /**
1842
+ * CompassError.
1843
+ * An error code assigned by an implementation when an error has occured
1844
+ * @constructor
1845
+ */
1846
+ var CompassError = function(err) {
1847
+ this.code = (typeof err != 'undefined' ? err : null);
1848
+ };
1849
+
1850
+ /**
1851
+ * Error codes
1852
+ */
1853
+ CompassError.COMPASS_INTERNAL_ERR = 0;
1854
+ CompassError.COMPASS_NOT_SUPPORTED = 20;
1855
+
1856
+ module.exports = CompassError;
1857
+
1858
+
1859
+ });
1860
+
1861
+ define('cordova/plugin/CompassHeading', function(require, exports, module) {
1862
+ var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, timestamp) {
1863
+ this.magneticHeading = magneticHeading !== undefined ? magneticHeading : null;
1864
+ this.trueHeading = trueHeading !== undefined ? trueHeading : null;
1865
+ this.headingAccuracy = headingAccuracy !== undefined ? headingAccuracy : null;
1866
+ this.timestamp = timestamp !== undefined ? new Date(timestamp) : new Date();
1867
+ };
1868
+
1869
+ module.exports = CompassHeading;
1870
+
1871
+ });
1872
+
1873
+ define('cordova/plugin/ConfigurationData', function(require, exports, module) {
1874
+ /**
1875
+ * Encapsulates a set of parameters that the capture device supports.
1876
+ */
1877
+ function ConfigurationData() {
1878
+ // The ASCII-encoded string in lower case representing the media type.
1879
+ this.type = null;
1880
+ // The height attribute represents height of the image or video in pixels.
1881
+ // In the case of a sound clip this attribute has value 0.
1882
+ this.height = 0;
1883
+ // The width attribute represents width of the image or video in pixels.
1884
+ // In the case of a sound clip this attribute has value 0
1885
+ this.width = 0;
1886
+ }
1887
+
1888
+ module.exports = ConfigurationData;
1889
+
1890
+ });
1891
+
1892
+ define('cordova/plugin/Connection', function(require, exports, module) {
1893
+ /**
1894
+ * Network status
1895
+ */
1896
+ module.exports = {
1897
+ UNKNOWN: "unknown",
1898
+ ETHERNET: "ethernet",
1899
+ WIFI: "wifi",
1900
+ CELL_2G: "2g",
1901
+ CELL_3G: "3g",
1902
+ CELL_4G: "4g",
1903
+ NONE: "none"
1904
+ };
1905
+
1906
+ });
1907
+
1908
+ define('cordova/plugin/Contact', function(require, exports, module) {
1909
+ var exec = require('cordova/exec'),
1910
+ ContactError = require('cordova/plugin/ContactError'),
1911
+ utils = require('cordova/utils');
1912
+
1913
+ /**
1914
+ * Contains information about a single contact.
1915
+ * @constructor
1916
+ * @param {DOMString} id unique identifier
1917
+ * @param {DOMString} displayName
1918
+ * @param {ContactName} name
1919
+ * @param {DOMString} nickname
1920
+ * @param {Array.<ContactField>} phoneNumbers array of phone numbers
1921
+ * @param {Array.<ContactField>} emails array of email addresses
1922
+ * @param {Array.<ContactAddress>} addresses array of addresses
1923
+ * @param {Array.<ContactField>} ims instant messaging user ids
1924
+ * @param {Array.<ContactOrganization>} organizations
1925
+ * @param {DOMString} birthday contact's birthday
1926
+ * @param {DOMString} note user notes about contact
1927
+ * @param {Array.<ContactField>} photos
1928
+ * @param {Array.<ContactField>} categories
1929
+ * @param {Array.<ContactField>} urls contact's web sites
1930
+ */
1931
+ var Contact = function (id, displayName, name, nickname, phoneNumbers, emails, addresses,
1932
+ ims, organizations, birthday, note, photos, categories, urls) {
1933
+ this.id = id || null;
1934
+ this.rawId = null;
1935
+ this.displayName = displayName || null;
1936
+ this.name = name || null; // ContactName
1937
+ this.nickname = nickname || null;
1938
+ this.phoneNumbers = phoneNumbers || []; // ContactField[]
1939
+ this.emails = emails || []; // ContactField[]
1940
+ this.addresses = addresses || []; // ContactAddress[]
1941
+ this.ims = ims || []; // ContactField[]
1942
+ this.organizations = organizations || []; // ContactOrganization[]
1943
+ this.birthday = birthday || null;
1944
+ this.note = note || null;
1945
+ this.photos = photos || []; // ContactField[]
1946
+ this.categories = categories || []; // ContactField[]
1947
+ this.urls = urls || []; // ContactField[]
1948
+ };
1949
+
1950
+ /**
1951
+ * Removes contact from device storage.
1952
+ * @param successCB success callback
1953
+ * @param errorCB error callback
1954
+ */
1955
+ Contact.prototype.remove = function(successCB, errorCB) {
1956
+ if (this.id === null) {
1957
+ var errorObj = new ContactError(ContactError.UNKNOWN_ERROR);
1958
+ errorCB(errorObj);
1959
+ }
1960
+ else {
1961
+ exec(successCB, errorCB, "Contacts", "remove", [this.id]);
1962
+ }
1963
+ };
1964
+
1965
+ /**
1966
+ * Creates a deep copy of this Contact.
1967
+ * With the contact ID set to null.
1968
+ * @return copy of this Contact
1969
+ */
1970
+ Contact.prototype.clone = function() {
1971
+ var clonedContact = utils.clone(this);
1972
+ var i;
1973
+ clonedContact.id = null;
1974
+ clonedContact.rawId = null;
1975
+ // Loop through and clear out any id's in phones, emails, etc.
1976
+ if (clonedContact.phoneNumbers) {
1977
+ for (i = 0; i < clonedContact.phoneNumbers.length; i++) {
1978
+ clonedContact.phoneNumbers[i].id = null;
1979
+ }
1980
+ }
1981
+ if (clonedContact.emails) {
1982
+ for (i = 0; i < clonedContact.emails.length; i++) {
1983
+ clonedContact.emails[i].id = null;
1984
+ }
1985
+ }
1986
+ if (clonedContact.addresses) {
1987
+ for (i = 0; i < clonedContact.addresses.length; i++) {
1988
+ clonedContact.addresses[i].id = null;
1989
+ }
1990
+ }
1991
+ if (clonedContact.ims) {
1992
+ for (i = 0; i < clonedContact.ims.length; i++) {
1993
+ clonedContact.ims[i].id = null;
1994
+ }
1995
+ }
1996
+ if (clonedContact.organizations) {
1997
+ for (i = 0; i < clonedContact.organizations.length; i++) {
1998
+ clonedContact.organizations[i].id = null;
1999
+ }
2000
+ }
2001
+ if (clonedContact.categories) {
2002
+ for (i = 0; i < clonedContact.categories.length; i++) {
2003
+ clonedContact.categories[i].id = null;
2004
+ }
2005
+ }
2006
+ if (clonedContact.photos) {
2007
+ for (i = 0; i < clonedContact.photos.length; i++) {
2008
+ clonedContact.photos[i].id = null;
2009
+ }
2010
+ }
2011
+ if (clonedContact.urls) {
2012
+ for (i = 0; i < clonedContact.urls.length; i++) {
2013
+ clonedContact.urls[i].id = null;
2014
+ }
2015
+ }
2016
+ return clonedContact;
2017
+ };
2018
+
2019
+ /**
2020
+ * Persists contact to device storage.
2021
+ * @param successCB success callback
2022
+ * @param errorCB error callback
2023
+ */
2024
+ Contact.prototype.save = function(successCB, errorCB) {
2025
+ exec(successCB, errorCB, "Contacts", "save", [this]);
2026
+ };
2027
+
2028
+
2029
+ module.exports = Contact;
2030
+
2031
+ });
2032
+
2033
+ define('cordova/plugin/ContactAddress', function(require, exports, module) {
2034
+ /**
2035
+ * Contact address.
2036
+ * @constructor
2037
+ * @param {DOMString} id unique identifier, should only be set by native code
2038
+ * @param formatted // NOTE: not a W3C standard
2039
+ * @param streetAddress
2040
+ * @param locality
2041
+ * @param region
2042
+ * @param postalCode
2043
+ * @param country
2044
+ */
2045
+
2046
+ var ContactAddress = function(pref, type, formatted, streetAddress, locality, region, postalCode, country) {
2047
+ this.id = null;
2048
+ this.pref = (typeof pref != 'undefined' ? pref : false);
2049
+ this.type = type || null;
2050
+ this.formatted = formatted || null;
2051
+ this.streetAddress = streetAddress || null;
2052
+ this.locality = locality || null;
2053
+ this.region = region || null;
2054
+ this.postalCode = postalCode || null;
2055
+ this.country = country || null;
2056
+ };
2057
+
2058
+ module.exports = ContactAddress;
2059
+
2060
+ });
2061
+
2062
+ define('cordova/plugin/ContactError', function(require, exports, module) {
2063
+ /**
2064
+ * ContactError.
2065
+ * An error code assigned by an implementation when an error has occured
2066
+ * @constructor
2067
+ */
2068
+ var ContactError = function(err) {
2069
+ this.code = (typeof err != 'undefined' ? err : null);
2070
+ };
2071
+
2072
+ /**
2073
+ * Error codes
2074
+ */
2075
+ ContactError.UNKNOWN_ERROR = 0;
2076
+ ContactError.INVALID_ARGUMENT_ERROR = 1;
2077
+ ContactError.TIMEOUT_ERROR = 2;
2078
+ ContactError.PENDING_OPERATION_ERROR = 3;
2079
+ ContactError.IO_ERROR = 4;
2080
+ ContactError.NOT_SUPPORTED_ERROR = 5;
2081
+ ContactError.PERMISSION_DENIED_ERROR = 20;
2082
+
2083
+ module.exports = ContactError;
2084
+
2085
+ });
2086
+
2087
+ define('cordova/plugin/ContactField', function(require, exports, module) {
2088
+ /**
2089
+ * Generic contact field.
2090
+ * @constructor
2091
+ * @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard
2092
+ * @param type
2093
+ * @param value
2094
+ * @param pref
2095
+ */
2096
+ var ContactField = function(type, value, pref) {
2097
+ this.id = null;
2098
+ this.type = type || null;
2099
+ this.value = value || null;
2100
+ this.pref = (typeof pref != 'undefined' ? pref : false);
2101
+ };
2102
+
2103
+ module.exports = ContactField;
2104
+
2105
+ });
2106
+
2107
+ define('cordova/plugin/ContactFindOptions', function(require, exports, module) {
2108
+ /**
2109
+ * ContactFindOptions.
2110
+ * @constructor
2111
+ * @param filter used to match contacts against
2112
+ * @param multiple boolean used to determine if more than one contact should be returned
2113
+ */
2114
+
2115
+ var ContactFindOptions = function(filter, multiple) {
2116
+ this.filter = filter || '';
2117
+ this.multiple = (typeof multiple != 'undefined' ? multiple : false);
2118
+ };
2119
+
2120
+ module.exports = ContactFindOptions;
2121
+
2122
+ });
2123
+
2124
+ define('cordova/plugin/ContactName', function(require, exports, module) {
2125
+ /**
2126
+ * Contact name.
2127
+ * @constructor
2128
+ * @param formatted // NOTE: not part of W3C standard
2129
+ * @param familyName
2130
+ * @param givenName
2131
+ * @param middle
2132
+ * @param prefix
2133
+ * @param suffix
2134
+ */
2135
+ var ContactName = function(formatted, familyName, givenName, middle, prefix, suffix) {
2136
+ this.formatted = formatted || null;
2137
+ this.familyName = familyName || null;
2138
+ this.givenName = givenName || null;
2139
+ this.middleName = middle || null;
2140
+ this.honorificPrefix = prefix || null;
2141
+ this.honorificSuffix = suffix || null;
2142
+ };
2143
+
2144
+ module.exports = ContactName;
2145
+
2146
+ });
2147
+
2148
+ define('cordova/plugin/ContactOrganization', function(require, exports, module) {
2149
+ /**
2150
+ * Contact organization.
2151
+ * @constructor
2152
+ * @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard
2153
+ * @param name
2154
+ * @param dept
2155
+ * @param title
2156
+ * @param startDate
2157
+ * @param endDate
2158
+ * @param location
2159
+ * @param desc
2160
+ */
2161
+
2162
+ var ContactOrganization = function(pref, type, name, dept, title) {
2163
+ this.id = null;
2164
+ this.pref = (typeof pref != 'undefined' ? pref : false);
2165
+ this.type = type || null;
2166
+ this.name = name || null;
2167
+ this.department = dept || null;
2168
+ this.title = title || null;
2169
+ };
2170
+
2171
+ module.exports = ContactOrganization;
2172
+
2173
+ });
2174
+
2175
+ define('cordova/plugin/contacts', function(require, exports, module) {
2176
+ var exec = require('cordova/exec'),
2177
+ ContactError = require('cordova/plugin/ContactError'),
2178
+ Contact = require('cordova/plugin/Contact');
2179
+
2180
+ /**
2181
+ * Represents a group of Contacts.
2182
+ * @constructor
2183
+ */
2184
+ var contacts = {
2185
+ /**
2186
+ * Returns an array of Contacts matching the search criteria.
2187
+ * @param fields that should be searched
2188
+ * @param successCB success callback
2189
+ * @param errorCB error callback
2190
+ * @param {ContactFindOptions} options that can be applied to contact searching
2191
+ * @return array of Contacts matching search criteria
2192
+ */
2193
+ find:function(fields, successCB, errorCB, options) {
2194
+ if (!successCB) {
2195
+ throw new TypeError("You must specify a success callback for the find command.");
2196
+ }
2197
+ if (!fields || (fields instanceof Array && fields.length === 0)) {
2198
+ if (typeof errorCB === "function") {
2199
+ errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
2200
+ }
2201
+ } else {
2202
+ var win = function(result) {
2203
+ var cs = [];
2204
+ for (var i = 0, l = result.length; i < l; i++) {
2205
+ cs.push(contacts.create(result[i]));
2206
+ }
2207
+ successCB(cs);
2208
+ };
2209
+ exec(win, errorCB, "Contacts", "search", [fields, options]);
2210
+ }
2211
+ },
2212
+
2213
+ /**
2214
+ * This function creates a new contact, but it does not persist the contact
2215
+ * to device storage. To persist the contact to device storage, invoke
2216
+ * contact.save().
2217
+ * @param properties an object who's properties will be examined to create a new Contact
2218
+ * @returns new Contact object
2219
+ */
2220
+ create:function(properties) {
2221
+ var i;
2222
+ var contact = new Contact();
2223
+ for (i in properties) {
2224
+ if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) {
2225
+ contact[i] = properties[i];
2226
+ }
2227
+ }
2228
+ return contact;
2229
+ }
2230
+ };
2231
+
2232
+ module.exports = contacts;
2233
+
2234
+ });
2235
+
2236
+ define('cordova/plugin/Coordinates', function(require, exports, module) {
2237
+ /**
2238
+ * This class contains position information.
2239
+ * @param {Object} lat
2240
+ * @param {Object} lng
2241
+ * @param {Object} alt
2242
+ * @param {Object} acc
2243
+ * @param {Object} head
2244
+ * @param {Object} vel
2245
+ * @param {Object} altacc
2246
+ * @constructor
2247
+ */
2248
+ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
2249
+ /**
2250
+ * The latitude of the position.
2251
+ */
2252
+ this.latitude = lat;
2253
+ /**
2254
+ * The longitude of the position,
2255
+ */
2256
+ this.longitude = lng;
2257
+ /**
2258
+ * The accuracy of the position.
2259
+ */
2260
+ this.accuracy = acc;
2261
+ /**
2262
+ * The altitude of the position.
2263
+ */
2264
+ this.altitude = alt;
2265
+ /**
2266
+ * The direction the device is moving at the position.
2267
+ */
2268
+ this.heading = head;
2269
+ /**
2270
+ * The velocity with which the device is moving at the position.
2271
+ */
2272
+ this.speed = vel;
2273
+ /**
2274
+ * The altitude accuracy of the position.
2275
+ */
2276
+ this.altitudeAccuracy = (altacc !== undefined) ? altacc : null;
2277
+ };
2278
+
2279
+ module.exports = Coordinates;
2280
+
2281
+ });
2282
+
2283
+ define('cordova/plugin/DirectoryEntry', function(require, exports, module) {
2284
+ var utils = require('cordova/utils'),
2285
+ exec = require('cordova/exec'),
2286
+ Entry = require('cordova/plugin/Entry'),
2287
+ DirectoryReader = require('cordova/plugin/DirectoryReader');
2288
+
2289
+ /**
2290
+ * An interface representing a directory on the file system.
2291
+ *
2292
+ * {boolean} isFile always false (readonly)
2293
+ * {boolean} isDirectory always true (readonly)
2294
+ * {DOMString} name of the directory, excluding the path leading to it (readonly)
2295
+ * {DOMString} fullPath the absolute full path to the directory (readonly)
2296
+ * {FileSystem} filesystem on which the directory resides (readonly)
2297
+ */
2298
+ var DirectoryEntry = function(name, fullPath) {
2299
+ DirectoryEntry.__super__.constructor.apply(this, [false, true, name, fullPath]);
2300
+ };
2301
+
2302
+ utils.extend(DirectoryEntry, Entry);
2303
+
2304
+ /**
2305
+ * Creates a new DirectoryReader to read entries from this directory
2306
+ */
2307
+ DirectoryEntry.prototype.createReader = function() {
2308
+ return new DirectoryReader(this.fullPath);
2309
+ };
2310
+
2311
+ /**
2312
+ * Creates or looks up a directory
2313
+ *
2314
+ * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a directory
2315
+ * @param {Flags} options to create or excluively create the directory
2316
+ * @param {Function} successCallback is called with the new entry
2317
+ * @param {Function} errorCallback is called with a FileError
2318
+ */
2319
+ DirectoryEntry.prototype.getDirectory = function(path, options, successCallback, errorCallback) {
2320
+ var win = typeof successCallback !== 'function' ? null : function(result) {
2321
+ var entry = new DirectoryEntry(result.name, result.fullPath);
2322
+ successCallback(entry);
2323
+ };
2324
+ var fail = typeof errorCallback !== 'function' ? null : function(code) {
2325
+ errorCallback(new FileError(code));
2326
+ };
2327
+ exec(win, fail, "File", "getDirectory", [this.fullPath, path, options]);
2328
+ };
2329
+
2330
+ /**
2331
+ * Deletes a directory and all of it's contents
2332
+ *
2333
+ * @param {Function} successCallback is called with no parameters
2334
+ * @param {Function} errorCallback is called with a FileError
2335
+ */
2336
+ DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) {
2337
+ var fail = typeof errorCallback !== 'function' ? null : function(code) {
2338
+ errorCallback(new FileError(code));
2339
+ };
2340
+ exec(successCallback, fail, "File", "removeRecursively", [this.fullPath]);
2341
+ };
2342
+
2343
+ /**
2344
+ * Creates or looks up a file
2345
+ *
2346
+ * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a file
2347
+ * @param {Flags} options to create or excluively create the file
2348
+ * @param {Function} successCallback is called with the new entry
2349
+ * @param {Function} errorCallback is called with a FileError
2350
+ */
2351
+ DirectoryEntry.prototype.getFile = function(path, options, successCallback, errorCallback) {
2352
+ var win = typeof successCallback !== 'function' ? null : function(result) {
2353
+ var FileEntry = require('cordova/plugin/FileEntry');
2354
+ var entry = new FileEntry(result.name, result.fullPath);
2355
+ successCallback(entry);
2356
+ };
2357
+ var fail = typeof errorCallback !== 'function' ? null : function(code) {
2358
+ errorCallback(new FileError(code));
2359
+ };
2360
+ exec(win, fail, "File", "getFile", [this.fullPath, path, options]);
2361
+ };
2362
+
2363
+ module.exports = DirectoryEntry;
2364
+
2365
+ });
2366
+
2367
+ define('cordova/plugin/DirectoryReader', function(require, exports, module) {
2368
+ var exec = require('cordova/exec');
2369
+
2370
+ /**
2371
+ * An interface that lists the files and directories in a directory.
2372
+ */
2373
+ function DirectoryReader(path) {
2374
+ this.path = path || null;
2375
+ }
2376
+
2377
+ /**
2378
+ * Returns a list of entries from a directory.
2379
+ *
2380
+ * @param {Function} successCallback is called with a list of entries
2381
+ * @param {Function} errorCallback is called with a FileError
2382
+ */
2383
+ DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) {
2384
+ var win = typeof successCallback !== 'function' ? null : function(result) {
2385
+ var retVal = [];
2386
+ for (var i=0; i<result.length; i++) {
2387
+ var entry = null;
2388
+ if (result[i].isDirectory) {
2389
+ entry = new DirectoryEntry();
2390
+ }
2391
+ else if (result[i].isFile) {
2392
+ entry = new FileEntry();
2393
+ }
2394
+ entry.isDirectory = result[i].isDirectory;
2395
+ entry.isFile = result[i].isFile;
2396
+ entry.name = result[i].name;
2397
+ entry.fullPath = result[i].fullPath;
2398
+ retVal.push(entry);
2399
+ }
2400
+ successCallback(retVal);
2401
+ };
2402
+ var fail = typeof errorCallback !== 'function' ? null : function(code) {
2403
+ errorCallback(new FileError(code));
2404
+ };
2405
+ exec(win, fail, "File", "readEntries", [this.path]);
2406
+ };
2407
+
2408
+ module.exports = DirectoryReader;
2409
+
2410
+ });
2411
+
2412
+ define('cordova/plugin/Entry', function(require, exports, module) {
2413
+ var exec = require('cordova/exec'),
2414
+ FileError = require('cordova/plugin/FileError'),
2415
+ Metadata = require('cordova/plugin/Metadata');
2416
+
2417
+ /**
2418
+ * Represents a file or directory on the local file system.
2419
+ *
2420
+ * @param isFile
2421
+ * {boolean} true if Entry is a file (readonly)
2422
+ * @param isDirectory
2423
+ * {boolean} true if Entry is a directory (readonly)
2424
+ * @param name
2425
+ * {DOMString} name of the file or directory, excluding the path
2426
+ * leading to it (readonly)
2427
+ * @param fullPath
2428
+ * {DOMString} the absolute full path to the file or directory
2429
+ * (readonly)
2430
+ */
2431
+ function Entry(isFile, isDirectory, name, fullPath, fileSystem) {
2432
+ this.isFile = (typeof isFile != 'undefined'?isFile:false);
2433
+ this.isDirectory = (typeof isDirectory != 'undefined'?isDirectory:false);
2434
+ this.name = name || '';
2435
+ this.fullPath = fullPath || '';
2436
+ this.filesystem = fileSystem || null;
2437
+ }
2438
+
2439
+ /**
2440
+ * Look up the metadata of the entry.
2441
+ *
2442
+ * @param successCallback
2443
+ * {Function} is called with a Metadata object
2444
+ * @param errorCallback
2445
+ * {Function} is called with a FileError
2446
+ */
2447
+ Entry.prototype.getMetadata = function(successCallback, errorCallback) {
2448
+ var success = typeof successCallback !== 'function' ? null : function(lastModified) {
2449
+ var metadata = new Metadata(lastModified);
2450
+ successCallback(metadata);
2451
+ };
2452
+ var fail = typeof errorCallback !== 'function' ? null : function(code) {
2453
+ errorCallback(new FileError(code));
2454
+ };
2455
+
2456
+ exec(success, fail, "File", "getMetadata", [this.fullPath]);
2457
+ };
2458
+
2459
+ /**
2460
+ * Move a file or directory to a new location.
2461
+ *
2462
+ * @param parent
2463
+ * {DirectoryEntry} the directory to which to move this entry
2464
+ * @param newName
2465
+ * {DOMString} new name of the entry, defaults to the current name
2466
+ * @param successCallback
2467
+ * {Function} called with the new DirectoryEntry object
2468
+ * @param errorCallback
2469
+ * {Function} called with a FileError
2470
+ */
2471
+ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallback) {
2472
+ var fail = function(code) {
2473
+ if (typeof errorCallback === 'function') {
2474
+ errorCallback(new FileError(code));
2475
+ }
2476
+ };
2477
+ // user must specify parent Entry
2478
+ if (!parent) {
2479
+ fail(FileError.NOT_FOUND_ERR);
2480
+ return;
2481
+ }
2482
+ // source path
2483
+ var srcPath = this.fullPath,
2484
+ // entry name
2485
+ name = newName || this.name,
2486
+ success = function(entry) {
2487
+ if (entry) {
2488
+ if (typeof successCallback === 'function') {
2489
+ // create appropriate Entry object
2490
+ var result = (entry.isDirectory) ? new (require('cordova/plugin/DirectoryEntry'))(entry.name, entry.fullPath) : new (require('cordova/plugin/FileEntry'))(entry.name, entry.fullPath);
2491
+ try {
2492
+ successCallback(result);
2493
+ }
2494
+ catch (e) {
2495
+ console.log('Error invoking callback: ' + e);
2496
+ }
2497
+ }
2498
+ }
2499
+ else {
2500
+ // no Entry object returned
2501
+ fail(FileError.NOT_FOUND_ERR);
2502
+ }
2503
+ };
2504
+
2505
+ // copy
2506
+ exec(success, fail, "File", "moveTo", [srcPath, parent.fullPath, name]);
2507
+ };
2508
+
2509
+ /**
2510
+ * Copy a directory to a different location.
2511
+ *
2512
+ * @param parent
2513
+ * {DirectoryEntry} the directory to which to copy the entry
2514
+ * @param newName
2515
+ * {DOMString} new name of the entry, defaults to the current name
2516
+ * @param successCallback
2517
+ * {Function} called with the new Entry object
2518
+ * @param errorCallback
2519
+ * {Function} called with a FileError
2520
+ */
2521
+ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallback) {
2522
+ var fail = function(code) {
2523
+ if (typeof errorCallback === 'function') {
2524
+ errorCallback(new FileError(code));
2525
+ }
2526
+ };
2527
+
2528
+ // user must specify parent Entry
2529
+ if (!parent) {
2530
+ fail(FileError.NOT_FOUND_ERR);
2531
+ return;
2532
+ }
2533
+
2534
+ // source path
2535
+ var srcPath = this.fullPath,
2536
+ // entry name
2537
+ name = newName || this.name,
2538
+ // success callback
2539
+ success = function(entry) {
2540
+ if (entry) {
2541
+ if (typeof successCallback === 'function') {
2542
+ // create appropriate Entry object
2543
+ var result = (entry.isDirectory) ? new (require('cordova/plugin/DirectoryEntry'))(entry.name, entry.fullPath) : new (require('cordova/plugin/FileEntry'))(entry.name, entry.fullPath);
2544
+ try {
2545
+ successCallback(result);
2546
+ }
2547
+ catch (e) {
2548
+ console.log('Error invoking callback: ' + e);
2549
+ }
2550
+ }
2551
+ }
2552
+ else {
2553
+ // no Entry object returned
2554
+ fail(FileError.NOT_FOUND_ERR);
2555
+ }
2556
+ };
2557
+
2558
+ // copy
2559
+ exec(success, fail, "File", "copyTo", [srcPath, parent.fullPath, name]);
2560
+ };
2561
+
2562
+ /**
2563
+ * Return a URL that can be used to identify this entry.
2564
+ */
2565
+ Entry.prototype.toURL = function() {
2566
+ // fullPath attribute contains the full URL
2567
+ return this.fullPath;
2568
+ };
2569
+
2570
+ /**
2571
+ * Returns a URI that can be used to identify this entry.
2572
+ *
2573
+ * @param {DOMString} mimeType for a FileEntry, the mime type to be used to interpret the file, when loaded through this URI.
2574
+ * @return uri
2575
+ */
2576
+ Entry.prototype.toURI = function(mimeType) {
2577
+ console.log("DEPRECATED: Update your code to use 'toURL'");
2578
+ // fullPath attribute contains the full URI
2579
+ return this.fullPath;
2580
+ };
2581
+
2582
+ /**
2583
+ * Remove a file or directory. It is an error to attempt to delete a
2584
+ * directory that is not empty. It is an error to attempt to delete a
2585
+ * root directory of a file system.
2586
+ *
2587
+ * @param successCallback {Function} called with no parameters
2588
+ * @param errorCallback {Function} called with a FileError
2589
+ */
2590
+ Entry.prototype.remove = function(successCallback, errorCallback) {
2591
+ var fail = typeof errorCallback !== 'function' ? null : function(code) {
2592
+ errorCallback(new FileError(code));
2593
+ };
2594
+ exec(successCallback, fail, "File", "remove", [this.fullPath]);
2595
+ };
2596
+
2597
+ /**
2598
+ * Look up the parent DirectoryEntry of this entry.
2599
+ *
2600
+ * @param successCallback {Function} called with the parent DirectoryEntry object
2601
+ * @param errorCallback {Function} called with a FileError
2602
+ */
2603
+ Entry.prototype.getParent = function(successCallback, errorCallback) {
2604
+ var fail = typeof errorCallback !== 'function' ? null : function(code) {
2605
+ errorCallback(new FileError(code));
2606
+ };
2607
+ exec(successCallback, fail, "File", "getParent", [this.fullPath]);
2608
+ };
2609
+
2610
+ module.exports = Entry;
2611
+
2612
+ });
2613
+
2614
+ define('cordova/plugin/File', function(require, exports, module) {
2615
+ /**
2616
+ * Constructor.
2617
+ * name {DOMString} name of the file, without path information
2618
+ * fullPath {DOMString} the full path of the file, including the name
2619
+ * type {DOMString} mime type
2620
+ * lastModifiedDate {Date} last modified date
2621
+ * size {Number} size of the file in bytes
2622
+ */
2623
+
2624
+ var File = function(name, fullPath, type, lastModifiedDate, size){
2625
+ this.name = name || '';
2626
+ this.fullPath = fullPath || null;
2627
+ this.type = type || null;
2628
+ this.lastModifiedDate = lastModifiedDate || null;
2629
+ this.size = size || 0;
2630
+ };
2631
+
2632
+ module.exports = File;
2633
+
2634
+ });
2635
+
2636
+ define('cordova/plugin/FileEntry', function(require, exports, module) {
2637
+ var utils = require('cordova/utils'),
2638
+ exec = require('cordova/exec'),
2639
+ Entry = require('cordova/plugin/Entry'),
2640
+ FileWriter = require('cordova/plugin/FileWriter'),
2641
+ File = require('cordova/plugin/File'),
2642
+ FileError = require('cordova/plugin/FileError');
2643
+
2644
+ /**
2645
+ * An interface representing a file on the file system.
2646
+ *
2647
+ * {boolean} isFile always true (readonly)
2648
+ * {boolean} isDirectory always false (readonly)
2649
+ * {DOMString} name of the file, excluding the path leading to it (readonly)
2650
+ * {DOMString} fullPath the absolute full path to the file (readonly)
2651
+ * {FileSystem} filesystem on which the file resides (readonly)
2652
+ */
2653
+ var FileEntry = function(name, fullPath) {
2654
+ FileEntry.__super__.constructor.apply(this, [true, false, name, fullPath]);
2655
+ };
2656
+
2657
+ utils.extend(FileEntry, Entry);
2658
+
2659
+ /**
2660
+ * Creates a new FileWriter associated with the file that this FileEntry represents.
2661
+ *
2662
+ * @param {Function} successCallback is called with the new FileWriter
2663
+ * @param {Function} errorCallback is called with a FileError
2664
+ */
2665
+ FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
2666
+ this.file(function(filePointer) {
2667
+ var writer = new FileWriter(filePointer);
2668
+
2669
+ if (writer.fileName === null || writer.fileName === "") {
2670
+ if (typeof errorCallback === "function") {
2671
+ errorCallback(new FileError(FileError.INVALID_STATE_ERR));
2672
+ }
2673
+ } else {
2674
+ if (typeof successCallback === "function") {
2675
+ successCallback(writer);
2676
+ }
2677
+ }
2678
+ }, errorCallback);
2679
+ };
2680
+
2681
+ /**
2682
+ * Returns a File that represents the current state of the file that this FileEntry represents.
2683
+ *
2684
+ * @param {Function} successCallback is called with the new File object
2685
+ * @param {Function} errorCallback is called with a FileError
2686
+ */
2687
+ FileEntry.prototype.file = function(successCallback, errorCallback) {
2688
+ var win = typeof successCallback !== 'function' ? null : function(f) {
2689
+ var file = new File(f.name, f.fullPath, f.type, f.lastModifiedDate, f.size);
2690
+ successCallback(file);
2691
+ };
2692
+ var fail = typeof errorCallback !== 'function' ? null : function(code) {
2693
+ errorCallback(new FileError(code));
2694
+ };
2695
+ exec(win, fail, "File", "getFileMetadata", [this.fullPath]);
2696
+ };
2697
+
2698
+
2699
+ module.exports = FileEntry;
2700
+
2701
+ });
2702
+
2703
+ define('cordova/plugin/FileError', function(require, exports, module) {
2704
+ /**
2705
+ * FileError
2706
+ */
2707
+ function FileError(error) {
2708
+ this.code = error || null;
2709
+ }
2710
+
2711
+ // File error codes
2712
+ // Found in DOMException
2713
+ FileError.NOT_FOUND_ERR = 1;
2714
+ FileError.SECURITY_ERR = 2;
2715
+ FileError.ABORT_ERR = 3;
2716
+
2717
+ // Added by File API specification
2718
+ FileError.NOT_READABLE_ERR = 4;
2719
+ FileError.ENCODING_ERR = 5;
2720
+ FileError.NO_MODIFICATION_ALLOWED_ERR = 6;
2721
+ FileError.INVALID_STATE_ERR = 7;
2722
+ FileError.SYNTAX_ERR = 8;
2723
+ FileError.INVALID_MODIFICATION_ERR = 9;
2724
+ FileError.QUOTA_EXCEEDED_ERR = 10;
2725
+ FileError.TYPE_MISMATCH_ERR = 11;
2726
+ FileError.PATH_EXISTS_ERR = 12;
2727
+
2728
+ module.exports = FileError;
2729
+
2730
+ });
2731
+
2732
+ define('cordova/plugin/FileReader', function(require, exports, module) {
2733
+ var exec = require('cordova/exec'),
2734
+ FileError = require('cordova/plugin/FileError'),
2735
+ ProgressEvent = require('cordova/plugin/ProgressEvent');
2736
+
2737
+ /**
2738
+ * This class reads the mobile device file system.
2739
+ *
2740
+ * For Android:
2741
+ * The root directory is the root of the file system.
2742
+ * To read from the SD card, the file name is "sdcard/my_file.txt"
2743
+ * @constructor
2744
+ */
2745
+ var FileReader = function() {
2746
+ this.fileName = "";
2747
+
2748
+ this.readyState = 0; // FileReader.EMPTY
2749
+
2750
+ // File data
2751
+ this.result = null;
2752
+
2753
+ // Error
2754
+ this.error = null;
2755
+
2756
+ // Event handlers
2757
+ this.onloadstart = null; // When the read starts.
2758
+ this.onprogress = null; // While reading (and decoding) file or fileBlob data, and reporting partial file data (progess.loaded/progress.total)
2759
+ this.onload = null; // When the read has successfully completed.
2760
+ this.onerror = null; // When the read has failed (see errors).
2761
+ this.onloadend = null; // When the request has completed (either in success or failure).
2762
+ this.onabort = null; // When the read has been aborted. For instance, by invoking the abort() method.
2763
+ };
2764
+
2765
+ // States
2766
+ FileReader.EMPTY = 0;
2767
+ FileReader.LOADING = 1;
2768
+ FileReader.DONE = 2;
2769
+
2770
+ /**
2771
+ * Abort reading file.
2772
+ */
2773
+ FileReader.prototype.abort = function() {
2774
+ this.result = null;
2775
+
2776
+ if (this.readyState == FileReader.DONE || this.readyState == FileReader.EMPTY) {
2777
+ return;
2778
+ }
2779
+
2780
+ this.readyState = FileReader.DONE;
2781
+
2782
+ // If abort callback
2783
+ if (typeof this.onabort === 'function') {
2784
+ this.onabort(new ProgressEvent('abort', {target:this}));
2785
+ }
2786
+ // If load end callback
2787
+ if (typeof this.onloadend === 'function') {
2788
+ this.onloadend(new ProgressEvent('loadend', {target:this}));
2789
+ }
2790
+ };
2791
+
2792
+ /**
2793
+ * Read text file.
2794
+ *
2795
+ * @param file {File} File object containing file properties
2796
+ * @param encoding [Optional] (see http://www.iana.org/assignments/character-sets)
2797
+ */
2798
+ FileReader.prototype.readAsText = function(file, encoding) {
2799
+ // Figure out pathing
2800
+ this.fileName = '';
2801
+ if (typeof file.fullPath === 'undefined') {
2802
+ this.fileName = file;
2803
+ } else {
2804
+ this.fileName = file.fullPath;
2805
+ }
2806
+
2807
+ // Already loading something
2808
+ if (this.readyState == FileReader.LOADING) {
2809
+ throw new FileError(FileError.INVALID_STATE_ERR);
2810
+ }
2811
+
2812
+ // LOADING state
2813
+ this.readyState = FileReader.LOADING;
2814
+
2815
+ // If loadstart callback
2816
+ if (typeof this.onloadstart === "function") {
2817
+ this.onloadstart(new ProgressEvent("loadstart", {target:this}));
2818
+ }
2819
+
2820
+ // Default encoding is UTF-8
2821
+ var enc = encoding ? encoding : "UTF-8";
2822
+
2823
+ var me = this;
2824
+
2825
+ // Read file
2826
+ exec(
2827
+ // Success callback
2828
+ function(r) {
2829
+ // If DONE (cancelled), then don't do anything
2830
+ if (me.readyState === FileReader.DONE) {
2831
+ return;
2832
+ }
2833
+ // Save result
2834
+ me.result = r;
2835
+
2836
+ // If onload callback
2837
+ if (typeof me.onload === "function") {
2838
+ me.onload(new ProgressEvent("load", {target:me}));
2839
+ }
2840
+
2841
+ // DONE state
2842
+ me.readyState = FileReader.DONE;
2843
+
2844
+ // If onloadend callback
2845
+ if (typeof me.onloadend === "function") {
2846
+ me.onloadend(new ProgressEvent("loadend", {target:me}));
2847
+ }
2848
+ },
2849
+ // Error callback
2850
+ function(e) {
2851
+ // If DONE (cancelled), then don't do anything
2852
+ if (me.readyState === FileReader.DONE) {
2853
+ return;
2854
+ }
2855
+
2856
+ // DONE state
2857
+ me.readyState = FileReader.DONE;
2858
+
2859
+ // null result
2860
+ me.result = null;
2861
+
2862
+ // Save error
2863
+ me.error = new FileError(e);
2864
+
2865
+ // If onerror callback
2866
+ if (typeof me.onerror === "function") {
2867
+ me.onerror(new ProgressEvent("error", {target:me}));
2868
+ }
2869
+
2870
+ // If onloadend callback
2871
+ if (typeof me.onloadend === "function") {
2872
+ me.onloadend(new ProgressEvent("loadend", {target:me}));
2873
+ }
2874
+ }, "File", "readAsText", [this.fileName, enc]);
2875
+ };
2876
+
2877
+
2878
+ /**
2879
+ * Read file and return data as a base64 encoded data url.
2880
+ * A data url is of the form:
2881
+ * data:[<mediatype>][;base64],<data>
2882
+ *
2883
+ * @param file {File} File object containing file properties
2884
+ */
2885
+ FileReader.prototype.readAsDataURL = function(file) {
2886
+ this.fileName = "";
2887
+ if (typeof file.fullPath === "undefined") {
2888
+ this.fileName = file;
2889
+ } else {
2890
+ this.fileName = file.fullPath;
2891
+ }
2892
+
2893
+ // Already loading something
2894
+ if (this.readyState == FileReader.LOADING) {
2895
+ throw new FileError(FileError.INVALID_STATE_ERR);
2896
+ }
2897
+
2898
+ // LOADING state
2899
+ this.readyState = FileReader.LOADING;
2900
+
2901
+ // If loadstart callback
2902
+ if (typeof this.onloadstart === "function") {
2903
+ this.onloadstart(new ProgressEvent("loadstart", {target:this}));
2904
+ }
2905
+
2906
+ var me = this;
2907
+
2908
+ // Read file
2909
+ exec(
2910
+ // Success callback
2911
+ function(r) {
2912
+ // If DONE (cancelled), then don't do anything
2913
+ if (me.readyState === FileReader.DONE) {
2914
+ return;
2915
+ }
2916
+
2917
+ // DONE state
2918
+ me.readyState = FileReader.DONE;
2919
+
2920
+ // Save result
2921
+ me.result = r;
2922
+
2923
+ // If onload callback
2924
+ if (typeof me.onload === "function") {
2925
+ me.onload(new ProgressEvent("load", {target:me}));
2926
+ }
2927
+
2928
+ // If onloadend callback
2929
+ if (typeof me.onloadend === "function") {
2930
+ me.onloadend(new ProgressEvent("loadend", {target:me}));
2931
+ }
2932
+ },
2933
+ // Error callback
2934
+ function(e) {
2935
+ // If DONE (cancelled), then don't do anything
2936
+ if (me.readyState === FileReader.DONE) {
2937
+ return;
2938
+ }
2939
+
2940
+ // DONE state
2941
+ me.readyState = FileReader.DONE;
2942
+
2943
+ me.result = null;
2944
+
2945
+ // Save error
2946
+ me.error = new FileError(e);
2947
+
2948
+ // If onerror callback
2949
+ if (typeof me.onerror === "function") {
2950
+ me.onerror(new ProgressEvent("error", {target:me}));
2951
+ }
2952
+
2953
+ // If onloadend callback
2954
+ if (typeof me.onloadend === "function") {
2955
+ me.onloadend(new ProgressEvent("loadend", {target:me}));
2956
+ }
2957
+ }, "File", "readAsDataURL", [this.fileName]);
2958
+ };
2959
+
2960
+ /**
2961
+ * Read file and return data as a binary data.
2962
+ *
2963
+ * @param file {File} File object containing file properties
2964
+ */
2965
+ FileReader.prototype.readAsBinaryString = function(file) {
2966
+ // TODO - Can't return binary data to browser.
2967
+ console.log('This method is not supported at this time.');
2968
+ };
2969
+
2970
+ /**
2971
+ * Read file and return data as a binary data.
2972
+ *
2973
+ * @param file {File} File object containing file properties
2974
+ */
2975
+ FileReader.prototype.readAsArrayBuffer = function(file) {
2976
+ // TODO - Can't return binary data to browser.
2977
+ console.log('This method is not supported at this time.');
2978
+ };
2979
+
2980
+ module.exports = FileReader;
2981
+
2982
+ });
2983
+
2984
+ define('cordova/plugin/FileSystem', function(require, exports, module) {
2985
+ var DirectoryEntry = require('cordova/plugin/DirectoryEntry');
2986
+
2987
+ /**
2988
+ * An interface representing a file system
2989
+ *
2990
+ * @constructor
2991
+ * {DOMString} name the unique name of the file system (readonly)
2992
+ * {DirectoryEntry} root directory of the file system (readonly)
2993
+ */
2994
+ var FileSystem = function(name, root) {
2995
+ this.name = name || null;
2996
+ if (root) {
2997
+ this.root = new DirectoryEntry(root.name, root.fullPath);
2998
+ }
2999
+ };
3000
+
3001
+ module.exports = FileSystem;
3002
+
3003
+ });
3004
+
3005
+ define('cordova/plugin/FileTransfer', function(require, exports, module) {
3006
+ var exec = require('cordova/exec');
3007
+
3008
+ /**
3009
+ * FileTransfer uploads a file to a remote server.
3010
+ * @constructor
3011
+ */
3012
+ var FileTransfer = function() {};
3013
+
3014
+ /**
3015
+ * Given an absolute file path, uploads a file on the device to a remote server
3016
+ * using a multipart HTTP request.
3017
+ * @param filePath {String} Full path of the file on the device
3018
+ * @param server {String} URL of the server to receive the file
3019
+ * @param successCallback (Function} Callback to be invoked when upload has completed
3020
+ * @param errorCallback {Function} Callback to be invoked upon error
3021
+ * @param options {FileUploadOptions} Optional parameters such as file name and mimetype
3022
+ */
3023
+ FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, debug) {
3024
+ // check for options
3025
+ var fileKey = null;
3026
+ var fileName = null;
3027
+ var mimeType = null;
3028
+ var params = null;
3029
+ var chunkedMode = true;
3030
+ if (options) {
3031
+ fileKey = options.fileKey;
3032
+ fileName = options.fileName;
3033
+ mimeType = options.mimeType;
3034
+ if (options.chunkedMode !== null || typeof options.chunkedMode !== "undefined") {
3035
+ chunkedMode = options.chunkedMode;
3036
+ }
3037
+ if (options.params) {
3038
+ params = options.params;
3039
+ }
3040
+ else {
3041
+ params = {};
3042
+ }
3043
+ }
3044
+
3045
+ exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, debug, chunkedMode]);
3046
+ };
3047
+
3048
+ /**
3049
+ * Downloads a file form a given URL and saves it to the specified directory.
3050
+ * @param source {String} URL of the server to receive the file
3051
+ * @param target {String} Full path of the file on the device
3052
+ * @param successCallback (Function} Callback to be invoked when upload has completed
3053
+ * @param errorCallback {Function} Callback to be invoked upon error
3054
+ */
3055
+ FileTransfer.prototype.download = function(source, target, successCallback, errorCallback) {
3056
+ var win = function(result) {
3057
+ var entry = null;
3058
+ if (result.isDirectory) {
3059
+ entry = new DirectoryEntry();
3060
+ }
3061
+ else if (result.isFile) {
3062
+ entry = new FileEntry();
3063
+ }
3064
+ entry.isDirectory = result.isDirectory;
3065
+ entry.isFile = result.isFile;
3066
+ entry.name = result.name;
3067
+ entry.fullPath = result.fullPath;
3068
+ successCallback(entry);
3069
+ };
3070
+ exec(win, errorCallback, 'FileTransfer', 'download', [source, target]);
3071
+ };
3072
+
3073
+ module.exports = FileTransfer;
3074
+
3075
+ });
3076
+
3077
+ define('cordova/plugin/FileTransferError', function(require, exports, module) {
3078
+ /**
3079
+ * FileTransferError
3080
+ * @constructor
3081
+ */
3082
+ var FileTransferError = function(code) {
3083
+ this.code = code || null;
3084
+ };
3085
+
3086
+ FileTransferError.FILE_NOT_FOUND_ERR = 1;
3087
+ FileTransferError.INVALID_URL_ERR = 2;
3088
+ FileTransferError.CONNECTION_ERR = 3;
3089
+
3090
+ module.exports = FileTransferError;
3091
+
3092
+ });
3093
+
3094
+ define('cordova/plugin/FileUploadOptions', function(require, exports, module) {
3095
+ /**
3096
+ * Options to customize the HTTP request used to upload files.
3097
+ * @constructor
3098
+ * @param fileKey {String} Name of file request parameter.
3099
+ * @param fileName {String} Filename to be used by the server. Defaults to image.jpg.
3100
+ * @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg.
3101
+ * @param params {Object} Object with key: value params to send to the server.
3102
+ */
3103
+ var FileUploadOptions = function(fileKey, fileName, mimeType, params) {
3104
+ this.fileKey = fileKey || null;
3105
+ this.fileName = fileName || null;
3106
+ this.mimeType = mimeType || null;
3107
+ this.params = params || null;
3108
+ };
3109
+
3110
+ module.exports = FileUploadOptions;
3111
+
3112
+ });
3113
+
3114
+ define('cordova/plugin/FileUploadResult', function(require, exports, module) {
3115
+ /**
3116
+ * FileUploadResult
3117
+ * @constructor
3118
+ */
3119
+ var FileUploadResult = function() {
3120
+ this.bytesSent = 0;
3121
+ this.responseCode = null;
3122
+ this.response = null;
3123
+ };
3124
+
3125
+ module.exports = FileUploadResult;
3126
+
3127
+ });
3128
+
3129
+ define('cordova/plugin/FileWriter', function(require, exports, module) {
3130
+ var exec = require('cordova/exec'),
3131
+ FileError = require('cordova/plugin/FileError');
3132
+ ProgressEvent = require('cordova/plugin/ProgressEvent');
3133
+
3134
+ /**
3135
+ * This class writes to the mobile device file system.
3136
+ *
3137
+ * For Android:
3138
+ * The root directory is the root of the file system.
3139
+ * To write to the SD card, the file name is "sdcard/my_file.txt"
3140
+ *
3141
+ * @constructor
3142
+ * @param file {File} File object containing file properties
3143
+ * @param append if true write to the end of the file, otherwise overwrite the file
3144
+ */
3145
+ var FileWriter = function(file) {
3146
+ this.fileName = "";
3147
+ this.length = 0;
3148
+ if (file) {
3149
+ this.fileName = file.fullPath || file;
3150
+ this.length = file.size || 0;
3151
+ }
3152
+ // default is to write at the beginning of the file
3153
+ this.position = 0;
3154
+
3155
+ this.readyState = 0; // EMPTY
3156
+
3157
+ this.result = null;
3158
+
3159
+ // Error
3160
+ this.error = null;
3161
+
3162
+ // Event handlers
3163
+ this.onwritestart = null; // When writing starts
3164
+ this.onprogress = null; // While writing the file, and reporting partial file data
3165
+ this.onwrite = null; // When the write has successfully completed.
3166
+ this.onwriteend = null; // When the request has completed (either in success or failure).
3167
+ this.onabort = null; // When the write has been aborted. For instance, by invoking the abort() method.
3168
+ this.onerror = null; // When the write has failed (see errors).
3169
+ };
3170
+
3171
+ // States
3172
+ FileWriter.INIT = 0;
3173
+ FileWriter.WRITING = 1;
3174
+ FileWriter.DONE = 2;
3175
+
3176
+ /**
3177
+ * Abort writing file.
3178
+ */
3179
+ FileWriter.prototype.abort = function() {
3180
+ // check for invalid state
3181
+ if (this.readyState === FileWriter.DONE || this.readyState === FileWriter.INIT) {
3182
+ throw new FileError(FileError.INVALID_STATE_ERR);
3183
+ }
3184
+
3185
+ // set error
3186
+ this.error = new FileError(FileError.ABORT_ERR);
3187
+
3188
+ this.readyState = FileWriter.DONE;
3189
+
3190
+ // If abort callback
3191
+ if (typeof this.onabort === "function") {
3192
+ this.onabort(new ProgressEvent("abort", {"target":this}));
3193
+ }
3194
+
3195
+ // If write end callback
3196
+ if (typeof this.onwriteend === "function") {
3197
+ this.onwriteend(new ProgressEvent("writeend", {"target":this}));
3198
+ }
3199
+ };
3200
+
3201
+ /**
3202
+ * Writes data to the file
3203
+ *
3204
+ * @param text to be written
3205
+ */
3206
+ FileWriter.prototype.write = function(text) {
3207
+ // Throw an exception if we are already writing a file
3208
+ if (this.readyState === FileWriter.WRITING) {
3209
+ throw new FileError(FileError.INVALID_STATE_ERR);
3210
+ }
3211
+
3212
+ // WRITING state
3213
+ this.readyState = FileWriter.WRITING;
3214
+
3215
+ var me = this;
3216
+
3217
+ // If onwritestart callback
3218
+ if (typeof me.onwritestart === "function") {
3219
+ me.onwritestart(new ProgressEvent("writestart", {"target":me}));
3220
+ }
3221
+
3222
+ // Write file
3223
+ exec(
3224
+ // Success callback
3225
+ function(r) {
3226
+ // If DONE (cancelled), then don't do anything
3227
+ if (me.readyState === FileWriter.DONE) {
3228
+ return;
3229
+ }
3230
+
3231
+ // position always increases by bytes written because file would be extended
3232
+ me.position += r;
3233
+ // The length of the file is now where we are done writing.
3234
+
3235
+ me.length = me.position;
3236
+
3237
+ // DONE state
3238
+ me.readyState = FileWriter.DONE;
3239
+
3240
+ // If onwrite callback
3241
+ if (typeof me.onwrite === "function") {
3242
+ me.onwrite(new ProgressEvent("write", {"target":me}));
3243
+ }
3244
+
3245
+ // If onwriteend callback
3246
+ if (typeof me.onwriteend === "function") {
3247
+ me.onwriteend(new ProgressEvent("writeend", {"target":me}));
3248
+ }
3249
+ },
3250
+ // Error callback
3251
+ function(e) {
3252
+ // If DONE (cancelled), then don't do anything
3253
+ if (me.readyState === FileWriter.DONE) {
3254
+ return;
3255
+ }
3256
+
3257
+ // DONE state
3258
+ me.readyState = FileWriter.DONE;
3259
+
3260
+ // Save error
3261
+ me.error = new FileError(e);
3262
+
3263
+ // If onerror callback
3264
+ if (typeof me.onerror === "function") {
3265
+ me.onerror(new ProgressEvent("error", {"target":me}));
3266
+ }
3267
+
3268
+ // If onwriteend callback
3269
+ if (typeof me.onwriteend === "function") {
3270
+ me.onwriteend(new ProgressEvent("writeend", {"target":me}));
3271
+ }
3272
+ }, "File", "write", [this.fileName, text, this.position]);
3273
+ };
3274
+
3275
+ /**
3276
+ * Moves the file pointer to the location specified.
3277
+ *
3278
+ * If the offset is a negative number the position of the file
3279
+ * pointer is rewound. If the offset is greater than the file
3280
+ * size the position is set to the end of the file.
3281
+ *
3282
+ * @param offset is the location to move the file pointer to.
3283
+ */
3284
+ FileWriter.prototype.seek = function(offset) {
3285
+ // Throw an exception if we are already writing a file
3286
+ if (this.readyState === FileWriter.WRITING) {
3287
+ throw new FileError(FileError.INVALID_STATE_ERR);
3288
+ }
3289
+
3290
+ if (!offset) {
3291
+ return;
3292
+ }
3293
+
3294
+ // See back from end of file.
3295
+ if (offset < 0) {
3296
+ this.position = Math.max(offset + this.length, 0);
3297
+ }
3298
+ // Offset is bigger then file size so set position
3299
+ // to the end of the file.
3300
+ else if (offset > this.length) {
3301
+ this.position = this.length;
3302
+ }
3303
+ // Offset is between 0 and file size so set the position
3304
+ // to start writing.
3305
+ else {
3306
+ this.position = offset;
3307
+ }
3308
+ };
3309
+
3310
+ /**
3311
+ * Truncates the file to the size specified.
3312
+ *
3313
+ * @param size to chop the file at.
3314
+ */
3315
+ FileWriter.prototype.truncate = function(size) {
3316
+ // Throw an exception if we are already writing a file
3317
+ if (this.readyState === FileWriter.WRITING) {
3318
+ throw new FileError(FileError.INVALID_STATE_ERR);
3319
+ }
3320
+
3321
+ // WRITING state
3322
+ this.readyState = FileWriter.WRITING;
3323
+
3324
+ var me = this;
3325
+
3326
+ // If onwritestart callback
3327
+ if (typeof me.onwritestart === "function") {
3328
+ me.onwritestart(new ProgressEvent("writestart", {"target":this}));
3329
+ }
3330
+
3331
+ // Write file
3332
+ exec(
3333
+ // Success callback
3334
+ function(r) {
3335
+ // If DONE (cancelled), then don't do anything
3336
+ if (me.readyState === FileWriter.DONE) {
3337
+ return;
3338
+ }
3339
+
3340
+ // DONE state
3341
+ me.readyState = FileWriter.DONE;
3342
+
3343
+ // Update the length of the file
3344
+ me.length = r;
3345
+ me.position = Math.min(me.position, r);
3346
+
3347
+ // If onwrite callback
3348
+ if (typeof me.onwrite === "function") {
3349
+ me.onwrite(new ProgressEvent("write", {"target":me}));
3350
+ }
3351
+
3352
+ // If onwriteend callback
3353
+ if (typeof me.onwriteend === "function") {
3354
+ me.onwriteend(new ProgressEvent("writeend", {"target":me}));
3355
+ }
3356
+ },
3357
+ // Error callback
3358
+ function(e) {
3359
+ // If DONE (cancelled), then don't do anything
3360
+ if (me.readyState === FileWriter.DONE) {
3361
+ return;
3362
+ }
3363
+
3364
+ // DONE state
3365
+ me.readyState = FileWriter.DONE;
3366
+
3367
+ // Save error
3368
+ me.error = new FileError(e);
3369
+
3370
+ // If onerror callback
3371
+ if (typeof me.onerror === "function") {
3372
+ me.onerror(new ProgressEvent("error", {"target":me}));
3373
+ }
3374
+
3375
+ // If onwriteend callback
3376
+ if (typeof me.onwriteend === "function") {
3377
+ me.onwriteend(new ProgressEvent("writeend", {"target":me}));
3378
+ }
3379
+ }, "File", "truncate", [this.fileName, size]);
3380
+ };
3381
+
3382
+ module.exports = FileWriter;
3383
+
3384
+ });
3385
+
3386
+ define('cordova/plugin/Flags', function(require, exports, module) {
3387
+ /**
3388
+ * Supplies arguments to methods that lookup or create files and directories.
3389
+ *
3390
+ * @param create
3391
+ * {boolean} file or directory if it doesn't exist
3392
+ * @param exclusive
3393
+ * {boolean} used with create; if true the command will fail if
3394
+ * target path exists
3395
+ */
3396
+ function Flags(create, exclusive) {
3397
+ this.create = create || false;
3398
+ this.exclusive = exclusive || false;
3399
+ }
3400
+
3401
+ module.exports = Flags;
3402
+
3403
+ });
3404
+
3405
+ define('cordova/plugin/geolocation', function(require, exports, module) {
3406
+ var utils = require('cordova/utils'),
3407
+ exec = require('cordova/exec'),
3408
+ PositionError = require('cordova/plugin/PositionError');
3409
+
3410
+ var timers = {}; // list of timers in use
3411
+
3412
+ // Returns default params, overrides if provided with values
3413
+ function parseParameters(options) {
3414
+ var opt = {
3415
+ maximumAge: 10000,
3416
+ enableHighAccuracy: false,
3417
+ timeout: 10000
3418
+ };
3419
+
3420
+ if (options) {
3421
+ if (typeof options.maximumAge !== "undefined") {
3422
+ opt.maximumAge = options.maximumAge;
3423
+ }
3424
+ if (typeof options.enableHighAccuracy !== "undefined") {
3425
+ opt.enableHighAccuracy = options.enableHighAccuracy;
3426
+ }
3427
+ if (typeof options.timeout !== "undefined") {
3428
+ opt.timeout = options.timeout;
3429
+ }
3430
+ }
3431
+
3432
+ return opt;
3433
+ }
3434
+
3435
+ var geolocation = {
3436
+ /**
3437
+ * Asynchronously aquires the current position.
3438
+ *
3439
+ * @param {Function} successCallback The function to call when the position data is available
3440
+ * @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL)
3441
+ * @param {PositionOptions} options The options for getting the position data. (OPTIONAL)
3442
+ */
3443
+ getCurrentPosition:function(successCallback, errorCallback, options) {
3444
+ options = parseParameters(options);
3445
+ exec(successCallback, errorCallback, "Geolocation", "getLocation", [options.enableHighAccuracy, options.timeout, options.maximumAge]);
3446
+ },
3447
+ /**
3448
+ * Asynchronously watches the geolocation for changes to geolocation. When a change occurs,
3449
+ * the successCallback is called with the new location.
3450
+ *
3451
+ * @param {Function} successCallback The function to call each time the location data is available
3452
+ * @param {Function} errorCallback The function to call when there is an error getting the location data. (OPTIONAL)
3453
+ * @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL)
3454
+ * @return String The watch id that must be passed to #clearWatch to stop watching.
3455
+ */
3456
+ watchPosition:function(successCallback, errorCallback, options) {
3457
+ options = parseParameters(options);
3458
+ var id = utils.createUUID();
3459
+ timers[id] = window.setInterval(function() {
3460
+ exec(successCallback, errorCallback, "Geolocation", "getLocation", [options.enableHighAccuracy, options.timeout, options.maximumAge]);
3461
+ }, options.timeout);
3462
+
3463
+ return id;
3464
+ },
3465
+ /**
3466
+ * Clears the specified heading watch.
3467
+ *
3468
+ * @param {String} id The ID of the watch returned from #watchPosition
3469
+ */
3470
+ clearWatch:function(id) {
3471
+ if (id && timers[id] !== undefined) {
3472
+ window.clearInterval(timers[id]);
3473
+ delete timers[id];
3474
+ }
3475
+ }
3476
+ };
3477
+
3478
+ module.exports = geolocation;
3479
+
3480
+ });
3481
+
3482
+
3483
+ define('cordova/plugin/LocalFileSystem', function(require, exports, module) {
3484
+ var exec = require('cordova/exec');
3485
+
3486
+ /**
3487
+ * Represents a local file system.
3488
+ */
3489
+ var LocalFileSystem = function() {
3490
+
3491
+ };
3492
+
3493
+ LocalFileSystem.TEMPORARY = 0; //temporary, with no guarantee of persistence
3494
+ LocalFileSystem.PERSISTENT = 1; //persistent
3495
+
3496
+ module.exports = LocalFileSystem;
3497
+
3498
+ });
3499
+
3500
+ define('cordova/plugin/Media', function(require, exports, module) {
3501
+ var utils = require('cordova/utils'),
3502
+ exec = require('cordova/exec');
3503
+
3504
+ var mediaObjects = {};
3505
+
3506
+ /**
3507
+ * This class provides access to the device media, interfaces to both sound and video
3508
+ *
3509
+ * @constructor
3510
+ * @param src The file name or url to play
3511
+ * @param successCallback The callback to be called when the file is done playing or recording.
3512
+ * successCallback()
3513
+ * @param errorCallback The callback to be called if there is an error.
3514
+ * errorCallback(int errorCode) - OPTIONAL
3515
+ * @param statusCallback The callback to be called when media status has changed.
3516
+ * statusCallback(int statusCode) - OPTIONAL
3517
+ */
3518
+ var Media = function(src, successCallback, errorCallback, statusCallback) {
3519
+
3520
+ // successCallback optional
3521
+ if (successCallback && (typeof successCallback !== "function")) {
3522
+ console.log("Media Error: successCallback is not a function");
3523
+ return;
3524
+ }
3525
+
3526
+ // errorCallback optional
3527
+ if (errorCallback && (typeof errorCallback !== "function")) {
3528
+ console.log("Media Error: errorCallback is not a function");
3529
+ return;
3530
+ }
3531
+
3532
+ // statusCallback optional
3533
+ if (statusCallback && (typeof statusCallback !== "function")) {
3534
+ console.log("Media Error: statusCallback is not a function");
3535
+ return;
3536
+ }
3537
+
3538
+ this.id = utils.createUUID();
3539
+ mediaObjects[this.id] = this;
3540
+ this.src = src;
3541
+ this.successCallback = successCallback;
3542
+ this.errorCallback = errorCallback;
3543
+ this.statusCallback = statusCallback;
3544
+ this._duration = -1;
3545
+ this._position = -1;
3546
+ exec(null, this.errorCallback, "Media", "create", [this.id, this.src]);
3547
+ };
3548
+
3549
+ // Media messages
3550
+ Media.MEDIA_STATE = 1;
3551
+ Media.MEDIA_DURATION = 2;
3552
+ Media.MEDIA_POSITION = 3;
3553
+ Media.MEDIA_ERROR = 9;
3554
+
3555
+ // Media states
3556
+ Media.MEDIA_NONE = 0;
3557
+ Media.MEDIA_STARTING = 1;
3558
+ Media.MEDIA_RUNNING = 2;
3559
+ Media.MEDIA_PAUSED = 3;
3560
+ Media.MEDIA_STOPPED = 4;
3561
+ Media.MEDIA_MSG = ["None", "Starting", "Running", "Paused", "Stopped"];
3562
+
3563
+ // "static" function to return existing objs.
3564
+ Media.get = function(id) {
3565
+ return mediaObjects[id];
3566
+ };
3567
+
3568
+ /**
3569
+ * Start or resume playing audio file.
3570
+ */
3571
+ Media.prototype.play = function() {
3572
+ exec(this.successCallback, this.errorCallback, "Media", "startPlayingAudio", [this.id, this.src]);
3573
+ };
3574
+
3575
+ /**
3576
+ * Stop playing audio file.
3577
+ */
3578
+ Media.prototype.stop = function() {
3579
+ var me = this;
3580
+ exec(function() {
3581
+ me._position = 0;
3582
+ me.successCallback();
3583
+ }, this.errorCallback, "Media", "stopPlayingAudio", [this.id]);
3584
+ };
3585
+
3586
+ /**
3587
+ * Seek or jump to a new time in the track..
3588
+ */
3589
+ Media.prototype.seekTo = function(milliseconds) {
3590
+ var me = this;
3591
+ exec(function(p) {
3592
+ me._position = p;
3593
+ }, this.errorCallback, "Media", "seekToAudio", [this.id, milliseconds]);
3594
+ };
3595
+
3596
+ /**
3597
+ * Pause playing audio file.
3598
+ */
3599
+ Media.prototype.pause = function() {
3600
+ exec(null, this.errorCallback, "Media", "pausePlayingAudio", [this.id]);
3601
+ };
3602
+
3603
+ /**
3604
+ * Get duration of an audio file.
3605
+ * The duration is only set for audio that is playing, paused or stopped.
3606
+ *
3607
+ * @return duration or -1 if not known.
3608
+ */
3609
+ Media.prototype.getDuration = function() {
3610
+ return this._duration;
3611
+ };
3612
+
3613
+ /**
3614
+ * Get position of audio.
3615
+ */
3616
+ Media.prototype.getCurrentPosition = function(success, fail) {
3617
+ var me = this;
3618
+ exec(function(p) {
3619
+ me._position = p;
3620
+ success(p);
3621
+ }, fail, "Media", "getCurrentPositionAudio", [this.id]);
3622
+ };
3623
+
3624
+ /**
3625
+ * Start recording audio file.
3626
+ */
3627
+ Media.prototype.startRecord = function() {
3628
+ exec(this.successCallback, this.errorCallback, "Media", "startRecordingAudio", [this.id, this.src]);
3629
+ };
3630
+
3631
+ /**
3632
+ * Stop recording audio file.
3633
+ */
3634
+ Media.prototype.stopRecord = function() {
3635
+ exec(this.successCallback, this.errorCallback, "Media", "stopRecordingAudio", [this.id]);
3636
+ };
3637
+
3638
+ /**
3639
+ * Release the resources.
3640
+ */
3641
+ Media.prototype.release = function() {
3642
+ exec(null, this.errorCallback, "Media", "release", [this.id]);
3643
+ };
3644
+
3645
+ /**
3646
+ * Adjust the volume.
3647
+ */
3648
+ Media.prototype.setVolume = function(volume) {
3649
+ exec(null, null, "Media", "setVolume", [this.id, volume]);
3650
+ };
3651
+
3652
+ /**
3653
+ * Audio has status update.
3654
+ * PRIVATE
3655
+ *
3656
+ * @param id The media object id (string)
3657
+ * @param status The status code (int)
3658
+ * @param msg The status message (string)
3659
+ */
3660
+ Media.onStatus = function(id, msg, value) {
3661
+ var media = mediaObjects[id];
3662
+ // If state update
3663
+ if (msg === Media.MEDIA_STATE) {
3664
+ if (value === Media.MEDIA_STOPPED) {
3665
+ if (media.successCallback) {
3666
+ media.successCallback();
3667
+ }
3668
+ }
3669
+ if (media.statusCallback) {
3670
+ media.statusCallback(value);
3671
+ }
3672
+ }
3673
+ else if (msg === Media.MEDIA_DURATION) {
3674
+ media._duration = value;
3675
+ }
3676
+ else if (msg === Media.MEDIA_ERROR) {
3677
+ if (media.errorCallback) {
3678
+ media.errorCallback({"code":value});
3679
+ }
3680
+ }
3681
+ else if (msg === Media.MEDIA_POSITION) {
3682
+ media._position = value;
3683
+ }
3684
+ };
3685
+
3686
+ module.exports = Media;
3687
+
3688
+ });
3689
+
3690
+ define('cordova/plugin/MediaError', function(require, exports, module) {
3691
+ /**
3692
+ * This class contains information about any Media errors.
3693
+ * @constructor
3694
+ */
3695
+ var MediaError = function(code, msg) {
3696
+ this.code = code || null;
3697
+ this.message = msg || "";
3698
+ };
3699
+
3700
+ MediaError.MEDIA_ERR_NONE_ACTIVE = 0;
3701
+ MediaError.MEDIA_ERR_ABORTED = 1;
3702
+ MediaError.MEDIA_ERR_NETWORK = 2;
3703
+ MediaError.MEDIA_ERR_DECODE = 3;
3704
+ MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
3705
+
3706
+ module.exports = MediaError;
3707
+
3708
+ });
3709
+
3710
+ define('cordova/plugin/MediaFile', function(require, exports, module) {
3711
+ var utils = require('cordova/utils'),
3712
+ exec = require('cordova/exec'),
3713
+ File = require('cordova/plugin/File'),
3714
+ CaptureError = require('cordova/plugin/CaptureError');
3715
+ /**
3716
+ * Represents a single file.
3717
+ *
3718
+ * name {DOMString} name of the file, without path information
3719
+ * fullPath {DOMString} the full path of the file, including the name
3720
+ * type {DOMString} mime type
3721
+ * lastModifiedDate {Date} last modified date
3722
+ * size {Number} size of the file in bytes
3723
+ */
3724
+ var MediaFile = function(name, fullPath, type, lastModifiedDate, size){
3725
+ MediaFile.__super__.constructor.apply(this, arguments);
3726
+ };
3727
+
3728
+ utils.extend(MediaFile, File);
3729
+
3730
+ /**
3731
+ * Request capture format data for a specific file and type
3732
+ *
3733
+ * @param {Function} successCB
3734
+ * @param {Function} errorCB
3735
+ */
3736
+ MediaFile.prototype.getFormatData = function(successCallback, errorCallback) {
3737
+ if (typeof this.fullPath === "undefined" || this.fullPath === null) {
3738
+ errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
3739
+ } else {
3740
+ exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]);
3741
+ }
3742
+ };
3743
+
3744
+ /**
3745
+ * Casts a PluginResult message property (array of objects) to an array of MediaFile objects
3746
+ * (used in Objective-C and Android)
3747
+ *
3748
+ * @param {PluginResult} pluginResult
3749
+ */
3750
+ MediaFile.cast = function(pluginResult) {
3751
+ var mediaFiles = [];
3752
+ var i;
3753
+ for (i=0; i<pluginResult.message.length; i++) {
3754
+ var mediaFile = new MediaFile();
3755
+ mediaFile.name = pluginResult.message[i].name;
3756
+ mediaFile.fullPath = pluginResult.message[i].fullPath;
3757
+ mediaFile.type = pluginResult.message[i].type;
3758
+ mediaFile.lastModifiedDate = pluginResult.message[i].lastModifiedDate;
3759
+ mediaFile.size = pluginResult.message[i].size;
3760
+ mediaFiles.push(mediaFile);
3761
+ }
3762
+ pluginResult.message = mediaFiles;
3763
+ return pluginResult;
3764
+ };
3765
+
3766
+ module.exports = MediaFile;
3767
+
3768
+ });
3769
+
3770
+ define('cordova/plugin/MediaFileData', function(require, exports, module) {
3771
+ /**
3772
+ * MediaFileData encapsulates format information of a media file.
3773
+ *
3774
+ * @param {DOMString} codecs
3775
+ * @param {long} bitrate
3776
+ * @param {long} height
3777
+ * @param {long} width
3778
+ * @param {float} duration
3779
+ */
3780
+ var MediaFileData = function(codecs, bitrate, height, width, duration){
3781
+ this.codecs = codecs || null;
3782
+ this.bitrate = bitrate || 0;
3783
+ this.height = height || 0;
3784
+ this.width = width || 0;
3785
+ this.duration = duration || 0;
3786
+ };
3787
+
3788
+ module.exports = MediaFileData;
3789
+
3790
+ });
3791
+
3792
+ define('cordova/plugin/Metadata', function(require, exports, module) {
3793
+ /**
3794
+ * Information about the state of the file or directory
3795
+ *
3796
+ * {Date} modificationTime (readonly)
3797
+ */
3798
+ var Metadata = function(time) {
3799
+ this.modificationTime = (typeof time != 'undefined'?new Date(time):null);
3800
+ };
3801
+
3802
+ module.exports = Metadata;
3803
+
3804
+ });
3805
+
3806
+ define('cordova/plugin/network', function(require, exports, module) {
3807
+ var exec = require('cordova/exec'),
3808
+ cordova = require('cordova'),
3809
+ channel = require('cordova/channel');
3810
+
3811
+ var NetworkConnection = function () {
3812
+ this.type = null;
3813
+ this._firstRun = true;
3814
+ this._timer = null;
3815
+ this.timeout = 500;
3816
+
3817
+ var me = this;
3818
+
3819
+ this.getInfo(
3820
+ function (info) {
3821
+ me.type = info;
3822
+ if (info === "none") {
3823
+ // set a timer if still offline at the end of timer send the offline event
3824
+ me._timer = setTimeout(function(){
3825
+ cordova.fireWindowEvent("offline");
3826
+ me._timer = null;
3827
+ }, me.timeout);
3828
+ } else {
3829
+ // If there is a current offline event pending clear it
3830
+ if (me._timer !== null) {
3831
+ clearTimeout(me._timer);
3832
+ me._timer = null;
3833
+ }
3834
+ cordova.fireWindowEvent("online");
3835
+ }
3836
+
3837
+ // should only fire this once
3838
+ if (me._firstRun) {
3839
+ me._firstRun = false;
3840
+ channel.onCordovaConnectionReady.fire();
3841
+ }
3842
+ },
3843
+ function (e) {
3844
+ // If we can't get the network info we should still tell Cordova
3845
+ // to fire the deviceready event.
3846
+ if (me._firstRun) {
3847
+ me._firstRun = false;
3848
+ channel.onCordovaConnectionReady.fire();
3849
+ }
3850
+ console.log("Error initializing Network Connection: " + e);
3851
+ });
3852
+ };
3853
+
3854
+ /**
3855
+ * Get connection info
3856
+ *
3857
+ * @param {Function} successCallback The function to call when the Connection data is available
3858
+ * @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
3859
+ */
3860
+ NetworkConnection.prototype.getInfo = function (successCallback, errorCallback) {
3861
+ // Get info
3862
+ exec(successCallback, errorCallback, "Network Status", "getConnectionInfo", []);
3863
+ };
3864
+
3865
+ module.exports = new NetworkConnection();
3866
+
3867
+ });
3868
+
3869
+ define('cordova/plugin/notification', function(require, exports, module) {
3870
+ var exec = require('cordova/exec');
3871
+
3872
+ /**
3873
+ * Provides access to notifications on the device.
3874
+ */
3875
+
3876
+ module.exports = {
3877
+
3878
+ /**
3879
+ * Open a native alert dialog, with a customizable title and button text.
3880
+ *
3881
+ * @param {String} message Message to print in the body of the alert
3882
+ * @param {Function} completeCallback The callback that is called when user clicks on a button.
3883
+ * @param {String} title Title of the alert dialog (default: Alert)
3884
+ * @param {String} buttonLabel Label of the close button (default: OK)
3885
+ */
3886
+ alert: function(message, completeCallback, title, buttonLabel) {
3887
+ var _title = (title || "Alert");
3888
+ var _buttonLabel = (buttonLabel || "OK");
3889
+ exec(completeCallback, null, "Notification", "alert", [message, _title, _buttonLabel]);
3890
+ },
3891
+
3892
+ /**
3893
+ * Open a native confirm dialog, with a customizable title and button text.
3894
+ * The result that the user selects is returned to the result callback.
3895
+ *
3896
+ * @param {String} message Message to print in the body of the alert
3897
+ * @param {Function} resultCallback The callback that is called when user clicks on a button.
3898
+ * @param {String} title Title of the alert dialog (default: Confirm)
3899
+ * @param {String} buttonLabels Comma separated list of the labels of the buttons (default: 'OK,Cancel')
3900
+ */
3901
+ confirm: function(message, resultCallback, title, buttonLabels) {
3902
+ var _title = (title || "Confirm");
3903
+ var _buttonLabels = (buttonLabels || "OK,Cancel");
3904
+ exec(resultCallback, null, "Notification", "confirm", [message, _title, _buttonLabels]);
3905
+ },
3906
+
3907
+ /**
3908
+ * Causes the device to vibrate.
3909
+ *
3910
+ * @param {Integer} mills The number of milliseconds to vibrate for.
3911
+ */
3912
+ vibrate: function(mills) {
3913
+ exec(null, null, "Notification", "vibrate", [mills]);
3914
+ },
3915
+
3916
+ /**
3917
+ * Causes the device to beep.
3918
+ * On Android, the default notification ringtone is played "count" times.
3919
+ *
3920
+ * @param {Integer} count The number of beeps.
3921
+ */
3922
+ beep: function(count) {
3923
+ exec(null, null, "Notification", "beep", [count]);
3924
+ }
3925
+ };
3926
+
3927
+ });
3928
+
3929
+
3930
+ define('cordova/plugin/Position', function(require, exports, module) {
3931
+ var Position = function(coords, timestamp) {
3932
+ this.coords = coords;
3933
+ this.timestamp = (timestamp !== undefined) ? timestamp : new Date().getTime();
3934
+ };
3935
+
3936
+ module.exports = Position;
3937
+
3938
+ });
3939
+
3940
+ define('cordova/plugin/PositionError', function(require, exports, module) {
3941
+ /**
3942
+ * Position error object
3943
+ *
3944
+ * @constructor
3945
+ * @param code
3946
+ * @param message
3947
+ */
3948
+ var PositionError = function(code, message) {
3949
+ this.code = code || null;
3950
+ this.message = message || '';
3951
+ };
3952
+
3953
+ PositionError.PERMISSION_DENIED = 1;
3954
+ PositionError.POSITION_UNAVAILABLE = 2;
3955
+ PositionError.TIMEOUT = 3;
3956
+
3957
+ module.exports = PositionError;
3958
+
3959
+ });
3960
+
3961
+ define('cordova/plugin/ProgressEvent', function(require, exports, module) {
3962
+ // If ProgressEvent exists in global context, use it already, otherwise use our own polyfill
3963
+ // Feature test: See if we can instantiate a native ProgressEvent;
3964
+ // if so, use that approach,
3965
+ // otherwise fill-in with our own implementation.
3966
+ //
3967
+ // NOTE: right now we always fill in with our own. Down the road would be nice if we can use whatever is native in the webview.
3968
+ var ProgressEvent = (function() {
3969
+ /*
3970
+ var createEvent = function(data) {
3971
+ var event = document.createEvent('Events');
3972
+ event.initEvent('ProgressEvent', false, false);
3973
+ if (data) {
3974
+ for (var i in data) {
3975
+ if (data.hasOwnProperty(i)) {
3976
+ event[i] = data[i];
3977
+ }
3978
+ }
3979
+ if (data.target) {
3980
+ // TODO: cannot call <some_custom_object>.dispatchEvent
3981
+ // need to first figure out how to implement EventTarget
3982
+ }
3983
+ }
3984
+ return event;
3985
+ };
3986
+ try {
3987
+ var ev = createEvent({type:"abort",target:document});
3988
+ return function ProgressEvent(type, data) {
3989
+ data.type = type;
3990
+ return createEvent(data);
3991
+ };
3992
+ } catch(e){
3993
+ */
3994
+ return function ProgressEvent(type, dict) {
3995
+ this.type = type;
3996
+ this.bubbles = false;
3997
+ this.cancelBubble = false;
3998
+ this.cancelable = false;
3999
+ this.lengthComputable = false;
4000
+ this.loaded = dict && dict.loaded ? dict.loaded : 0;
4001
+ this.total = dict && dict.total ? dict.total : 0;
4002
+ this.target = dict && dict.target ? dict.target : null;
4003
+ };
4004
+ //}
4005
+ })();
4006
+
4007
+ module.exports = ProgressEvent;
4008
+
4009
+ });
4010
+
4011
+ define('cordova/plugin/requestFileSystem', function(require, exports, module) {
4012
+ var FileError = require('cordova/plugin/FileError'),
4013
+ FileSystem = require('cordova/plugin/FileSystem'),
4014
+ exec = require('cordova/exec');
4015
+
4016
+ /**
4017
+ * Request a file system in which to store application data.
4018
+ * @param type local file system type
4019
+ * @param size indicates how much storage space, in bytes, the application expects to need
4020
+ * @param successCallback invoked with a FileSystem object
4021
+ * @param errorCallback invoked if error occurs retrieving file system
4022
+ */
4023
+ var requestFileSystem = function(type, size, successCallback, errorCallback) {
4024
+ var fail = function(code) {
4025
+ if (typeof errorCallback === 'function') {
4026
+ errorCallback(new FileError(code));
4027
+ }
4028
+ };
4029
+
4030
+ if (type < 0 || type > 3) {
4031
+ fail(FileError.SYNTAX_ERR);
4032
+ } else {
4033
+ // if successful, return a FileSystem object
4034
+ var success = function(file_system) {
4035
+ if (file_system) {
4036
+ if (typeof successCallback === 'function') {
4037
+ // grab the name and root from the file system object
4038
+ var result = new FileSystem(file_system.name, file_system.root);
4039
+ successCallback(result);
4040
+ }
4041
+ }
4042
+ else {
4043
+ // no FileSystem object returned
4044
+ fail(FileError.NOT_FOUND_ERR);
4045
+ }
4046
+ };
4047
+ exec(success, fail, "File", "requestFileSystem", [type, size]);
4048
+ }
4049
+ };
4050
+
4051
+ module.exports = requestFileSystem;
4052
+
4053
+ });
4054
+
4055
+ define('cordova/plugin/resolveLocalFileSystemURI', function(require, exports, module) {
4056
+ var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
4057
+ FileEntry = require('cordova/plugin/FileEntry'),
4058
+ exec = require('cordova/exec');
4059
+
4060
+ /**
4061
+ * Look up file system Entry referred to by local URI.
4062
+ * @param {DOMString} uri URI referring to a local file or directory
4063
+ * @param successCallback invoked with Entry object corresponding to URI
4064
+ * @param errorCallback invoked if error occurs retrieving file system entry
4065
+ */
4066
+ module.exports = function(uri, successCallback, errorCallback) {
4067
+ // error callback
4068
+ var fail = function(error) {
4069
+ if (typeof errorCallback === 'function') {
4070
+ errorCallback(new FileError(error));
4071
+ }
4072
+ };
4073
+ // if successful, return either a file or directory entry
4074
+ var success = function(entry) {
4075
+ var result;
4076
+
4077
+ if (entry) {
4078
+ if (typeof successCallback === 'function') {
4079
+ // create appropriate Entry object
4080
+ result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath);
4081
+ try {
4082
+ successCallback(result);
4083
+ }
4084
+ catch (e) {
4085
+ console.log('Error invoking callback: ' + e);
4086
+ }
4087
+ }
4088
+ }
4089
+ else {
4090
+ // no Entry object returned
4091
+ fail(FileError.NOT_FOUND_ERR);
4092
+ }
4093
+ };
4094
+
4095
+ exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]);
4096
+ };
4097
+
4098
+ });
4099
+
4100
+
4101
+ define('cordova/plugin/android/app', function(require, exports, module) {
4102
+ var exec = require('cordova/exec');
4103
+
4104
+ module.exports = {
4105
+ /**
4106
+ * Clear the resource cache.
4107
+ */
4108
+ clearCache:function() {
4109
+ exec(null, null, "App", "clearCache", []);
4110
+ },
4111
+
4112
+ /**
4113
+ * Load the url into the webview or into new browser instance.
4114
+ *
4115
+ * @param url The URL to load
4116
+ * @param props Properties that can be passed in to the activity:
4117
+ * wait: int => wait msec before loading URL
4118
+ * loadingDialog: "Title,Message" => display a native loading dialog
4119
+ * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error
4120
+ * clearHistory: boolean => clear webview history (default=false)
4121
+ * openExternal: boolean => open in a new browser (default=false)
4122
+ *
4123
+ * Example:
4124
+ * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
4125
+ */
4126
+ loadUrl:function(url, props) {
4127
+ exec(null, null, "App", "loadUrl", [url, props]);
4128
+ },
4129
+
4130
+ /**
4131
+ * Cancel loadUrl that is waiting to be loaded.
4132
+ */
4133
+ cancelLoadUrl:function() {
4134
+ exec(null, null, "App", "cancelLoadUrl", []);
4135
+ },
4136
+
4137
+ /**
4138
+ * Clear web history in this web view.
4139
+ * Instead of BACK button loading the previous web page, it will exit the app.
4140
+ */
4141
+ clearHistory:function() {
4142
+ exec(null, null, "App", "clearHistory", []);
4143
+ },
4144
+
4145
+ /**
4146
+ * Go to previous page displayed.
4147
+ * This is the same as pressing the backbutton on Android device.
4148
+ */
4149
+ backHistory:function() {
4150
+ exec(null, null, "App", "backHistory", []);
4151
+ },
4152
+
4153
+ /**
4154
+ * Override the default behavior of the Android back button.
4155
+ * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
4156
+ *
4157
+ * Note: The user should not have to call this method. Instead, when the user
4158
+ * registers for the "backbutton" event, this is automatically done.
4159
+ *
4160
+ * @param override T=override, F=cancel override
4161
+ */
4162
+ overrideBackbutton:function(override) {
4163
+ exec(null, null, "App", "overrideBackbutton", [override]);
4164
+ },
4165
+
4166
+ /**
4167
+ * Exit and terminate the application.
4168
+ */
4169
+ exitApp:function() {
4170
+ return exec(null, null, "App", "exitApp", []);
4171
+ }
4172
+ };
4173
+
4174
+ });
4175
+
4176
+ define('cordova/plugin/android/callback', function(require, exports, module) {
4177
+ var port = null,
4178
+ token = null,
4179
+ cordova = require('cordova'),
4180
+ polling = require('cordova/plugin/android/polling'),
4181
+ callback = function() {
4182
+ // Exit if shutting down app
4183
+ if (cordova.shuttingDown) {
4184
+ return;
4185
+ }
4186
+
4187
+ // If polling flag was changed, start using polling from now on
4188
+ if (cordova.UsePolling) {
4189
+ polling();
4190
+ return;
4191
+ }
4192
+
4193
+ var xmlhttp = new XMLHttpRequest();
4194
+
4195
+ // Callback function when XMLHttpRequest is ready
4196
+ xmlhttp.onreadystatechange=function(){
4197
+ if(xmlhttp.readyState === 4){
4198
+
4199
+ // Exit if shutting down app
4200
+ if (cordova.shuttingDown) {
4201
+ return;
4202
+ }
4203
+
4204
+ // If callback has JavaScript statement to execute
4205
+ if (xmlhttp.status === 200) {
4206
+
4207
+ // Need to url decode the response
4208
+ var msg = decodeURIComponent(xmlhttp.responseText);
4209
+ setTimeout(function() {
4210
+ try {
4211
+ var t = eval(msg);
4212
+ }
4213
+ catch (e) {
4214
+ // If we're getting an error here, seeing the message will help in debugging
4215
+ console.log("JSCallback: Message from Server: " + msg);
4216
+ console.log("JSCallback Error: "+e);
4217
+ }
4218
+ }, 1);
4219
+ setTimeout(callback, 1);
4220
+ }
4221
+
4222
+ // If callback ping (used to keep XHR request from timing out)
4223
+ else if (xmlhttp.status === 404) {
4224
+ setTimeout(callback, 10);
4225
+ }
4226
+
4227
+ // If security error
4228
+ else if (xmlhttp.status === 403) {
4229
+ console.log("JSCallback Error: Invalid token. Stopping callbacks.");
4230
+ }
4231
+
4232
+ // If server is stopping
4233
+ else if (xmlhttp.status === 503) {
4234
+ console.log("JSCallback Server Closed: Stopping callbacks.");
4235
+ }
4236
+
4237
+ // If request wasn't GET
4238
+ else if (xmlhttp.status === 400) {
4239
+ console.log("JSCallback Error: Bad request. Stopping callbacks.");
4240
+ }
4241
+
4242
+ // If error, revert to polling
4243
+ else {
4244
+ console.log("JSCallback Error: Request failed.");
4245
+ cordova.UsePolling = true;
4246
+ polling();
4247
+ }
4248
+ }
4249
+ };
4250
+
4251
+ if (port === null) {
4252
+ port = prompt("getPort", "gap_callbackServer:");
4253
+ }
4254
+ if (token === null) {
4255
+ token = prompt("getToken", "gap_callbackServer:");
4256
+ }
4257
+ xmlhttp.open("GET", "http://127.0.0.1:"+port+"/"+token , true);
4258
+ xmlhttp.send();
4259
+ };
4260
+
4261
+ module.exports = callback;
4262
+
4263
+ });
4264
+
4265
+ define('cordova/plugin/android/device', function(require, exports, module) {
4266
+ var channel = require('cordova/channel'),
4267
+ exec = require('cordova/exec');
4268
+
4269
+ /**
4270
+ * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the
4271
+ * phone, etc.
4272
+ * @constructor
4273
+ */
4274
+ function Device() {
4275
+ this.available = false;
4276
+ this.platform = null;
4277
+ this.version = null;
4278
+ this.name = null;
4279
+ this.uuid = null;
4280
+ this.cordova = null;
4281
+
4282
+ var me = this;
4283
+ this.getInfo(
4284
+ function(info) {
4285
+ me.available = true;
4286
+ me.platform = info.platform;
4287
+ me.version = info.version;
4288
+ me.name = info.name;
4289
+ me.uuid = info.uuid;
4290
+ me.cordova = info.cordova;
4291
+ channel.onCordovaInfoReady.fire();
4292
+ },
4293
+ function(e) {
4294
+ me.available = false;
4295
+ console.log("Error initializing Cordova: " + e);
4296
+ alert("Error initializing Cordova: "+e);
4297
+ });
4298
+ }
4299
+
4300
+ /**
4301
+ * Get device info
4302
+ *
4303
+ * @param {Function} successCallback The function to call when the heading data is available
4304
+ * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL)
4305
+ */
4306
+ Device.prototype.getInfo = function(successCallback, errorCallback) {
4307
+
4308
+ // successCallback required
4309
+ if (typeof successCallback !== "function") {
4310
+ console.log("Device Error: successCallback is not a function");
4311
+ return;
4312
+ }
4313
+
4314
+ // errorCallback optional
4315
+ if (errorCallback && (typeof errorCallback !== "function")) {
4316
+ console.log("Device Error: errorCallback is not a function");
4317
+ return;
4318
+ }
4319
+
4320
+ // Get info
4321
+ exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
4322
+ };
4323
+
4324
+ /*
4325
+ * DEPRECATED
4326
+ * This is only for Android.
4327
+ *
4328
+ * You must explicitly override the back button.
4329
+ */
4330
+ Device.prototype.overrideBackButton = function() {
4331
+ console.log("Device.overrideBackButton() is deprecated. Use App.overrideBackbutton(true).");
4332
+ navigator.app.overrideBackbutton(true);
4333
+ };
4334
+
4335
+ /*
4336
+ * DEPRECATED
4337
+ * This is only for Android.
4338
+ *
4339
+ * This resets the back button to the default behaviour
4340
+ */
4341
+ Device.prototype.resetBackButton = function() {
4342
+ console.log("Device.resetBackButton() is deprecated. Use App.overrideBackbutton(false).");
4343
+ navigator.app.overrideBackbutton(false);
4344
+ };
4345
+
4346
+ /*
4347
+ * DEPRECATED
4348
+ * This is only for Android.
4349
+ *
4350
+ * This terminates the activity!
4351
+ */
4352
+ Device.prototype.exitApp = function() {
4353
+ console.log("Device.exitApp() is deprecated. Use App.exitApp().");
4354
+ navigator.app.exitApp();
4355
+ };
4356
+
4357
+ module.exports = new Device();
4358
+
4359
+ });
4360
+
4361
+ define('cordova/plugin/android/polling', function(require, exports, module) {
4362
+ var cordova = require('cordova'),
4363
+ period = 50,
4364
+ polling = function() {
4365
+ // Exit if shutting down app
4366
+ if (cordova.shuttingDown) {
4367
+ return;
4368
+ }
4369
+
4370
+ // If polling flag was changed, stop using polling from now on and switch to XHR server / callback
4371
+ if (!cordova.UsePolling) {
4372
+ require('cordova/plugin/android/callback')();
4373
+ return;
4374
+ }
4375
+
4376
+ var msg = prompt("", "gap_poll:");
4377
+ if (msg) {
4378
+ setTimeout(function() {
4379
+ try {
4380
+ var t = eval(""+msg);
4381
+ }
4382
+ catch (e) {
4383
+ console.log("JSCallbackPolling: Message from Server: " + msg);
4384
+ console.log("JSCallbackPolling Error: "+e);
4385
+ }
4386
+ }, 1);
4387
+ setTimeout(polling, 1);
4388
+ }
4389
+ else {
4390
+ setTimeout(polling, period);
4391
+ }
4392
+ };
4393
+
4394
+ module.exports = polling;
4395
+
4396
+ });
4397
+
4398
+ define('cordova/plugin/android/storage', function(require, exports, module) {
4399
+ var utils = require('cordova/utils'),
4400
+ exec = require('cordova/exec');
4401
+
4402
+ var queryQueue = {};
4403
+
4404
+ /**
4405
+ * SQL result set object
4406
+ * PRIVATE METHOD
4407
+ * @constructor
4408
+ */
4409
+ var DroidDB_Rows = function() {
4410
+ this.resultSet = []; // results array
4411
+ this.length = 0; // number of rows
4412
+ };
4413
+
4414
+ /**
4415
+ * Get item from SQL result set
4416
+ *
4417
+ * @param row The row number to return
4418
+ * @return The row object
4419
+ */
4420
+ DroidDB_Rows.prototype.item = function(row) {
4421
+ return this.resultSet[row];
4422
+ };
4423
+
4424
+ /**
4425
+ * SQL result set that is returned to user.
4426
+ * PRIVATE METHOD
4427
+ * @constructor
4428
+ */
4429
+ var DroidDB_Result = function() {
4430
+ this.rows = new DroidDB_Rows();
4431
+ };
4432
+
4433
+ /**
4434
+ * Callback from native code when query is complete.
4435
+ * PRIVATE METHOD
4436
+ *
4437
+ * @param id Query id
4438
+ */
4439
+ function completeQuery(id, data) {
4440
+ var query = queryQueue[id];
4441
+ if (query) {
4442
+ try {
4443
+ delete queryQueue[id];
4444
+
4445
+ // Get transaction
4446
+ var tx = query.tx;
4447
+
4448
+ // If transaction hasn't failed
4449
+ // Note: We ignore all query results if previous query
4450
+ // in the same transaction failed.
4451
+ if (tx && tx.queryList[id]) {
4452
+
4453
+ // Save query results
4454
+ var r = new DroidDB_Result();
4455
+ r.rows.resultSet = data;
4456
+ r.rows.length = data.length;
4457
+ try {
4458
+ if (typeof query.successCallback === 'function') {
4459
+ query.successCallback(query.tx, r);
4460
+ }
4461
+ } catch (ex) {
4462
+ console.log("executeSql error calling user success callback: "+ex);
4463
+ }
4464
+
4465
+ tx.queryComplete(id);
4466
+ }
4467
+ } catch (e) {
4468
+ console.log("executeSql error: "+e);
4469
+ }
4470
+ }
4471
+ }
4472
+
4473
+ /**
4474
+ * Callback from native code when query fails
4475
+ * PRIVATE METHOD
4476
+ *
4477
+ * @param reason Error message
4478
+ * @param id Query id
4479
+ */
4480
+ function failQuery(reason, id) {
4481
+ var query = queryQueue[id];
4482
+ if (query) {
4483
+ try {
4484
+ delete queryQueue[id];
4485
+
4486
+ // Get transaction
4487
+ var tx = query.tx;
4488
+
4489
+ // If transaction hasn't failed
4490
+ // Note: We ignore all query results if previous query
4491
+ // in the same transaction failed.
4492
+ if (tx && tx.queryList[id]) {
4493
+ tx.queryList = {};
4494
+
4495
+ try {
4496
+ if (typeof query.errorCallback === 'function') {
4497
+ query.errorCallback(query.tx, reason);
4498
+ }
4499
+ } catch (ex) {
4500
+ console.log("executeSql error calling user error callback: "+ex);
4501
+ }
4502
+
4503
+ tx.queryFailed(id, reason);
4504
+ }
4505
+
4506
+ } catch (e) {
4507
+ console.log("executeSql error: "+e);
4508
+ }
4509
+ }
4510
+ }
4511
+
4512
+ /**
4513
+ * SQL query object
4514
+ * PRIVATE METHOD
4515
+ *
4516
+ * @constructor
4517
+ * @param tx The transaction object that this query belongs to
4518
+ */
4519
+ var DroidDB_Query = function(tx) {
4520
+
4521
+ // Set the id of the query
4522
+ this.id = utils.createUUID();
4523
+
4524
+ // Add this query to the queue
4525
+ queryQueue[this.id] = this;
4526
+
4527
+ // Init result
4528
+ this.resultSet = [];
4529
+
4530
+ // Set transaction that this query belongs to
4531
+ this.tx = tx;
4532
+
4533
+ // Add this query to transaction list
4534
+ this.tx.queryList[this.id] = this;
4535
+
4536
+ // Callbacks
4537
+ this.successCallback = null;
4538
+ this.errorCallback = null;
4539
+
4540
+ };
4541
+
4542
+ /**
4543
+ * Transaction object
4544
+ * PRIVATE METHOD
4545
+ * @constructor
4546
+ */
4547
+ var DroidDB_Tx = function() {
4548
+
4549
+ // Set the id of the transaction
4550
+ this.id = utils.createUUID();
4551
+
4552
+ // Callbacks
4553
+ this.successCallback = null;
4554
+ this.errorCallback = null;
4555
+
4556
+ // Query list
4557
+ this.queryList = {};
4558
+ };
4559
+
4560
+ /**
4561
+ * Mark query in transaction as complete.
4562
+ * If all queries are complete, call the user's transaction success callback.
4563
+ *
4564
+ * @param id Query id
4565
+ */
4566
+ DroidDB_Tx.prototype.queryComplete = function(id) {
4567
+ delete this.queryList[id];
4568
+
4569
+ // If no more outstanding queries, then fire transaction success
4570
+ if (this.successCallback) {
4571
+ var count = 0;
4572
+ var i;
4573
+ for (i in this.queryList) {
4574
+ if (this.queryList.hasOwnProperty(i)) {
4575
+ count++;
4576
+ }
4577
+ }
4578
+ if (count === 0) {
4579
+ try {
4580
+ this.successCallback();
4581
+ } catch(e) {
4582
+ console.log("Transaction error calling user success callback: " + e);
4583
+ }
4584
+ }
4585
+ }
4586
+ };
4587
+
4588
+ /**
4589
+ * Mark query in transaction as failed.
4590
+ *
4591
+ * @param id Query id
4592
+ * @param reason Error message
4593
+ */
4594
+ DroidDB_Tx.prototype.queryFailed = function(id, reason) {
4595
+
4596
+ // The sql queries in this transaction have already been run, since
4597
+ // we really don't have a real transaction implemented in native code.
4598
+ // However, the user callbacks for the remaining sql queries in transaction
4599
+ // will not be called.
4600
+ this.queryList = {};
4601
+
4602
+ if (this.errorCallback) {
4603
+ try {
4604
+ this.errorCallback(reason);
4605
+ } catch(e) {
4606
+ console.log("Transaction error calling user error callback: " + e);
4607
+ }
4608
+ }
4609
+ };
4610
+
4611
+ /**
4612
+ * Execute SQL statement
4613
+ *
4614
+ * @param sql SQL statement to execute
4615
+ * @param params Statement parameters
4616
+ * @param successCallback Success callback
4617
+ * @param errorCallback Error callback
4618
+ */
4619
+ DroidDB_Tx.prototype.executeSql = function(sql, params, successCallback, errorCallback) {
4620
+
4621
+ // Init params array
4622
+ if (typeof params === 'undefined') {
4623
+ params = [];
4624
+ }
4625
+
4626
+ // Create query and add to queue
4627
+ var query = new DroidDB_Query(this);
4628
+ queryQueue[query.id] = query;
4629
+
4630
+ // Save callbacks
4631
+ query.successCallback = successCallback;
4632
+ query.errorCallback = errorCallback;
4633
+
4634
+ // Call native code
4635
+ exec(null, null, "Storage", "executeSql", [sql, params, query.id]);
4636
+ };
4637
+
4638
+ var DatabaseShell = function() {
4639
+ };
4640
+
4641
+ /**
4642
+ * Start a transaction.
4643
+ * Does not support rollback in event of failure.
4644
+ *
4645
+ * @param process {Function} The transaction function
4646
+ * @param successCallback {Function}
4647
+ * @param errorCallback {Function}
4648
+ */
4649
+ DatabaseShell.prototype.transaction = function(process, errorCallback, successCallback) {
4650
+ var tx = new DroidDB_Tx();
4651
+ tx.successCallback = successCallback;
4652
+ tx.errorCallback = errorCallback;
4653
+ try {
4654
+ process(tx);
4655
+ } catch (e) {
4656
+ console.log("Transaction error: "+e);
4657
+ if (tx.errorCallback) {
4658
+ try {
4659
+ tx.errorCallback(e);
4660
+ } catch (ex) {
4661
+ console.log("Transaction error calling user error callback: "+e);
4662
+ }
4663
+ }
4664
+ }
4665
+ };
4666
+
4667
+ /**
4668
+ * Open database
4669
+ *
4670
+ * @param name Database name
4671
+ * @param version Database version
4672
+ * @param display_name Database display name
4673
+ * @param size Database size in bytes
4674
+ * @return Database object
4675
+ */
4676
+ var DroidDB_openDatabase = function(name, version, display_name, size) {
4677
+ exec(null, null, "Storage", "openDatabase", [name, version, display_name, size]);
4678
+ var db = new DatabaseShell();
4679
+ return db;
4680
+ };
4681
+
4682
+ /**
4683
+ * For browsers with no localStorage we emulate it with SQLite. Follows the w3c api.
4684
+ * TODO: Do similar for sessionStorage.
4685
+ * @constructor
4686
+ */
4687
+ var CupcakeLocalStorage = function() {
4688
+ try {
4689
+
4690
+ this.db = openDatabase('localStorage', '1.0', 'localStorage', 2621440);
4691
+ var storage = {};
4692
+ this.length = 0;
4693
+ function setLength (length) {
4694
+ this.length = length;
4695
+ localStorage.length = length;
4696
+ }
4697
+ this.db.transaction(
4698
+ function (transaction) {
4699
+ var i;
4700
+ transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
4701
+ transaction.executeSql('SELECT * FROM storage', [], function(tx, result) {
4702
+ for(var i = 0; i < result.rows.length; i++) {
4703
+ storage[result.rows.item(i)['id']] = result.rows.item(i)['body'];
4704
+ }
4705
+ setLength(result.rows.length);
4706
+ });
4707
+
4708
+ },
4709
+ function (err) {
4710
+ alert(err.message);
4711
+ }
4712
+ );
4713
+ this.setItem = function(key, val) {
4714
+ if (typeof(storage[key])=='undefined') {
4715
+ this.length++;
4716
+ }
4717
+ storage[key] = val;
4718
+ this.db.transaction(
4719
+ function (transaction) {
4720
+ transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
4721
+ transaction.executeSql('REPLACE INTO storage (id, body) values(?,?)', [key,val]);
4722
+ }
4723
+ );
4724
+ };
4725
+ this.getItem = function(key) {
4726
+ return storage[key];
4727
+ };
4728
+ this.removeItem = function(key) {
4729
+ delete storage[key];
4730
+ this.length--;
4731
+ this.db.transaction(
4732
+ function (transaction) {
4733
+ transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
4734
+ transaction.executeSql('DELETE FROM storage where id=?', [key]);
4735
+ }
4736
+ );
4737
+ };
4738
+ this.clear = function() {
4739
+ storage = {};
4740
+ this.length = 0;
4741
+ this.db.transaction(
4742
+ function (transaction) {
4743
+ transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))');
4744
+ transaction.executeSql('DELETE FROM storage', []);
4745
+ }
4746
+ );
4747
+ };
4748
+ this.key = function(index) {
4749
+ var i = 0;
4750
+ for (var j in storage) {
4751
+ if (i==index) {
4752
+ return j;
4753
+ } else {
4754
+ i++;
4755
+ }
4756
+ }
4757
+ return null;
4758
+ };
4759
+
4760
+ } catch(e) {
4761
+ alert("Database error "+e+".");
4762
+ return;
4763
+ }
4764
+ };
4765
+
4766
+ module.exports = {
4767
+ openDatabase:DroidDB_openDatabase,
4768
+ CupcakeLocalStorage:CupcakeLocalStorage,
4769
+ failQuery:failQuery,
4770
+ completeQuery:completeQuery
4771
+ };
4772
+
4773
+ });
4774
+ window.cordova = require('cordova');
4775
+ (function (context) {
4776
+ var channel = require("cordova/channel"),
4777
+ /**
4778
+ * cordova Channels that must fire before "deviceready" is fired.
4779
+ */
4780
+ deviceReadyChannelsArray = [channel.onCordovaReady, channel.onCordovaInfoReady, channel.onCordovaConnectionReady],
4781
+ deviceReadyChannelsMap = {},
4782
+ _self = {
4783
+ boot: function () {
4784
+ //---------------
4785
+ // Event handling
4786
+ //---------------
4787
+
4788
+ /**
4789
+ * Listen for DOMContentLoaded and notify our channel subscribers.
4790
+ */
4791
+ document.addEventListener('DOMContentLoaded', function() {
4792
+ channel.onDOMContentLoaded.fire();
4793
+ }, false);
4794
+ if (document.readyState == 'complete') {
4795
+ channel.onDOMContentLoaded.fire();
4796
+ }
4797
+
4798
+ /**
4799
+ * Create all cordova objects once page has fully loaded and native side is ready.
4800
+ */
4801
+ channel.join(function() {
4802
+ var builder = require('cordova/builder'),
4803
+ base = require('cordova/common'),
4804
+ platform = require('cordova/platform');
4805
+
4806
+ // Drop the common globals into the window object, but be nice and don't overwrite anything.
4807
+ builder.build(base.objects).intoButDontClobber(window);
4808
+
4809
+ // Drop the platform-specific globals into the window object and do it like a honey badger does it.
4810
+ builder.build(platform.objects).intoAndClobberTheFOutOf(window);
4811
+
4812
+ // Call the platform-specific initialization
4813
+ platform.initialize();
4814
+
4815
+ // Fire event to notify that all objects are created
4816
+ channel.onCordovaReady.fire();
4817
+
4818
+ // Fire onDeviceReady event once all constructors have run and
4819
+ // cordova info has been received from native side.
4820
+ channel.join(function() {
4821
+ channel.onDeviceReady.fire();
4822
+
4823
+ // Fire the onresume event, since first one happens before JavaScript is loaded
4824
+ channel.onResume.fire();
4825
+ }, deviceReadyChannelsArray);
4826
+
4827
+ }, [ channel.onDOMContentLoaded, channel.onNativeReady ]);
4828
+ }
4829
+ };
4830
+ // boot up once native side is ready
4831
+ channel.onNativeReady.subscribe(_self.boot);
4832
+
4833
+ // _nativeReady is global variable that the native side can set
4834
+ // to signify that the native code is ready. It is a global since
4835
+ // it may be called before any cordova JS is ready.
4836
+ if (window._nativeReady) {
4837
+ channel.onNativeReady.fire();
4838
+ }
4839
+
4840
+ }(window));
4841
+