updated cordova.js in tests.
Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/b07daec7 Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/b07daec7 Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/b07daec7 Branch: refs/heads/master Commit: b07daec774a228b284dc403c5b309268d7fb3a8f Parents: bb2029d Author: Archana Naik <[email protected]> Authored: Thu Aug 28 12:01:16 2014 -0700 Committer: Archana Naik <[email protected]> Committed: Thu Aug 28 12:01:16 2014 -0700 ---------------------------------------------------------------------- test/assets/www/cordova.js | 47 ++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b07daec7/test/assets/www/cordova.js ---------------------------------------------------------------------- diff --git a/test/assets/www/cordova.js b/test/assets/www/cordova.js index 0a87e6c..b8627c9 100755 --- a/test/assets/www/cordova.js +++ b/test/assets/www/cordova.js @@ -1,5 +1,6 @@ -// Platform: android -// 3.6.0-dev-70cdca3 + +// Platform: amazon-fireos +// 3.6.3 /* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -19,7 +20,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 */ @@ -316,7 +317,7 @@ module.exports = cordova; }); -// file: src/android/android/nativeapiprovider.js +// file: src/amazon-fireos/android/nativeapiprovider.js define("cordova/android/nativeapiprovider", function(require, exports, module) { /** @@ -339,7 +340,7 @@ module.exports = { }); -// file: src/android/android/promptbasednativeapi.js +// file: src/amazon-fireos/android/promptbasednativeapi.js define("cordova/android/promptbasednativeapi", function(require, exports, module) { /** @@ -848,7 +849,7 @@ module.exports = channel; }); -// file: src/android/exec.js +// file: src/amazon-fireos/exec.js define("cordova/exec", function(require, exports, module) { /** @@ -1468,7 +1469,7 @@ exports.reset(); }); -// file: src/android/platform.js +// file: src/amazon-fireos/platform.js define("cordova/platform", function(require, exports, module) { module.exports = { @@ -1497,6 +1498,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() { @@ -1507,7 +1519,7 @@ module.exports = { }); -// file: src/android/plugin/android/app.js +// file: src/amazon-fireos/plugin/android/app.js define("cordova/plugin/android/app", function(require, exports, module) { var exec = require('cordova/exec'); @@ -1575,6 +1587,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 +1694,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; } }
