Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated to version 0.9.6

  • Loading branch information...
commit 15ae7d101d619edaf63bb2bd713645582533d448 1 parent 2465729
@stevengill stevengill authored
Showing with 1,826 additions and 730 deletions.
  1. +1 −1  Android/Sample/assets/www/index.html
  2. +54 −70 Android/Sample/assets/www/{phonegap.0.9.5.1.js → phonegap.0.9.6.js}
  3. BIN  Android/Sample/libs/phonegap.0.9.5.1.jar
  4. BIN  Android/Sample/libs/phonegap.0.9.6.jar
  5. BIN  Android/phonegap.0.9.5.1.jar
  6. BIN  Android/phonegap.0.9.6.jar
  7. +54 −70 Android/{phonegap.0.9.5.1.js → phonegap.0.9.6.js}
  8. +8 −0 Android/phonegap.0.9.6.min.js
  9. +2 −1  Bada/VERSION
  10. +2 −2 BlackBerry-WebWorks/LICENSE
  11. +1 −1  BlackBerry-WebWorks/VERSION
  12. +4 −4 BlackBerry-WebWorks/build.xml
  13. +9 −0 BlackBerry-WebWorks/changes.txt
  14. +1 −1  BlackBerry-WebWorks/framework/ext/src/com/phonegap/device/Device.java
  15. +376 −0 BlackBerry-WebWorks/framework/ext/src/com/phonegap/network/ConnectionInfoAction.java
  16. +16 −2 BlackBerry-WebWorks/framework/ext/src/com/phonegap/network/Network.java
  17. +1 −1  BlackBerry-WebWorks/framework/ext/src/library.xml
  18. +22 −7 BlackBerry-WebWorks/javascript/_phonegap.js
  19. +51 −1 BlackBerry-WebWorks/javascript/network.js
  20. +1 −1  BlackBerry-WebWorks/template/project/www/config.xml
  21. +23 −3 BlackBerry-WebWorks/template/project/www/index.html
  22. 0  BlackBerry-WebWorks/template/project/www/{javascript → }/json2.js
  23. +7 −0 Documentation/_index.html
  24. +1 −1  Documentation/_index.json
  25. +5 −0 Documentation/index.html
  26. +13 −24 Documentation/phonegap_accelerometer_accelerometer.md.html
  27. +5 −7 Documentation/phonegap_camera_camera.md.html
  28. +10 −18 Documentation/phonegap_compass_compass.md.html
  29. +189 −0 Documentation/phonegap_connection_connection.md.html
  30. +25 −48 Documentation/phonegap_contacts_contacts.md.html
  31. +16 −30 Documentation/phonegap_device_device.md.html
  32. +313 −22 Documentation/phonegap_events_events.md.html
  33. +14 −25 Documentation/phonegap_file_file.md.html
  34. +16 −30 Documentation/phonegap_geolocation_geolocation.md.html
  35. +1 −0  Documentation/phonegap_media_capture_CaptureError.md.html
  36. +65 −8 Documentation/phonegap_media_capture_capture.md.html
  37. +19 −36 Documentation/phonegap_media_media.md.html
  38. +9 −11 Documentation/phonegap_network_network.md.html
  39. +13 −24 Documentation/phonegap_notification_notification.md.html
  40. +19 −36 Documentation/phonegap_storage_storage.md.html
  41. +2 −1  Symbian/VERSION
  42. +2 −0  VERSION
  43. +188 −0 changes.txt
  44. BIN  iOS/PhoneGapInstaller.pkg
  45. +139 −0 iOS/README.md
  46. +1 −2  webOS/Makefile
  47. +20 −21 webOS/README.md
  48. +2 −1  webOS/VERSION
  49. +2 −1  webOS/framework/appinfo.json
  50. +1 −2  webOS/framework/dashboard.html
  51. +66 −10 webOS/framework/index.html
  52. +13 −103 webOS/framework/phonegap.js
  53. +19 −1 webOS/js/device.js
  54. +0 −4 webOS/js/mojo.js
  55. +5 −0 webOS/js/phonegap.js.base
  56. +0 −99 webOS/js/storage.js
