You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/11/01 11:53:31 UTC
[47/51] [abbrv] renamed metro folder
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/cordova.js
----------------------------------------------------------------------
diff --git a/windows8/test/cordova.js b/windows8/test/cordova.js
new file mode 100644
index 0000000..1f2c353
--- /dev/null
+++ b/windows8/test/cordova.js
@@ -0,0 +1,27 @@
+(function () {
+
+ var VERSION = '2.2.0',
+ currentScript = 'cordova-' + VERSION + '.js',
+ scripts = document.getElementsByTagName('script');
+
+ for (var n = 0; n < scripts.length; n++) {
+ if (scripts[n].src.indexOf('cordova.js') > -1) {
+ var cordovaPath = scripts[n].src.replace('cordova.js', currentScript);
+ var scriptElem = document.createElement("script");
+ scriptElem.src = cordovaPath;
+ document.head.appendChild(scriptElem);
+ }
+ }
+
+})();
+
+function backHome() {
+ if (window.device && device.platform && device.platform.toLowerCase() == 'android') {
+ navigator.app.backHistory();
+ }
+ else {
+ window.history.go(-1);
+ }
+}
+
+window.alert = window.alert || function (msg, title, btn) { console.log("Alert::" + msg); };
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/events/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/events/index.html b/windows8/test/events/index.html
new file mode 100644
index 0000000..1449bd9
--- /dev/null
+++ b/windows8/test/events/index.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</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="../cordova.js"></script>
+
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ function interceptBackbutton() {
+ eventOutput("Back button intercepted");
+ }
+ function interceptMenubutton() {
+ eventOutput("Menu button intercepted");
+ }
+ function interceptSearchbutton() {
+ eventOutput("Search button intercepted");
+ }
+ function interceptResume() {
+ eventOutput("Resume event intercepted");
+ }
+ function interceptPause() {
+ eventOutput("Pause event intercepted");
+ }
+ function interceptOnline() {
+ eventOutput("Online event intercepted");
+ }
+ function interceptOffline() {
+ eventOutput("Offline event intercepted");
+ }
+
+ var eventOutput = function(s) {
+ var el = document.getElementById("results");
+ el.innerHTML = el.innerHTML + s + "<br>";
+ };
+
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ eventOutput("deviceready event: "+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Events</h1>
+ <div id="info">
+ <b>Results:</b><br>
+ <span id="results"></span>
+ </div>
+
+ <h2>Action</h2>
+ <div class="btn large" onclick="document.addEventListener('backbutton', interceptBackbutton, false);">Intercept backbutton</div>
+ <div class="btn large" onclick="document.removeEventListener('backbutton', interceptBackbutton, false);">Stop intercept of backbutton</div>
+ <div class="btn large" onclick="document.addEventListener('menubutton', interceptMenubutton, false);">Intercept menubutton</div>
+ <div class="btn large" onclick="document.removeEventListener('menubutton', interceptMenubutton, false);">Stop intercept of menubutton</div>
+ <div class="btn large" onclick="document.addEventListener('searchbutton', interceptSearchbutton, false);">Intercept searchbutton</div>
+ <div class="btn large" onclick="document.removeEventListener('searchbutton', interceptSearchbutton, false);">Stop intercept of searchbutton</div>
+ <div class="btn large" onclick="document.addEventListener('resume', interceptResume, false);">Intercept resume</div>
+ <div class="btn large" onclick="document.removeEventListener('resume', interceptResume, false);">Stop intercept of resume</div>
+ <div class="btn large" onclick="document.addEventListener('pause', interceptPause, false);">Intercept pause</div>
+ <div class="btn large" onclick="document.removeEventListener('pause', interceptPause, false);">Stop intercept of pause</div>
+ <div class="btn large" onclick="document.addEventListener('online', interceptOnline, false);">Intercept online</div>
+ <div class="btn large" onclick="document.removeEventListener('online', interceptOnline, false);">Stop intercept of online</div>
+ <div class="btn large" onclick="document.addEventListener('offline', interceptOffline, false);">Intercept offline</div>
+ <div class="btn large" onclick="document.removeEventListener('offline', interceptOffline, false);">Stop intercept of offline</div>
+
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/images/logo.png
----------------------------------------------------------------------
diff --git a/windows8/test/images/logo.png b/windows8/test/images/logo.png
new file mode 100644
index 0000000..86a48a8
Binary files /dev/null and b/windows8/test/images/logo.png differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/images/smalllogo.png
----------------------------------------------------------------------
diff --git a/windows8/test/images/smalllogo.png b/windows8/test/images/smalllogo.png
new file mode 100644
index 0000000..0e648ef
Binary files /dev/null and b/windows8/test/images/smalllogo.png differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/images/splashscreen.png
----------------------------------------------------------------------
diff --git a/windows8/test/images/splashscreen.png b/windows8/test/images/splashscreen.png
new file mode 100644
index 0000000..d1e6c98
Binary files /dev/null and b/windows8/test/images/splashscreen.png differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/images/storelogo.png
----------------------------------------------------------------------
diff --git a/windows8/test/images/storelogo.png b/windows8/test/images/storelogo.png
new file mode 100644
index 0000000..dd00478
Binary files /dev/null and b/windows8/test/images/storelogo.png differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/index.html b/windows8/test/index.html
new file mode 100644
index 0000000..ac6466a
--- /dev/null
+++ b/windows8/test/index.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title">
+
+ <!-- WinJS references -->
+ <!--<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />-->
+ <script src="//Microsoft.WinJS.1.0/js/base.js"></script>
+ <script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
+ <script type="text/javascript" charset="utf-8" src="main.js"></script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+ <h1>PhoneGap Tests</h1>
+ <div id="info">
+ <h4>Platform: <span id="platform"> </span></h4>
+ <h4>Version: <span id="version"> </span></h4>
+ <h4>UUID: <span id="uuid"> </span></h4>
+ <h4>Name: <span id="name"> </span></h4>
+ <h4>Width: <span id="width"> </span>, Height: <span id="height">
+ </span>, Color Depth: <span id="colorDepth"></span></h4>
+ </div>
+ <a href="autotest/index.html" class="btn large">Automatic Test</a>
+ <a href="accelerometer/index.html" class="btn large">Accelerometer</a>
+ <a href="audio/index.html" class="btn large">Audio Play/Record</a>
+ <a href="battery/index.html" class="btn large">Battery</a>
+ <a href="camera/index.html" class="btn large">Camera</a>
+ <a href="compass/index.html" class="btn large">Compass</a>
+ <a href="contacts/index.html" class="btn large">Contacts</a>
+ <a href="events/index.html" class="btn large">Events</a>
+ <a href="location/index.html" class="btn large">Location</a>
+ <a href="misc/index.html" class="btn large">Misc Content</a>
+ <a href="network/index.html" class="btn large">Network</a>
+ <a href="notification/index.html" class="btn large">Notification</a>
+ <a href="sql/index.html" class="btn large">Web SQL</a>
+ <a href="storage/index.html" class="btn large">Local Storage</a>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/location/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/location/index.html b/windows8/test/location/index.html
new file mode 100644
index 0000000..6eb39c5
--- /dev/null
+++ b/windows8/test/location/index.html
@@ -0,0 +1,154 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</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="../cordova.js"></script>
+
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ //-------------------------------------------------------------------------
+ // Location
+ //-------------------------------------------------------------------------
+ var watchLocationId = null;
+
+ /**
+ * Start watching location
+ */
+ var watchLocation = function(geo) {
+ console.log("watchLocation()");
+
+ // Success callback
+ var success = function(p){
+ console.log('watch location success');
+ setLocationDetails(p);
+ };
+
+ // Fail callback
+ var fail = function(e){
+ console.log("watchLocation fail callback with error code "+e);
+ stopLocation(geo);
+ };
+
+ // Get location
+ watchLocationId = geo.watchPosition(success, fail, {enableHighAccuracy: true});
+ setLocationStatus("Running");
+ };
+
+ /**
+ * Stop watching the location
+ */
+ var stopLocation = function(geo) {
+ setLocationStatus("Stopped");
+ if (watchLocationId) {
+ geo.clearWatch(watchLocationId);
+ watchLocationId = null;
+ }
+ };
+
+ /**
+ * Get current location
+ */
+ var getLocation = function(geo, opts) {
+ console.log("getLocation()");
+
+ // Stop location if running
+ stopLocation(geo);
+
+ // Success callback
+ var success = function(p){
+ console.log('get location success');
+ setLocationDetails(p);
+ setLocationStatus("Done");
+ };
+
+ // Fail callback
+ var fail = function(e){
+ console.log("getLocation fail callback with error code "+e.code);
+ setLocationStatus("Error: "+e.code);
+ };
+
+ // Get location
+ geo.getCurrentPosition(success, fail, opts || {enableHighAccuracy: true}); //, {timeout: 10000});
+ setLocationStatus("Retrieving location...");
+
+ };
+
+ /**
+ * Set location status
+ */
+ var setLocationStatus = function(status) {
+ document.getElementById('location_status').innerHTML = status;
+ };
+var setLocationDetails = function(p) {
+var date = (new Date(p.timestamp));
+ document.getElementById('latitude').innerHTML = p.coords.latitude;
+ document.getElementById('longitude').innerHTML = p.coords.longitude;
+ document.getElementById('altitude').innerHTML = p.coords.altitude;
+ document.getElementById('accuracy').innerHTML = p.coords.accuracy;
+ document.getElementById('heading').innerHTML = p.coords.heading;
+ document.getElementById('speed').innerHTML = p.coords.speed;
+ document.getElementById('altitude_accuracy').innerHTML = p.coords.altitudeAccuracy;
+ document.getElementById('timestamp').innerHTML = date.toDateString() + " " + date.toTimeString();
+ }
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Location</h1>
+ <div id="info">
+ <b>Status:</b> <span id="location_status">Stopped</span>
+ <table width="100%">
+ <tr><td><b>Latitude:</b></td><td id="latitude"> </td></tr>
+ <tr><td><b>Longitude:</b></td><td id="longitude"> </td></tr>
+ <tr><td><b>Altitude:</b></td><td id="altitude"> </td></tr>
+ <tr><td><b>Accuracy:</b></td><td id="accuracy"> </td></tr>
+ <tr><td><b>Heading:</b></td><td id="heading"> </td></tr>
+ <tr><td><b>Speed:</b></td><td id="speed"> </td></tr>
+ <tr><td><b>Altitude Accuracy:</b></td><td id="altitude_accuracy"> </td></tr>
+ <tr><td><b>Time:</b></td><td id="timestamp"> </td></tr>
+ </table>
+ </div>
+ <h2>Action</h2>
+ <div>
+ <h3>Use Built-in WebView navigator.geolocation</h3>
+ <span class="btn large" onclick="getLocation(navigator.geolocation);">Get Location</span>
+ <span class="btn large" onclick="watchLocation(navigator.geolocation);">Start Watching Location</span>
+ <span class="btn large" onclick="stopLocation(navigator.geolocation);">Stop Watching Location</span>
+ <span class="btn large" onclick="getLocation(navigator.geolocation, {maximumAge:30000});">Get Location Up to 30 Seconds Old</span>
+ </div>
+ <div>
+ <h3>Use Cordova Geolocation Plugin</h3>
+ <span class="btn large" onclick="getLocation(cordova.require('cordova/plugin/geolocation'));">Get Location</span>
+ <span class="btn large" onclick="watchLocation(cordova.require('cordova/plugin/geolocation'));">Start Watching Location</span>
+ <span class="btn large" onclick="stopLocation(cordova.require('cordova/plugin/geolocation'));">Stop Watching Location</span>
+ <span class="btn large" onclick="getLocation(cordova.require('cordova/plugin/geolocation'), {maximumAge:30000});">Get Location Up to 30 Seconds Old</span>
+ </div>
+
+
+ <h2> </h2><a class="backBtn" onclick="backHome();">Back</a>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/main.js
----------------------------------------------------------------------
diff --git a/windows8/test/main.js b/windows8/test/main.js
new file mode 100644
index 0000000..8a4c54d
--- /dev/null
+++ b/windows8/test/main.js
@@ -0,0 +1,140 @@
+var deviceInfo = function(bob) {
+ document.getElementById("platform").innerHTML = device.platform;
+ document.getElementById("version").innerHTML = device.version;
+ document.getElementById("uuid").innerHTML = device.uuid;
+ document.getElementById("name").innerHTML = device.name;
+ document.getElementById("width").innerHTML = screen.width;
+ document.getElementById("height").innerHTML = screen.height;
+ document.getElementById("colorDepth").innerHTML = screen.colorDepth;
+};
+
+var getLocation = function() {
+ var suc = function(p) {
+ alert(p.coords.latitude + " " + p.coords.longitude);
+ };
+ var locFail = function() {
+ };
+ navigator.geolocation.getCurrentPosition(suc, locFail);
+};
+
+var beep = function() {
+ navigator.notification.beep(2);
+};
+
+var vibrate = function() {
+ navigator.notification.vibrate(0);
+};
+
+function roundNumber(num) {
+ var dec = 3;
+ var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
+ return result;
+}
+
+var accelerationWatch = null;
+
+function updateAcceleration(a) {
+ document.getElementById('x').innerHTML = roundNumber(a.x);
+ document.getElementById('y').innerHTML = roundNumber(a.y);
+ document.getElementById('z').innerHTML = roundNumber(a.z);
+}
+
+var toggleAccel = function() {
+ if (accelerationWatch !== null) {
+ navigator.accelerometer.clearWatch(accelerationWatch);
+ updateAcceleration({
+ x : "",
+ y : "",
+ z : ""
+ });
+ accelerationWatch = null;
+ } else {
+ var options = {};
+ options.frequency = 1000;
+ accelerationWatch = navigator.accelerometer.watchAcceleration(
+ updateAcceleration, function(ex) {
+ alert("accel fail (" + ex.name + ": " + ex.message + ")");
+ }, options);
+ }
+};
+
+var preventBehavior = function(e) {
+ e.preventDefault();
+};
+
+function dump_pic(data) {
+ var viewport = document.getElementById('viewport');
+ console.log(data);
+ viewport.style.display = "";
+ viewport.style.position = "absolute";
+ viewport.style.top = "10px";
+ viewport.style.left = "10px";
+ document.getElementById("test_img").src = "data:image/jpeg;base64," + data;
+}
+
+function fail(msg) {
+ alert(msg);
+}
+
+function show_pic() {
+ navigator.camera.getPicture(dump_pic, fail, {
+ quality : 50
+ });
+}
+
+function close() {
+ var viewport = document.getElementById('viewport');
+ viewport.style.position = "relative";
+ viewport.style.display = "none";
+}
+
+// This is just to do this.
+function readFile() {
+ navigator.file.read('/sdcard/phonegap.txt', fail, fail);
+}
+
+function writeFile() {
+ navigator.file.write('foo.txt', "This is a test of writing to a file",
+ fail, fail);
+}
+
+function contacts_success(contacts) {
+ alert(contacts.length
+ + ' contacts returned.'
+ + (contacts[2] && contacts[2].name ? (' Third contact is ' + contacts[2].name.formatted)
+ : ''));
+}
+
+function get_contacts() {
+ var obj = new ContactFindOptions();
+ obj.filter = "";
+ obj.multiple = true;
+ obj.limit = 5;
+ navigator.service.contacts.find(
+ [ "displayName", "name" ], contacts_success,
+ fail, obj);
+}
+
+var networkReachableCallback = function(reachability) {
+ // There is no consistency on the format of reachability
+ var networkState = reachability.code || reachability;
+
+ var currentState = {};
+ currentState[NetworkStatus.NOT_REACHABLE] = 'No network connection';
+ currentState[NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK] = 'Carrier data connection';
+ currentState[NetworkStatus.REACHABLE_VIA_WIFI_NETWORK] = 'WiFi connection';
+
+ confirm("Connection type:\n" + currentState[networkState]);
+};
+
+function check_network() {
+ navigator.network.isReachable("www.mobiledevelopersolutions.com",
+ networkReachableCallback, {});
+}
+
+function init() {
+ // the next line makes it impossible to see Contacts on the HTC Evo since it
+ // doesn't have a scroll button
+ // document.addEventListener("touchmove", preventBehavior, false);
+ document.addEventListener("deviceready", deviceInfo, true);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/master.css
----------------------------------------------------------------------
diff --git a/windows8/test/master.css b/windows8/test/master.css
new file mode 100644
index 0000000..f64b29c
--- /dev/null
+++ b/windows8/test/master.css
@@ -0,0 +1,131 @@
+ body {
+ background:#222 none repeat scroll 0 0;
+ color:#666;
+ font-family:Helvetica;
+ font-size:72%;
+ line-height:1.5em;
+ margin:0;
+ border-top:1px solid #393939;
+ }
+
+ #info{
+ background:#ffa;
+ border: 1px solid #ffd324;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ clear:both;
+ margin:15px 6px 0;
+ width:295px;
+ padding:4px 0px 2px 10px;
+ }
+
+ #info > h4{
+ font-size:.95em;
+ margin:5px 0;
+ }
+
+ #stage.theme{
+ padding-top:3px;
+ }
+
+ /* Definition List */
+ #stage.theme > dl{
+ padding-top:10px;
+ clear:both;
+ margin:0;
+ list-style-type:none;
+ padding-left:10px;
+ overflow:auto;
+ }
+
+ #stage.theme > dl > dt{
+ font-weight:bold;
+ float:left;
+ margin-left:5px;
+ }
+
+ #stage.theme > dl > dd{
+ width:45px;
+ float:left;
+ color:#a87;
+ font-weight:bold;
+ }
+
+ /* Content Styling */
+ #stage.theme > h1, #stage.theme > h2, #stage.theme > p{
+ margin:1em 0 .5em 13px;
+ }
+
+ #stage.theme > h1{
+ color:#eee;
+ font-size:1.6em;
+ text-align:center;
+ margin:0;
+ margin-top:15px;
+ padding:0;
+ }
+
+ #stage.theme > h2{
+ clear:both;
+ margin:0;
+ padding:3px;
+ font-size:1em;
+ text-align:center;
+ }
+
+ /* Stage Buttons */
+ #stage.theme .btn{
+ border: 1px solid #555;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ text-align:center;
+ display:block;
+ float:left;
+ background:#444;
+ width:150px;
+ color:#9ab;
+ font-size:1.1em;
+ text-decoration:none;
+ padding:1.2em 0;
+ margin:3px 0px 3px 5px;
+ }
+
+ #stage.theme .large{
+ width:308px;
+ padding:1.2em 0;
+ }
+
+ #stage.theme .backBtn{
+ border: 1px solid #555;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ text-align:center;
+ display:block;
+ float:right;
+ background:#666;
+ width:75px;
+ color:#9ab;
+ font-size:1.1em;
+ text-decoration:none;
+ padding:1.2em 0;
+ margin:3px 5px 3px 5px;
+ }
+
+ #stage.theme .input{
+ border: 1px solid #555;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ text-align:center;
+ display:block;
+ float:light;
+ background:#888;
+ color:#9cd;
+ font-size:1.1em;
+ text-decoration:none;
+ padding:1.2em 0;
+ margin:3px 0px 3px 5px;
+ }
+
+ #stage.theme .numeric{
+ width:100%;
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/misc/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/misc/index.html b/windows8/test/misc/index.html
new file mode 100644
index 0000000..443fb21
--- /dev/null
+++ b/windows8/test/misc/index.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</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="../cordova.js"></script>
+
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ function roundNumber(num) {
+ var dec = 3;
+ var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
+ return result;
+ }
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Display Other Content</h1>
+ <div id="info">
+ </div>
+ <h2>Action</h2>
+ <div class="btn large" onclick="document.location='tel:5551212';" >Call 411</div>
+ <a href="mailto:bob@abc.org?subject=My Subject&body=This is the body.%0D%0ANew line." class="btn large">Send Mail</a>
+ <a href="sms:5125551234?body=The SMS message." class="btn large">Send SMS</a>
+ <a href="http://www.google.com" class="btn large">Load Web Site</a>
+ <!-- Need new URL -->
+ <!-- a href="http://handle.library.cornell.edu/control/authBasic/authTest/" class="btn large">Basic Auth: test/this</a -->
+ <a href="page2.html" hrefbad="page2.html?me=test" class="btn large">Load another PhoneGap page</a>
+ <h2>Android Only</h2>
+ <a href="geo:0,0?q=11400 Burnet Rd, Austin, TX" class="btn large">Map IBM</a>
+ <a href="market://search?q=google" class="btn large">Search Android market</a>
+ <a href="content://media/external/images/media" class="btn large">View image app</a>
+
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/misc/page2.html
----------------------------------------------------------------------
diff --git a/windows8/test/misc/page2.html b/windows8/test/misc/page2.html
new file mode 100644
index 0000000..97ab95c
--- /dev/null
+++ b/windows8/test/misc/page2.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <title>Cordova Mobile Spec</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="../cordova.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="../main.js"></script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+ <h1>Page2 App</h1>
+ <h2>This is page 2 of a PhoneGap app</h2>
+ <div id="info">
+ <h4>Platform: <span id="platform"> </span></h4>
+ <h4>Version: <span id="version"> </span></h4>
+ <h4>UUID: <span id="uuid"> </span></h4>
+ <h4>Name: <span id="name"> </span></h4>
+ <h4>Width: <span id="width"> </span>, Height: <span id="height">
+ </span>, Color Depth: <span id="colorDepth"></span></h4>
+ </div>
+ <div ><button class="backBtn" onclick="backHome();">Back</button></div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/network/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/network/index.html b/windows8/test/network/index.html
new file mode 100644
index 0000000..0a552c4
--- /dev/null
+++ b/windows8/test/network/index.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</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="../cordova.js"></script>
+
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ var eventOutput = function(s) {
+ var el = document.getElementById("results");
+ el.innerHTML = el.innerHTML + s + "<br>";
+ };
+
+ function printNetwork() {
+ eventOutput("Current network connection type is: " + navigator.network.connection.type);
+ }
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ eventOutput("Network Connection is: " + navigator.network.connection.type);
+ document.addEventListener('online', function() { eventOutput('Online event, connection is: ' + navigator.network.connection.type); }, false);
+ document.addEventListener('offline', function() { eventOutput('Offline event, connection is: ' + navigator.network.connection.type); }, false);
+
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: Cordova did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Network Events and State</h1>
+ <div id="info">
+ <b>Results:</b><br>
+ <span id="results"></span>
+ </div>
+
+ <h2>Action</h2>
+ <div class="btn large" onclick="printNetwork();">Show Network Connection</div>
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/notification/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/notification/index.html b/windows8/test/notification/index.html
new file mode 100644
index 0000000..edbd21a
--- /dev/null
+++ b/windows8/test/notification/index.html
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</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="../cordova.js"></script>
+
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ //-------------------------------------------------------------------------
+ // Notifications
+ //-------------------------------------------------------------------------
+
+ var beep = function(){
+ navigator.notification.beep(3);
+ };
+
+ var vibrate = function(){
+ navigator.notification.vibrate(1000);
+ };
+
+ var alertDialog = function(message, title, button) {
+ console.log("alertDialog()");
+ navigator.notification.alert(message,
+ function(){
+ console.log("Alert dismissed.");
+ },
+ title, button);
+ console.log("After alert");
+ };
+
+ var confirmDialog = function(message, title, buttons) {
+ navigator.notification.confirm(message,
+ function(r) {
+ console.log("You selected " + r);
+ alert("You selected " + (buttons.split(","))[r-1]);
+ },
+ title,
+ buttons);
+ };
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Notifications and Dialogs</h1>
+ <div id="info">
+ </div>
+
+ <h2>Action</h2>
+ <div class="btn large" onclick="beep();">Beep</div>
+ <div class="btn large" onclick="vibrate();">Vibrate</div>
+ <div class="btn large" onclick="alertDialog('You pressed alert.', 'Alert Dialog', 'Continue');">Alert Dialog</div>
+ <div class="btn large" onclick="confirmDialog('You pressed confirm.', 'Confirm Dialog', 'Yes,No,Maybe');">Confirm Dialog</div>
+ <div class="btn large" onclick="alert('You pressed alert.');">Built-in Alert Dialog</div>
+ <div class="btn large" onclick="confirm('You selected confirm');">Built-in Confirm Dialog</div>
+ <div class="btn large" onclick="prompt('This is a prompt.', 'Default value');">Built-in Prompt Dialog</div>
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/package.appxmanifest
----------------------------------------------------------------------
diff --git a/windows8/test/package.appxmanifest b/windows8/test/package.appxmanifest
new file mode 100644
index 0000000..5a2d8a4
--- /dev/null
+++ b/windows8/test/package.appxmanifest
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
+ <Identity Name="f0eea4fc-197b-4c4e-8590-5d9b2b964f5b" Version="1.0.0.0" Publisher="CN=Jesse" />
+ <Properties>
+ <DisplayName>MetroTestApp</DisplayName>
+ <PublisherDisplayName>Jesse</PublisherDisplayName>
+ <Logo>images\storelogo.png</Logo>
+ </Properties>
+ <Prerequisites>
+ <OSMinVersion>6.2.0</OSMinVersion>
+ <OSMaxVersionTested>6.2.0</OSMaxVersionTested>
+ </Prerequisites>
+ <Resources>
+ <Resource Language="x-generate" />
+ </Resources>
+ <Applications>
+ <Application Id="App" StartPage="index.html">
+ <VisualElements DisplayName="CordovaTestApp" Logo="images\logo.png" SmallLogo="images\smalllogo.png" Description="CordovaTestApp includes mobile spec automated tests, and various manual test pages." ForegroundText="dark" BackgroundColor="#999999">
+ <DefaultTile ShowName="allLogos" />
+ <SplashScreen Image="images\splashscreen.png" BackgroundColor="#999999" />
+ <InitialRotationPreference>
+ <Rotation Preference="portrait" />
+ <Rotation Preference="landscape" />
+ <Rotation Preference="portraitFlipped" />
+ <Rotation Preference="landscapeFlipped" />
+ </InitialRotationPreference>
+ </VisualElements>
+ </Application>
+ </Applications>
+ <Capabilities>
+ <Capability Name="videosLibrary" />
+ <Capability Name="musicLibrary" />
+ <Capability Name="picturesLibrary" />
+ <Capability Name="internetClient" />
+ <DeviceCapability Name="location" />
+ <DeviceCapability Name="webcam" />
+ <DeviceCapability Name="microphone" />
+ </Capabilities>
+</Package>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/sql/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/sql/index.html b/windows8/test/sql/index.html
new file mode 100644
index 0000000..d5feddc
--- /dev/null
+++ b/windows8/test/sql/index.html
@@ -0,0 +1,133 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</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="../cordova.js"></script>
+
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ //-------------------------------------------------------------------------
+ // HTML5 Database
+ //-------------------------------------------------------------------------
+ var db;
+ var callDatabase = function() {
+ db = openDatabase("mydb", "1.0", "PhoneGap Demo", 20000);
+ if (db === null) {
+ databaseOutput("Database could not be opened.");
+ return;
+ }
+ databaseOutput("Database opened.");
+ db.transaction(function (tx) {
+ tx.executeSql('DROP TABLE IF EXISTS DEMO');
+ tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)', [],
+ function(tx,results) { console.log("Created table"); },
+ function(tx,err) { alert("Error creating table: "+err.message); });
+ tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")', [],
+ function(tx,results) { console.log("Insert row1 success"); },
+ function(tx,err) { alert("Error adding 1st row: "+err.message); });
+ tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")', [],
+ function(tx,results) { console.log("Insert row2 success"); },
+ function(tx,err) { alert("Error adding 2nd row: "+err.message); });
+ databaseOutput("Data written to DEMO table.");
+ console.log("Data written to DEMO table.");
+
+ tx.executeSql('SELECT * FROM DEMO', [], function (tx, results) {
+ var len = results.rows.length;
+ var text = "DEMO table: " + len + " rows found.<br>";
+ text = text + "<table border='1'><tr><td>Row</td><td>Data</td></tr>";
+ for (var i=0; i<len; i++){
+ text = text + "<tr><td>" + i + "</td><td>" + results.rows.item(i).id + ", " + results.rows.item(i).data + "</td></tr>";
+ }
+ text = text + "</table>";
+ databaseOutput(text);
+ }, function(tx, err) {
+ alert("Error processing SELECT * SQL: "+err.message);
+ });
+ tx.executeSql('SELECT ID FROM DEMO', [], function (tx, results) {
+ var len = results.rows.length;
+ var text = "DEMO table: " + len + " rows found.<br>";
+ text = text + "<table border='1'><tr><td>Row</td><td>Data</td></tr>";
+ for (var i=0; i<len; i++){
+ text = text + "<tr><td>" + i + "</td><td>" + results.rows.item(i).id + "</td></tr>";
+ }
+ text = text + "</table>";
+ databaseOutput(text);
+ }, function(tx, err) {
+ alert("Error processing SELECT ID SQL: "+err.message);
+ });
+
+ },
+ function(err) {
+ console.log("Transaction failed: " + err.message);
+ });
+
+
+ };
+
+ var readDatabase = function() {
+ if (!db) {
+ db = openDatabase("mydb", "1.0", "PhoneGap Demo", 20000);
+ if (db === null) {
+ databaseOutput("Database could not be opened.");
+ return;
+ }
+ }
+ db.transaction(function (tx) {
+ tx.executeSql('SELECT * FROM DEMO WHERE id=2', [], function (tx, results) {
+ var len = results.rows.length;
+ var text = "DEMO table: " + len + " rows found.<br>";
+ text = text + "<table border='1'><tr><td>Row</td><td>Data</td></tr>";
+ for (var i=0; i<len; i++){
+ text = text + "<tr><td>" + i + "</td><td>" + results.rows.item(i).id + ", " + results.rows.item(i).data + "</td></tr>";
+ }
+ text = text + "</table>";
+ databaseOutput(text);
+ }, function(tx, err) {
+ alert("Error processing SELECT * WHERE id=2 SQL: "+err.message);
+ });
+ });
+ }
+
+ var databaseOutput = function(s) {
+ var el = document.getElementById("database_results");
+ el.innerHTML = el.innerHTML + s + "<br>";
+ };
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>HTML5 Database</h1>
+ <div id="info">
+ <b>Results:</b><br>
+ <span id="database_results"></span>
+ </div>
+ <h2>Action</h2>
+ <div class="btn large" onclick="callDatabase();">Create, Add, Read Database</div>
+ <div class="btn large" onclick="readDatabase();">Read Database</div>
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/071eba61/windows8/test/storage/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/storage/index.html b/windows8/test/storage/index.html
new file mode 100644
index 0000000..e75a049
--- /dev/null
+++ b/windows8/test/storage/index.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+
+ <script src="//Microsoft.WinJS.1.0.RC/js/base.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Local Storage</h1>
+ <div id="info">
+ You have run this app <span id="count">an untold number of</span> time(s).
+ </div>
+
+ <script>
+ if (!localStorage.pageLoadCount) {
+ localStorage.pageLoadCount = 0;
+ }
+ localStorage.pageLoadCount = parseInt(localStorage.pageLoadCount) + 1;
+ document.getElementById('count').textContent = localStorage.pageLoadCount;
+ </script>
+
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>