cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject [08/31] android commit: CB-7385 update cordova.js for testing prior to branch/tag
Date Thu, 11 Sep 2014 15:28:50 GMT
CB-7385 update cordova.js for testing prior to branch/tag


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

Branch: refs/heads/4.0.x
Commit: c6ccde0558369272acdb02c153af034dfcd0525b
Parents: 16e3ebd
Author: Marcel Kinard <cmarcelk@gmail.com>
Authored: Wed Aug 27 09:04:32 2014 -0400
Committer: Marcel Kinard <cmarcelk@gmail.com>
Committed: Wed Aug 27 09:04:32 2014 -0400

----------------------------------------------------------------------
 framework/assets/www/cordova.js | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/c6ccde05/framework/assets/www/cordova.js
----------------------------------------------------------------------
diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js
index f0e57cd..73ec0fe 100644
--- a/framework/assets/www/cordova.js
+++ b/framework/assets/www/cordova.js
@@ -1,5 +1,5 @@
 // Platform: android
-// 3.6.0-dev-70cdca3
+// 3.6.3
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-70cdca3';
+var CORDOVA_JS_BUILD_LABEL = '3.6.3';
 // file: src/scripts/require.js
 
 /*jshint -W079 */
@@ -1497,6 +1497,17 @@ module.exports = {
         cordova.addDocumentEventHandler('menubutton');
         cordova.addDocumentEventHandler('searchbutton');
 
+        function bindButtonChannel(buttonName) {
+            // generic button bind used for volumeup/volumedown buttons
+            var volumeButtonChannel = cordova.addDocumentEventHandler(buttonName + 'button');
+            volumeButtonChannel.onHasSubscribersChange = function() {
+                exec(null, null, "App", "overrideButton", [buttonName, this.numHandlers ==
1]);
+            };
+        }
+        // Inject a listener for the volume buttons on the document.
+        bindButtonChannel('volumeup');
+        bindButtonChannel('volumedown');
+
         // Let native code know we are all done on the JS side.
         // Native code will then un-hide the WebView.
         channel.onCordovaReady.subscribe(function() {
@@ -1575,6 +1586,21 @@ module.exports = {
     },
 
     /**
+    * Override the default behavior of the Android volume button.
+    * If overridden, when the volume button is pressed, the "volume[up|down]button"
+    * JavaScript event will be fired.
+    *
+    * Note: The user should not have to call this method.  Instead, when the user
+    *       registers for the "volume[up|down]button" event, this is automatically done.
+    *
+    * @param button          volumeup, volumedown
+    * @param override        T=override, F=cancel override
+    */
+    overrideButton:function(button, override) {
+        exec(null, null, "App", "overrideButton", [button, override]);
+    },
+
+    /**
     * Exit and terminate the application.
     */
     exitApp:function() {
@@ -1667,11 +1693,11 @@ function handlePluginsObject(path, moduleList, finishPluginLoading)
{
 function findCordovaPath() {
     var path = null;
     var scripts = document.getElementsByTagName('script');
-    var term = 'cordova.js';
+    var term = '/cordova.js';
     for (var n = scripts.length-1; n>-1; n--) {
         var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
         if (src.indexOf(term) == (src.length - term.length)) {
-            path = src.substring(0, src.length - term.length);
+            path = src.substring(0, src.length - term.length) + '/';
             break;
         }
     }


Mime
View raw message