Repository: cordova-mobile-spec
Updated Branches:
  refs/heads/master e2ddbd366 -> 77ff9a37d


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/misc/page3A.js
----------------------------------------------------------------------
diff --git a/www/misc/page3A.js b/www/misc/page3A.js
new file mode 100644
index 0000000..8efad58
--- /dev/null
+++ b/www/misc/page3A.js
@@ -0,0 +1,27 @@
+console.log('Changing hash #1.');
+if (location.search.indexOf('hash1') != -1) {
+  location.hash = 'a';
+} else if (location.search.indexOf('hash2') != -1) {
+  location.replace('#replaced');
+}
+var hashCount = 0;
+function changeHash() {
+  hashCount += 1;
+  if (hashCount % 1) {
+    location.hash = hashCount;
+  } else {
+    location.replace('#' + hashCount);
+  }
+}
+if (location.search.indexOf('changeURL') != -1) {
+  history.replaceState(null, null, 'fakepage.html');
+}
+function loadFrame() {
+  var ifr = document.createElement('iframe');
+  ifr.src="data:text/html;base64,PGh0bWw+";
+  document.body.appendChild(ifr);
+}
+function reload() {
+  // Test that iOS CDVWebViewDelegate doesn't ignore changes when URL doesn't 
change.
+  location.reload();
+}

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/network/index.html
----------------------------------------------------------------------
diff --git a/www/network/index.html b/www/network/index.html
new file mode 100644
index 0000000..b750f6c
--- /dev/null
+++ b/www/network/index.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<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-incl.js"></script>
+    <script type="text/javascript" charset="utf-8" src="./index.js"></script>  
    
