Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0E64CD0DA for ; Thu, 23 May 2013 04:22:37 +0000 (UTC) Received: (qmail 85937 invoked by uid 500); 23 May 2013 04:22:36 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 85838 invoked by uid 500); 23 May 2013 04:22:35 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 85802 invoked by uid 99); 23 May 2013 04:22:34 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 May 2013 04:22:34 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B1153894038; Thu, 23 May 2013 04:22:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agrieve@apache.org To: commits@cordova.apache.org Message-Id: <219289adfadb473ba6c4b984478f6a7e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ios commit: Update JS snapshot to version 2.8.0rc1 Date: Thu, 23 May 2013 04:22:33 +0000 (UTC) Updated Branches: refs/heads/master e4b021760 -> f45d4de11 Update JS snapshot to version 2.8.0rc1 Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/f45d4de1 Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/f45d4de1 Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/f45d4de1 Branch: refs/heads/master Commit: f45d4de1129b18c6476151f268883a710feb6981 Parents: e4b0217 Author: Andrew Grieve Authored: Thu May 23 00:22:28 2013 -0400 Committer: Andrew Grieve Committed: Thu May 23 00:22:28 2013 -0400 ---------------------------------------------------------------------- CordovaLib/cordova.js | 158 +++++++++++++++++++++++++++----------------- 1 files changed, 96 insertions(+), 62 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/f45d4de1/CordovaLib/cordova.js ---------------------------------------------------------------------- diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js index b716939..f48d6f9 100644 --- a/CordovaLib/cordova.js +++ b/CordovaLib/cordova.js @@ -1,9 +1,5 @@ // Platform: ios - -// commit cd29cf0f224ccf25e9d422a33fd02ef67d3a78f4 - -// File generated at :: Mon Apr 29 2013 16:14:47 GMT-0700 (PDT) - +// 2.8.0rc1-0-g22bc4d8 /* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -22,26 +18,36 @@ specific language governing permissions and limitations under the License. */ - ;(function() { - +var CORDOVA_JS_BUILD_LABEL = '2.8.0rc1-0-g22bc4d8'; // file: lib/scripts/require.js var require, define; (function () { - var modules = {}; + var modules = {}, // Stack of moduleIds currently being built. - var requireStack = []; + requireStack = [], // Map of module ID -> index into requireStack of modules currently being built. - var inProgressModules = {}; + inProgressModules = {}, + SEPERATOR = "."; + + function build(module) { - var factory = module.factory; + var factory = module.factory, + localRequire = function (id) { + var resultantId = id; + //Its a relative path, so lop off the last portion and add the id (minus "./") + if (id.charAt(0) === ".") { + resultantId = module.id.slice(0, module.id.lastIndexOf(SEPERATOR)) + SEPERATOR + id.slice(2); + } + return require(resultantId); + }; module.exports = {}; delete module.factory; - factory(require, module.exports, module); + factory(localRequire, module.exports, module); return module.exports; } @@ -1301,8 +1307,6 @@ var CaptureAudioOptions = function(){ this.limit = 1; // Maximum duration of a single sound clip in seconds. this.duration = 0; - // The selected audio mode. Must match with one of the elements in supportedAudioModes array. - this.mode = null; }; module.exports = CaptureAudioOptions; @@ -1343,8 +1347,6 @@ define("cordova/plugin/CaptureImageOptions", function(require, exports, module) var CaptureImageOptions = function(){ // Upper limit of images user can take. Value must be equal or greater than 1. this.limit = 1; - // The selected image mode. Must match with one of the elements in supportedImageModes array. - this.mode = null; }; module.exports = CaptureImageOptions; @@ -1362,8 +1364,6 @@ var CaptureVideoOptions = function(){ this.limit = 1; // Maximum duration of a single video clip in seconds. this.duration = 0; - // The selected video mode. Must match with one of the elements in supportedVideoModes array. - this.mode = null; }; module.exports = CaptureVideoOptions; @@ -4511,12 +4511,16 @@ function Device() { channel.onCordovaReady.subscribe(function() { me.getInfo(function(info) { + var buildLabel = info.cordova; + if (buildLabel != CORDOVA_JS_BUILD_LABEL) { + buildLabel += ' JS=' + CORDOVA_JS_BUILD_LABEL; + } me.available = true; me.platform = info.platform; me.version = info.version; me.name = info.name; me.uuid = info.uuid; - me.cordova = info.cordova; + me.cordova = buildLabel; me.model = info.model; channel.onCordovaInfoReady.fire(); },function(e) { @@ -5369,7 +5373,7 @@ define("cordova/plugin/ios/logger/plugininit", function(require, exports, module // use the native logger var logger = require("cordova/plugin/logger"); -logger.useConsole(false); +logger.useConsole(true); }); @@ -5426,10 +5430,13 @@ var exec = require('cordova/exec'); var utils = require('cordova/utils'); var UseConsole = true; +var UseLogger = true; var Queued = []; var DeviceReady = false; var CurrentLevel; +var originalConsole = console; + /** * Logging levels */ @@ -5490,8 +5497,7 @@ logger.level = function (value) { * Getter/Setter for the useConsole functionality * * When useConsole is true, the logger will log via the - * browser 'console' object. Otherwise, it will use the - * native Logger plugin. + * browser 'console' object. */ logger.useConsole = function (value) { if (arguments.length) UseConsole = !!value; @@ -5516,6 +5522,18 @@ logger.useConsole = function (value) { }; /** + * Getter/Setter for the useLogger functionality + * + * When useLogger is true, the logger will log via the + * native Logger plugin. + */ +logger.useLogger = function (value) { + // Enforce boolean + if (arguments.length) UseLogger = !!value; + return UseLogger; +}; + +/** * Logs a message at the LOG level. * * Parameters passed after message are used applied to @@ -5584,24 +5602,26 @@ logger.logLevel = function(level /* , ... */) { return; } - // if not using the console, use the native logger - if (!UseConsole) { + // Log using the native logger if that is enabled + if (UseLogger) { exec(null, null, "Logger", "logLevel", [level, message]); - return; } - // make sure console is not using logger - if (console.__usingCordovaLogger) { - throw new Error("console and logger are too intertwingly"); - } + // Log using the console if that is enabled + if (UseConsole) { + // make sure console is not using logger + if (console.__usingCordovaLogger) { + throw new Error("console and logger are too intertwingly"); + } - // log to the console - switch (level) { - case logger.LOG: console.log(message); break; - case logger.ERROR: console.log("ERROR: " + message); break; - case logger.WARN: console.log("WARN: " + message); break; - case logger.INFO: console.log("INFO: " + message); break; - case logger.DEBUG: console.log("DEBUG: " + message); break; + // log to the console + switch (level) { + case logger.LOG: originalConsole.log(message); break; + case logger.ERROR: originalConsole.log("ERROR: " + message); break; + case logger.WARN: originalConsole.log("WARN: " + message); break; + case logger.INFO: originalConsole.log("INFO: " + message); break; + case logger.DEBUG: originalConsole.log("DEBUG: " + message); break; + } } }; @@ -5862,7 +5882,7 @@ module.exports = { // Some platforms take an array of button label names. // Other platforms take a comma separated list. // For compatibility, we convert to the desired type based on the platform. - if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone") { + if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id == "blackberry10") { if (typeof _buttonLabels === 'string') { var buttonLabelString = _buttonLabels; _buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here @@ -5886,12 +5906,14 @@ module.exports = { * @param {Function} resultCallback The callback that is called when user clicks on a button. * @param {String} title Title of the dialog (default: "Prompt") * @param {Array} buttonLabels Array of strings for the button labels (default: ["OK","Cancel"]) + * @param {String} defaultText Textbox input value (default: "Default text") */ - prompt: function(message, resultCallback, title, buttonLabels) { + prompt: function(message, resultCallback, title, buttonLabels, defaultText) { var _message = (message || "Prompt message"); var _title = (title || "Prompt"); var _buttonLabels = (buttonLabels || ["OK","Cancel"]); - exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels]); + var _defaultText = (defaultText || "Default text"); + exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]); }, /** @@ -6233,9 +6255,7 @@ function UUIDcreatePart(length) { }); - window.cordova = require('cordova'); - // file: lib/scripts/bootstrap.js (function (context) { @@ -6351,7 +6371,7 @@ require('cordova/channel').onNativeReady.fire(); // See plugman's plugin_loader.js for the details of this object. // This function is only called if the really is a plugins array that isn't empty. // Otherwise the XHR response handler will just call finishPluginLoading(). - function handlePluginsObject(modules) { + function handlePluginsObject(modules, path) { // First create the callback for when all plugins are loaded. var mapper = context.cordova.require('cordova/modulemapper'); onScriptLoadingComplete = function() { @@ -6385,35 +6405,49 @@ require('cordova/channel').onNativeReady.fire(); // Now inject the scripts. for (var i = 0; i < modules.length; i++) { - injectScript(modules[i].file); + injectScript(path + modules[i].file); } } - + // Find the root of the app + var path = ''; + var scripts = document.getElementsByTagName('script'); + var term = 'cordova.js'; + for (var n = scripts.length-1; n>-1; n--) { + var src = scripts[n].src; + if (src.indexOf(term) == (src.length - term.length)) { + path = src.substring(0, src.length - term.length); + break; + } + } // Try to XHR the cordova_plugins.json file asynchronously. - try { // we commented we were going to try, so let us actually try and catch - var xhr = new context.XMLHttpRequest(); - xhr.onload = function() { - // If the response is a JSON string which composes an array, call handlePluginsObject. - // If the request fails, or the response is not a JSON array, just call finishPluginLoading. - var obj = this.responseText && JSON.parse(this.responseText); - if (obj && obj instanceof Array && obj.length > 0) { - handlePluginsObject(obj); - } else { - finishPluginLoading(); - } - }; - xhr.onerror = function() { + var xhr = new XMLHttpRequest(); + xhr.onload = function() { + // If the response is a JSON string which composes an array, call handlePluginsObject. + // If the request fails, or the response is not a JSON array, just call finishPluginLoading. + var obj; + try { + obj = (this.status == 0 || this.status == 200) && this.responseText && JSON.parse(this.responseText); + } catch (err) { + // obj will be undefined. + } + if (Array.isArray(obj) && obj.length > 0) { + handlePluginsObject(obj, path); + } else { finishPluginLoading(); - }; - xhr.open('GET', 'cordova_plugins.json', true); // Async + } + }; + xhr.onerror = function() { + finishPluginLoading(); + }; + var plugins_json = path + 'cordova_plugins.json'; + try { // we commented we were going to try, so let us actually try and catch + xhr.open('GET', plugins_json, true); // Async xhr.send(); - } - catch(err){ + } catch(err){ finishPluginLoading(); } }(window)); - })(); \ No newline at end of file