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/09/01 04:30:34 UTC

[5/7] wp7 commit: updated to latest hello app + latest cordova-js

updated to latest hello app + latest cordova-js


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/commit/a50bcbb9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/a50bcbb9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/a50bcbb9

Branch: refs/heads/master
Commit: a50bcbb904a2f125319a553420e1720aab889d35
Parents: d011080
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Aug 31 16:33:17 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Aug 31 16:33:17 2012 -0700

----------------------------------------------------------------------
 example/www/cordova-2.1.0.js              |   25 +-----
 templates/full/www/cordova-2.1.0.js       |   24 +-----
 templates/full/www/css/index.css          |  109 +++++++++++++----------
 templates/full/www/img/cordova.png        |  Bin 19932 -> 0 bytes
 templates/full/www/img/logo.png           |  Bin 0 -> 21814 bytes
 templates/full/www/js/index.js            |   55 +++++++++---
 templates/standalone/www/cordova-2.1.0.js |   24 +-----
 templates/standalone/www/css/index.css    |  109 +++++++++++++----------
 templates/standalone/www/img/cordova.png  |  Bin 19932 -> 0 bytes
 templates/standalone/www/img/logo.png     |  Bin 0 -> 21814 bytes
 templates/standalone/www/js/index.js      |   55 +++++++++---
 11 files changed, 218 insertions(+), 183 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/example/www/cordova-2.1.0.js
----------------------------------------------------------------------
diff --git a/example/www/cordova-2.1.0.js b/example/www/cordova-2.1.0.js
index e9fdbbd..7db46ec 100644
--- a/example/www/cordova-2.1.0.js
+++ b/example/www/cordova-2.1.0.js
@@ -1,6 +1,6 @@
-// commit 69d652e9dcaaaf4bdaa55ec37329636dd5b20fbe
+// commit 2aa46aa0eef2ba641cf91793735152d7fb5b6998
 