+</script>
+
+  </head>
+  <body 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 printNetwork">Show Network Connection</div>
+    <h2> </h2><div class="backBtn">Back</div>
+  </body>
+</html>
+

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/network/index.js
----------------------------------------------------------------------
diff --git a/www/network/index.js b/www/network/index.js
new file mode 100644
index 0000000..41c2c47
--- /dev/null
+++ b/www/network/index.js
@@ -0,0 +1,38 @@
+function eventOutput(s) {
+    var el = document.getElementById("results");
+    el.innerHTML = el.innerHTML + s + "<br>";
+}
+
+function printNetwork() {
+    eventOutput("navigator.connection.type=" + navigator.connection.type);
+    eventOutput("navigator.network.connection.type=" + 
navigator.network.connection.type);
+}
+
+/**
+ * Function called when page has finished loading.
+ */
+function init() {
+    var deviceReady = false;
+    function onEvent(e) {
+        eventOutput('Event of type: ' + e.type);
+        printNetwork();
+    }
+    document.addEventListener('online', onEvent, false);
+    document.addEventListener('offline', onEvent, false);
+    document.addEventListener("deviceready", function() {
+        deviceReady = true;
+        eventOutput("Device="+device.platform+" "+device.version);
+        printNetwork();
+    }, false);
+    window.setTimeout(function() {
+        if (!deviceReady) {
+            alert("Error: Cordova did not initialize.  Demo will not run 
correctly.");
+        }
+    }, 1000);
+}
+
+window.onload = function() {
+  addListenerToClass('printNetwork', printNetwork);
+  addListenerToClass('backBtn', backHome);
+  init();
+}

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/notification/index.html
----------------------------------------------------------------------
diff --git a/www/notification/index.html b/www/notification/index.html
new file mode 100644
index 0000000..ab648df
--- /dev/null
+++ b/www/notification/index.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<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-incl.js"></script>      
+    <script type="text/javascript" charset="utf-8" src="./index.js"></script>  
    
+  </head>
+  <body id="stage" class="theme">
+  
+    <h1>Notifications and Dialogs</h1>
+    <div id="info">
+    </div>
+    
+    <h2>Action</h2>
+    <div class="btn large beep">Beep</div>
+    <div class="btn large alertDialog">Alert Dialog</div>
+    <div class="btn large confirmDialogA">Confirm Dialog - Deprecated</div>
+    <div class="btn large confirmDialogB">Confirm Dialog</div>
+    <div class="btn large promptDialog">Prompt Dialog</div>
+    
+    <div class="btn large builtInAlert">Built-in Alert Dialog</div>
+    <div class="btn large builtInConfirm">Built-in Confirm Dialog</div>
+    <div class="btn large builtInPrompt">Built-in Prompt Dialog</div>
+    <h2> </h2><div class="backBtn">Back</div>
+  </body>
+</html>      

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/notification/index.js
----------------------------------------------------------------------
diff --git a/www/notification/index.js b/www/notification/index.js
new file mode 100644
index 0000000..12e672f
--- /dev/null
+++ b/www/notification/index.js
@@ -0,0 +1,100 @@
+var deviceReady = false;
+
+//-------------------------------------------------------------------------
+// Notifications
+//-------------------------------------------------------------------------
+
+var beep = function(){
+    navigator.notification.beep(3);
+};
+
+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 confirmDialogA = function(message, title, buttons) {
+    navigator.notification.confirm(message,
+        function(r) {
+            if(r===0){
+                console.log("Dismissed dialog without making a selection.");
+                alert("Dismissed dialog without making a selection.");
+            }else{
+                console.log("You selected " + r);
+                alert("You selected " + (buttons.split(","))[r-1]);
+            }
+        },
+        title,
+        buttons);
+};
+
+var confirmDialogB = function(message, title, buttons) {
+    navigator.notification.confirm(message,
+        function(r) {
+            if(r===0){
+                console.log("Dismissed dialog without making a selection.");
+                alert("Dismissed dialog without making a selection.");
+            }else{
+                console.log("You selected " + r);
+                alert("You selected " + buttons[r-1]);
+            }
+        },
+        title,
+        buttons);
+};
+
+var promptDialog = function(message, title, buttons) {
+    navigator.notification.prompt(message,
+        function(r) {
+            if(r && r.buttonIndex===0){
+                var msg = "Dismissed dialog";
+                if( r.input1 ){
+                    msg+=" with input: " + r.input1
+                }
+                console.log(msg);
+                alert(msg);
+            }else{
+                console.log("You selected " + r.buttonIndex + " and entered: " 
+ r.input1);
+                alert("You selected " + buttons[r.buttonIndex-1] + " and 
entered: " + r.input1);
+            }
+        },
+        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: Apache Cordova did not initialize.  Demo will not 
run correctly.");
+        }
+    },1000);
+}
+
+window.onload = function() {
+  addListenerToClass('beep', beep);
+  addListenerToClass('alertDialog', alertDialog, 
+      ['You pressed alert.', 'Alert Dialog', 'Continue']);
+  addListenerToClass('confirmDialogA', confirmDialogA, 
+      ['You pressed confirm.', 'Confirm Dialog', 'Yes,No,Maybe']);
+  addListenerToClass('confirmDialogB', confirmDialogB,
+      ['You pressed confirm.', 'Confirm Dialog', ['Yes', 'No', 'Maybe, Not 
Sure']]);
+  addListenerToClass('promptDialog', promptDialog,
+      ['You pressed prompt.', 'Prompt Dialog', ['Yes', 'No', 'Maybe, Not 
Sure']]);
+  addListenerToClass('builtInAlert', alert, 'You pressed alert.');
+  addListenerToClass('builtInConfirm', confirm, 'You selected confirm');
+  addListenerToClass('builtInPrompt', prompt, ['This is a prompt.', 'Default 
value']);
+
+  addListenerToClass('backBtn', backHome);
+  init();
+}

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/splashscreen/index.html
----------------------------------------------------------------------
diff --git a/www/splashscreen/index.html b/www/splashscreen/index.html
new file mode 100644
index 0000000..19132a4
--- /dev/null
+++ b/www/splashscreen/index.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<html>
+  <head>
+    <meta name="viewport" 
content="width=device-width,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-incl.js"></script>
+
+<script type="text/javascript" charset="utf-8">
+  function showFor(duration) {
+      navigator.splashscreen.show();
+      window.setTimeout(function() {
+          navigator.splashscreen.hide();
+      }, 1000 * duration);
+  }
+</script>
+  </head>
+  <body id="stage" class="theme">
+    <h1>Splashscreen</h1>
+    <h2>Action</h2>
+    <div class="btn large" onclick="showFor(1)">Show for 1 second</div>
+    <div class="btn large" onclick="showFor(5)">Show for 5 seconds</div>
+    <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/sql/index.html
----------------------------------------------------------------------
diff --git a/www/sql/index.html b/www/sql/index.html
new file mode 100644
index 0000000..da0d809
--- /dev/null
+++ b/www/sql/index.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<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-incl.js"></script>      
+    <script type="text/javascript" charset="utf-8" src="./index.js"></script>  
    
+  </head>
+  <body 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 callDatabase0">Create, Add, Read Database (Constant 
name)</div>
+    <div class="btn large readDatabase0">Read Database (Constant name)</div>
+    <div class="btn large increaseQuota0">Increase Quota (Constant name)</div>
+    <div class="btn large callDatabase1">Create, Add, Read Database (Random 
Name)</div>
+    <div class="btn large readDatabase1">Read Database (Random Name)</div>
+    <div class="btn large increaseQuota1">Increase Quota (Random Name)</div>
+    <div class="btn large reloadPage">Reload Page</div>
+    <h2> </h2><div class="backBtn">Back</div>    
+  </body>
+</html>      

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/sql/index.js
----------------------------------------------------------------------
diff --git a/www/sql/index.js b/www/sql/index.js
new file mode 100644
index 0000000..b5d5653
--- /dev/null
+++ b/www/sql/index.js
@@ -0,0 +1,125 @@
+//-------------------------------------------------------------------------
+// HTML5 Database
+//-------------------------------------------------------------------------
+var dbs = [];
+var quotas = [2000000, 2000000];
+var names = ['mydb', 'rand' + Math.random()];
+function openDb(index) {
+    try {
+        databaseOutput('Openning db with name: ' + names[index]);
+        return openDatabase(names[index], "1.0", "Apache Cordova Demo", 
quotas[index]);
+    } catch (e) {
+        databaseOutput('Got exception: ' + e);
+    }
+}
+
+var callDatabase = function(index) {
+    var db = dbs[index] = openDb(index);
+    if (!db) {
+        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(index) {
+    var db = dbs[index];
+  if (!db) {
+        db = dbs[index] = openDb(index);
+        if (!db) {
+            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);
+        });
+    });
+}
+
+function increaseQuota(index) {
+    quotas[index] *= 2;
+    databaseOutput('quota ' + index + ' is now ' + quotas[index]);
+}
+
+var databaseOutput = function(s) {
+    var el = document.getElementById("database_results");
+    el.innerHTML = el.innerHTML + s + "<br>";
+    el.scrollByLines(20000);
+};
+
+/**
+ * Function called when page has finished loading.
+ */
+function init() {
+    document.addEventListener("deviceready", function() {
+        console.log("Device="+device.platform+" "+device.version);
+    }, false);
+}
+
+window.onload = function() {
+  addListenerToClass('callDatabase0', callDatabase, [0]);
+  addListenerToClass('readDatabase0', readDatabase, [0]);
+  addListenerToClass('increaseQuota0', increaseQuota, [0]);
+  addListenerToClass('callDatabase1', callDatabase, 1);
+  addListenerToClass('readDatabase1', readDatabase, 1);
+  addListenerToClass('increaseQuota1', increaseQuota, 1);
+  addListenerToClass('reloadPage', function() {
+    location = location.href;
+  });
+  addListenerToClass('backBtn', backHome);
+  init();
+}

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/storage/index.html
----------------------------------------------------------------------
diff --git a/www/storage/index.html b/www/storage/index.html
new file mode 100644
index 0000000..0b713a2
--- /dev/null
+++ b/www/storage/index.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<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-incl.js"></script>      
+    <script type="text/javascript" charset="utf-8" src="./index.js"></script>  
    
+  </head>
+  <body 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>
+    <h2> </h2><div class="backBtn">Back</div>
+  </body>
+</html>      

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/storage/index.js
----------------------------------------------------------------------
diff --git a/www/storage/index.js b/www/storage/index.js
new file mode 100644
index 0000000..00ae7e1
--- /dev/null
+++ b/www/storage/index.js
@@ -0,0 +1,27 @@
+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: Apache Cordova did not initialize.  Demo will not run 
correctly.");
+      }
+    },1000);
+}
+
+window.onload = function() {
+  addListenerToClass('backBtn', backHome);
+  init();
+
+  if (!localStorage.pageLoadCount) {
+      localStorage.pageLoadCount = 0;
+  }
+  localStorage.pageLoadCount = parseInt(localStorage.pageLoadCount) + 1;
+  document.getElementById('count').textContent = localStorage.pageLoadCount;
+}

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/vibration/index.html
----------------------------------------------------------------------
diff --git a/www/vibration/index.html b/www/vibration/index.html
new file mode 100644
index 0000000..a24110e
--- /dev/null
+++ b/www/vibration/index.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<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-incl.js"></script>      
+    <script type="text/javascript" charset="utf-8" src="./index.js"></script>  
    
+  </head>
+  <body id="stage" class="theme">
+  
+    <h1>Vibrations</h1>
+    <div id="info">
+    </div>
+    
+    <h2>Action</h2>
+    <div class="btn large vibrate">Vibrate</div>
+    <h2> </h2><div class="backBtn">Back</div>
+  </body>
+</html>      

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/vibration/index.js
----------------------------------------------------------------------
diff --git a/www/vibration/index.js b/www/vibration/index.js
new file mode 100644
index 0000000..0d28902
--- /dev/null
+++ b/www/vibration/index.js
@@ -0,0 +1,31 @@
+var deviceReady = false;
+
+//-------------------------------------------------------------------------
+// Vibrations
+//-------------------------------------------------------------------------
+
+var vibrate = function(){
+  navigator.notification.vibrate(2500);
+};
+
+
+/**
+ * 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: Apache Cordova did not initialize.  Demo will not 
run correctly.");
+        }
+    },1000);
+}
+
+window.onload = function() {
+  addListenerToClass('vibrate', vibrate);
+  addListenerToClass('backBtn', backHome);
+  init();
+}

Reply via email to