View
2  Android/Sample/assets/www/index.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap</title>
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="phonegap.0.9.5.1.js"></script>
+ <script type="text/javascript" charset="utf-8" src="phonegap.0.9.6.js"></script>
<script type="text/javascript" charset="utf-8" src="main.js"></script>
</head>
View
124 ...oid/Sample/assets/www/phonegap.0.9.5.1.js → Android/Sample/assets/www/phonegap.0.9.6.js
@@ -99,7 +99,7 @@ PhoneGap.Channel.prototype.subscribe = function(f, c, g) {
if (f === null) { return; }
var func = f;
- if (typeof c === "object" && f instanceof Function) { func = PhoneGap.close(c, f); }
+ if (typeof c === "object" && typeof f === "function") { func = PhoneGap.close(c, f); }
g = g || func.observer_guid || f.observer_guid || this.guid++;
func.observer_guid = g;
@@ -120,7 +120,7 @@ PhoneGap.Channel.prototype.subscribeOnce = function(f, c) {
_this.unsubscribe(g);
};
if (this.fired) {
- if (typeof c === "object" && f instanceof Function) { f = PhoneGap.close(c, f); }
+ if (typeof c === "object" && typeof f === "function") { f = PhoneGap.close(c, f); }
f.apply(this, this.fireArgs);
} else {
g = this.subscribe(m);
@@ -132,7 +132,7 @@ PhoneGap.Channel.prototype.subscribeOnce = function(f, c) {
* Unsubscribes the function with the given guid from the channel.
*/
PhoneGap.Channel.prototype.unsubscribe = function(g) {
- if (g instanceof Function) { g = g.observer_guid; }
+ if (typeof g === "function") { g = g.observer_guid; }
this.handlers[g] = null;
delete this.handlers[g];
};
@@ -147,7 +147,7 @@ PhoneGap.Channel.prototype.fire = function(e) {
for (item in this.handlers) {
if (this.handlers.hasOwnProperty(item)) {
handler = this.handlers[item];
- if (handler instanceof Function) {
+ if (typeof handler === "function") {
rv = (handler.apply(this, arguments) === false);
fail = fail || rv;
}
@@ -344,10 +344,13 @@ PhoneGap.Channel.join(function() {
}
else {
var polling = prompt("usePolling", "gap_callbackServer:");
+ PhoneGap.UsePolling = polling;
if (polling == "true") {
+ PhoneGap.UsePolling = true;
PhoneGap.JSCallbackPolling();
}
else {
+ PhoneGap.UsePolling = false;
PhoneGap.JSCallback();
}
}
@@ -507,7 +510,7 @@ PhoneGap.clone = function(obj) {
return retVal;
}
- if (obj instanceof Function) {
+ if (typeof obj === "function") {
return obj;
}
@@ -767,8 +770,8 @@ PhoneGap.JSCallback = function() {
// If callback has JavaScript statement to execute
if (xmlhttp.status === 200) {
- // Need to url decode the response and replace %20 with a space
- var msg = decodeURIComponent(xmlhttp.responseText.replace(/\+/g, '%20'));
+ // Need to url decode the response
+ var msg = decodeURIComponent(xmlhttp.responseText);
setTimeout(function() {
try {
var t = eval(msg);
@@ -802,13 +805,11 @@ PhoneGap.JSCallback = function() {
console.log("JSCallback Error: Bad request. Stopping callbacks.");
}
- // If error, restart callback server
+ // If error, revert to polling
else {
console.log("JSCallback Error: Request failed.");
- prompt("restartServer", "gap_callbackServer:");
- PhoneGap.JSCallbackPort = null;
- PhoneGap.JSCallbackToken = null;
- setTimeout(PhoneGap.JSCallback, 100);
+ PhoneGap.UsePolling = true;
+ PhoneGap.JSCallbackPolling();
}
}
};
@@ -935,7 +936,11 @@ PhoneGap.includeJavascript = function(jsfile, successCallback) {
*/
var PluginManager = {
addService: function(serviceType, className) {
- navigator.app.addService(serviceType, className);
+ try {
+ navigator.app.addService(serviceType, className);
+ } catch (e) {
+ console.log("Error adding service "+serviceType+": "+e);
+ }
}
};
@@ -1066,8 +1071,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1162,8 +1165,6 @@ PhoneGap.addConstructor(function() {
navigator.app = window.app = new App();
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1261,8 +1262,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1453,9 +1452,7 @@ PhoneGap.addConstructor(function(){
navigator.device.capture = window.device.capture = new Capture();
}
});
-}
-
-/*
+}/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
*
@@ -1574,8 +1571,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1885,8 +1880,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1930,8 +1923,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -2037,8 +2028,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3085,7 +3074,7 @@ LocalFileSystem.prototype._castDate = function(pluginResult) {
file.type = pluginResult.message.type;
file.name = pluginResult.message.name;
file.fullPath = pluginResult.message.fullPath;
- file.lastModifedDate = new Date(pluginResult.message.lastModifiedDate);
+ file.lastModifiedDate = new Date(pluginResult.message.lastModifiedDate);
pluginResult.message = file;
}
return pluginResult;
@@ -3102,8 +3091,6 @@ PhoneGap.addConstructor(function() {
if(typeof window.resolveLocalFileSystemURI == "undefined") window.resolveLocalFileSystemURI = pgLocalFileSystem.resolveLocalFileSystemURI;
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3189,8 +3176,6 @@ var FileUploadOptions = function(fileKey, fileName, mimeType, params) {
this.params = params || null;
};
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3389,17 +3374,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
-/*
- * PhoneGap is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- *
- * Copyright (c) 2005-2010, Nitobi Software Inc.
- * Copyright (c) 2010, IBM Corporation
- */
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3611,8 +3585,6 @@ PhoneGap.Media.onStatus = function(id, msg, value) {
}
};
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3680,29 +3652,49 @@ Network.prototype.isReachable = function(uri, callback, options) {
*/
var Connection = function() {
this.type = null;
- this.homeNW = null;
- this.currentNW = null;
+ this._firstRun = true;
+ this._timer = null;
+ this.timeout = 500;
var me = this;
this.getInfo(
- function(info) {
- me.type = info.type;
- me.homeNW = info.homeNW;
- me.currentNW = info.currentNW;
- PhoneGap.onPhoneGapConnectionReady.fire();
+ function(type) {
+ // Need to send events if we are on or offline
+ if (type == "none") {
+ // set a timer if still offline at the end of timer send the offline event
+ me._timer = setTimeout(function(){
+ me.type = type;
+ PhoneGap.fireEvent('offline');
+ me._timer = null;
+ }, me.timeout);
+ } else {
+ // If there is a current offline event pending clear it
+ if (me._timer != null) {
+ clearTimeout(me._timer);
+ me._timer = null;
+ }
+ me.type = type;
+ PhoneGap.fireEvent('online');
+ }
+
+ // should only fire this once
+ if (me._firstRun) {
+ me._firstRun = false;
+ PhoneGap.onPhoneGapConnectionReady.fire();
+ }
},
function(e) {
console.log("Error initializing Network Connection: " + e);
});
};
-Connection.UNKNOWN = 0;
-Connection.ETHERNET = 1;
-Connection.WIFI = 2;
-Connection.CELL_2G = 3;
-Connection.CELL_3G = 4;
-Connection.CELL_4G = 5;
-Connection.NONE = 20;
+Connection.UNKNOWN = "unknown";
+Connection.ETHERNET = "ethernet";
+Connection.WIFI = "wifi";
+Connection.CELL_2G = "2g";
+Connection.CELL_3G = "3g";
+Connection.CELL_4G = "4g";
+Connection.NONE = "none";
/**
* Get connection info
@@ -3725,8 +3717,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3849,8 +3839,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3940,8 +3928,6 @@ PositionError.PERMISSION_DENIED = 1;
PositionError.POSITION_UNAVAILABLE = 2;
PositionError.TIMEOUT = 3;
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -4370,5 +4356,3 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
View
BIN  Android/Sample/libs/phonegap.0.9.5.1.jar
Binary file not shown
View
BIN  Android/Sample/libs/phonegap.0.9.6.jar
Binary file not shown
View
BIN  Android/phonegap.0.9.5.1.jar
Binary file not shown
View
BIN  Android/phonegap.0.9.6.jar
Binary file not shown
View
124 Android/phonegap.0.9.5.1.js → Android/phonegap.0.9.6.js
@@ -99,7 +99,7 @@ PhoneGap.Channel.prototype.subscribe = function(f, c, g) {
if (f === null) { return; }
var func = f;
- if (typeof c === "object" && f instanceof Function) { func = PhoneGap.close(c, f); }
+ if (typeof c === "object" && typeof f === "function") { func = PhoneGap.close(c, f); }
g = g || func.observer_guid || f.observer_guid || this.guid++;
func.observer_guid = g;
@@ -120,7 +120,7 @@ PhoneGap.Channel.prototype.subscribeOnce = function(f, c) {
_this.unsubscribe(g);
};
if (this.fired) {
- if (typeof c === "object" && f instanceof Function) { f = PhoneGap.close(c, f); }
+ if (typeof c === "object" && typeof f === "function") { f = PhoneGap.close(c, f); }
f.apply(this, this.fireArgs);
} else {
g = this.subscribe(m);
@@ -132,7 +132,7 @@ PhoneGap.Channel.prototype.subscribeOnce = function(f, c) {
* Unsubscribes the function with the given guid from the channel.
*/
PhoneGap.Channel.prototype.unsubscribe = function(g) {
- if (g instanceof Function) { g = g.observer_guid; }
+ if (typeof g === "function") { g = g.observer_guid; }
this.handlers[g] = null;
delete this.handlers[g];
};
@@ -147,7 +147,7 @@ PhoneGap.Channel.prototype.fire = function(e) {
for (item in this.handlers) {
if (this.handlers.hasOwnProperty(item)) {
handler = this.handlers[item];
- if (handler instanceof Function) {
+ if (typeof handler === "function") {
rv = (handler.apply(this, arguments) === false);
fail = fail || rv;
}
@@ -344,10 +344,13 @@ PhoneGap.Channel.join(function() {
}
else {
var polling = prompt("usePolling", "gap_callbackServer:");
+ PhoneGap.UsePolling = polling;
if (polling == "true") {
+ PhoneGap.UsePolling = true;
PhoneGap.JSCallbackPolling();
}
else {
+ PhoneGap.UsePolling = false;
PhoneGap.JSCallback();
}
}
@@ -507,7 +510,7 @@ PhoneGap.clone = function(obj) {
return retVal;
}
- if (obj instanceof Function) {
+ if (typeof obj === "function") {
return obj;
}
@@ -767,8 +770,8 @@ PhoneGap.JSCallback = function() {
// If callback has JavaScript statement to execute
if (xmlhttp.status === 200) {
- // Need to url decode the response and replace %20 with a space
- var msg = decodeURIComponent(xmlhttp.responseText.replace(/\+/g, '%20'));
+ // Need to url decode the response
+ var msg = decodeURIComponent(xmlhttp.responseText);
setTimeout(function() {
try {
var t = eval(msg);
@@ -802,13 +805,11 @@ PhoneGap.JSCallback = function() {
console.log("JSCallback Error: Bad request. Stopping callbacks.");
}
- // If error, restart callback server
+ // If error, revert to polling
else {
console.log("JSCallback Error: Request failed.");
- prompt("restartServer", "gap_callbackServer:");
- PhoneGap.JSCallbackPort = null;
- PhoneGap.JSCallbackToken = null;
- setTimeout(PhoneGap.JSCallback, 100);
+ PhoneGap.UsePolling = true;
+ PhoneGap.JSCallbackPolling();
}
}
};
@@ -935,7 +936,11 @@ PhoneGap.includeJavascript = function(jsfile, successCallback) {
*/
var PluginManager = {
addService: function(serviceType, className) {
- navigator.app.addService(serviceType, className);
+ try {
+ navigator.app.addService(serviceType, className);
+ } catch (e) {
+ console.log("Error adding service "+serviceType+": "+e);
+ }
}
};
@@ -1066,8 +1071,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1162,8 +1165,6 @@ PhoneGap.addConstructor(function() {
navigator.app = window.app = new App();
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1261,8 +1262,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1453,9 +1452,7 @@ PhoneGap.addConstructor(function(){
navigator.device.capture = window.device.capture = new Capture();
}
});
-}
-
-/*
+}/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
*
@@ -1574,8 +1571,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1885,8 +1880,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -1930,8 +1923,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -2037,8 +2028,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3085,7 +3074,7 @@ LocalFileSystem.prototype._castDate = function(pluginResult) {
file.type = pluginResult.message.type;
file.name = pluginResult.message.name;
file.fullPath = pluginResult.message.fullPath;
- file.lastModifedDate = new Date(pluginResult.message.lastModifiedDate);
+ file.lastModifiedDate = new Date(pluginResult.message.lastModifiedDate);
pluginResult.message = file;
}
return pluginResult;
@@ -3102,8 +3091,6 @@ PhoneGap.addConstructor(function() {
if(typeof window.resolveLocalFileSystemURI == "undefined") window.resolveLocalFileSystemURI = pgLocalFileSystem.resolveLocalFileSystemURI;
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3189,8 +3176,6 @@ var FileUploadOptions = function(fileKey, fileName, mimeType, params) {
this.params = params || null;
};
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3389,17 +3374,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
-/*
- * PhoneGap is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- *
- * Copyright (c) 2005-2010, Nitobi Software Inc.
- * Copyright (c) 2010, IBM Corporation
- */
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3611,8 +3585,6 @@ PhoneGap.Media.onStatus = function(id, msg, value) {
}
};
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3680,29 +3652,49 @@ Network.prototype.isReachable = function(uri, callback, options) {
*/
var Connection = function() {
this.type = null;
- this.homeNW = null;
- this.currentNW = null;
+ this._firstRun = true;
+ this._timer = null;
+ this.timeout = 500;
var me = this;
this.getInfo(
- function(info) {
- me.type = info.type;
- me.homeNW = info.homeNW;
- me.currentNW = info.currentNW;
- PhoneGap.onPhoneGapConnectionReady.fire();
+ function(type) {
+ // Need to send events if we are on or offline
+ if (type == "none") {
+ // set a timer if still offline at the end of timer send the offline event
+ me._timer = setTimeout(function(){
+ me.type = type;
+ PhoneGap.fireEvent('offline');
+ me._timer = null;
+ }, me.timeout);
+ } else {
+ // If there is a current offline event pending clear it
+ if (me._timer != null) {
+ clearTimeout(me._timer);
+ me._timer = null;
+ }
+ me.type = type;
+ PhoneGap.fireEvent('online');
+ }
+
+ // should only fire this once
+ if (me._firstRun) {
+ me._firstRun = false;
+ PhoneGap.onPhoneGapConnectionReady.fire();
+ }
},
function(e) {
console.log("Error initializing Network Connection: " + e);
});
};
-Connection.UNKNOWN = 0;
-Connection.ETHERNET = 1;
-Connection.WIFI = 2;
-Connection.CELL_2G = 3;
-Connection.CELL_3G = 4;
-Connection.CELL_4G = 5;
-Connection.NONE = 20;
+Connection.UNKNOWN = "unknown";
+Connection.ETHERNET = "ethernet";
+Connection.WIFI = "wifi";
+Connection.CELL_2G = "2g";
+Connection.CELL_3G = "3g";
+Connection.CELL_4G = "4g";
+Connection.NONE = "none";
/**
* Get connection info
@@ -3725,8 +3717,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3849,8 +3839,6 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -3940,8 +3928,6 @@ PositionError.PERMISSION_DENIED = 1;
PositionError.POSITION_UNAVAILABLE = 2;
PositionError.TIMEOUT = 3;
}
-
-
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
@@ -4370,5 +4356,3 @@ PhoneGap.addConstructor(function() {
}
});
}
-
-
View
8 Android/phonegap.0.9.6.min.js
@@ -0,0 +1,8 @@
+/*
+ * PhoneGap is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ *
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+if(typeof PhoneGap==="undefined"){if(typeof(DeviceInfo)!=="object"){var DeviceInfo={}}var PhoneGap={queue:{ready:true,commands:[],timer:null}};PhoneGap.resources={base:true};PhoneGap.hasResource=function(name){return PhoneGap.resources[name]};PhoneGap.addResource=function(name){PhoneGap.resources[name]=true};PhoneGap.Channel=function(type){this.type=type;this.handlers={};this.guid=0;this.fired=false;this.enabled=true};PhoneGap.Channel.prototype.subscribe=function(f,c,g){if(f===null){return}var func=f;if(typeof c==="object"&&typeof f==="function"){func=PhoneGap.close(c,f)}g=g||func.observer_guid||f.observer_guid||this.guid++;func.observer_guid=g;f.observer_guid=g;this.handlers[g]=func;return g};PhoneGap.Channel.prototype.subscribeOnce=function(f,c){var g=null;var _this=this;var m=function(){f.apply(c||null,arguments);_this.unsubscribe(g)};if(this.fired){if(typeof c==="object"&&typeof f==="function"){f=PhoneGap.close(c,f)}f.apply(this,this.fireArgs)}else{g=this.subscribe(m)}return g};PhoneGap.Channel.prototype.unsubscribe=function(g){if(typeof g==="function"){g=g.observer_guid}this.handlers[g]=null;delete this.handlers[g]};PhoneGap.Channel.prototype.fire=function(e){if(this.enabled){var fail=false;var item,handler,rv;for(item in this.handlers){if(this.handlers.hasOwnProperty(item)){handler=this.handlers[item];if(typeof handler==="function"){rv=(handler.apply(this,arguments)===false);fail=fail||rv}}}this.fired=true;this.fireArgs=arguments;return !fail}return true};PhoneGap.Channel.join=function(h,c){var i=c.length;var f=function(){if(!(--i)){h()}};var len=i;var j;for(j=0;j<len;j++){if(!c[j].fired){c[j].subscribeOnce(f)}else{i--}}if(!i){h()}};PhoneGap.available=DeviceInfo.uuid!==undefined;PhoneGap.addConstructor=function(func){PhoneGap.onPhoneGapInit.subscribeOnce(function(){try{func()}catch(e){console.log("Failed to run constructor: "+e)}})};if(!window.plugins){window.plugins={}}PhoneGap.addPlugin=function(name,obj){if(!window.plugins[name]){window.plugins[name]=obj}else{console.log("Error: Plugin "+name+" already exists.")}};PhoneGap.onDOMContentLoaded=new PhoneGap.Channel("onDOMContentLoaded");PhoneGap.onNativeReady=new PhoneGap.Channel("onNativeReady");PhoneGap.onPhoneGapInit=new PhoneGap.Channel("onPhoneGapInit");PhoneGap.onPhoneGapReady=new PhoneGap.Channel("onPhoneGapReady");PhoneGap.onPhoneGapInfoReady=new PhoneGap.Channel("onPhoneGapInfoReady");PhoneGap.onPhoneGapConnectionReady=new PhoneGap.Channel("onPhoneGapConnectionReady");PhoneGap.onResume=new PhoneGap.Channel("onResume");PhoneGap.onPause=new PhoneGap.Channel("onPause");PhoneGap.onDestroy=new PhoneGap.Channel("onDestroy");PhoneGap.onDestroy.subscribeOnce(function(){PhoneGap.shuttingDown=true});PhoneGap.shuttingDown=false;if(typeof _nativeReady!=="undefined"){PhoneGap.onNativeReady.fire()}PhoneGap.onDeviceReady=new PhoneGap.Channel("onDeviceReady");PhoneGap.deviceReadyChannelsArray=[PhoneGap.onPhoneGapReady,PhoneGap.onPhoneGapInfoReady,PhoneGap.onPhoneGapConnectionReady];PhoneGap.deviceReadyChannelsMap={};PhoneGap.waitForInitialization=function(feature){if(feature){var channel=new PhoneGap.Channel(feature);PhoneGap.deviceReadyChannelsMap[feature]=channel;PhoneGap.deviceReadyChannelsArray.push(channel)}};PhoneGap.initializationComplete=function(feature){var channel=PhoneGap.deviceReadyChannelsMap[feature];if(channel){channel.fire()}};PhoneGap.Channel.join(function(){setTimeout(function(){if(PhoneGap.UsePolling){PhoneGap.JSCallbackPolling()}else{var polling=prompt("usePolling","gap_callbackServer:");PhoneGap.UsePolling=polling;if(polling=="true"){PhoneGap.UsePolling=true;PhoneGap.JSCallbackPolling()}else{PhoneGap.UsePolling=false;PhoneGap.JSCallback()}}},1);PhoneGap.onPhoneGapInit.fire();PhoneGap.onPhoneGapReady.fire();PhoneGap.Channel.join(function(){navigator.notification.activityStop();PhoneGap.onDeviceReady.fire();PhoneGap.onResume.fire()},PhoneGap.deviceReadyChannelsArray)},[PhoneGap.onDOMContentLoaded,PhoneGap.onNativeReady]);document.addEventListener("DOMContentLoaded",function(){PhoneGap.onDOMContentLoaded.fire()},false);PhoneGap.m_document_addEventListener=document.addEventListener;document.addEventListener=function(evt,handler,capture){var e=evt.toLowerCase();if(e==="deviceready"){PhoneGap.onDeviceReady.subscribeOnce(handler)}else{if(e==="resume"){PhoneGap.onResume.subscribe(handler);if(PhoneGap.onDeviceReady.fired){PhoneGap.onResume.fire()}}else{if(e==="pause"){PhoneGap.onPause.subscribe(handler)}else{if(e==="backbutton"){PhoneGap.exec(null,null,"App","overrideBackbutton",[true])}PhoneGap.m_document_addEventListener.call(document,evt,handler,capture)}}}};PhoneGap.m_document_removeEventListener=document.removeEventListener;document.removeEventListener=function(evt,handler,capture){var e=evt.toLowerCase();if(e==="backbutton"){PhoneGap.exec(null,null,"App","overrideBackbutton",[false])}PhoneGap.m_document_removeEventListener.call(document,evt,handler,capture)};PhoneGap.fireEvent=function(type){var e=document.createEvent("Events");e.initEvent(type);document.dispatchEvent(e)};PhoneGap.stringify=function(args){if(typeof JSON==="undefined"){var s="[";var i,type,start,name,nameType,a;for(i=0;i<args.length;i++){if(args[i]!==null){if(i>0){s=s+","}type=typeof args[i];if((type==="number")||(type==="boolean")){s=s+args[i]}else{if(args[i] instanceof Array){s=s+"["+args[i]+"]"}else{if(args[i] instanceof Object){start=true;s=s+"{";for(name in args[i]){if(args[i][name]!==null){if(!start){s=s+","}s=s+'"'+name+'":';nameType=typeof args[i][name];if((nameType==="number")||(nameType==="boolean")){s=s+args[i][name]}else{if((typeof args[i][name])==="function"){s=s+'""'}else{if(args[i][name] instanceof Object){s=s+PhoneGap.stringify(args[i][name])}else{s=s+'"'+args[i][name]+'"'}}}start=false}}s=s+"}"}else{a=args[i].replace(/\\/g,"\\\\");a=a.replace(/"/g,'\\"');s=s+'"'+a+'"'}}}}}s=s+"]";return s}else{return JSON.stringify(args)}};PhoneGap.clone=function(obj){var i,retVal;if(!obj){return obj}if(obj instanceof Array){retVal=[];for(i=0;i<obj.length;++i){retVal.push(PhoneGap.clone(obj[i]))}return retVal}if(typeof obj==="function"){return obj}if(!(obj instanceof Object)){return obj}if(obj instanceof Date){return obj}retVal={};for(i in obj){if(!(i in retVal)||retVal[i]!==obj[i]){retVal[i]=PhoneGap.clone(obj[i])}}return retVal};PhoneGap.callbackId=0;PhoneGap.callbacks={};PhoneGap.callbackStatus={NO_RESULT:0,OK:1,CLASS_NOT_FOUND_EXCEPTION:2,ILLEGAL_ACCESS_EXCEPTION:3,INSTANTIATION_EXCEPTION:4,MALFORMED_URL_EXCEPTION:5,IO_EXCEPTION:6,INVALID_ACTION:7,JSON_EXCEPTION:8,ERROR:9};PhoneGap.exec=function(success,fail,service,action,args){try{var callbackId=service+PhoneGap.callbackId++;if(success||fail){PhoneGap.callbacks[callbackId]={success:success,fail:fail}}var r=prompt(PhoneGap.stringify(args),"gap:"+PhoneGap.stringify([service,action,callbackId,true]));if(r.length>0){eval("var v="+r+";");if(v.status===PhoneGap.callbackStatus.OK){if(success){try{success(v.message)}catch(e){console.log("Error in success callback: "+callbackId+" = "+e)}if(!v.keepCallback){delete PhoneGap.callbacks[callbackId]}}return v.message}else{if(v.status===PhoneGap.callbackStatus.NO_RESULT){if(!v.keepCallback){delete PhoneGap.callbacks[callbackId]}}else{console.log("Error: Status="+v.status+" Message="+v.message);if(fail){try{fail(v.message)}catch(e1){console.log("Error in error callback: "+callbackId+" = "+e1)}if(!v.keepCallback){delete PhoneGap.callbacks[callbackId]}}return null}}}}catch(e2){console.log("Error: "+e2)}};PhoneGap.callbackSuccess=function(callbackId,args){if(PhoneGap.callbacks[callbackId]){if(args.status===PhoneGap.callbackStatus.OK){try{if(PhoneGap.callbacks[callbackId].success){PhoneGap.callbacks[callbackId].success(args.message)}}catch(e){console.log("Error in success callback: "+callbackId+" = "+e)}}if(!args.keepCallback){delete PhoneGap.callbacks[callbackId]}}};PhoneGap.callbackError=function(callbackId,args){if(PhoneGap.callbacks[callbackId]){try{if(PhoneGap.callbacks[callbackId].fail){PhoneGap.callbacks[callbackId].fail(args.message)}}catch(e){console.log("Error in error callback: "+callbackId+" = "+e)}if(!args.keepCallback){delete PhoneGap.callbacks[callbackId]}}};PhoneGap.run_command=function(){if(!PhoneGap.available||!PhoneGap.queue.ready){return}PhoneGap.queue.ready=false;var args=PhoneGap.queue.commands.shift();if(PhoneGap.queue.commands.length===0){clearInterval(PhoneGap.queue.timer);PhoneGap.queue.timer=null}var uri=[];var dict=null;var i;for(i=1;i<args.length;i++){var arg=args[i];if(arg===undefined||arg===null){arg=""}if(typeof(arg)==="object"){dict=arg}else{uri.push(encodeURIComponent(arg))}}var url="gap://"+args[0]+"/"+uri.join("/");if(dict!==null){var name;var query_args=[];for(name in dict){if(dict.hasOwnProperty(name)&&(typeof(name)==="string")){query_args.push(encodeURIComponent(name)+"="+encodeURIComponent(dict[name]))}}if(query_args.length>0){url+="?"+query_args.join("&")}}document.location=url};PhoneGap.JSCallbackPort=null;PhoneGap.JSCallbackToken=null;PhoneGap.JSCallback=function(){if(PhoneGap.shuttingDown){return}if(PhoneGap.UsePolling){PhoneGap.JSCallbackPolling();return}var xmlhttp=new XMLHttpRequest();xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState===4){if(PhoneGap.shuttingDown){return}if(xmlhttp.status===200){var msg=decodeURIComponent(xmlhttp.responseText);setTimeout(function(){try{var t=eval(msg)}catch(e){console.log("JSCallback: Message from Server: "+msg);console.log("JSCallback Error: "+e)}},1);setTimeout(PhoneGap.JSCallback,1)}else{if(xmlhttp.status===404){setTimeout(PhoneGap.JSCallback,10)}else{if(xmlhttp.status===403){console.log("JSCallback Error: Invalid token. Stopping callbacks.")}else{if(xmlhttp.status===503){console.log("JSCallback Error: Service unavailable. Stopping callbacks.")}else{if(xmlhttp.status===400){console.log("JSCallback Error: Bad request. Stopping callbacks.")}else{console.log("JSCallback Error: Request failed.");PhoneGap.UsePolling=true;PhoneGap.JSCallbackPolling()}}}}}}};if(PhoneGap.JSCallbackPort===null){PhoneGap.JSCallbackPort=prompt("getPort","gap_callbackServer:")}if(PhoneGap.JSCallbackToken===null){PhoneGap.JSCallbackToken=prompt("getToken","gap_callbackServer:")}xmlhttp.open("GET","http://127.0.0.1:"+PhoneGap.JSCallbackPort+"/"+PhoneGap.JSCallbackToken,true);xmlhttp.send()};PhoneGap.JSCallbackPollingPeriod=50;PhoneGap.UsePolling=false;PhoneGap.JSCallbackPolling=function(){if(PhoneGap.shuttingDown){return}if(!PhoneGap.UsePolling){PhoneGap.JSCallback();return}var msg=prompt("","gap_poll:");if(msg){setTimeout(function(){try{var t=eval(""+msg)}catch(e){console.log("JSCallbackPolling: Message from Server: "+msg);console.log("JSCallbackPolling Error: "+e)}},1);setTimeout(PhoneGap.JSCallbackPolling,1)}else{setTimeout(PhoneGap.JSCallbackPolling,PhoneGap.JSCallbackPollingPeriod)}};PhoneGap.createUUID=function(){return PhoneGap.UUIDcreatePart(4)+"-"+PhoneGap.UUIDcreatePart(2)+"-"+PhoneGap.UUIDcreatePart(2)+"-"+PhoneGap.UUIDcreatePart(2)+"-"+PhoneGap.UUIDcreatePart(6)};PhoneGap.UUIDcreatePart=function(length){var uuidpart="";var i,uuidchar;for(i=0;i<length;i++){uuidchar=parseInt((Math.random()*256),0).toString(16);if(uuidchar.length===1){uuidchar="0"+uuidchar}uuidpart+=uuidchar}return uuidpart};PhoneGap.close=function(context,func,params){if(typeof params==="undefined"){return function(){return func.apply(context,arguments)}}else{return function(){return func.apply(context,params)}}};PhoneGap.includeJavascript=function(jsfile,successCallback){var id=document.getElementsByTagName("head")[0];var el=document.createElement("script");el.type="text/javascript";if(typeof successCallback==="function"){el.onload=successCallback}el.src=jsfile;id.appendChild(el)};var PluginManager={addService:function(serviceType,className){try{navigator.app.addService(serviceType,className)}catch(e){console.log("Error adding service "+serviceType+": "+e)}}}}if(!PhoneGap.hasResource("accelerometer")){PhoneGap.addResource("accelerometer");var Acceleration=function(x,y,z){this.x=x;this.y=y;this.z=z;this.timestamp=new Date().getTime()};var Accelerometer=function(){this.lastAcceleration=null;this.timers={}};Accelerometer.ERROR_MSG=["Not running","Starting","","Failed to start"];Accelerometer.prototype.getCurrentAcceleration=function(successCallback,errorCallback,options){if(typeof successCallback!=="function"){console.log("Accelerometer Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!=="function")){console.log("Accelerometer Error: errorCallback is not a function");return}PhoneGap.exec(successCallback,errorCallback,"Accelerometer","getAcceleration",[])};Accelerometer.prototype.watchAcceleration=function(successCallback,errorCallback,options){var frequency=(options!==undefined)?options.frequency:10000;if(typeof successCallback!=="function"){console.log("Accelerometer Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!=="function")){console.log("Accelerometer Error: errorCallback is not a function");return}PhoneGap.exec(function(timeout){if(timeout<(frequency+10000)){PhoneGap.exec(null,null,"Accelerometer","setTimeout",[frequency+10000])}},function(e){},"Accelerometer","getTimeout",[]);var id=PhoneGap.createUUID();navigator.accelerometer.timers[id]=setInterval(function(){PhoneGap.exec(successCallback,errorCallback,"Accelerometer","getAcceleration",[])},(frequency?frequency:1));return id};Accelerometer.prototype.clearWatch=function(id){if(id&&navigator.accelerometer.timers[id]!==undefined){clearInterval(navigator.accelerometer.timers[id]);delete navigator.accelerometer.timers[id]}};PhoneGap.addConstructor(function(){if(typeof navigator.accelerometer==="undefined"){navigator.accelerometer=new Accelerometer()}})}if(!PhoneGap.hasResource("app")){PhoneGap.addResource("app");var App=function(){};App.prototype.clearCache=function(){PhoneGap.exec(null,null,"App","clearCache",[])};App.prototype.loadUrl=function(url,props){PhoneGap.exec(null,null,"App","loadUrl",[url,props])};App.prototype.cancelLoadUrl=function(){PhoneGap.exec(null,null,"App","cancelLoadUrl",[])};App.prototype.clearHistory=function(){PhoneGap.exec(null,null,"App","clearHistory",[])};App.prototype.addService=function(serviceType,className){PhoneGap.exec(null,null,"App","addService",[serviceType,className])};App.prototype.overrideBackbutton=function(override){PhoneGap.exec(null,null,"App","overrideBackbutton",[override])};App.prototype.exitApp=function(){return PhoneGap.exec(null,null,"App","exitApp",[])};PhoneGap.addConstructor(function(){navigator.app=window.app=new App()})}if(!PhoneGap.hasResource("camera")){PhoneGap.addResource("camera");var Camera=function(){this.successCallback=null;this.errorCallback=null;this.options=null};Camera.DestinationType={DATA_URL:0,FILE_URI:1};Camera.prototype.DestinationType=Camera.DestinationType;Camera.PictureSourceType={PHOTOLIBRARY:0,CAMERA:1,SAVEDPHOTOALBUM:2};Camera.prototype.PictureSourceType=Camera.PictureSourceType;Camera.prototype.getPicture=function(successCallback,errorCallback,options){if(typeof successCallback!=="function"){console.log("Camera Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!=="function")){console.log("Camera Error: errorCallback is not a function");return}this.options=options;var quality=80;if(options.quality){quality=this.options.quality}var destinationType=Camera.DestinationType.DATA_URL;if(this.options.destinationType){destinationType=this.options.destinationType}var sourceType=Camera.PictureSourceType.CAMERA;if(typeof this.options.sourceType==="number"){sourceType=this.options.sourceType}PhoneGap.exec(successCallback,errorCallback,"Camera","takePicture",[quality,destinationType,sourceType])};PhoneGap.addConstructor(function(){if(typeof navigator.camera==="undefined"){navigator.camera=new Camera()}})}if(!PhoneGap.hasResource("capture")){PhoneGap.addResource("capture");var MediaFile=function(name,fullPath,type,lastModifiedDate,size){this.name=name||null;this.fullPath=fullPath||null;this.type=type||null;this.lastModifiedDate=lastModifiedDate||null;this.size=size||0};MediaFile.prototype.getFormatData=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"Capture","getFormatData",[this.fullPath,this.type])};var MediaFileData=function(codecs,bitrate,height,width,duration){this.codecs=codecs||null;this.bitrate=bitrate||0;this.height=height||0;this.width=width||0;this.duration=duration||0};var CaptureError=function(){this.code=null};CaptureError.CAPTURE_INTERNAL_ERR=0;CaptureError.CAPTURE_APPLICATION_BUSY=1;CaptureError.CAPTURE_INVALID_ARGUMENT=2;CaptureError.CAPTURE_NO_MEDIA_FILES=3;CaptureError.CAPTURE_NOT_SUPPORTED=20;var Capture=function(){this.supportedAudioModes=[];this.supportedImageModes=[];this.supportedVideoModes=[]};Capture.prototype.captureAudio=function(successCallback,errorCallback,options){PhoneGap.exec(successCallback,errorCallback,"Capture","captureAudio",[options])};Capture.prototype.captureImage=function(successCallback,errorCallback,options){PhoneGap.exec(successCallback,errorCallback,"Capture","captureImage",[options])};Capture.prototype._castMediaFile=function(pluginResult){var mediaFiles=[];var i;for(i=0;i<pluginResult.message.length;i++){var mediaFile=new MediaFile();mediaFile.name=pluginResult.message[i].name;mediaFile.fullPath=pluginResult.message[i].fullPath;mediaFile.type=pluginResult.message[i].type;mediaFile.lastModifiedDate=pluginResult.message[i].lastModifiedDate;mediaFile.size=pluginResult.message[i].size;mediaFiles.push(mediaFile)}pluginResult.message=mediaFiles;return pluginResult};Capture.prototype.captureVideo=function(successCallback,errorCallback,options){PhoneGap.exec(successCallback,errorCallback,"Capture","captureVideo",[options])};var ConfigurationData=function(){this.type=null;this.height=0;this.width=0};var CaptureImageOptions=function(){this.limit=1;this.mode=null};var CaptureVideoOptions=function(){this.limit=1;this.duration=0;this.mode=null};var CaptureAudioOptions=function(){this.limit=1;this.duration=0;this.mode=null};PhoneGap.addConstructor(function(){if(typeof navigator.device==="undefined"){navigator.device=window.device=new Device()}if(typeof navigator.device.capture==="undefined"){navigator.device.capture=window.device.capture=new Capture()}})}if(!PhoneGap.hasResource("compass")){PhoneGap.addResource("compass");var Compass=function(){this.lastHeading=null;this.timers={}};Compass.ERROR_MSG=["Not running","Starting","","Failed to start"];Compass.prototype.getCurrentHeading=function(successCallback,errorCallback,options){if(typeof successCallback!=="function"){console.log("Compass Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!=="function")){console.log("Compass Error: errorCallback is not a function");return}PhoneGap.exec(successCallback,errorCallback,"Compass","getHeading",[])};Compass.prototype.watchHeading=function(successCallback,errorCallback,options){var frequency=(options!==undefined)?options.frequency:100;if(typeof successCallback!=="function"){console.log("Compass Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!=="function")){console.log("Compass Error: errorCallback is not a function");return}PhoneGap.exec(function(timeout){if(timeout<(frequency+10000)){PhoneGap.exec(null,null,"Compass","setTimeout",[frequency+10000])}},function(e){},"Compass","getTimeout",[]);var id=PhoneGap.createUUID();navigator.compass.timers[id]=setInterval(function(){PhoneGap.exec(successCallback,errorCallback,"Compass","getHeading",[])},(frequency?frequency:1));return id};Compass.prototype.clearWatch=function(id){if(id&&navigator.compass.timers[id]){clearInterval(navigator.compass.timers[id]);delete navigator.compass.timers[id]}};PhoneGap.addConstructor(function(){if(typeof navigator.compass==="undefined"){navigator.compass=new Compass()}})}if(!PhoneGap.hasResource("contact")){PhoneGap.addResource("contact");var Contact=function(id,displayName,name,nickname,phoneNumbers,emails,addresses,ims,organizations,revision,birthday,gender,note,photos,categories,urls,timezone){this.id=id||null;this.rawId=null;this.displayName=displayName||null;this.name=name||null;this.nickname=nickname||null;this.phoneNumbers=phoneNumbers||null;this.emails=emails||null;this.addresses=addresses||null;this.ims=ims||null;this.organizations=organizations||null;this.revision=revision||null;this.birthday=birthday||null;this.gender=gender||null;this.note=note||null;this.photos=photos||null;this.categories=categories||null;this.urls=urls||null;this.timezone=timezone||null};var ContactError=function(){this.code=null};ContactError.UNKNOWN_ERROR=0;ContactError.INVALID_ARGUMENT_ERROR=1;ContactError.NOT_FOUND_ERROR=2;ContactError.TIMEOUT_ERROR=3;ContactError.PENDING_OPERATION_ERROR=4;ContactError.IO_ERROR=5;ContactError.NOT_SUPPORTED_ERROR=6;ContactError.PERMISSION_DENIED_ERROR=20;Contact.prototype.remove=function(successCB,errorCB){if(this.id===null){var errorObj=new ContactError();errorObj.code=ContactError.NOT_FOUND_ERROR;errorCB(errorObj)}else{PhoneGap.exec(successCB,errorCB,"Contacts","remove",[this.id])}};Contact.prototype.clone=function(){var clonedContact=PhoneGap.clone(this);var i;clonedContact.id=null;clonedContact.rawId=null;if(clonedContact.phoneNumbers){for(i=0;i<clonedContact.phoneNumbers.length;i++){clonedContact.phoneNumbers[i].id=null}}if(clonedContact.emails){for(i=0;i<clonedContact.emails.length;i++){clonedContact.emails[i].id=null}}if(clonedContact.addresses){for(i=0;i<clonedContact.addresses.length;i++){clonedContact.addresses[i].id=null}}if(clonedContact.ims){for(i=0;i<clonedContact.ims.length;i++){clonedContact.ims[i].id=null}}if(clonedContact.organizations){for(i=0;i<clonedContact.organizations.length;i++){clonedContact.organizations[i].id=null}}if(clonedContact.tags){for(i=0;i<clonedContact.tags.length;i++){clonedContact.tags[i].id=null}}if(clonedContact.photos){for(i=0;i<clonedContact.photos.length;i++){clonedContact.photos[i].id=null}}if(clonedContact.urls){for(i=0;i<clonedContact.urls.length;i++){clonedContact.urls[i].id=null}}return clonedContact};Contact.prototype.save=function(successCB,errorCB){PhoneGap.exec(successCB,errorCB,"Contacts","save",[this])};var ContactName=function(formatted,familyName,givenName,middle,prefix,suffix){this.formatted=formatted||null;this.familyName=familyName||null;this.givenName=givenName||null;this.middleName=middle||null;this.honorificPrefix=prefix||null;this.honorificSuffix=suffix||null};var ContactField=function(type,value,pref){this.id=null;this.type=type||null;this.value=value||null;this.pref=pref||null};var ContactAddress=function(formatted,streetAddress,locality,region,postalCode,country){this.id=null;this.formatted=formatted||null;this.streetAddress=streetAddress||null;this.locality=locality||null;this.region=region||null;this.postalCode=postalCode||null;this.country=country||null};var ContactOrganization=function(name,dept,title){this.id=null;this.name=name||null;this.department=dept||null;this.title=title||null};var Contacts=function(){this.inProgress=false;this.records=[]};Contacts.prototype.find=function(fields,successCB,errorCB,options){PhoneGap.exec(successCB,errorCB,"Contacts","search",[fields,options])};Contacts.prototype.create=function(properties){var i;var contact=new Contact();for(i in properties){if(contact[i]!=="undefined"){contact[i]=properties[i]}}return contact};Contacts.prototype.cast=function(pluginResult){var contacts=[];var i;for(i=0;i<pluginResult.message.length;i++){contacts.push(navigator.service.contacts.create(pluginResult.message[i]))}pluginResult.message=contacts;return pluginResult};var ContactFindOptions=function(filter,multiple,updatedSince){this.filter=filter||"";this.multiple=multiple||true;this.updatedSince=updatedSince||""};PhoneGap.addConstructor(function(){if(typeof navigator.service==="undefined"){navigator.service={}}if(typeof navigator.service.contacts==="undefined"){navigator.service.contacts=new Contacts()}})}if(!PhoneGap.hasResource("crypto")){PhoneGap.addResource("crypto");var Crypto=function(){};Crypto.prototype.encrypt=function(seed,string,callback){this.encryptWin=callback;PhoneGap.exec(null,null,"Crypto","encrypt",[seed,string])};Crypto.prototype.decrypt=function(seed,string,callback){this.decryptWin=callback;PhoneGap.exec(null,null,"Crypto","decrypt",[seed,string])};Crypto.prototype.gotCryptedString=function(string){this.encryptWin(string)};Crypto.prototype.getPlainString=function(string){this.decryptWin(string)};PhoneGap.addConstructor(function(){if(typeof navigator.Crypto==="undefined"){navigator.Crypto=new Crypto()}})}if(!PhoneGap.hasResource("device")){PhoneGap.addResource("device");var Device=function(){this.available=PhoneGap.available;this.platform=null;this.version=null;this.name=null;this.uuid=null;this.phonegap=null;var me=this;this.getInfo(function(info){me.available=true;me.platform=info.platform;me.version=info.version;me.name=info.name;me.uuid=info.uuid;me.phonegap=info.phonegap;PhoneGap.onPhoneGapInfoReady.fire()},function(e){me.available=false;console.log("Error initializing PhoneGap: "+e);alert("Error initializing PhoneGap: "+e)})};Device.prototype.getInfo=function(successCallback,errorCallback){if(typeof successCallback!=="function"){console.log("Device Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!=="function")){console.log("Device Error: errorCallback is not a function");return}PhoneGap.exec(successCallback,errorCallback,"Device","getDeviceInfo",[])};Device.prototype.overrideBackButton=function(){console.log("Device.overrideBackButton() is deprecated. Use App.overrideBackbutton(true).");navigator.app.overrideBackbutton(true)};Device.prototype.resetBackButton=function(){console.log("Device.resetBackButton() is deprecated. Use App.overrideBackbutton(false).");navigator.app.overrideBackbutton(false)};Device.prototype.exitApp=function(){console.log("Device.exitApp() is deprecated. Use App.exitApp().");navigator.app.exitApp()};PhoneGap.addConstructor(function(){if(typeof navigator.device==="undefined"){navigator.device=window.device=new Device()}})}if(!PhoneGap.hasResource("file")){PhoneGap.addResource("file");var FileProperties=function(filePath){this.filePath=filePath;this.size=0;this.lastModifiedDate=null};var File=function(name,fullPath,type,lastModifiedDate,size){this.name=name||null;this.fullPath=fullPath||null;this.type=type||null;this.lastModifiedDate=lastModifiedDate||null;this.size=size||0};var FileError=function(){this.code=null};FileError.NOT_FOUND_ERR=1;FileError.SECURITY_ERR=2;FileError.ABORT_ERR=3;FileError.NOT_READABLE_ERR=4;FileError.ENCODING_ERR=5;FileError.NO_MODIFICATION_ALLOWED_ERR=6;FileError.INVALID_STATE_ERR=7;FileError.SYNTAX_ERR=8;FileError.INVALID_MODIFICATION_ERR=9;FileError.QUOTA_EXCEEDED_ERR=10;FileError.TYPE_MISMATCH_ERR=11;FileError.PATH_EXISTS_ERR=12;var FileMgr=function(){};FileMgr.prototype.getFileProperties=function(filePath){return PhoneGap.exec(null,null,"File","getFileProperties",[filePath])};FileMgr.prototype.getFileBasePaths=function(){};FileMgr.prototype.testSaveLocationExists=function(successCallback,errorCallback){return PhoneGap.exec(successCallback,errorCallback,"File","testSaveLocationExists",[])};FileMgr.prototype.testFileExists=function(fileName,successCallback,errorCallback){return PhoneGap.exec(successCallback,errorCallback,"File","testFileExists",[fileName])};FileMgr.prototype.testDirectoryExists=function(dirName,successCallback,errorCallback){return PhoneGap.exec(successCallback,errorCallback,"File","testDirectoryExists",[dirName])};FileMgr.prototype.getFreeDiskSpace=function(successCallback,errorCallback){return PhoneGap.exec(successCallback,errorCallback,"File","getFreeDiskSpace",[])};FileMgr.prototype.writeAsText=function(fileName,data,append,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","writeAsText",[fileName,data,append])};FileMgr.prototype.write=function(fileName,data,position,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","write",[fileName,data,position])};FileMgr.prototype.truncate=function(fileName,size,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","truncate",[fileName,size])};FileMgr.prototype.readAsText=function(fileName,encoding,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","readAsText",[fileName,encoding])};FileMgr.prototype.readAsDataURL=function(fileName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","readAsDataURL",[fileName])};PhoneGap.addConstructor(function(){if(typeof navigator.fileMgr==="undefined"){navigator.fileMgr=new FileMgr()}});var FileReader=function(){this.fileName="";this.readyState=0;this.result=null;this.error=null;this.onloadstart=null;this.onprogress=null;this.onload=null;this.onerror=null;this.onloadend=null;this.onabort=null};FileReader.EMPTY=0;FileReader.LOADING=1;FileReader.DONE=2;FileReader.prototype.abort=function(){var evt;this.readyState=FileReader.DONE;this.result=null;var error=new FileError();error.code=error.ABORT_ERR;this.error=error;if(typeof this.onerror==="function"){this.onerror({type:"error",target:this})}if(typeof this.onabort==="function"){this.oneabort({type:"abort",target:this})}if(typeof this.onloadend==="function"){this.onloadend({type:"loadend",target:this})}};FileReader.prototype.readAsText=function(file,encoding){this.fileName="";if(typeof file.fullPath==="undefined"){this.fileName=file}else{this.fileName=file.fullPath}this.readyState=FileReader.LOADING;if(typeof this.onloadstart==="function"){this.onloadstart({type:"loadstart",target:this})}var enc=encoding?encoding:"UTF-8";var me=this;navigator.fileMgr.readAsText(this.fileName,enc,function(r){var evt;if(me.readyState===FileReader.DONE){return}me.result=r;if(typeof me.onload==="function"){me.onload({type:"load",target:me})}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){me.onloadend({type:"loadend",target:me})}},function(e){var evt;if(me.readyState===FileReader.DONE){return}me.error=e;if(typeof me.onerror==="function"){me.onerror({type:"error",target:me})}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){me.onloadend({type:"loadend",target:me})}})};FileReader.prototype.readAsDataURL=function(file){this.fileName="";if(typeof file.fullPath==="undefined"){this.fileName=file}else{this.fileName=file.fullPath}this.readyState=FileReader.LOADING;if(typeof this.onloadstart==="function"){this.onloadstart({type:"loadstart",target:this})}var me=this;navigator.fileMgr.readAsDataURL(this.fileName,function(r){var evt;if(me.readyState===FileReader.DONE){return}me.result=r;if(typeof me.onload==="function"){me.onload({type:"load",target:me})}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){me.onloadend({type:"loadend",target:me})}},function(e){var evt;if(me.readyState===FileReader.DONE){return}me.error=e;if(typeof me.onerror==="function"){me.onerror({type:"error",target:me})}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){me.onloadend({type:"loadend",target:me})}})};FileReader.prototype.readAsBinaryString=function(file){this.fileName=file};FileReader.prototype.readAsArrayBuffer=function(file){this.fileName=file};var FileWriter=function(file){this.fileName="";this.length=0;if(file){this.fileName=file.fullPath||file;this.length=file.size||0}this.position=0;this.readyState=0;this.result=null;this.error=null;this.onwritestart=null;this.onprogress=null;this.onwrite=null;this.onwriteend=null;this.onabort=null;this.onerror=null};FileWriter.INIT=0;FileWriter.WRITING=1;FileWriter.DONE=2;FileWriter.prototype.abort=function(){if(this.readyState===FileWriter.DONE||this.readyState===FileWriter.INIT){throw FileError.INVALID_STATE_ERR}var error=new FileError(),evt;error.code=error.ABORT_ERR;this.error=error;if(typeof this.onerror==="function"){this.onerror({type:"error",target:this})}if(typeof this.onabort==="function"){this.oneabort({type:"abort",target:this})}this.readyState=FileWriter.DONE;if(typeof this.onwriteend=="function"){this.onwriteend({type:"writeend",target:this})}};FileWriter.prototype.write=function(text){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}this.readyState=FileWriter.WRITING;var me=this;if(typeof me.onwritestart==="function"){me.onwritestart({type:"writestart",target:me})}navigator.fileMgr.write(this.fileName,text,this.position,function(r){var evt;if(me.readyState===FileWriter.DONE){return}me.position+=r;me.length=me.position;if(typeof me.onwrite==="function"){me.onwrite({type:"write",target:me})}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){me.onwriteend({type:"writeend",target:me})}},function(e){var evt;if(me.readyState===FileWriter.DONE){return}me.error=e;if(typeof me.onerror==="function"){me.onerror({type:"error",target:me})}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){me.onwriteend({type:"writeend",target:me})}})};FileWriter.prototype.seek=function(offset){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}if(!offset){return}if(offset<0){this.position=Math.max(offset+this.length,0)}else{if(offset>this.length){this.position=this.length}else{this.position=offset}}};FileWriter.prototype.truncate=function(size){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}this.readyState=FileWriter.WRITING;var me=this;if(typeof me.onwritestart==="function"){me.onwritestart({type:"writestart",target:this})}navigator.fileMgr.truncate(this.fileName,size,function(r){var evt;if(me.readyState===FileWriter.DONE){return}me.length=r;me.position=Math.min(me.position,r);if(typeof me.onwrite==="function"){me.onwrite({type:"write",target:me})}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){me.onwriteend({type:"writeend",target:me})}},function(e){var evt;if(me.readyState===FileWriter.DONE){return}me.error=e;if(typeof me.onerror==="function"){me.onerror({type:"error",target:me})}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){me.onwriteend({type:"writeend",target:me})}})};var Metadata=function(){this.modificationTime=null};var Flags=function(create,exclusive){this.create=create||false;this.exclusive=exclusive||false};var FileSystem=function(){this.name=null;this.root=null};var DirectoryReader=function(fullPath){this.fullPath=fullPath||null};DirectoryReader.prototype.readEntries=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","readEntries",[this.fullPath])};var DirectoryEntry=function(){this.isFile=false;this.isDirectory=true;this.name=null;this.fullPath=null;this.filesystem=null};DirectoryEntry.prototype.copyTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","copyTo",[this.fullPath,parent,newName])};DirectoryEntry.prototype.getMetadata=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getMetadata",[this.fullPath])};DirectoryEntry.prototype.getParent=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getParent",[this.fullPath])};DirectoryEntry.prototype.moveTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","moveTo",[this.fullPath,parent,newName])};DirectoryEntry.prototype.remove=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","remove",[this.fullPath])};DirectoryEntry.prototype.toURI=function(mimeType){return"file://"+this.fullPath};DirectoryEntry.prototype.createReader=function(successCallback,errorCallback){return new DirectoryReader(this.fullPath)};DirectoryEntry.prototype.getDirectory=function(path,options,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getDirectory",[this.fullPath,path,options])};DirectoryEntry.prototype.getFile=function(path,options,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getFile",[this.fullPath,path,options])};DirectoryEntry.prototype.removeRecursively=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","removeRecursively",[this.fullPath])};var FileEntry=function(){this.isFile=true;this.isDirectory=false;this.name=null;this.fullPath=null;this.filesystem=null};FileEntry.prototype.copyTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","copyTo",[this.fullPath,parent,newName])};FileEntry.prototype.getMetadata=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getMetadata",[this.fullPath])};FileEntry.prototype.getParent=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getParent",[this.fullPath])};FileEntry.prototype.moveTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","moveTo",[this.fullPath,parent,newName])};FileEntry.prototype.remove=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","remove",[this.fullPath])};FileEntry.prototype.toURI=function(mimeType){return"file://"+this.fullPath};FileEntry.prototype.createWriter=function(successCallback,errorCallback){this.file(function(filePointer){var writer=new FileWriter(filePointer);if(writer.fileName===null||writer.fileName===""){if(typeof errorCallback=="function"){errorCallback({code:FileError.INVALID_STATE_ERR})}}if(typeof successCallback=="function"){successCallback(writer)}},errorCallback)};FileEntry.prototype.file=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getFileMetadata",[this.fullPath])};var LocalFileSystem=function(){};LocalFileSystem.TEMPORARY=0;LocalFileSystem.PERSISTENT=1;LocalFileSystem.RESOURCE=2;LocalFileSystem.APPLICATION=3;LocalFileSystem.prototype.requestFileSystem=function(type,size,successCallback,errorCallback){if(type<0||type>3){if(typeof errorCallback=="function"){errorCallback({code:FileError.SYNTAX_ERR})}}else{PhoneGap.exec(successCallback,errorCallback,"File","requestFileSystem",[type,size])}};LocalFileSystem.prototype.resolveLocalFileSystemURI=function(uri,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","resolveLocalFileSystemURI",[uri])};LocalFileSystem.prototype._castFS=function(pluginResult){var entry=null;entry=new DirectoryEntry();entry.isDirectory=pluginResult.message.root.isDirectory;entry.isFile=pluginResult.message.root.isFile;entry.name=pluginResult.message.root.name;entry.fullPath=pluginResult.message.root.fullPath;pluginResult.message.root=entry;return pluginResult};LocalFileSystem.prototype._castEntry=function(pluginResult){var entry=null;if(pluginResult.message.isDirectory){console.log("This is a dir");entry=new DirectoryEntry()}else{if(pluginResult.message.isFile){console.log("This is a file");entry=new FileEntry()}}entry.isDirectory=pluginResult.message.isDirectory;entry.isFile=pluginResult.message.isFile;entry.name=pluginResult.message.name;entry.fullPath=pluginResult.message.fullPath;pluginResult.message=entry;return pluginResult};LocalFileSystem.prototype._castEntries=function(pluginResult){var entries=pluginResult.message;var retVal=[];for(var i=0;i<entries.length;i++){retVal.push(window.localFileSystem._createEntry(entries[i]))}pluginResult.message=retVal;return pluginResult};LocalFileSystem.prototype._createEntry=function(castMe){var entry=null;if(castMe.isDirectory){console.log("This is a dir");entry=new DirectoryEntry()}else{if(castMe.isFile){console.log("This is a file");entry=new FileEntry()}}entry.isDirectory=castMe.isDirectory;entry.isFile=castMe.isFile;entry.name=castMe.name;entry.fullPath=castMe.fullPath;return entry};LocalFileSystem.prototype._castDate=function(pluginResult){if(pluginResult.message.modificationTime){var modTime=new Date(pluginResult.message.modificationTime);pluginResult.message.modificationTime=modTime}else{if(pluginResult.message.lastModifiedDate){var file=new File();file.size=pluginResult.message.size;file.type=pluginResult.message.type;file.name=pluginResult.message.name;file.fullPath=pluginResult.message.fullPath;file.lastModifiedDate=new Date(pluginResult.message.lastModifiedDate);pluginResult.message=file}}return pluginResult};PhoneGap.addConstructor(function(){var pgLocalFileSystem=new LocalFileSystem();if(typeof window.localFileSystem=="undefined"){window.localFileSystem=pgLocalFileSystem}if(typeof window.requestFileSystem=="undefined"){window.requestFileSystem=pgLocalFileSystem.requestFileSystem}if(typeof window.resolveLocalFileSystemURI=="undefined"){window.resolveLocalFileSystemURI=pgLocalFileSystem.resolveLocalFileSystemURI}})}if(!PhoneGap.hasResource("filetransfer")){PhoneGap.addResource("filetransfer");var FileTransfer=function(){};var FileUploadResult=function(){this.bytesSent=0;this.responseCode=null;this.response=null};var FileTransferError=function(){this.code=null};FileTransferError.FILE_NOT_FOUND_ERR=1;FileTransferError.INVALID_URL_ERR=2;FileTransferError.CONNECTION_ERR=3;FileTransfer.prototype.upload=function(filePath,server,successCallback,errorCallback,options,debug){var fileKey=null;var fileName=null;var mimeType=null;var params=null;if(options){fileKey=options.fileKey;fileName=options.fileName;mimeType=options.mimeType;if(options.params){params=options.params}else{params={}}}PhoneGap.exec(successCallback,errorCallback,"FileTransfer","upload",[filePath,server,fileKey,fileName,mimeType,params,debug])};var FileUploadOptions=function(fileKey,fileName,mimeType,params){this.fileKey=fileKey||null;this.fileName=fileName||null;this.mimeType=mimeType||null;this.params=params||null}}if(!PhoneGap.hasResource("geolocation")){PhoneGap.addResource("geolocation");var Geolocation=function(){this.lastPosition=null;this.listeners={}};var PositionError=function(code,message){this.code=code;this.message=message};PositionError.PERMISSION_DENIED=1;PositionError.POSITION_UNAVAILABLE=2;PositionError.TIMEOUT=3;Geolocation.prototype.getCurrentPosition=function(successCallback,errorCallback,options){if(navigator._geo.listeners.global){console.log("Geolocation Error: Still waiting for previous getCurrentPosition() request.");try{errorCallback(new PositionError(PositionError.TIMEOUT,"Geolocation Error: Still waiting for previous getCurrentPosition() request."))}catch(e){}return}var maximumAge=10000;var enableHighAccuracy=false;var timeout=10000;if(typeof options!=="undefined"){if(typeof options.maximumAge!=="undefined"){maximumAge=options.maximumAge}if(typeof options.enableHighAccuracy!=="undefined"){enableHighAccuracy=options.enableHighAccuracy}if(typeof options.timeout!=="undefined"){timeout=options.timeout}}navigator._geo.listeners.global={success:successCallback,fail:errorCallback};PhoneGap.exec(null,null,"Geolocation","getCurrentLocation",[enableHighAccuracy,timeout,maximumAge])};Geolocation.prototype.watchPosition=function(successCallback,errorCallback,options){var maximumAge=10000;var enableHighAccuracy=false;var timeout=10000;if(typeof options!=="undefined"){if(typeof options.frequency!=="undefined"){maximumAge=options.frequency}if(typeof options.maximumAge!=="undefined"){maximumAge=options.maximumAge}if(typeof options.enableHighAccuracy!=="undefined"){enableHighAccuracy=options.enableHighAccuracy}if(typeof options.timeout!=="undefined"){timeout=options.timeout}}var id=PhoneGap.createUUID();navigator._geo.listeners[id]={success:successCallback,fail:errorCallback};PhoneGap.exec(null,null,"Geolocation","start",[id,enableHighAccuracy,timeout,maximumAge]);return id};Geolocation.prototype.success=function(id,lat,lng,alt,altacc,head,vel,stamp){var coords=new Coordinates(lat,lng,alt,altacc,head,vel);var loc=new Position(coords,stamp);try{if(lat==="undefined"||lng==="undefined"){navigator._geo.listeners[id].fail(new PositionError(PositionError.POSITION_UNAVAILABLE,"Lat/Lng are undefined."))}else{navigator._geo.lastPosition=loc;navigator._geo.listeners[id].success(loc)}}catch(e){console.log("Geolocation Error: Error calling success callback function.")}if(id==="global"){delete navigator._geo.listeners.global}};Geolocation.prototype.fail=function(id,code,msg){try{navigator._geo.listeners[id].fail(new PositionError(code,msg))}catch(e){console.log("Geolocation Error: Error calling error callback function.")}};Geolocation.prototype.clearWatch=function(id){PhoneGap.exec(null,null,"Geolocation","stop",[id]);delete navigator._geo.listeners[id]};Geolocation.usingPhoneGap=false;Geolocation.usePhoneGap=function(){if(Geolocation.usingPhoneGap){return}Geolocation.usingPhoneGap=true;navigator.geolocation.setLocation=navigator._geo.setLocation;navigator.geolocation.getCurrentPosition=navigator._geo.getCurrentPosition;navigator.geolocation.watchPosition=navigator._geo.watchPosition;navigator.geolocation.clearWatch=navigator._geo.clearWatch;navigator.geolocation.start=navigator._geo.start;navigator.geolocation.stop=navigator._geo.stop};PhoneGap.addConstructor(function(){navigator._geo=new Geolocation();if(typeof navigator.geolocation==="undefined"){navigator.geolocation=navigator._geo;Geolocation.usingPhoneGap=true}})}if(!PhoneGap.hasResource("media")){PhoneGap.addResource("media");var Media=function(src,successCallback,errorCallback,statusCallback,positionCallback){if(successCallback&&(typeof successCallback!=="function")){console.log("Media Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!=="function")){console.log("Media Error: errorCallback is not a function");return}if(statusCallback&&(typeof statusCallback!=="function")){console.log("Media Error: statusCallback is not a function");return}if(positionCallback&&(typeof positionCallback!=="function")){console.log("Media Error: positionCallback is not a function");return}this.id=PhoneGap.createUUID();PhoneGap.mediaObjects[this.id]=this;this.src=src;this.successCallback=successCallback;this.errorCallback=errorCallback;this.statusCallback=statusCallback;this.positionCallback=positionCallback;this._duration=-1;this._position=-1};Media.MEDIA_STATE=1;Media.MEDIA_DURATION=2;Media.MEDIA_ERROR=9;Media.MEDIA_NONE=0;Media.MEDIA_STARTING=1;Media.MEDIA_RUNNING=2;Media.MEDIA_PAUSED=3;Media.MEDIA_STOPPED=4;Media.MEDIA_MSG=["None","Starting","Running","Paused","Stopped"];var MediaError=function(){this.code=null;this.message=""};MediaError.MEDIA_ERR_ABORTED=1;MediaError.MEDIA_ERR_NETWORK=2;MediaError.MEDIA_ERR_DECODE=3;MediaError.MEDIA_ERR_NONE_SUPPORTED=4;Media.prototype.play=function(){PhoneGap.exec(null,null,"Media","startPlayingAudio",[this.id,this.src])};Media.prototype.stop=function(){return PhoneGap.exec(null,null,"Media","stopPlayingAudio",[this.id])};Media.prototype.seekTo=function(milliseconds){PhoneGap.exec(null,null,"Media","seekToAudio",[this.id,milliseconds])};Media.prototype.pause=function(){PhoneGap.exec(null,null,"Media","pausePlayingAudio",[this.id])};Media.prototype.getDuration=function(){return this._duration};Media.prototype.getCurrentPosition=function(success,fail){PhoneGap.exec(success,fail,"Media","getCurrentPositionAudio",[this.id])};Media.prototype.startRecord=function(){PhoneGap.exec(null,null,"Media","startRecordingAudio",[this.id,this.src])};Media.prototype.stopRecord=function(){PhoneGap.exec(null,null,"Media","stopRecordingAudio",[this.id])};Media.prototype.release=function(){PhoneGap.exec(null,null,"Media","release",[this.id])};PhoneGap.mediaObjects={};PhoneGap.Media=function(){};PhoneGap.Media.getMediaObject=function(id){return PhoneGap.mediaObjects[id]};PhoneGap.Media.onStatus=function(id,msg,value){var media=PhoneGap.mediaObjects[id];if(msg===Media.MEDIA_STATE){if(value===Media.MEDIA_STOPPED){if(media.successCallback){media.successCallback()}}if(media.statusCallback){media.statusCallback(value)}}else{if(msg===Media.MEDIA_DURATION){media._duration=value}else{if(msg===Media.MEDIA_ERROR){if(media.errorCallback){media.errorCallback(value)}}}}}}if(!PhoneGap.hasResource("network")){PhoneGap.addResource("network");var NetworkStatus=function(){};NetworkStatus.NOT_REACHABLE=0;NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK=1;NetworkStatus.REACHABLE_VIA_WIFI_NETWORK=2;var Network=function(){this.lastReachability=null};Network.prototype.updateReachability=function(reachability){this.lastReachability=reachability};Network.prototype.isReachable=function(uri,callback,options){var isIpAddress=false;if(options&&options.isIpAddress){isIpAddress=options.isIpAddress}PhoneGap.exec(callback,null,"Network Status","isReachable",[uri,isIpAddress])};var Connection=function(){this.type=null;this._firstRun=true;this._timer=null;this.timeout=500;var me=this;this.getInfo(function(type){if(type=="none"){me._timer=setTimeout(function(){me.type=type;PhoneGap.fireEvent("offline");me._timer=null},me.timeout)}else{if(me._timer!=null){clearTimeout(me._timer);me._timer=null}me.type=type;PhoneGap.fireEvent("online")}if(me._firstRun){me._firstRun=false;PhoneGap.onPhoneGapConnectionReady.fire()}},function(e){console.log("Error initializing Network Connection: "+e)})};Connection.UNKNOWN="unknown";Connection.ETHERNET="ethernet";Connection.WIFI="wifi";Connection.CELL_2G="2g";Connection.CELL_3G="3g";Connection.CELL_4G="4g";Connection.NONE="none";Connection.prototype.getInfo=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"Network Status","getConnectionInfo",[])};PhoneGap.addConstructor(function(){if(typeof navigator.network==="undefined"){navigator.network=new Network()}if(typeof navigator.network.connection==="undefined"){navigator.network.connection=new Connection()}})}if(!PhoneGap.hasResource("notification")){PhoneGap.addResource("notification");var Notification=function(){};Notification.prototype.alert=function(message,completeCallback,title,buttonLabel){var _title=(title||"Alert");var _buttonLabel=(buttonLabel||"OK");PhoneGap.exec(completeCallback,null,"Notification","alert",[message,_title,_buttonLabel])};Notification.prototype.confirm=function(message,resultCallback,title,buttonLabels){var _title=(title||"Confirm");var _buttonLabels=(buttonLabels||"OK,Cancel");PhoneGap.exec(resultCallback,null,"Notification","confirm",[message,_title,_buttonLabels])};Notification.prototype.activityStart=function(){PhoneGap.exec(null,null,"Notification","activityStart",["Busy","Please wait..."])};Notification.prototype.activityStop=function(){PhoneGap.exec(null,null,"Notification","activityStop",[])};Notification.prototype.progressStart=function(title,message){PhoneGap.exec(null,null,"Notification","progressStart",[title,message])};Notification.prototype.progressValue=function(value){PhoneGap.exec(null,null,"Notification","progressValue",[value])};Notification.prototype.progressStop=function(){PhoneGap.exec(null,null,"Notification","progressStop",[])};Notification.prototype.blink=function(count,colour){};Notification.prototype.vibrate=function(mills){PhoneGap.exec(null,null,"Notification","vibrate",[mills])};Notification.prototype.beep=function(count){PhoneGap.exec(null,null,"Notification","beep",[count])};PhoneGap.addConstructor(function(){if(typeof navigator.notification==="undefined"){navigator.notification=new Notification()}})}if(!PhoneGap.hasResource("position")){PhoneGap.addResource("position");var Position=function(coords,timestamp){this.coords=coords;this.timestamp=(timestamp!=="undefined")?timestamp:new Date().getTime()};var Coordinates=function(lat,lng,alt,acc,head,vel,altacc){this.latitude=lat;this.longitude=lng;this.accuracy=acc;this.altitude=alt;this.heading=head;this.speed=vel;this.altitudeAccuracy=(altacc!=="undefined")?altacc:null};var PositionOptions=function(){this.enableHighAccuracy=true;this.timeout=10000};var PositionError=function(){this.code=null;this.message=""};PositionError.UNKNOWN_ERROR=0;PositionError.PERMISSION_DENIED=1;PositionError.POSITION_UNAVAILABLE=2;PositionError.TIMEOUT=3}if(!PhoneGap.hasResource("storage")){PhoneGap.addResource("storage");var DroidDB_Rows=function(){this.resultSet=[];this.length=0};DroidDB_Rows.prototype.item=function(row){return this.resultSet[row]};var DroidDB_Result=function(){this.rows=new DroidDB_Rows()};var DroidDB=function(){this.queryQueue={}};DroidDB.prototype.completeQuery=function(id,data){var query=this.queryQueue[id];if(query){try{delete this.queryQueue[id];var tx=query.tx;if(tx&&tx.queryList[id]){var r=new DroidDB_Result();r.rows.resultSet=data;r.rows.length=data.length;try{if(typeof query.successCallback==="function"){query.successCallback(query.tx,r)}}catch(ex){console.log("executeSql error calling user success callback: "+ex)}tx.queryComplete(id)}}catch(e){console.log("executeSql error: "+e)}}};DroidDB.prototype.fail=function(reason,id){var query=this.queryQueue[id];if(query){try{delete this.queryQueue[id];var tx=query.tx;if(tx&&tx.queryList[id]){tx.queryList={};try{if(typeof query.errorCallback==="function"){query.errorCallback(query.tx,reason)}}catch(ex){console.log("executeSql error calling user error callback: "+ex)}tx.queryFailed(id,reason)}}catch(e){console.log("executeSql error: "+e)}}};var DroidDB_Query=function(tx){this.id=PhoneGap.createUUID();droiddb.queryQueue[this.id]=this;this.resultSet=[];this.tx=tx;this.tx.queryList[this.id]=this;this.successCallback=null;this.errorCallback=null};var DroidDB_Tx=function(){this.id=PhoneGap.createUUID();this.successCallback=null;this.errorCallback=null;this.queryList={}};DroidDB_Tx.prototype.queryComplete=function(id){delete this.queryList[id];if(this.successCallback){var count=0;var i;for(i in this.queryList){if(this.queryList.hasOwnProperty(i)){count++}}if(count===0){try{this.successCallback()}catch(e){console.log("Transaction error calling user success callback: "+e)}}}};DroidDB_Tx.prototype.queryFailed=function(id,reason){this.queryList={};if(this.errorCallback){try{this.errorCallback(reason)}catch(e){console.log("Transaction error calling user error callback: "+e)}}};DroidDB_Tx.prototype.executeSql=function(sql,params,successCallback,errorCallback){if(typeof params==="undefined"){params=[]}var query=new DroidDB_Query(this);droiddb.queryQueue[query.id]=query;query.successCallback=successCallback;query.errorCallback=errorCallback;PhoneGap.exec(null,null,"Storage","executeSql",[sql,params,query.id])};var DatabaseShell=function(){};DatabaseShell.prototype.transaction=function(process,errorCallback,successCallback){var tx=new DroidDB_Tx();tx.successCallback=successCallback;tx.errorCallback=errorCallback;try{process(tx)}catch(e){console.log("Transaction error: "+e);if(tx.errorCallback){try{tx.errorCallback(e)}catch(ex){console.log("Transaction error calling user error callback: "+e)}}}};var DroidDB_openDatabase=function(name,version,display_name,size){PhoneGap.exec(null,null,"Storage","openDatabase",[name,version,display_name,size]);var db=new DatabaseShell();return db};var CupcakeLocalStorage=function(){try{this.db=openDatabase("localStorage","1.0","localStorage",2621440);var storage={};this.length=0;function setLength(length){this.length=length;localStorage.length=length}this.db.transaction(function(transaction){var i;transaction.executeSql("CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))");transaction.executeSql("SELECT * FROM storage",[],function(tx,result){for(var i=0;i<result.rows.length;i++){storage[result.rows.item(i)["id"]]=result.rows.item(i)["body"]}setLength(result.rows.length);PhoneGap.initializationComplete("cupcakeStorage")})},function(err){alert(err.message)});this.setItem=function(key,val){if(typeof(storage[key])=="undefined"){this.length++}storage[key]=val;this.db.transaction(function(transaction){transaction.executeSql("CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))");transaction.executeSql("REPLACE INTO storage (id, body) values(?,?)",[key,val])})};this.getItem=function(key){return storage[key]};this.removeItem=function(key){delete storage[key];this.length--;this.db.transaction(function(transaction){transaction.executeSql("CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))");transaction.executeSql("DELETE FROM storage where id=?",[key])})};this.clear=function(){storage={};this.length=0;this.db.transaction(function(transaction){transaction.executeSql("CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))");transaction.executeSql("DELETE FROM storage",[])})};this.key=function(index){var i=0;for(var j in storage){if(i==index){return j}else{i++}}return null}}catch(e){alert("Database error "+e+".");return}};PhoneGap.addConstructor(function(){var setupDroidDB=function(){navigator.openDatabase=window.openDatabase=DroidDB_openDatabase;window.droiddb=new DroidDB()};if(typeof window.openDatabase==="undefined"){setupDroidDB()}else{window.openDatabase_orig=window.openDatabase;window.openDatabase=function(name,version,desc,size){var db=null;try{db=window.openDatabase_orig(name,version,desc,size)}catch(ex){db=null}if(db==null){setupDroidDB();return DroidDB_openDatabase(name,version,desc,size)}else{return db}}}if(typeof window.localStorage==="undefined"){navigator.localStorage=window.localStorage=new CupcakeLocalStorage();PhoneGap.waitForInitialization("cupcakeStorage")}})};
View
3  Bada/VERSION
@@ -1 +1,2 @@
-0.9.5.1
+0.9.6
+
View
4 BlackBerry-WebWorks/LICENSE
@@ -13,7 +13,7 @@ The text of the MIT and BSD licenses is reproduced below.
The "New" BSD License:
**********************
-Copyright (c) 2005-2010, Nitobi Software Inc.
+Copyright (c) 2005-2011, Nitobi Software Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The MIT License
*****************
-Copyright (c) <2010> <Nitobi Software Inc., et. al., >
+Copyright (c) <2011> <Nitobi Software Inc., et. al., >
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
View
2  BlackBerry-WebWorks/VERSION
@@ -1 +1 @@
-0.9.5.1
+0.9.6
View
8 BlackBerry-WebWorks/build.xml
@@ -76,7 +76,7 @@
</replaceregexp>
<!-- copy phonegap.js -->
- <copy todir="${project.path}/www/javascript">
+ <copy todir="${project.path}/www">
<fileset dir="${build.dir}/${js.path}" />
</copy>
@@ -145,14 +145,14 @@ Install:
2. Install the JavaScript library:
- - delete /www/${js.path}/phonegap.js
+ - delete /www/phonegap.js
- copy /${update.dir}/${js.file}
- to /www/${js.path}/phonegap.js
+ to /www/${js.basename}
3. Update JavaScript references:
- - &#60;script type=&#34;text/javascript&#34; src=&#34;${js.file}&#34;&#62;&#60;/script&#62;
+ - &#60;script type=&#34;text/javascript&#34; src=&#34;${js.basename}&#34;&#62;&#60;/script&#62;
</echo>
</target>
View
9 BlackBerry-WebWorks/changes.txt
@@ -0,0 +1,9 @@
+Drew Walters (2):
+ Add Network Connection API to match spec released on June 7th
+ Delay onDeviceReady until connection info is available.
+
+Michael Brooks (3):
+ #23 - Move phonegap.js to www/ to match other platforms.
+ Update Nitobi copyright.
+ Version 0.9.6
+
View
2  BlackBerry-WebWorks/framework/ext/src/com/phonegap/device/Device.java
@@ -31,7 +31,7 @@ else if (name.equals(FIELD_UUID)) {
return new Integer(DeviceInfo.getDeviceId());
}
else if (name.equals(FIELD_PHONEGAP)) {
- return "0.9.5.1";
+ return "0.9.6";
}
return super.getField(name);
View
376 BlackBerry-WebWorks/framework/ext/src/com/phonegap/network/ConnectionInfoAction.java
@@ -0,0 +1,376 @@
+/*
+ * PhoneGap is available under *either* the terms of the modified BSD license *or* the
+ * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
+ *
+ * Copyright (c) 2005-2010, Nitobi Software Inc.
+ * Copyright (c) 2010, IBM Corporation
+ */
+package com.phonegap.network;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import com.phonegap.PhoneGapExtension;
+import com.phonegap.api.PluginResult;
+import com.phonegap.json4j.JSONException;
+import com.phonegap.json4j.JSONObject;
+import com.phonegap.util.Logger;
+
+import net.rim.device.api.system.Application;
+import net.rim.device.api.system.CoverageInfo;
+import net.rim.device.api.system.CoverageStatusListener;
+import net.rim.device.api.system.RadioInfo;
+import net.rim.device.api.system.RadioStatusListener;
+import net.rim.device.api.system.WLANConnectionListener;
+import net.rim.device.api.system.WLANInfo;
+
+/**
+ * Determines the current network data connection type and listens for changes
+ * to network coverage. This class is intended for use through the Network
+ * plug-in.
+ */
+public class ConnectionInfoAction {
+ // Returned JSON attributes
+ private static final String EVENT = "event";
+ private static final String TYPE = "type";
+
+ // Return types
+ private static final String TYPE_UNKNOWN = "unknown";
+ private static final String TYPE_ETHERNET = "ethernet";
+ private static final String TYPE_WIFI = "wifi";
+ private static final String TYPE_2G = "2g";
+ private static final String TYPE_3G = "3g";
+ private static final String TYPE_4G = "4g";
+ private static final String TYPE_NONE = "none";
+
+ // Network status event values
+ private static final String OFFLINE = "offline";
+ private static final String ONLINE = "online";
+
+ // Network service support constants
+ private static final int DATA = RadioInfo.NETWORK_SERVICE_DATA;
+ private static final int TWO_G = RadioInfo.NETWORK_SERVICE_DATA
+ | RadioInfo.NETWORK_SERVICE_EDGE;
+ private static final int THREE_G = RadioInfo.NETWORK_SERVICE_EVDO_REV0
+ | RadioInfo.NETWORK_SERVICE_EVDO_REV0_ONLY
+ | RadioInfo.NETWORK_SERVICE_EVDO_REVA
+ | RadioInfo.NETWORK_SERVICE_EVDO_REVA_ONLY
+ | RadioInfo.NETWORK_SERVICE_UMTS;
+
+ // Listeners used to detect network changes
+ private RadioStatusListener radioListener = null;
+ private WLANConnectionListener wlanListener = null;
+ private CoverageStatusListener coverageListener = null;
+
+ // Variable indicating whether the user has disabled mobile data
+ private Boolean dataDisabled = Boolean.FALSE;
+
+ // The set of call back IDs to send results to. Using Hashtable because
+ // BlackBerry does not support Collections. There should only ever be one
+ // call back ID, but this allows multiple.
+ private Hashtable callbackIds = new Hashtable();
+
+ private String prevType = TYPE_NONE;
+ private String prevEvent = OFFLINE;
+
+ /**
+ * Determines the current network data connection type. Listeners are
+ * registered to return additional results when network state changes.
+ *
+ * @param callbackId
+ * The success call back ID to receive network type results.
+ * @return A PluginResult object with the success or failure result of the
+ * operation. A success result includes information about the
+ * currently active network type.
+ */
+ protected PluginResult getConnectionInfo(String callbackId) {
+
+ // Ensure that the dataDisabled variable is initialized.
+ setDataDisabled(CoverageInfo.getCoverageStatus(), false);
+
+ // Add the network change listeners if they have not been added.
+ addListeners(callbackId);
+
+ // Retrieve the current active connection type and build the return
+ // result.
+ String type = getConnectionType(true, true);
+ JSONObject connectInfo = new JSONObject();
+ try {
+ connectInfo.put(TYPE, type);
+ } catch (JSONException e) {
+ Logger.error("JSONException: " + e.getMessage());
+ return new PluginResult(PluginResult.Status.JSONEXCEPTION,
+ "JSONException: " + e.getMessage());
+ }
+
+ PluginResult result = new PluginResult(PluginResult.Status.OK,
+ connectInfo);
+
+ // Need to keep the call back since listeners have been registered to
+ // fire events on the specified call back ID.
+ result.setKeepCallback(true);
+
+ return result;
+ }
+
+ /**
+ * Removes all coverage listeners and clears the list of call back IDs. This
+ * method should be invoked when the Network plug-in's onDestroy is called.
+ */
+ protected synchronized void shutdown() {
+ if (radioListener != null) {
+ Application.getApplication().removeRadioListener(radioListener);
+ radioListener = null;
+ }
+
+ if (wlanListener != null) {
+ WLANInfo.removeListener(wlanListener);
+ wlanListener = null;
+ }
+
+ if (coverageListener != null) {
+ CoverageInfo.removeListener(coverageListener);
+ coverageListener = null;
+ }
+
+ callbackIds.clear();
+ }
+
+ /**
+ * Adds a RadioStatusListener, WLANConnectionListener and
+ * CoverageStatusListener to listen for various network change events. The
+ * listeners are only registered if they have not already been added. Each
+ * listener is used to detect different types of network change events.
+ *
+ * RadioStatusListener - Detects changes in cellular data coverage.
+ * WLANConnectionListener - Detects changes in wifi coverage.
+ * CoverageStatusListener - Used to detect changes in the mobile data config
+ *
+ * @param callbackId
+ * The reference point to call back when a listener event occurs.
+ */
+ private synchronized void addListeners(String callbackId) {
+ callbackIds.put(callbackId, callbackId);
+
+ if (radioListener == null) {
+ radioListener = new RadioStatusListener() {
+ public void baseStationChange() {}
+ public void networkScanComplete(boolean success) {}
+
+ public void networkServiceChange(int networkId, int service) {
+ // Cellular data change detected. If the user hasn't
+ // disabled mobile data and wifi is not currently in use
+ // return a result indicating the cellular data coverage
+ // change.
+ if (dataDisabled == Boolean.FALSE
+ && WLANInfo.getWLANState() != WLANInfo.WLAN_STATE_CONNECTED) {
+ if ((service & DATA) == 0) {
+ sendResult(TYPE_NONE, OFFLINE);
+ } else {
+ // In the case where cell data and wifi was turned
+ // off and then the user disabled mobile data
+ // configuration, the mobile data config disablement
+ // by the user isn't detected by the coverage status
+ // listener so dataDisabled may not be accurate.
+ // When service data is activated, have to make sure
+ // that dataDisabled is properly set.
+ setDataDisabled(CoverageInfo.getCoverageStatus(),
+ false);
+ if (dataDisabled == Boolean.FALSE) {
+ sendResult(getConnectionType(false, true),
+ ONLINE);
+ }
+ }
+ }
+ }
+
+ public void networkStarted(int networkId, int service) {}
+ public void networkStateChange(int state) {}
+ public void pdpStateChange(int apn, int state, int cause) {}
+ public void radioTurnedOff() {}
+ public void signalLevel(int level) {}
+ };
+ Application.getApplication().addRadioListener(radioListener);
+ }
+
+ if (wlanListener == null) {
+ wlanListener = new WLANConnectionListener() {
+ public void networkConnected() {
+ if (dataDisabled == Boolean.FALSE) {
+ sendResult(TYPE_WIFI, ONLINE);
+ }
+ }
+
+ public void networkDisconnected(int reason) {
+ // Wifi was disconnected, if the user hasn't disabled mobile
+ // data, check if cellular data coverage exists.
+ if (dataDisabled == Boolean.FALSE) {
+ String type = getConnectionType(false, true);
+ String event = OFFLINE;
+ if (!TYPE_NONE.equals(type)) {
+ event = ONLINE;
+ }
+ sendResult(type, event);
+ }
+ }
+ };
+ WLANInfo.addListener(wlanListener);
+ }
+
+ if (coverageListener == null) {
+ coverageListener = new CoverageStatusListener() {
+ public void coverageStatusChanged(int newCoverage) {
+ // When coverage changes, check to determine if it is due
+ // to the user disabling mobile data through configuration
+ // flag.
+ setDataDisabled(newCoverage, true);
+ }
+ };
+ CoverageInfo.addListener(coverageListener);
+ }
+ }
+
+ /**
+ * Determine the type of connection currently being used for data
+ * transmission on the device. If the user has disabled mobile data then
+ * TYPE_NONE is returned regardless of cellular or wifi radio state as this
+ * is the way the browser behaves. Otherwise, wifi and/or cellular radios
+ * are queried for state based on the passed in parameters.
+ *
+ * @param checkWLAN
+ * Determines whether wifi radio state is queried or not.
+ * @param checkCell
+ * Determines whether cellular radio state is queried or not.
+ * @return A string indicating one of the defined network connections types.
+ */
+ private String getConnectionType(boolean checkWLAN, boolean checkCell) {
+ String networkType = TYPE_NONE;
+
+ if (dataDisabled == Boolean.FALSE) {
+ // Detect if wifi is active and connected. If wifi is active it
+ // takes precedence over cellular data transmission.
+ if (checkWLAN
+ && WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
+ networkType = TYPE_WIFI;
+ }
+
+ if (checkCell && TYPE_NONE.equals(networkType)
+ && RadioInfo.isDataServiceOperational()) {
+
+ int activeServices = RadioInfo.getNetworkService();
+ networkType = TYPE_UNKNOWN;
+ if ((activeServices & THREE_G) != 0) {
+ networkType = TYPE_3G;
+ } else if ((activeServices & TWO_G) != 0) {
+ networkType = TYPE_2G;
+ }
+ }
+ }
+
+ return networkType;
+ }
+
+ /**
+ * Helper function to build and send the PluginResult to the saved call back
+ * IDs.
+ *
+ * @param type
+ * The network connection type. This value should be null if the
+ * specified event is "offline".
+ * @param event
+ * The network event.
+ */
+ private void sendResult(String type, String event) {
+
+ JSONObject connectionInfo = new JSONObject();
+ try {
+ connectionInfo.put(TYPE, type);
+ connectionInfo.put(EVENT, event);
+ } catch (JSONException e) {
+ Logger.error("JSONException: " + e.getMessage());
+ for (Enumeration callbacks = this.callbackIds.elements(); callbacks
+ .hasMoreElements();) {
+ String callbackId = (String) callbacks.nextElement();
+ PhoneGapExtension.invokeErrorCallback(callbackId,
+ new PluginResult(PluginResult.Status.JSONEXCEPTION,
+ "JSONException: " + e.getMessage()));
+ }
+ return;
+ }
+
+ // Only send the event if it is different then the last sent event.
+ synchronized (prevType) {
+ if (prevType != null && prevEvent != null && prevType.equals(type)
+ && prevEvent.equals(event)) {
+ return;
+ } else {
+ prevType = type;
+ prevEvent = event;
+ }
+ }
+
+ PluginResult result = new PluginResult(PluginResult.Status.OK,
+ connectionInfo);
+
+ // Must keep the call back active for future events.
+ result.setKeepCallback(true);
+
+ // Iterate through the saved call back IDs. Really should only ever be
+ // one.
+ for (Enumeration callbacks = this.callbackIds.elements(); callbacks
+ .hasMoreElements();) {
+ String callbackId = (String) callbacks.nextElement();
+ PhoneGapExtension.invokeSuccessCallback(callbackId, result);
+ }
+
+ }
+
+ /**
+ * Determines if the user has disabled mobile data through the user level
+ * configuration panels and optionally returns an "online" or "offline"
+ * result.
+ *
+ * @param newCoverage
+ * A bit mask of CoverageInfo.COVERAGE_* flags indicating the
+ * current coverage.
+ * @param returnResult
+ * If true, return a result based on the value of the mobile data
+ * configuration.
+ */
+ private void setDataDisabled(int newCoverage, boolean returnResult) {
+
+ boolean isRadioData = (RadioInfo.getNetworkService() & DATA) != 0;
+ boolean wlanConnected = WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED;
+ boolean eventDetected = false;
+ String event = OFFLINE;
+
+ // Note: To detect that mobile data has been disabled through
+ // configuration, determine if the current coverage is
+ // CoverageInfo.COVERAGE_NONE AND that either cellular or wifi radios
+ // are currently connected. This is because the low level radio routines
+ // will return a connected state even when mobile data is disabled
+ // through configuration.
+ synchronized (dataDisabled) {
+ if (newCoverage == CoverageInfo.COVERAGE_NONE
+ && (isRadioData || wlanConnected)) {
+ if (dataDisabled == Boolean.FALSE) {
+ Logger.log("Mobile data was disabled by the user through configuration.");
+ dataDisabled = Boolean.TRUE;
+ eventDetected = true;
+ }
+ } else if (dataDisabled == Boolean.TRUE) {
+ Logger.log("Mobile data was enabled by the user.");
+ dataDisabled = Boolean.FALSE;
+ event = ONLINE;
+ eventDetected = true;
+ }
+ }
+
+ if (returnResult && eventDetected) {
+ // The user has enabled/disabled mobile data. Return a result
+ // indicating the current network state.
+ String type = getConnectionType(true, true);
+ sendResult(type, event);
+ }
+ }
+}
View
18 BlackBerry-WebWorks/framework/ext/src/com/phonegap/network/Network.java
@@ -17,12 +17,16 @@
* The Network class can invoke the following actions:
*
* - isReachable(domain, callback)
+ * - getConnectionInfo(callback)
*
*/
public class Network extends Plugin {
-
+ // Supported actions
public static final String ACTION_IS_REACHABLE = "isReachable";
-
+ public static final String ACTION_CONNECTION_INFO = "getConnectionInfo";
+
+ private ConnectionInfoAction connectionInfo = new ConnectionInfoAction();
+
/**
* Executes the request and returns CommandResult.
*
@@ -37,10 +41,20 @@ public PluginResult execute(String action, JSONArray args, String callbackId) {
if (action.equals(ACTION_IS_REACHABLE)) {
result = IsReachableAction.execute(args);
}
+ else if (action.equals(ACTION_CONNECTION_INFO)) {
+ result = connectionInfo.getConnectionInfo(callbackId);
+ }
else {
result = new PluginResult(PluginResult.Status.INVALIDACTION, "Network: Invalid action: " + action);
}
return result;
}
+
+ /**
+ * Called when Plugin is destroyed.
+ */
+ public void onDestroy() {
+ connectionInfo.shutdown();
+ }
}
View
2  BlackBerry-WebWorks/framework/ext/src/library.xml
@@ -4,6 +4,6 @@
<entryClass>com.phonegap.PhoneGapExtension</entryClass>
</extension>
<features>
- <feature id="phonegap" version="0.9.5.1">PhoneGap JavaScript Extension</feature>
+ <feature id="phonegap" version="0.9.6">PhoneGap JavaScript Extension</feature>
</features>
</library>
View
29 BlackBerry-WebWorks/javascript/_phonegap.js
@@ -51,7 +51,7 @@ var PhoneGap = PhoneGap || (function() {
*/
PhoneGap.Channel = function(type) {
this.type = type;
- this.handlers = {};
+ this.handlers = [];
this.guid = 0;
this.fired = false;
this.enabled = true;
@@ -88,7 +88,7 @@ var PhoneGap = PhoneGap || (function() {
var m = function() {
f.apply(c || null, arguments);
_this.unsubscribe(g);
- }
+ };
if (this.fired) {
if (typeof c == "object" && f instanceof Function) { f = PhoneGap.close(c, f); }
f.apply(this, this.fireArgs);
@@ -136,7 +136,7 @@ var PhoneGap = PhoneGap || (function() {
var len = i;
var f = function() {
if (!(--i)) h();
- }
+ };
for (var j=0; j<len; j++) {
(!c[j].fired?c[j].subscribeOnce(f):i--);
}
@@ -173,6 +173,12 @@ var PhoneGap = PhoneGap || (function() {
PhoneGap.onPhoneGapInfoReady = new PhoneGap.Channel('onPhoneGapInfoReady');
/**
+ * onPhoneGapConnectionReady channel is fired when the PhoneGap connection properties
+ * has been set.
+ */
+ PhoneGap.onPhoneGapConnectionReady = new PhoneGap.Channel('onPhoneGapConnectionReady');
+
+ /**
* onResume channel is fired when the PhoneGap native code
* resumes.
*/
@@ -193,7 +199,7 @@ var PhoneGap = PhoneGap || (function() {
/**
* PhoneGap Channels that must fire before "deviceready" is fired.
*/
- PhoneGap.deviceReadyChannelsArray = [ PhoneGap.onPhoneGapReady, PhoneGap.onPhoneGapInfoReady ];
+ PhoneGap.deviceReadyChannelsArray = [ PhoneGap.onPhoneGapReady, PhoneGap.onPhoneGapInfoReady, PhoneGap.onPhoneGapConnectionReady ];
/**
* User-defined channels that must also fire before "deviceready" is fired.
@@ -286,6 +292,15 @@ var PhoneGap = PhoneGap || (function() {
};
/**
+ * Method to fire event from native code
+ */
+ PhoneGap.fireEvent = function(type) {
+ var e = document.createEvent('Events');
+ e.initEvent(type, false, false);
+ document.dispatchEvent(e);
+ };
+
+ /**
* When BlackBerry WebWorks application is brought to foreground,
* fire onResume event.
*/
@@ -564,11 +579,11 @@ var PhoneGap = PhoneGap || (function() {
if (typeof params === 'undefined') {
return function() {
return func.apply(context, arguments);
- }
+ };
} else {
return function() {
return func.apply(context, params);
- }
+ };
}
};
@@ -608,7 +623,7 @@ var PhoneGap = PhoneGap || (function() {
Child.prototype = new F();
Child.__super__ = Parent.prototype;
Child.prototype.constructor = Child;
- }
+ };
}());
return PhoneGap;
View
52 BlackBerry-WebWorks/javascript/network.js
@@ -16,6 +16,16 @@ NetworkStatus = {
REACHABLE_VIA_WIFI_NETWORK: 2
};
+Connection = {
+ UNKNOWN: "unknown",
+ ETHERNET: "ethernet",
+ WIFI: "wifi",
+ CELL_2G: "2g",
+ CELL_3G: "3g",
+ CELL_4G: "4g",
+ NONE: "none"
+};
+
/**
* navigator.network
*/
@@ -56,9 +66,49 @@ NetworkStatus = {
};
/**
- * Define navigator.network object.
+ * This class contains information about the current network Connection.
+ * @constructor
+ */
+ var NetworkConnection = function() {
+ this.type = null;
+ this._firstRun = true;
+
+ var me = this;
+ this.getInfo(
+ function(info) {
+ me.type = info.type;
+ if (typeof info.event !== "undefined") {
+ PhoneGap.fireEvent(info.event);
+ }
+
+ // should only fire this once
+ if (me._firstRun) {
+ me._firstRun = false;
+ PhoneGap.onPhoneGapConnectionReady.fire();
+ }
+ },
+ function(e) {
+ console.log("Error initializing Network Connection: " + e);
+ });
+ };
+
+ /**
+ * Get connection info
+ *
+ * @param {Function} successCallback The function to call when the Connection data is available
+ * @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
+ */
+ NetworkConnection.prototype.getInfo = function(successCallback, errorCallback) {
+ // Get info
+ PhoneGap.exec(successCallback, errorCallback, "Network Status", "getConnectionInfo", []);
+ };
+
+ /**
+ * Define navigator.network and navigator.network.connection objects
*/
PhoneGap.addConstructor(function() {
navigator.network = new Network();
+
+ navigator.network.connection = new NetworkConnection();
});
}());
View
2  BlackBerry-WebWorks/template/project/www/config.xml
@@ -20,7 +20,7 @@
<!-- PhoneGap API -->
<feature id="blackberry.system" required="true" version="1.0.0.0" />
- <feature id="phonegap" required="true" version="0.9.5.1" />
+ <feature id="phonegap" required="true" version="0.9.6" />
<feature id="blackberry.find" required="true" version="1.0.0.0" />
<feature id="blackberry.identity" required="true" version="1.0.0.0" />
<feature id="blackberry.pim.Address" required="true" version="1.0.0.0" />
View
26 BlackBerry-WebWorks/template/project/www/index.html
@@ -2,7 +2,7 @@
PhoneGap is available under *either* the terms of the modified BSD license *or* the MIT License (2008).
See http://opensource.org/licenses/alphabetical for full text.
-Copyright (c) 2005-2010, Nitobi Software Inc.
+Copyright (c) 2005-2011, Nitobi Software Inc.
Copyright (c) 2010-2011, IBM Corporation
website: http://phonegap.com
@@ -13,8 +13,8 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" id="viewport" content="initial-scale=1.0,user-scalable=no">
- <script src="javascript/json2.js" type="text/javascript"></script>
- <script src="javascript/phonegap.js" type="text/javascript"></script>
+ <script src="json2.js" type="text/javascript"></script>
+ <script src="phonegap.js" type="text/javascript"></script>
<script type="text/javascript">
//---------------------------------------------------------------------
@@ -48,12 +48,24 @@
console.log('doPause()');
}
+ // invoked when application is online
+ function doOnline() {
+ console.log('Event: online\n' + 'Network Type: ' + navigator.network.connection.type + '\n');
+ }
+
+ // invoked when application is offline
+ function doOffline() {
+ console.log('Event: offline\n' + 'Network Type: ' + navigator.network.connection.type + '\n');
+ }
+
// register PhoneGap event listeners when DOM content loaded
function init() {
console.log('init()');
document.addEventListener("deviceready", deviceInfo, true);
document.addEventListener("resume", doResume, false);
document.addEventListener("pause", doPause, false);
+ document.addEventListener("online", doOnline, false);
+ document.addEventListener("offline", doOffline, false);
}
function unload() {
@@ -101,6 +113,13 @@
}
//---------------------------------------------------------------------
+ // Network
+ //---------------------------------------------------------------------
+ function getNetworkType() {
+ alert('Network Type: ' + navigator.network.connection.type + '\n');
+ }
+
+ //---------------------------------------------------------------------
// Accelerometer
//---------------------------------------------------------------------
function showAcceleration(acceleration) {
@@ -862,6 +881,7 @@
<h3>navigator.network</h3>
<p id="networkStatus">[navigator.network.isReachable]</p>
+ <input type="button" value="Get Network Type" onclick="getNetworkType();return false;" />
<h3>navigator.geolocation</h3>
<dl id="location-data">
View
0  .../template/project/www/javascript/json2.js → ...ry-WebWorks/template/project/www/json2.js
File renamed without changes
View
7 Documentation/_index.html
@@ -44,6 +44,7 @@
<li><a href="phonegap_camera_camera.md.html">Camera</a></li>
<li><a href="phonegap_media_capture_capture.md.html">Capture</a></li>
<li><a href="phonegap_compass_compass.md.html">Compass</a></li>
+ <li><a href="phonegap_connection_connection.md.html">Connection</a></li>
<li><a href="phonegap_contacts_contacts.md.html">Contacts</a></li>
<li><a href="phonegap_device_device.md.html">Device</a></li>
<li><a href="phonegap_events_events.md.html">Events</a></li>
@@ -111,6 +112,8 @@
<li><a href="phonegap_compass_compass.md.html#compassOptions">compassOptions</a></li>
<li><a href="phonegap_compass_compass.md.html#compassSuccess">compassSuccess</a></li>
<li><a href="phonegap_media_capture_capture.md.html#ConfigurationData">ConfigurationData</a></li>
+<li><a href="phonegap_connection_connection.md.html#Connection">Connection</a></li>
+<li><a href="phonegap_connection_connection.md.html#connection.type">connection.type</a></li>
<li><a href="phonegap_contacts_contacts.md.html#Contact">Contact</a></li>
<li><a href="phonegap_contacts_contacts.md.html#ContactAddress">ContactAddress</a></li>
<li><a href="phonegap_contacts_contacts.md.html#contactError">contactError</a></li>
@@ -197,6 +200,7 @@
<li><a href="phonegap_media_capture_capture.md.html#MediaFile">MediaFile</a></li>
<li><a href="phonegap_media_capture_capture.md.html#MediaFile.getFormatData">MediaFile.getFormatData</a></li>
<li><a href="phonegap_media_capture_capture.md.html#MediaFileData">MediaFileData</a></li>
+<li><a href="phonegap_events_events.md.html#menubutton">menubutton</a></li>
<li><a href="phonegap_file_file.md.html#Metadata">Metadata</a></li>
</ul>
<h2>N</h2>
@@ -215,6 +219,8 @@
<h2>O</h2>
<ul>
+<li><a href="phonegap_events_events.md.html#offline">offline</a></li>
+<li><a href="phonegap_events_events.md.html#online">online</a></li>
<li><a href="phonegap_storage_storage.md.html#openDatabase">openDatabase</a></li>
</ul>
<h2>P</h2>
@@ -235,6 +241,7 @@
<h2>S</h2>
<ul>
+<li><a href="phonegap_events_events.md.html#searchbutton">searchbutton</a></li>
<li><a href="phonegap_storage_storage.md.html#size">size</a></li>
<li><a href="phonegap_storage_storage.md.html#SQLError">SQLError</a></li>
<li><a href="phonegap_storage_storage.md.html#SQLResultSet">SQLResultSet</a></li>
View
2  Documentation/_index.json
@@ -1 +1 @@
-[{"term":"Acceleration","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"Accelerometer","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometer.clearWatch","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometer.getCurrentAcceleration","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometer.watchAcceleration","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometerError","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometerOptions","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometerSuccess","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"API Reference","url":"index.md.html"},{"term":"backbutton","url":"phonegap_events_events.md.html"},{"term":"Camera","url":"phonegap_camera_camera.md.html"},{"term":"camera.getPicture","url":"phonegap_camera_camera.md.html"},{"term":"cameraError","url":"phonegap_camera_camera.md.html"},{"term":"cameraOptions","url":"phonegap_camera_camera.md.html"},{"term":"cameraSuccess","url":"phonegap_camera_camera.md.html"},{"term":"Capture","url":"phonegap_media_capture_capture.md.html"},{"term":"capture.captureAudio","url":"phonegap_media_capture_capture.md.html"},{"term":"capture.captureImage","url":"phonegap_media_capture_capture.md.html"},{"term":"capture.captureVideo","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureAudioOptions","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureCB","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureError","url":"phonegap_media_capture_CaptureError.md.html"},{"term":"CaptureErrorCB","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureImageOptions","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureVideoOptions","url":"phonegap_media_capture_capture.md.html"},{"term":"Compass","url":"phonegap_compass_compass.md.html"},{"term":"compass.clearWatch","url":"phonegap_compass_compass.md.html"},{"term":"compass.getCurrentHeading","url":"phonegap_compass_compass.md.html"},{"term":"compass.watchHeading","url":"phonegap_compass_compass.md.html"},{"term":"compassError","url":"phonegap_compass_compass.md.html"},{"term":"compassOptions","url":"phonegap_compass_compass.md.html"},{"term":"compassSuccess","url":"phonegap_compass_compass.md.html"},{"term":"ConfigurationData","url":"phonegap_media_capture_capture.md.html"},{"term":"Contact","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactAddress","url":"phonegap_contacts_contacts.md.html"},{"term":"contactError","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactError","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactField","url":"phonegap_contacts_contacts.md.html"},{"term":"contactFields","url":"phonegap_contacts_contacts.md.html"},{"term":"contactFindOptions","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactFindOptions","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactName","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactOrganization","url":"phonegap_contacts_contacts.md.html"},{"term":"Contacts","url":"phonegap_contacts_contacts.md.html"},{"term":"contacts.create","url":"phonegap_contacts_contacts.md.html"},{"term":"contacts.find","url":"phonegap_contacts_contacts.md.html"},{"term":"contactSuccess","url":"phonegap_contacts_contacts.md.html"},{"term":"Coordinates","url":"phonegap_geolocation_geolocation.md.html"},{"term":"Database","url":"phonegap_storage_storage.md.html"},{"term":"Device","url":"phonegap_device_device.md.html"},{"term":"device.name","url":"phonegap_device_device.md.html"},{"term":"device.phonegap","url":"phonegap_device_device.md.html"},{"term":"device.platform","url":"phonegap_device_device.md.html"},{"term":"device.uuid","url":"phonegap_device_device.md.html"},{"term":"device.version","url":"phonegap_device_device.md.html"},{"term":"deviceready","url":"phonegap_events_events.md.html"},{"term":"DirectoryEntry","url":"phonegap_file_file.md.html"},{"term":"DirectoryReader","url":"phonegap_file_file.md.html"},{"term":"display_name","url":"phonegap_storage_storage.md.html"},{"term":"Events","url":"phonegap_events_events.md.html"},{"term":"File","url":"phonegap_file_file.md.html"},{"term":"FileEntry","url":"phonegap_file_file.md.html"},{"term":"FileError","url":"phonegap_file_file.md.html"},{"term":"FileReader","url":"phonegap_file_file.md.html"},{"term":"FileSystem","url":"phonegap_file_file.md.html"},{"term":"FileTransfer","url":"phonegap_file_file.md.html"},{"term":"FileTransferError","url":"phonegap_file_file.md.html"},{"term":"FileUploadOptions","url":"phonegap_file_file.md.html"},{"term":"FileUploadResult","url":"phonegap_file_file.md.html"},{"term":"FileWriter","url":"phonegap_file_file.md.html"},{"term":"Flags","url":"phonegap_file_file.md.html"},{"term":"Geolocation","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocation.clearWatch","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocation.getCurrentPosition","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocation.watchPosition","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocationError","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocationOptions","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocationSuccess","url":"phonegap_geolocation_geolocation.md.html"},{"term":"Guides","url":"index.md.html"},{"term":"LocalFileSystem","url":"phonegap_file_file.md.html"},{"term":"localStorage","url":"phonegap_storage_storage.md.html"},{"term":"Media","url":"phonegap_media_media.md.html"},{"term":"media.getCurrentPosition","url":"phonegap_media_media.md.html"},{"term":"media.getDuration","url":"phonegap_media_media.md.html"},{"term":"media.pause","url":"phonegap_media_media.md.html"},{"term":"media.play","url":"phonegap_media_media.md.html"},{"term":"media.release","url":"phonegap_media_media.md.html"},{"term":"media.startRecord","url":"phonegap_media_media.md.html"},{"term":"media.stop","url":"phonegap_media_media.md.html"},{"term":"media.stopRecord","url":"phonegap_media_media.md.html"},{"term":"mediaError","url":"phonegap_media_media.md.html"},{"term":"MediaError","url":"phonegap_media_media.md.html"},{"term":"MediaFile","url":"phonegap_media_capture_capture.md.html"},{"term":"MediaFile.getFormatData","url":"phonegap_media_capture_capture.md.html"},{"term":"MediaFileData","url":"phonegap_media_capture_capture.md.html"},{"term":"Metadata","url":"phonegap_file_file.md.html"},{"term":"name","url":"phonegap_storage_storage.md.html"},{"term":"Network","url":"phonegap_network_network.md.html"},{"term":"network.isReachable","url":"phonegap_network_network.md.html"},{"term":"NetworkStatus","url":"phonegap_network_network.md.html"},{"term":"Notification","url":"phonegap_notification_notification.md.html"},{"term":"notification.alert","url":"phonegap_notification_notification.md.html"},{"term":"notification.beep","url":"phonegap_notification_notification.md.html"},{"term":"notification.confirm","url":"phonegap_notification_notification.md.html"},{"term":"notification.vibrate","url":"phonegap_notification_notification.md.html"},{"term":"openDatabase","url":"phonegap_storage_storage.md.html"},{"term":"pause","url":"phonegap_events_events.md.html"},{"term":"Position","url":"phonegap_geolocation_geolocation.md.html"},{"term":"PositionError","url":"phonegap_geolocation_geolocation.md.html"},{"term":"reachableCallback","url":"phonegap_network_network.md.html"},{"term":"reachableHostname","url":"phonegap_network_network.md.html"},{"term":"reachableOptions","url":"phonegap_network_network.md.html"},{"term":"resume","url":"phonegap_events_events.md.html"},{"term":"size","url":"phonegap_storage_storage.md.html"},{"term":"SQLError","url":"phonegap_storage_storage.md.html"},{"term":"SQLResultSet","url":"phonegap_storage_storage.md.html"},{"term":"SQLResultSetList","url":"phonegap_storage_storage.md.html"},{"term":"SQLTransaction","url":"phonegap_storage_storage.md.html"},{"term":"Storage","url":"phonegap_storage_storage.md.html"},{"term":"version","url":"phonegap_storage_storage.md.html"}]
+[{"term":"Acceleration","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"Accelerometer","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometer.clearWatch","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometer.getCurrentAcceleration","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometer.watchAcceleration","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometerError","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometerOptions","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"accelerometerSuccess","url":"phonegap_accelerometer_accelerometer.md.html"},{"term":"API Reference","url":"index.md.html"},{"term":"backbutton","url":"phonegap_events_events.md.html"},{"term":"Camera","url":"phonegap_camera_camera.md.html"},{"term":"camera.getPicture","url":"phonegap_camera_camera.md.html"},{"term":"cameraError","url":"phonegap_camera_camera.md.html"},{"term":"cameraOptions","url":"phonegap_camera_camera.md.html"},{"term":"cameraSuccess","url":"phonegap_camera_camera.md.html"},{"term":"Capture","url":"phonegap_media_capture_capture.md.html"},{"term":"capture.captureAudio","url":"phonegap_media_capture_capture.md.html"},{"term":"capture.captureImage","url":"phonegap_media_capture_capture.md.html"},{"term":"capture.captureVideo","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureAudioOptions","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureCB","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureError","url":"phonegap_media_capture_CaptureError.md.html"},{"term":"CaptureErrorCB","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureImageOptions","url":"phonegap_media_capture_capture.md.html"},{"term":"CaptureVideoOptions","url":"phonegap_media_capture_capture.md.html"},{"term":"Compass","url":"phonegap_compass_compass.md.html"},{"term":"compass.clearWatch","url":"phonegap_compass_compass.md.html"},{"term":"compass.getCurrentHeading","url":"phonegap_compass_compass.md.html"},{"term":"compass.watchHeading","url":"phonegap_compass_compass.md.html"},{"term":"compassError","url":"phonegap_compass_compass.md.html"},{"term":"compassOptions","url":"phonegap_compass_compass.md.html"},{"term":"compassSuccess","url":"phonegap_compass_compass.md.html"},{"term":"ConfigurationData","url":"phonegap_media_capture_capture.md.html"},{"term":"Connection","url":"phonegap_connection_connection.md.html"},{"term":"connection.type","url":"phonegap_connection_connection.md.html"},{"term":"Contact","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactAddress","url":"phonegap_contacts_contacts.md.html"},{"term":"contactError","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactError","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactField","url":"phonegap_contacts_contacts.md.html"},{"term":"contactFields","url":"phonegap_contacts_contacts.md.html"},{"term":"contactFindOptions","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactFindOptions","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactName","url":"phonegap_contacts_contacts.md.html"},{"term":"ContactOrganization","url":"phonegap_contacts_contacts.md.html"},{"term":"Contacts","url":"phonegap_contacts_contacts.md.html"},{"term":"contacts.create","url":"phonegap_contacts_contacts.md.html"},{"term":"contacts.find","url":"phonegap_contacts_contacts.md.html"},{"term":"contactSuccess","url":"phonegap_contacts_contacts.md.html"},{"term":"Coordinates","url":"phonegap_geolocation_geolocation.md.html"},{"term":"Database","url":"phonegap_storage_storage.md.html"},{"term":"Device","url":"phonegap_device_device.md.html"},{"term":"device.name","url":"phonegap_device_device.md.html"},{"term":"device.phonegap","url":"phonegap_device_device.md.html"},{"term":"device.platform","url":"phonegap_device_device.md.html"},{"term":"device.uuid","url":"phonegap_device_device.md.html"},{"term":"device.version","url":"phonegap_device_device.md.html"},{"term":"deviceready","url":"phonegap_events_events.md.html"},{"term":"DirectoryEntry","url":"phonegap_file_file.md.html"},{"term":"DirectoryReader","url":"phonegap_file_file.md.html"},{"term":"display_name","url":"phonegap_storage_storage.md.html"},{"term":"Events","url":"phonegap_events_events.md.html"},{"term":"File","url":"phonegap_file_file.md.html"},{"term":"FileEntry","url":"phonegap_file_file.md.html"},{"term":"FileError","url":"phonegap_file_file.md.html"},{"term":"FileReader","url":"phonegap_file_file.md.html"},{"term":"FileSystem","url":"phonegap_file_file.md.html"},{"term":"FileTransfer","url":"phonegap_file_file.md.html"},{"term":"FileTransferError","url":"phonegap_file_file.md.html"},{"term":"FileUploadOptions","url":"phonegap_file_file.md.html"},{"term":"FileUploadResult","url":"phonegap_file_file.md.html"},{"term":"FileWriter","url":"phonegap_file_file.md.html"},{"term":"Flags","url":"phonegap_file_file.md.html"},{"term":"Geolocation","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocation.clearWatch","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocation.getCurrentPosition","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocation.watchPosition","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocationError","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocationOptions","url":"phonegap_geolocation_geolocation.md.html"},{"term":"geolocationSuccess","url":"phonegap_geolocation_geolocation.md.html"},{"term":"Guides","url":"index.md.html"},{"term":"LocalFileSystem","url":"phonegap_file_file.md.html"},{"term":"localStorage","url":"phonegap_storage_storage.md.html"},{"term":"Media","url":"phonegap_media_media.md.html"},{"term":"media.getCurrentPosition","url":"phonegap_media_media.md.html"},{"term":"media.getDuration","url":"phonegap_media_media.md.html"},{"term":"media.pause","url":"phonegap_media_media.md.html"},{"term":"media.play","url":"phonegap_media_media.md.html"},{"term":"media.release","url":"phonegap_media_media.md.html"},{"term":"media.startRecord","url":"phonegap_media_media.md.html"},{"term":"media.stop","url":"phonegap_media_media.md.html"},{"term":"media.stopRecord","url":"phonegap_media_media.md.html"},{"term":"mediaError","url":"phonegap_media_media.md.html"},{"term":"MediaError","url":"phonegap_media_media.md.html"},{"term":"MediaFile","url":"phonegap_media_capture_capture.md.html"},{"term":"MediaFile.getFormatData","url":"phonegap_media_capture_capture.md.html"},{"term":"MediaFileData","url":"phonegap_media_capture_capture.md.html"},{"term":"menubutton","url":"phonegap_events_events.md.html"},{"term":"Metadata","url":"phonegap_file_file.md.html"},{"term":"name","url":"phonegap_storage_storage.md.html"},{"term":"Network","url":"phonegap_network_network.md.html"},{"term":"network.isReachable","url":"phonegap_network_network.md.html"},{"term":"NetworkStatus","url":"phonegap_network_network.md.html"},{"term":"Notification","url":"phonegap_notification_notification.md.html"},{"term":"notification.alert","url":"phonegap_notification_notification.md.html"},{"term":"notification.beep","url":"phonegap_notification_notification.md.html"},{"term":"notification.confirm","url":"phonegap_notification_notification.md.html"},{"term":"notification.vibrate","url":"phonegap_notification_notification.md.html"},{"term":"offline","url":"phonegap_events_events.md.html"},{"term":"online","url":"phonegap_events_events.md.html"},{"term":"openDatabase","url":"phonegap_storage_storage.md.html"},{"term":"pause","url":"phonegap_events_events.md.html"},{"term":"Position","url":"phonegap_geolocation_geolocation.md.html"},{"term":"PositionError","url":"phonegap_geolocation_geolocation.md.html"},{"term":"reachableCallback","url":"phonegap_network_network.md.html"},{"term":"reachableHostname","url":"phonegap_network_network.md.html"},{"term":"reachableOptions","url":"phonegap_network_network.md.html"},{"term":"resume","url":"phonegap_events_events.md.html"},{"term":"searchbutton","url":"phonegap_events_events.md.html"},{"term":"size","url":"phonegap_storage_storage.md.html"},{"term":"SQLError","url":"phonegap_storage_storage.md.html"},{"term":"SQLResultSet","url":"phonegap_storage_storage.md.html"},{"term":"SQLResultSetList","url":"phonegap_storage_storage.md.html"},{"term":"SQLTransaction","url":"phonegap_storage_storage.md.html"},{"term":"Storage","url":"phonegap_storage_storage.md.html"},{"term":"version","url":"phonegap_storage_storage.md.html"}]
View
5 Documentation/index.html
@@ -44,6 +44,7 @@
<li><a href="phonegap_camera_camera.md.html">Camera</a></li>
<li><a href="phonegap_media_capture_capture.md.html">Capture</a></li>
<li><a href="phonegap_compass_compass.md.html">Compass</a></li>
+ <li><a href="phonegap_connection_connection.md.html">Connection</a></li>
<li><a href="phonegap_contacts_contacts.md.html">Contacts</a></li>
<li><a href="phonegap_device_device.md.html">Device</a></li>
<li><a href="phonegap_events_events.md.html">Events</a></li>
@@ -82,6 +83,10 @@
<span>Obtain the direction that the device is pointing.</span>
</li>
<li>
+ <h2><a href="phonegap_connection_connection.md.html#Connection">Connection</a></h2>
+ <span>Quickly check the network state, and cellular network information.</span>
+ </li>
+ <li>
<h2><a href="phonegap_contacts_contacts.md.html#Contacts">Contacts</a></h2>
<span>Work with the devices contact database.</span>
</li>
View
37 Documentation/phonegap_accelerometer_accelerometer.md.html
@@ -75,6 +75,7 @@
<li><a href="phonegap_camera_camera.md.html">Camera</a></li>
<li><a href="phonegap_media_capture_capture.md.html">Capture</a></li>
<li><a href="phonegap_compass_compass.md.html">Compass</a></li>
+ <li><a href="phonegap_connection_connection.md.html">Connection</a></li>
<li><a href="phonegap_contacts_contacts.md.html">Contacts</a></li>
<li><a href="phonegap_device_device.md.html">Device</a></li>
<li><a href="phonegap_events_events.md.html">Events</a></li>
@@ -157,8 +158,7 @@
<h2><a name="accelerometer.getCurrentAcceleration_full_example">Full Example</a></h2>
-<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"&gt;
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;<a href="phonegap_accelerometer_accelerometer.md.html#Acceleration">Acceleration</a> Example&lt;/title&gt;
@@ -168,9 +168,7 @@
// Wait for PhoneGap to load
//
- function onLoad() {
- document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
- }
+ document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
// PhoneGap is ready
//
@@ -195,7 +193,7 @@
&lt;/script&gt;
&lt;/head&gt;
- &lt;body onload="onLoad()"&gt;
+ &lt;body&gt;
&lt;h1&gt;Example&lt;/h1&gt;
&lt;p&gt;getCurrentAcceleration&lt;/p&gt;
&lt;/body&gt;
@@ -254,8 +252,7 @@
<h2><a name="accelerometer.watchAcceleration_full_example">Full Example</a></h2>
-<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"&gt;
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;<a href="phonegap_accelerometer_accelerometer.md.html#Acceleration">Acceleration</a> Example&lt;/title&gt;
@@ -268,9 +265,7 @@
// Wait for PhoneGap to load
//
- function onLoad() {
- document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
- }
+ document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
// PhoneGap is ready
//
@@ -315,7 +310,7 @@
&lt;/script&gt;
&lt;/head&gt;
- &lt;body onload="onLoad()"&gt;
+ &lt;body&gt;
&lt;div id="accelerometer"&gt;Waiting for accelerometer...&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
@@ -361,8 +356,7 @@
<h2><a name="accelerometer.clearWatch_full_example">Full Example</a></h2>
-<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"&gt;
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;<a href="phonegap_accelerometer_accelerometer.md.html#Acceleration">Acceleration</a> Example&lt;/title&gt;
@@ -375,9 +369,7 @@
// Wait for PhoneGap to load
//
- function onLoad() {
- document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
- }
+ document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
// PhoneGap is ready
//
@@ -422,7 +414,7 @@
&lt;/script&gt;
&lt;/head&gt;
- &lt;body onload="onLoad()"&gt;
+ &lt;body&gt;
&lt;div id="accelerometer"&gt;Waiting for accelerometer...&lt;/div&gt;
&lt;button onclick="stopWatch();"&gt;Stop Watching&lt;/button&gt;
&lt;/body&gt;
@@ -475,8 +467,7 @@
<h2><a name="Acceleration_full_example">Full Example</a></h2>
-<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"&gt;
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;<a href="phonegap_accelerometer_accelerometer.md.html#Acceleration">Acceleration</a> Example&lt;/title&gt;
@@ -486,9 +477,7 @@
// Wait for PhoneGap to load
//
- function onLoad() {
- document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
- }
+ document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
// PhoneGap is ready
//
@@ -513,7 +502,7 @@
&lt;/script&gt;
&lt;/head&gt;
- &lt;body onload="onLoad()"&gt;
+ &lt;body&gt;
&lt;h1&gt;Example&lt;/h1&gt;
&lt;p&gt;getCurrentAcceleration&lt;/p&gt;
&lt;/body&gt;
View
12 Documentation/phonegap_camera_camera.md.html
@@ -61,6 +61,7 @@
<li><a href="phonegap_camera_camera.md.html">Camera</a></li>
<li><a href="phonegap_media_capture_capture.md.html">Capture</a></li>
<li><a href="phonegap_compass_compass.md.html">Compass</a></li>
+ <li><a href="phonegap_connection_connection.md.html">Connection</a></li>
<li><a href="phonegap_contacts_contacts.md.html">Contacts</a></li>
<li><a href="phonegap_device_device.md.html">Device</a></li>
<li><a href="phonegap_events_events.md.html">Events</a></li>
@@ -160,8 +161,7 @@
<h2><a name="camera.getPicture_full_example">Full Example</a></h2>
-<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"&gt;
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;<a href="phonegap_media_capture_capture.md.html#Capture">Capture</a> Photo&lt;/title&gt;
@@ -174,9 +174,7 @@
// Wait for PhoneGap to connect with the device
//
- function onLoad() {
- document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>",onDeviceReady,false);
- }
+ document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>",onDeviceReady,false);
// PhoneGap is ready to be used!
//
@@ -250,13 +248,13 @@
// Called if something bad happens.
//
- function onFail(mesage) {
+ function onFail(message) {
alert('Failed because: ' + message);
}
&lt;/script&gt;
&lt;/head&gt;
- &lt;body onload="onLoad()"&gt;
+ &lt;body&gt;
&lt;button onclick="capturePhoto();"&gt;<a href="phonegap_media_capture_capture.md.html#Capture">Capture</a> Photo&lt;/button&gt; &lt;br&gt;
&lt;button onclick="capturePhotoEdit();"&gt;<a href="phonegap_media_capture_capture.md.html#Capture">Capture</a> Editable Photo&lt;/button&gt; &lt;br&gt;
&lt;button onclick="getPhoto(pictureSource.PHOTOLIBRARY);"&gt;From Photo Library&lt;/button&gt;&lt;br&gt;
View
28 Documentation/phonegap_compass_compass.md.html
@@ -66,6 +66,7 @@
<li><a href="phonegap_camera_camera.md.html">Camera</a></li>
<li><a href="phonegap_media_capture_capture.md.html">Capture</a></li>
<li><a href="phonegap_compass_compass.md.html">Compass</a></li>
+ <li><a href="phonegap_connection_connection.md.html">Connection</a></li>
<li><a href="phonegap_contacts_contacts.md.html">Contacts</a></li>
<li><a href="phonegap_device_device.md.html">Device</a></li>
<li><a href="phonegap_events_events.md.html">Events</a></li>
@@ -139,8 +140,7 @@
<h2><a name="compass.getCurrentHeading_full_example">Full Example</a></h2>
-<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"&gt;
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;<a href="phonegap_compass_compass.md.html#Compass">Compass</a> Example&lt;/title&gt;
@@ -150,9 +150,7 @@
// Wait for PhoneGap to load
//
- function onLoad() {
- document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
- }
+ document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
// PhoneGap is ready
//
@@ -174,7 +172,7 @@
&lt;/script&gt;
&lt;/head&gt;
- &lt;body onload="onLoad()"&gt;
+ &lt;body&gt;
&lt;h1&gt;Example&lt;/h1&gt;
&lt;p&gt;getCurrentHeading&lt;/p&gt;
&lt;/body&gt;
@@ -221,8 +219,7 @@
<h2><a name="compass.watchHeading_full_example">Full Example</a></h2>
-<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"&gt;
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;<a href="phonegap_compass_compass.md.html#Compass">Compass</a> Example&lt;/title&gt;
@@ -235,9 +232,7 @@
// Wait for PhoneGap to load
//
- function onLoad() {
- document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
- }
+ document.addEventListener("<a href="phonegap_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
// PhoneGap is ready
//
@@ -279,7 +274,7 @@
&lt;/script&gt;
&lt;/head&gt;
- &lt;body onload="onLoad()"&gt;
+ &lt;body&gt;
&lt;div id="heading"&gt;Waiting for heading...&lt;/div&gt;
&lt;button onclick="startWatch();"&gt;Start Watching&lt;/button&gt;
&lt;button onclick="stopWatch();"&gt;Stop Watching&lt;/button&gt;
@@ -316,8 +311,7 @@
<h2><a name="compass.clearWatch_full_example">Full Example</a></h2>
-<pre class="prettyprint"><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"&gt;
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;