-// File generated at :: Fri Aug 24 2012 14:00:49 GMT-0700 (Pacific Daylight Time)
+// File generated at :: Fri Aug 31 2012 14:36:02 GMT-0700 (Pacific Daylight Time)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -29,10 +29,6 @@ var require,
 
 (function () {
     var modules = {};
-    // Stack of moduleIds currently being built.
-    var requireStack = [];
-    // Map of module ID -> index into requireStack of modules currently being built.
-    var inProgressModules = {};
 
     function build(module) {
         var factory = module.factory;
@@ -45,21 +41,8 @@ var require,
     require = function (id) {
         if (!modules[id]) {
             throw "module " + id + " not found";
-        } else if (id in inProgressModules) {
-            var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
-            throw "Cycle in require graph: " + cycle;
         }
-        if (modules[id].factory) {
-            try {
-                inProgressModules[id] = requireStack.length;
-                requireStack.push(id);
-                return build(modules[id]);
-            } finally {
-                delete inProgressModules[id];
-                requireStack.pop();
-            }
-        }
-        return modules[id].exports;
+        return modules[id].factory ? build(modules[id]) : modules[id].exports;
     };
 
     define = function (id, factory) {
@@ -84,7 +67,6 @@ if (typeof module === "object" && typeof require === "function") {
     module.exports.require = require;
     module.exports.define = define;
 }
-
 // file: lib/cordova.js
 define("cordova", function(require, exports, module) {
 var channel = require('cordova/channel');
@@ -920,6 +902,7 @@ module.exports = function(success, fail, service, action, args) {
     {
         if(typeof args[n] !== "string")
         {
+			console.log("Extra encoding :: " + n);
             args[n] = JSON.stringify(args[n]);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/full/www/cordova-2.1.0.js
----------------------------------------------------------------------
diff --git a/templates/full/www/cordova-2.1.0.js b/templates/full/www/cordova-2.1.0.js
index e9fdbbd..e45a94d 100644
--- a/templates/full/www/cordova-2.1.0.js
+++ b/templates/full/www/cordova-2.1.0.js
@@ -1,6 +1,6 @@
-// commit 69d652e9dcaaaf4bdaa55ec37329636dd5b20fbe
+// commit 2aa46aa0eef2ba641cf91793735152d7fb5b6998
 
-// File generated at :: Fri Aug 24 2012 14:00:49 GMT-0700 (Pacific Daylight Time)
+// File generated at :: Fri Aug 31 2012 14:36:02 GMT-0700 (Pacific Daylight Time)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -29,10 +29,6 @@ var require,
 
 (function () {
     var modules = {};
-    // Stack of moduleIds currently being built.
-    var requireStack = [];
-    // Map of module ID -> index into requireStack of modules currently being built.
-    var inProgressModules = {};
 
     function build(module) {
         var factory = module.factory;
@@ -45,21 +41,8 @@ var require,
     require = function (id) {
         if (!modules[id]) {
             throw "module " + id + " not found";
-        } else if (id in inProgressModules) {
-            var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
-            throw "Cycle in require graph: " + cycle;
         }
-        if (modules[id].factory) {
-            try {
-                inProgressModules[id] = requireStack.length;
-                requireStack.push(id);
-                return build(modules[id]);
-            } finally {
-                delete inProgressModules[id];
-                requireStack.pop();
-            }
-        }
-        return modules[id].exports;
+        return modules[id].factory ? build(modules[id]) : modules[id].exports;
     };
 
     define = function (id, factory) {
@@ -84,7 +67,6 @@ if (typeof module === "object" && typeof require === "function") {
     module.exports.require = require;
     module.exports.define = define;
 }
-
 // file: lib/cordova.js
 define("cordova", function(require, exports, module) {
 var channel = require('cordova/channel');

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/full/www/css/index.css
----------------------------------------------------------------------
diff --git a/templates/full/www/css/index.css b/templates/full/www/css/index.css
index c869f87..f1f9d76 100644
--- a/templates/full/www/css/index.css
+++ b/templates/full/www/css/index.css
@@ -1,16 +1,30 @@
-html,
-body {
-    height:100%;
-    font-size:12px;
-    width:100%;
-}
-
-html {
-    display:table;
+/*
+ * 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.
+ */
+* {
+    -webkit-touch-callout: none;                /* prevent callout to copy image, etc when tap to hold */
+    -webkit-text-size-adjust: none;             /* prevent webkit from resizing text to fit */
+    -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
+    -webkit-user-select: none;                  /* prevent copy paste, to allow, change 'none' to 'text' */
 }
 
 body {
-    background-color:#A7A7A7;
+    background-color:#E4E4E4;
     background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
     background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
     background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
@@ -21,46 +35,65 @@ body {
         color-stop(0, #A7A7A7),
         color-stop(0.51, #E4E4E4)
     );
-    display:table-cell;
+    background-attachment:fixed;
     font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
+    font-size:12px;
+    height:100%;
+    margin:0px;
+    padding:0px;
     text-transform:uppercase;
-    vertical-align:middle;
+    width:100%;
 }
 
+/* Portrait layout (default) */
 .app {
-    background-image:url(../img/cordova.png);
-    background-repeat:no-repeat;
-    margin:0px auto;
-    width:275px;
+    background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
+    position:absolute;             /* position in the center of the screen */
+    left:50%;
+    top:50%;
+    height:50px;                   /* text area height */
+    width:225px;                   /* text area width */
+    text-align:center;
+    padding:180px 0px 0px 0px;     /* image height is 200px (bottom 20px are overlapped with text) */
+    margin:-115px 0px 0px -112px;  /* offset vertical: half of image height and text area height */
+                                   /* offset horizontal: half of text area width */
+}
+
+/* Landscape layout (with min-width) */
+@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
+    .app {
+        background-position:left center;
+        padding:75px 0px 75px 170px;  /* padding-top + padding-bottom + text area = image height */
+        margin:-90px 0px 0px -198px;  /* offset vertical: half of image height */
+                                      /* offset horizontal: half of image width and text area width */
+    }
 }
 
 h1 {
-    font-size:2em;
-    font-weight:300;
+    font-size:24px;
+    font-weight:normal;
     margin:0px;
     overflow:visible;
     padding:0px;
     text-align:center;
 }
 
-.status {
-    background-color:#333333;
+.event {
     border-radius:4px;
     -webkit-border-radius:4px;
     color:#FFFFFF;
-    font-size:1em;
-    margin:0px auto;
-    padding:2px 10px;
-    text-align:center;
-    width:100%;
-    max-width:175px;
+    font-size:12px;
+    margin:0px 30px;
+    padding:2px 0px;
 }
 
-.status.complete {
-    background-color:#4B946A;
+.event.listening {
+    background-color:#333333;
+    display:block;
 }
 
-.hide {
+.event.received {
+    background-color:#4B946A;
     display:none;
 }
 
@@ -80,21 +113,3 @@ h1 {
     animation:fade 3000ms infinite;
     -webkit-animation:fade 3000ms infinite;
 }
-
-/* portrait */
-/* @media screen and (max-aspect-ratio: 1/1) */
-.app {
-    background-position:center top;
-    height:100px;              /* adds enough room for text */
-    padding:180px 0px 0px 0px; /* background height - shadow offset */
-}
-
-/* lanscape (when wide enough) */
-@media screen and (min-aspect-ratio: 1/1) and (min-width:445px) {
-    .app {
-        background-position:left center;
-        height:140px;       /* height + padding = background image size */
-        padding-left:170px; /* background width */
-        padding-top:60px;   /* center the text */
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/full/www/img/cordova.png
----------------------------------------------------------------------
diff --git a/templates/full/www/img/cordova.png b/templates/full/www/img/cordova.png
deleted file mode 100644
index e8169cf..0000000
Binary files a/templates/full/www/img/cordova.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/full/www/img/logo.png
----------------------------------------------------------------------
diff --git a/templates/full/www/img/logo.png b/templates/full/www/img/logo.png
new file mode 100644
index 0000000..9519e7d
Binary files /dev/null and b/templates/full/www/img/logo.png differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/full/www/js/index.js
----------------------------------------------------------------------
diff --git a/templates/full/www/js/index.js b/templates/full/www/js/index.js
index 6140331..3b75d3f 100644
--- a/templates/full/www/js/index.js
+++ b/templates/full/www/js/index.js
@@ -1,20 +1,49 @@
+/*
+ * 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.
+ */
 var app = {
+    // Application Constructor
     initialize: function() {
-        this.bind();
+        this.bindEvents();
     },
-    bind: function() {
-        document.addEventListener('deviceready', this.deviceready, false);
+    // Bind Event Listeners
+    //
+    // Bind any events that are required on startup. Common events are:
+    // `load`, `deviceready`, `offline`, and `online`.
+    bindEvents: function() {
+        document.addEventListener('deviceready', this.onDeviceReady, false);
     },
-    deviceready: function() {
-        // note that this is an event handler so the scope is that of the event
-        // so we need to call app.report(), and not this.report()
-        app.report('deviceready');
+    // deviceready Event Handler
+    //
+    // The scope of `this` is the event. In order to call the `receivedEvent`
+    // function, we must explicity call `app.receivedEvent(...);`
+    onDeviceReady: function() {
+        app.receivedEvent('deviceready');
     },
-    report: function(id) { 
-        console.log("report:" + id);
-        // hide the .pending <p> and show the .complete <p>
-        document.querySelector('#' + id + ' .pending').className += ' hide';
-        var completeElem = document.querySelector('#' + id + ' .complete');
-        completeElem.className = completeElem.className.split('hide').join('');
+    // Update DOM on a Received Event
+    receivedEvent: function(id) {
+        var parentElement = document.getElementById(id);
+        var listeningElement = parentElement.querySelector('.listening');
+        var receivedElement = parentElement.querySelector('.received');
+
+        listeningElement.setAttribute('style', 'display:none;');
+        receivedElement.setAttribute('style', 'display:block;');
+
+        console.log('Received Event: ' + id);
     }
 };

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/standalone/www/cordova-2.1.0.js
----------------------------------------------------------------------
diff --git a/templates/standalone/www/cordova-2.1.0.js b/templates/standalone/www/cordova-2.1.0.js
index e9fdbbd..e45a94d 100644
--- a/templates/standalone/www/cordova-2.1.0.js
+++ b/templates/standalone/www/cordova-2.1.0.js
@@ -1,6 +1,6 @@
-// commit 69d652e9dcaaaf4bdaa55ec37329636dd5b20fbe
+// commit 2aa46aa0eef2ba641cf91793735152d7fb5b6998
 
-// File generated at :: Fri Aug 24 2012 14:00:49 GMT-0700 (Pacific Daylight Time)
+// File generated at :: Fri Aug 31 2012 14:36:02 GMT-0700 (Pacific Daylight Time)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -29,10 +29,6 @@ var require,
 
 (function () {
     var modules = {};
-    // Stack of moduleIds currently being built.
-    var requireStack = [];
-    // Map of module ID -> index into requireStack of modules currently being built.
-    var inProgressModules = {};
 
     function build(module) {
         var factory = module.factory;
@@ -45,21 +41,8 @@ var require,
     require = function (id) {
         if (!modules[id]) {
             throw "module " + id + " not found";
-        } else if (id in inProgressModules) {
-            var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
-            throw "Cycle in require graph: " + cycle;
         }
-        if (modules[id].factory) {
-            try {
-                inProgressModules[id] = requireStack.length;
-                requireStack.push(id);
-                return build(modules[id]);
-            } finally {
-                delete inProgressModules[id];
-                requireStack.pop();
-            }
-        }
-        return modules[id].exports;
+        return modules[id].factory ? build(modules[id]) : modules[id].exports;
     };
 
     define = function (id, factory) {
@@ -84,7 +67,6 @@ if (typeof module === "object" && typeof require === "function") {
     module.exports.require = require;
     module.exports.define = define;
 }
-
 // file: lib/cordova.js
 define("cordova", function(require, exports, module) {
 var channel = require('cordova/channel');

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/standalone/www/css/index.css
----------------------------------------------------------------------
diff --git a/templates/standalone/www/css/index.css b/templates/standalone/www/css/index.css
index c869f87..f1f9d76 100644
--- a/templates/standalone/www/css/index.css
+++ b/templates/standalone/www/css/index.css
@@ -1,16 +1,30 @@
-html,
-body {
-    height:100%;
-    font-size:12px;
-    width:100%;
-}
-
-html {
-    display:table;
+/*
+ * 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.
+ */
+* {
+    -webkit-touch-callout: none;                /* prevent callout to copy image, etc when tap to hold */
+    -webkit-text-size-adjust: none;             /* prevent webkit from resizing text to fit */
+    -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
+    -webkit-user-select: none;                  /* prevent copy paste, to allow, change 'none' to 'text' */
 }
 
 body {
-    background-color:#A7A7A7;
+    background-color:#E4E4E4;
     background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
     background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
     background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
@@ -21,46 +35,65 @@ body {
         color-stop(0, #A7A7A7),
         color-stop(0.51, #E4E4E4)
     );
-    display:table-cell;
+    background-attachment:fixed;
     font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
+    font-size:12px;
+    height:100%;
+    margin:0px;
+    padding:0px;
     text-transform:uppercase;
-    vertical-align:middle;
+    width:100%;
 }
 
+/* Portrait layout (default) */
 .app {
-    background-image:url(../img/cordova.png);
-    background-repeat:no-repeat;
-    margin:0px auto;
-    width:275px;
+    background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
+    position:absolute;             /* position in the center of the screen */
+    left:50%;
+    top:50%;
+    height:50px;                   /* text area height */
+    width:225px;                   /* text area width */
+    text-align:center;
+    padding:180px 0px 0px 0px;     /* image height is 200px (bottom 20px are overlapped with text) */
+    margin:-115px 0px 0px -112px;  /* offset vertical: half of image height and text area height */
+                                   /* offset horizontal: half of text area width */
+}
+
+/* Landscape layout (with min-width) */
+@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
+    .app {
+        background-position:left center;
+        padding:75px 0px 75px 170px;  /* padding-top + padding-bottom + text area = image height */
+        margin:-90px 0px 0px -198px;  /* offset vertical: half of image height */
+                                      /* offset horizontal: half of image width and text area width */
+    }
 }
 
 h1 {
-    font-size:2em;
-    font-weight:300;
+    font-size:24px;
+    font-weight:normal;
     margin:0px;
     overflow:visible;
     padding:0px;
     text-align:center;
 }
 
-.status {
-    background-color:#333333;
+.event {
     border-radius:4px;
     -webkit-border-radius:4px;
     color:#FFFFFF;
-    font-size:1em;
-    margin:0px auto;
-    padding:2px 10px;
-    text-align:center;
-    width:100%;
-    max-width:175px;
+    font-size:12px;
+    margin:0px 30px;
+    padding:2px 0px;
 }
 
-.status.complete {
-    background-color:#4B946A;
+.event.listening {
+    background-color:#333333;
+    display:block;
 }
 
-.hide {
+.event.received {
+    background-color:#4B946A;
     display:none;
 }
 
@@ -80,21 +113,3 @@ h1 {
     animation:fade 3000ms infinite;
     -webkit-animation:fade 3000ms infinite;
 }
-
-/* portrait */
-/* @media screen and (max-aspect-ratio: 1/1) */
-.app {
-    background-position:center top;
-    height:100px;              /* adds enough room for text */
-    padding:180px 0px 0px 0px; /* background height - shadow offset */
-}
-
-/* lanscape (when wide enough) */
-@media screen and (min-aspect-ratio: 1/1) and (min-width:445px) {
-    .app {
-        background-position:left center;
-        height:140px;       /* height + padding = background image size */
-        padding-left:170px; /* background width */
-        padding-top:60px;   /* center the text */
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/standalone/www/img/cordova.png
----------------------------------------------------------------------
diff --git a/templates/standalone/www/img/cordova.png b/templates/standalone/www/img/cordova.png
deleted file mode 100644
index e8169cf..0000000
Binary files a/templates/standalone/www/img/cordova.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/standalone/www/img/logo.png
----------------------------------------------------------------------
diff --git a/templates/standalone/www/img/logo.png b/templates/standalone/www/img/logo.png
new file mode 100644
index 0000000..9519e7d
Binary files /dev/null and b/templates/standalone/www/img/logo.png differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/a50bcbb9/templates/standalone/www/js/index.js
----------------------------------------------------------------------
diff --git a/templates/standalone/www/js/index.js b/templates/standalone/www/js/index.js
index 6140331..3b75d3f 100644
--- a/templates/standalone/www/js/index.js
+++ b/templates/standalone/www/js/index.js
@@ -1,20 +1,49 @@
+/*
+ * 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.
+ */
 var app = {
+    // Application Constructor
     initialize: function() {
-        this.bind();
+        this.bindEvents();
     },
-    bind: function() {
-        document.addEventListener('deviceready', this.deviceready, false);
+    // Bind Event Listeners
+    //
+    // Bind any events that are required on startup. Common events are:
+    // `load`, `deviceready`, `offline`, and `online`.
+    bindEvents: function() {
+        document.addEventListener('deviceready', this.onDeviceReady, false);
     },
-    deviceready: function() {
-        // note that this is an event handler so the scope is that of the event
-        // so we need to call app.report(), and not this.report()
-        app.report('deviceready');
+    // deviceready Event Handler
+    //
+    // The scope of `this` is the event. In order to call the `receivedEvent`
+    // function, we must explicity call `app.receivedEvent(...);`
+    onDeviceReady: function() {
+        app.receivedEvent('deviceready');
     },
-    report: function(id) { 
-        console.log("report:" + id);
-        // hide the .pending <p> and show the .complete <p>
-        document.querySelector('#' + id + ' .pending').className += ' hide';
-        var completeElem = document.querySelector('#' + id + ' .complete');
-        completeElem.className = completeElem.className.split('hide').join('');
+    // Update DOM on a Received Event
+    receivedEvent: function(id) {
+        var parentElement = document.getElementById(id);
+        var listeningElement = parentElement.querySelector('.listening');
+        var receivedElement = parentElement.querySelector('.received');
+
+        listeningElement.setAttribute('style', 'display:none;');
+        receivedElement.setAttribute('style', 'display:block;');
+
+        console.log('Received Event: ' + id);
     }
 };