CB-7385 update cordova.js for testing prior to branch/tag

This commit is contained in:
Marcel Kinard 2014-08-27 09:04:32 -04:00
parent 16e3ebd87b
commit c6ccde0558

View File

@ -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() {
@ -1574,6 +1585,21 @@ module.exports = {
exec(null, null, "App", "overrideBackbutton", [override]);
},
/**
* 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.
*/
@ -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;
}
}