diff --git a/cordova-1.7.0.js b/cordova-1.7.0.js index dcdcc9d..02ee44e 100644 --- a/cordova-1.7.0.js +++ b/cordova-1.7.0.js @@ -1,6 +1,6 @@ -// commit bb82c944d5d7465c0e014edbcd81be919f53064e +// commit 97d4ff51d1c63ce1017fd54e1493795c193722f6 -// File generated at :: Wed Apr 25 2012 15:25:32 GMT-0700 (PDT) +// File generated at :: Mon Apr 30 2012 12:27:44 GMT-0700 (Pacific Daylight Time) /* Licensed to the Apache Software Foundation (ASF) under one @@ -23,7 +23,7 @@ ;(function() { -// file: lib/scripts/require.js +// file: lib\scripts\require.js var require, define; @@ -101,27 +101,27 @@ document.addEventListener = function(evt, handler, capture) { if (e == 'deviceready') { channel.onDeviceReady.subscribeOnce(handler); } else if (e == 'resume') { - channel.onResume.subscribe(handler); - // if subscribing listener after event has already fired, invoke the handler - if (channel.onResume.fired && handler instanceof Function) { - handler(); - } + channel.onResume.subscribe(handler); + // if subscribing listener after event has already fired, invoke the handler + if (channel.onResume.fired && typeof handler == 'function') { + handler(); + } } else if (e == 'pause') { - channel.onPause.subscribe(handler); + channel.onPause.subscribe(handler); } else if (typeof documentEventHandlers[e] != 'undefined') { - documentEventHandlers[e].subscribe(handler); + documentEventHandlers[e].subscribe(handler); } else { - m_document_addEventListener.call(document, evt, handler, capture); + m_document_addEventListener.call(document, evt, handler, capture); } }; window.addEventListener = function(evt, handler, capture) { - var e = evt.toLowerCase(); - if (typeof windowEventHandlers[e] != 'undefined') { - windowEventHandlers[e].subscribe(handler); - } else { - m_window_addEventListener.call(window, evt, handler, capture); - } + var e = evt.toLowerCase(); + if (typeof windowEventHandlers[e] != 'undefined') { + windowEventHandlers[e].subscribe(handler); + } else { + m_window_addEventListener.call(window, evt, handler, capture); + } }; document.removeEventListener = function(evt, handler, capture) { @@ -140,30 +140,29 @@ document.removeEventListener = function(evt, handler, capture) { }; window.removeEventListener = function(evt, handler, capture) { - var e = evt.toLowerCase(); - // If unsubcribing from an event that is handled by a plugin - if (typeof windowEventHandlers[e] != "undefined") { - windowEventHandlers[e].unsubscribe(handler); - } else { - m_window_removeEventListener.call(window, evt, handler, capture); - } + var e = evt.toLowerCase(); + // If unsubcribing from an event that is handled by a plugin + if (typeof windowEventHandlers[e] != "undefined") { + windowEventHandlers[e].unsubscribe(handler); + } else { + m_window_removeEventListener.call(window, evt, handler, capture); + } }; function createEvent(type, data) { - var event = document.createEvent('Events'); - event.initEvent(type, false, false); - if (data) { - for (var i in data) { - if (data.hasOwnProperty(i)) { - event[i] = data[i]; - } + var event = document.createEvent('Events'); + event.initEvent(type, false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } } - } - return event; + return event; } -if(typeof window.console === "undefined") -{ +if(typeof window.console === "undefined") { window.console = { log:function(){} }; @@ -176,16 +175,16 @@ var cordova = { * Methods to add/remove your own addEventListener hijacking on document + window. */ addWindowEventHandler:function(event, opts) { - return (windowEventHandlers[event] = channel.create(event, opts)); + return (windowEventHandlers[event] = channel.create(event, opts)); }, addDocumentEventHandler:function(event, opts) { - return (documentEventHandlers[event] = channel.create(event, opts)); + return (documentEventHandlers[event] = channel.create(event, opts)); }, removeWindowEventHandler:function(event) { - delete windowEventHandlers[event]; + delete windowEventHandlers[event]; }, removeDocumentEventHandler:function(event) { - delete documentEventHandlers[event]; + delete documentEventHandlers[event]; }, /** * Retreive original event handlers that were replaced by Cordova @@ -200,20 +199,20 @@ var cordova = { * Method to fire event from native code */ fireDocumentEvent: function(type, data) { - var evt = createEvent(type, data); - if (typeof documentEventHandlers[type] != 'undefined') { - documentEventHandlers[type].fire(evt); - } else { - document.dispatchEvent(evt); - } + var evt = createEvent(type, data); + if (typeof documentEventHandlers[type] != 'undefined') { + documentEventHandlers[type].fire(evt); + } else { + document.dispatchEvent(evt); + } }, fireWindowEvent: function(type, data) { - var evt = createEvent(type,data); - if (typeof windowEventHandlers[type] != 'undefined') { - windowEventHandlers[type].fire(evt); - } else { - window.dispatchEvent(evt); - } + var evt = createEvent(type,data); + if (typeof windowEventHandlers[type] != 'undefined') { + windowEventHandlers[type].fire(evt); + } else { + window.dispatchEvent(evt); + } }, // TODO: this is Android only; think about how to do this better shuttingDown:false, @@ -319,15 +318,41 @@ var cordova = { } }; +// Adds deprecation warnings to functions of an object (but only logs a message once) +function deprecateFunctions(obj, objLabel) { + var newObj = {}; + var logHash = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + if (typeof obj[i] == 'function') { + newObj[i] = (function(prop){ + var oldFunk = obj[prop]; + var funkId = objLabel + '_' + prop; + return function() { + if (!logHash[funkId]) { + console.log('[DEPRECATION NOTICE] The "' + objLabel + '" global will be removed in version 2.0, please use lowercase "cordova".'); + logHash[funkId] = true; + } + oldFunk.apply(obj, arguments); + }; + })(i); + } else { + newObj[i] = (function(prop) { return obj[prop]; })(i); + } + } + } + return newObj; +} + /** * Legacy variable for plugin support * TODO: remove in 2.0. */ if (!window.PhoneGap) { - window.PhoneGap = cordova; + window.PhoneGap = deprecateFunctions(cordova, 'PhoneGap'); } if (!window.Cordova) { - window.Cordova = cordova; + window.Cordova = deprecateFunctions(cordova, 'Cordova'); } /** @@ -342,7 +367,7 @@ module.exports = cordova; }); -// file: lib/common/builder.js +// file: lib\common\builder.js define("cordova/builder", function(require, exports, module) { var utils = require('cordova/utils'); @@ -435,8 +460,10 @@ module.exports = { }); -// file: lib/common/channel.js +// file: lib\common\channel.js define("cordova/channel", function(require, exports, module) { +var utils = require('cordova/utils'); + /** * Custom pub-sub "channel" that can have functions subscribed to it * This object is used to define and control firing of events for @@ -484,21 +511,21 @@ define("cordova/channel", function(require, exports, module) { * context to the Channel. */ var Channel = function(type, opts) { - this.type = type; - this.handlers = {}; - this.numHandlers = 0; - this.guid = 0; - this.fired = false; - this.enabled = true; - this.events = { - onSubscribe:null, - onUnsubscribe:null - }; - if (opts) { - if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe; - if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe; - } - }, + this.type = type; + this.handlers = {}; + this.numHandlers = 0; + this.guid = 0; + this.fired = false; + this.enabled = true; + this.events = { + onSubscribe:null, + onUnsubscribe:null + }; + if (opts) { + if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe; + if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe; + } +}, channel = { /** * Calls the provided function only after all of the channels specified @@ -558,8 +585,11 @@ var Channel = function(type, opts) { c.fire(); } } - }, - utils = require('cordova/utils'); + }; + +function forceFunction(f) { + if (f === null || f === undefined || typeof f != 'function') throw "Function required as first argument!"; +} /** * Subscribes the given function to the channel. Any time that @@ -570,10 +600,10 @@ var Channel = function(type, opts) { */ Channel.prototype.subscribe = function(f, c, g) { // need a function to call - if (f === null || f === undefined) { return; } + forceFunction(f); var func = f; - if (typeof c == "object" && f instanceof Function) { func = utils.close(c, f); } + if (typeof c == "object") { func = utils.close(c, f); } g = g || func.observer_guid || f.observer_guid || this.guid++; func.observer_guid = g; @@ -590,7 +620,7 @@ Channel.prototype.subscribe = function(f, c, g) { */ Channel.prototype.subscribeOnce = function(f, c) { // need a function to call - if (f === null || f === undefined) { return; } + forceFunction(f); var g = null; var _this = this; @@ -599,7 +629,7 @@ Channel.prototype.subscribeOnce = function(f, c) { _this.unsubscribe(g); }; if (this.fired) { - if (typeof c == "object" && f instanceof Function) { f = utils.close(c, f); } + if (typeof c == "object") { f = utils.close(c, f); } f.apply(this, this.fireArgs); } else { g = this.subscribe(m); @@ -612,9 +642,9 @@ Channel.prototype.subscribeOnce = function(f, c) { */ Channel.prototype.unsubscribe = function(g) { // need a function to unsubscribe - if (g === null || g === undefined) { return; } + if (g === null || g === undefined) { throw "You must pass _something_ into Channel.unsubscribe"; } - if (g instanceof Function) { g = g.observer_guid; } + if (typeof g == 'function') { g = g.observer_guid; } this.handlers[g] = null; delete this.handlers[g]; this.numHandlers--; @@ -630,7 +660,7 @@ Channel.prototype.fire = function(e) { this.fired = true; for (var item in this.handlers) { var handler = this.handlers[item]; - if (handler instanceof Function) { + if (typeof handler == 'function') { var rv = (handler.apply(this, arguments)===false); fail = fail || rv; } @@ -676,9 +706,10 @@ channel.waitForInitialization('onCordovaInfoReady'); channel.waitForInitialization('onCordovaConnectionReady'); module.exports = channel; + }); -// file: lib/common/common.js +// file: lib\common\common.js define("cordova/common", function(require, exports, module) { module.exports = { objects: { @@ -862,7 +893,7 @@ module.exports = { }; }); -// file: lib/wp7/exec.js +// file: lib\wp7\exec.js define("cordova/exec", function(require, exports, module) { var cordova = require('cordova'); @@ -909,6 +940,9 @@ var NamedArgs = { }, Camera:{ takePicture:["quality", "destinationType", "sourceType", "targetWidth", "targetHeight", "encodingType"] + }, + Capture:{ + getFormatData:["fullPath","type"] } }; @@ -971,7 +1005,7 @@ module.exports = function(success, fail, service, action, args) { }); -// file: lib/wp7/platform.js +// file: lib\wp7\platform.js define("cordova/platform", function(require, exports, module) { var cordova = require('cordova'), exec = require('cordova/exec'); @@ -1057,7 +1091,7 @@ module.exports = { }; }); -// file: lib/common/plugin/Acceleration.js +// file: lib\common\plugin\Acceleration.js define("cordova/plugin/Acceleration", function(require, exports, module) { var Acceleration = function(x, y, z, timestamp) { this.x = x; @@ -1069,7 +1103,7 @@ var Acceleration = function(x, y, z, timestamp) { module.exports = Acceleration; }); -// file: lib/common/plugin/Camera.js +// file: lib\common\plugin\Camera.js define("cordova/plugin/Camera", function(require, exports, module) { var exec = require('cordova/exec'), Camera = require('cordova/plugin/CameraConstants'); @@ -1178,7 +1212,7 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) { module.exports = cameraExport; }); -// file: lib/common/plugin/CameraConstants.js +// file: lib\common\plugin\CameraConstants.js define("cordova/plugin/CameraConstants", function(require, exports, module) { module.exports = { DestinationType:{ @@ -1202,7 +1236,7 @@ module.exports = { }; }); -// file: lib/common/plugin/CaptureAudioOptions.js +// file: lib\common\plugin\CaptureAudioOptions.js define("cordova/plugin/CaptureAudioOptions", function(require, exports, module) { /** * Encapsulates all audio capture operation configuration options. @@ -1219,7 +1253,7 @@ var CaptureAudioOptions = function(){ module.exports = CaptureAudioOptions; }); -// file: lib/common/plugin/CaptureError.js +// file: lib\common\plugin\CaptureError.js define("cordova/plugin/CaptureError", function(require, exports, module) { /** * The CaptureError interface encapsulates all errors in the Capture API. @@ -1242,7 +1276,7 @@ CaptureError.CAPTURE_NOT_SUPPORTED = 20; module.exports = CaptureError; }); -// file: lib/common/plugin/CaptureImageOptions.js +// file: lib\common\plugin\CaptureImageOptions.js define("cordova/plugin/CaptureImageOptions", function(require, exports, module) { /** * Encapsulates all image capture operation configuration options. @@ -1257,7 +1291,7 @@ var CaptureImageOptions = function(){ module.exports = CaptureImageOptions; }); -// file: lib/common/plugin/CaptureVideoOptions.js +// file: lib\common\plugin\CaptureVideoOptions.js define("cordova/plugin/CaptureVideoOptions", function(require, exports, module) { /** * Encapsulates all video capture operation configuration options. @@ -1274,7 +1308,7 @@ var CaptureVideoOptions = function(){ module.exports = CaptureVideoOptions; }); -// file: lib/common/plugin/CompassError.js +// file: lib\common\plugin\CompassError.js define("cordova/plugin/CompassError", function(require, exports, module) { /** * CompassError. @@ -1291,7 +1325,7 @@ CompassError.COMPASS_NOT_SUPPORTED = 20; module.exports = CompassError; }); -// file: lib/common/plugin/CompassHeading.js +// file: lib\common\plugin\CompassHeading.js define("cordova/plugin/CompassHeading", function(require, exports, module) { var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, timestamp) { this.magneticHeading = (magneticHeading !== undefined ? magneticHeading : null); @@ -1303,7 +1337,7 @@ var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, tim module.exports = CompassHeading; }); -// file: lib/common/plugin/ConfigurationData.js +// file: lib\common\plugin\ConfigurationData.js define("cordova/plugin/ConfigurationData", function(require, exports, module) { /** * Encapsulates a set of parameters that the capture device supports. @@ -1322,7 +1356,7 @@ function ConfigurationData() { module.exports = ConfigurationData; }); -// file: lib/common/plugin/Connection.js +// file: lib\common\plugin\Connection.js define("cordova/plugin/Connection", function(require, exports, module) { /** * Network status @@ -1338,7 +1372,7 @@ module.exports = { }; }); -// file: lib/common/plugin/Contact.js +// file: lib\common\plugin\Contact.js define("cordova/plugin/Contact", function(require, exports, module) { var exec = require('cordova/exec'), ContactError = require('cordova/plugin/ContactError'), @@ -1367,14 +1401,14 @@ function convertOut(contact) { var value = contact.birthday; if (value !== null) { // try to make it a Date object if it is not already - if (!value instanceof Date){ + if (!utils.isDate(value)){ try { value = new Date(value); } catch(exception){ value = null; } } - if (value instanceof Date){ + if (utils.isDate(value)){ value = value.valueOf(); // convert to milliseconds } contact.birthday = value; @@ -1517,9 +1551,10 @@ Contact.prototype.save = function(successCB, errorCB) { module.exports = Contact; + }); -// file: lib/common/plugin/ContactAddress.js +// file: lib\common\plugin\ContactAddress.js define("cordova/plugin/ContactAddress", function(require, exports, module) { /** * Contact address. @@ -1548,7 +1583,7 @@ var ContactAddress = function(pref, type, formatted, streetAddress, locality, re module.exports = ContactAddress; }); -// file: lib/common/plugin/ContactError.js +// file: lib\common\plugin\ContactError.js define("cordova/plugin/ContactError", function(require, exports, module) { /** * ContactError. @@ -1573,7 +1608,7 @@ ContactError.PERMISSION_DENIED_ERROR = 20; module.exports = ContactError; }); -// file: lib/common/plugin/ContactField.js +// file: lib\common\plugin\ContactField.js define("cordova/plugin/ContactField", function(require, exports, module) { /** * Generic contact field. @@ -1585,15 +1620,15 @@ define("cordova/plugin/ContactField", function(require, exports, module) { */ var ContactField = function(type, value, pref) { this.id = null; - this.type = type || null; - this.value = value || null; + this.type = (type && type.toString()) || null; + this.value = (value && value.toString()) || null; this.pref = (typeof pref != 'undefined' ? pref : false); }; module.exports = ContactField; }); -// file: lib/common/plugin/ContactFindOptions.js +// file: lib\common\plugin\ContactFindOptions.js define("cordova/plugin/ContactFindOptions", function(require, exports, module) { /** * ContactFindOptions. @@ -1610,7 +1645,7 @@ var ContactFindOptions = function(filter, multiple) { module.exports = ContactFindOptions; }); -// file: lib/common/plugin/ContactName.js +// file: lib\common\plugin\ContactName.js define("cordova/plugin/ContactName", function(require, exports, module) { /** * Contact name. @@ -1634,7 +1669,7 @@ var ContactName = function(formatted, familyName, givenName, middle, prefix, suf module.exports = ContactName; }); -// file: lib/common/plugin/ContactOrganization.js +// file: lib\common\plugin\ContactOrganization.js define("cordova/plugin/ContactOrganization", function(require, exports, module) { /** * Contact organization. @@ -1661,7 +1696,7 @@ var ContactOrganization = function(pref, type, name, dept, title) { module.exports = ContactOrganization; }); -// file: lib/common/plugin/Coordinates.js +// file: lib\common\plugin\Coordinates.js define("cordova/plugin/Coordinates", function(require, exports, module) { /** * This class contains position information. @@ -1708,7 +1743,7 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) { module.exports = Coordinates; }); -// file: lib/common/plugin/DirectoryEntry.js +// file: lib\common\plugin\DirectoryEntry.js define("cordova/plugin/DirectoryEntry", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'), @@ -1794,7 +1829,7 @@ module.exports = DirectoryEntry; }); -// file: lib/common/plugin/DirectoryReader.js +// file: lib\common\plugin\DirectoryReader.js define("cordova/plugin/DirectoryReader", function(require, exports, module) { var exec = require('cordova/exec'), FileError = require('cordova/plugin/FileError') ; @@ -1841,7 +1876,7 @@ module.exports = DirectoryReader; }); -// file: lib/common/plugin/Entry.js +// file: lib\common\plugin\Entry.js define("cordova/plugin/Entry", function(require, exports, module) { var exec = require('cordova/exec'), FileError = require('cordova/plugin/FileError'), @@ -2048,7 +2083,7 @@ Entry.prototype.getParent = function(successCallback, errorCallback) { module.exports = Entry; }); -// file: lib/common/plugin/File.js +// file: lib\common\plugin\File.js define("cordova/plugin/File", function(require, exports, module) { /** * Constructor. @@ -2070,7 +2105,7 @@ var File = function(name, fullPath, type, lastModifiedDate, size){ module.exports = File; }); -// file: lib/common/plugin/FileEntry.js +// file: lib\common\plugin\FileEntry.js define("cordova/plugin/FileEntry", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'), @@ -2137,7 +2172,7 @@ FileEntry.prototype.file = function(successCallback, errorCallback) { module.exports = FileEntry; }); -// file: lib/common/plugin/FileError.js +// file: lib\common\plugin\FileError.js define("cordova/plugin/FileError", function(require, exports, module) { /** * FileError @@ -2166,7 +2201,7 @@ FileError.PATH_EXISTS_ERR = 12; module.exports = FileError; }); -// file: lib/common/plugin/FileReader.js +// file: lib\common\plugin\FileReader.js define("cordova/plugin/FileReader", function(require, exports, module) { var exec = require('cordova/exec'), FileError = require('cordova/plugin/FileError'), @@ -2419,7 +2454,7 @@ FileReader.prototype.readAsArrayBuffer = function(file) { module.exports = FileReader; }); -// file: lib/common/plugin/FileSystem.js +// file: lib\common\plugin\FileSystem.js define("cordova/plugin/FileSystem", function(require, exports, module) { var DirectoryEntry = require('cordova/plugin/DirectoryEntry'); @@ -2440,7 +2475,7 @@ var FileSystem = function(name, root) { module.exports = FileSystem; }); -// file: lib/common/plugin/FileTransfer.js +// file: lib\common\plugin\FileTransfer.js define("cordova/plugin/FileTransfer", function(require, exports, module) { var exec = require('cordova/exec'); @@ -2471,7 +2506,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro fileKey = options.fileKey; fileName = options.fileName; mimeType = options.mimeType; - if (options.chunkedMode !== null || typeof options.chunkedMode !== "undefined") { + if (options.chunkedMode !== null || typeof options.chunkedMode != "undefined") { chunkedMode = options.chunkedMode; } if (options.params) { @@ -2514,7 +2549,7 @@ module.exports = FileTransfer; }); -// file: lib/common/plugin/FileTransferError.js +// file: lib\common\plugin\FileTransferError.js define("cordova/plugin/FileTransferError", function(require, exports, module) { /** * FileTransferError @@ -2531,7 +2566,7 @@ FileTransferError.CONNECTION_ERR = 3; module.exports = FileTransferError; }); -// file: lib/common/plugin/FileUploadOptions.js +// file: lib\common\plugin\FileUploadOptions.js define("cordova/plugin/FileUploadOptions", function(require, exports, module) { /** * Options to customize the HTTP request used to upload files. @@ -2551,7 +2586,7 @@ var FileUploadOptions = function(fileKey, fileName, mimeType, params) { module.exports = FileUploadOptions; }); -// file: lib/common/plugin/FileUploadResult.js +// file: lib\common\plugin\FileUploadResult.js define("cordova/plugin/FileUploadResult", function(require, exports, module) { /** * FileUploadResult @@ -2566,7 +2601,7 @@ var FileUploadResult = function() { module.exports = FileUploadResult; }); -// file: lib/common/plugin/FileWriter.js +// file: lib\common\plugin\FileWriter.js define("cordova/plugin/FileWriter", function(require, exports, module) { var exec = require('cordova/exec'), FileError = require('cordova/plugin/FileError'), @@ -2824,7 +2859,7 @@ module.exports = FileWriter; }); -// file: lib/common/plugin/Flags.js +// file: lib\common\plugin\Flags.js define("cordova/plugin/Flags", function(require, exports, module) { /** * Supplies arguments to methods that lookup or create files and directories. @@ -2843,7 +2878,7 @@ function Flags(create, exclusive) { module.exports = Flags; }); -// file: lib/common/plugin/LocalFileSystem.js +// file: lib\common\plugin\LocalFileSystem.js define("cordova/plugin/LocalFileSystem", function(require, exports, module) { var exec = require('cordova/exec'); @@ -2860,7 +2895,7 @@ LocalFileSystem.PERSISTENT = 1; //persistent module.exports = LocalFileSystem; }); -// file: lib/common/plugin/Media.js +// file: lib\common\plugin\Media.js define("cordova/plugin/Media", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'); @@ -3051,7 +3086,7 @@ Media.onStatus = function(id, msg, value) { module.exports = Media; }); -// file: lib/common/plugin/MediaError.js +// file: lib\common\plugin\MediaError.js define("cordova/plugin/MediaError", function(require, exports, module) { /** * This class contains information about any Media errors. @@ -3071,7 +3106,7 @@ MediaError.MEDIA_ERR_NONE_SUPPORTED = 4; module.exports = MediaError; }); -// file: lib/common/plugin/MediaFile.js +// file: lib\common\plugin\MediaFile.js define("cordova/plugin/MediaFile", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'), @@ -3132,7 +3167,7 @@ module.exports = MediaFile; }); -// file: lib/common/plugin/MediaFileData.js +// file: lib\common\plugin\MediaFileData.js define("cordova/plugin/MediaFileData", function(require, exports, module) { /** * MediaFileData encapsulates format information of a media file. @@ -3154,7 +3189,7 @@ var MediaFileData = function(codecs, bitrate, height, width, duration){ module.exports = MediaFileData; }); -// file: lib/common/plugin/Metadata.js +// file: lib\common\plugin\Metadata.js define("cordova/plugin/Metadata", function(require, exports, module) { /** * Information about the state of the file or directory @@ -3168,7 +3203,7 @@ var Metadata = function(time) { module.exports = Metadata; }); -// file: lib/common/plugin/Position.js +// file: lib\common\plugin\Position.js define("cordova/plugin/Position", function(require, exports, module) { var Coordinates = require('cordova/plugin/Coordinates'); @@ -3180,7 +3215,7 @@ var Position = function(coords, timestamp) { module.exports = Position; }); -// file: lib/common/plugin/PositionError.js +// file: lib\common\plugin\PositionError.js define("cordova/plugin/PositionError", function(require, exports, module) { /** * Position error object @@ -3201,7 +3236,7 @@ PositionError.TIMEOUT = 3; module.exports = PositionError; }); -// file: lib/common/plugin/ProgressEvent.js +// file: lib\common\plugin\ProgressEvent.js define("cordova/plugin/ProgressEvent", function(require, exports, module) { // If ProgressEvent exists in global context, use it already, otherwise use our own polyfill // Feature test: See if we can instantiate a native ProgressEvent; @@ -3251,7 +3286,7 @@ var ProgressEvent = (function() { module.exports = ProgressEvent; }); -// file: lib/common/plugin/accelerometer.js +// file: lib\common\plugin\accelerometer.js define("cordova/plugin/accelerometer", function(require, exports, module) { /** * This class provides access to device accelerometer data. @@ -3350,7 +3385,7 @@ var accelerometer = { module.exports = accelerometer; }); -// file: lib/common/plugin/battery.js +// file: lib\common\plugin\battery.js define("cordova/plugin/battery", function(require, exports, module) { /** * This class contains information about the current battery status. @@ -3441,7 +3476,7 @@ var battery = new Battery(); module.exports = battery; }); -// file: lib/common/plugin/capture.js +// file: lib\common\plugin\capture.js define("cordova/plugin/capture", function(require, exports, module) { var exec = require('cordova/exec'), MediaFile = require('cordova/plugin/MediaFile'); @@ -3518,7 +3553,7 @@ module.exports = new Capture(); }); -// file: lib/common/plugin/compass.js +// file: lib\common\plugin\compass.js define("cordova/plugin/compass", function(require, exports, module) { var exec = require('cordova/exec'), utils = require('cordova/utils'), @@ -3623,10 +3658,11 @@ var exec = require('cordova/exec'), module.exports = compass; }); -// file: lib/common/plugin/contacts.js +// file: lib\common\plugin\contacts.js define("cordova/plugin/contacts", function(require, exports, module) { var exec = require('cordova/exec'), ContactError = require('cordova/plugin/ContactError'), + utils = require('cordova/utils'), Contact = require('cordova/plugin/Contact'); /** @@ -3646,7 +3682,7 @@ var contacts = { if (!successCB) { throw new TypeError("You must specify a success callback for the find command."); } - if (!fields || (fields instanceof Array && fields.length === 0)) { + if (!fields || (utils.isArray(fields) && fields.length === 0)) { if (typeof errorCB === "function") { errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR)); } @@ -3682,9 +3718,10 @@ var contacts = { }; module.exports = contacts; + }); -// file: lib/common/plugin/geolocation.js +// file: lib\common\plugin\geolocation.js define("cordova/plugin/geolocation", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'), @@ -3782,7 +3819,7 @@ var geolocation = { module.exports = geolocation; }); -// file: lib/common/plugin/network.js +// file: lib\common\plugin\network.js define("cordova/plugin/network", function(require, exports, module) { var exec = require('cordova/exec'), cordova = require('cordova'), @@ -3846,7 +3883,7 @@ NetworkConnection.prototype.getInfo = function (successCallback, errorCallback) module.exports = new NetworkConnection(); }); -// file: lib/common/plugin/notification.js +// file: lib\common\plugin\notification.js define("cordova/plugin/notification", function(require, exports, module) { var exec = require('cordova/exec'); @@ -3906,7 +3943,7 @@ module.exports = { }; }); -// file: lib/common/plugin/requestFileSystem.js +// file: lib\common\plugin\requestFileSystem.js define("cordova/plugin/requestFileSystem", function(require, exports, module) { var FileError = require('cordova/plugin/FileError'), FileSystem = require('cordova/plugin/FileSystem'), @@ -3950,7 +3987,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) { module.exports = requestFileSystem; }); -// file: lib/common/plugin/resolveLocalFileSystemURI.js +// file: lib\common\plugin\resolveLocalFileSystemURI.js define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) { var DirectoryEntry = require('cordova/plugin/DirectoryEntry'), FileEntry = require('cordova/plugin/FileEntry'), @@ -3997,7 +4034,7 @@ module.exports = function(uri, successCallback, errorCallback) { }); -// file: lib/wp7/plugin/wp7/CordovaCommandResult.js +// file: lib\wp7\plugin\wp7\CordovaCommandResult.js define("cordova/plugin/wp7/CordovaCommandResult", function(require, exports, module) { var cordova = require('cordova'); @@ -4053,7 +4090,7 @@ module.exports = function(status,callbackId,args,cast) { }; }); -// file: lib/wp7/plugin/wp7/CordovaMediaonStatus.js +// file: lib\wp7\plugin\wp7\CordovaMediaonStatus.js define("cordova/plugin/wp7/CordovaMediaonStatus", function(require, exports, module) { var cordova = require('cordova'); @@ -4066,7 +4103,7 @@ module.exports = function(args) { }; }); -// file: lib/wp7/plugin/wp7/DOMStorage.js +// file: lib\wp7\plugin\wp7\DOMStorage.js define("cordova/plugin/wp7/DOMStorage", function(require, exports, module) { (function() { @@ -4233,7 +4270,7 @@ define("cordova/plugin/wp7/DOMStorage", function(require, exports, module) { module.exports = null; }); -// file: lib/wp7/plugin/wp7/XHRPatch.js +// file: lib\wp7\plugin\wp7\XHRPatch.js define("cordova/plugin/wp7/XHRPatch", function(require, exports, module) { // TODO: the build process implicitly will wrap this in a define() call // with a closure of its own; do you need this extra closure? @@ -4435,7 +4472,7 @@ if (!docDomain || docDomain.length === 0) { module.exports = null; }); -// file: lib/wp7/plugin/wp7/console.js +// file: lib\wp7\plugin\wp7\console.js define("cordova/plugin/wp7/console", function(require, exports, module) { var exec = require('cordova/exec'), @@ -4457,7 +4494,7 @@ var debugConsole = { module.exports = debugConsole; }); -// file: lib/wp7/plugin/wp7/device.js +// file: lib\wp7\plugin\wp7\device.js define("cordova/plugin/wp7/device", function(require, exports, module) { var channel = require('cordova/channel'), utils = require('cordova/utils'), @@ -4521,7 +4558,7 @@ Device.prototype.getInfo = function(successCallback, errorCallback) { module.exports = new Device(); }); -// file: lib/wp7/plugin/wp7/requestFileSystem.js +// file: lib\wp7\plugin\wp7\requestFileSystem.js define("cordova/plugin/wp7/requestFileSystem", function(require, exports, module) { var FileError = require('cordova/plugin/FileError'), @@ -4567,7 +4604,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) { module.exports = requestFileSystem; }); -// file: lib/wp7/plugin/wp7/resolveLocalFileSystemURI.js +// file: lib\wp7\plugin\wp7\resolveLocalFileSystemURI.js define("cordova/plugin/wp7/resolveLocalFileSystemURI", function(require, exports, module) { @@ -4610,7 +4647,7 @@ module.exports = function(uri, successCallback, errorCallback) { }); -// file: lib/common/utils.js +// file: lib\common\utils.js define("cordova/utils", function(require, exports, module) { function UUIDcreatePart(length) { var uuidpart = ""; @@ -4625,17 +4662,23 @@ function UUIDcreatePart(length) { } var _self = { + isArray:function(a) { + return Object.prototype.toString.call(a) == '[object Array]'; + }, + isDate:function(d) { + return Object.prototype.toString.call(d) == '[object Date]'; + }, /** * Does a deep clone of the object. */ clone: function(obj) { - if(!obj) { + if(!obj || typeof obj == 'function' || _self.isDate(obj) || typeof obj != 'object') { return obj; } var retVal, i; - if(obj instanceof Array){ + if(_self.isArray(obj)){ retVal = []; for(i = 0; i < obj.length; ++i){ retVal.push(_self.clone(obj[i])); @@ -4643,18 +4686,6 @@ var _self = { return retVal; } - if (obj instanceof Function) { - return obj; - } - - if(!(obj instanceof Object)){ - return obj; - } - - if(obj instanceof Date){ - return obj; - } - retVal = {}; for(i in obj){ if(!(i in retVal) || retVal[i] != obj[i]) { @@ -4665,7 +4696,7 @@ var _self = { }, close: function(context, func, params) { - if (typeof params === 'undefined') { + if (typeof params == 'undefined') { return function() { return func.apply(context, arguments); }; @@ -4716,12 +4747,13 @@ var _self = { }; module.exports = _self; + }); window.cordova = require('cordova'); -// file: lib/scripts/bootstrap.js +// file: lib\scripts\bootstrap.js (function (context) { var channel = require("cordova/channel"), _self = { diff --git a/templates/full/www/cordova-1.7.0.js b/templates/full/www/cordova-1.7.0.js index dcdcc9d..02ee44e 100644 --- a/templates/full/www/cordova-1.7.0.js +++ b/templates/full/www/cordova-1.7.0.js @@ -1,6 +1,6 @@ -// commit bb82c944d5d7465c0e014edbcd81be919f53064e +// commit 97d4ff51d1c63ce1017fd54e1493795c193722f6 -// File generated at :: Wed Apr 25 2012 15:25:32 GMT-0700 (PDT) +// File generated at :: Mon Apr 30 2012 12:27:44 GMT-0700 (Pacific Daylight Time) /* Licensed to the Apache Software Foundation (ASF) under one @@ -23,7 +23,7 @@ ;(function() { -// file: lib/scripts/require.js +// file: lib\scripts\require.js var require, define; @@ -101,27 +101,27 @@ document.addEventListener = function(evt, handler, capture) { if (e == 'deviceready') { channel.onDeviceReady.subscribeOnce(handler); } else if (e == 'resume') { - channel.onResume.subscribe(handler); - // if subscribing listener after event has already fired, invoke the handler - if (channel.onResume.fired && handler instanceof Function) { - handler(); - } + channel.onResume.subscribe(handler); + // if subscribing listener after event has already fired, invoke the handler + if (channel.onResume.fired && typeof handler == 'function') { + handler(); + } } else if (e == 'pause') { - channel.onPause.subscribe(handler); + channel.onPause.subscribe(handler); } else if (typeof documentEventHandlers[e] != 'undefined') { - documentEventHandlers[e].subscribe(handler); + documentEventHandlers[e].subscribe(handler); } else { - m_document_addEventListener.call(document, evt, handler, capture); + m_document_addEventListener.call(document, evt, handler, capture); } }; window.addEventListener = function(evt, handler, capture) { - var e = evt.toLowerCase(); - if (typeof windowEventHandlers[e] != 'undefined') { - windowEventHandlers[e].subscribe(handler); - } else { - m_window_addEventListener.call(window, evt, handler, capture); - } + var e = evt.toLowerCase(); + if (typeof windowEventHandlers[e] != 'undefined') { + windowEventHandlers[e].subscribe(handler); + } else { + m_window_addEventListener.call(window, evt, handler, capture); + } }; document.removeEventListener = function(evt, handler, capture) { @@ -140,30 +140,29 @@ document.removeEventListener = function(evt, handler, capture) { }; window.removeEventListener = function(evt, handler, capture) { - var e = evt.toLowerCase(); - // If unsubcribing from an event that is handled by a plugin - if (typeof windowEventHandlers[e] != "undefined") { - windowEventHandlers[e].unsubscribe(handler); - } else { - m_window_removeEventListener.call(window, evt, handler, capture); - } + var e = evt.toLowerCase(); + // If unsubcribing from an event that is handled by a plugin + if (typeof windowEventHandlers[e] != "undefined") { + windowEventHandlers[e].unsubscribe(handler); + } else { + m_window_removeEventListener.call(window, evt, handler, capture); + } }; function createEvent(type, data) { - var event = document.createEvent('Events'); - event.initEvent(type, false, false); - if (data) { - for (var i in data) { - if (data.hasOwnProperty(i)) { - event[i] = data[i]; - } + var event = document.createEvent('Events'); + event.initEvent(type, false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } } - } - return event; + return event; } -if(typeof window.console === "undefined") -{ +if(typeof window.console === "undefined") { window.console = { log:function(){} }; @@ -176,16 +175,16 @@ var cordova = { * Methods to add/remove your own addEventListener hijacking on document + window. */ addWindowEventHandler:function(event, opts) { - return (windowEventHandlers[event] = channel.create(event, opts)); + return (windowEventHandlers[event] = channel.create(event, opts)); }, addDocumentEventHandler:function(event, opts) { - return (documentEventHandlers[event] = channel.create(event, opts)); + return (documentEventHandlers[event] = channel.create(event, opts)); }, removeWindowEventHandler:function(event) { - delete windowEventHandlers[event]; + delete windowEventHandlers[event]; }, removeDocumentEventHandler:function(event) { - delete documentEventHandlers[event]; + delete documentEventHandlers[event]; }, /** * Retreive original event handlers that were replaced by Cordova @@ -200,20 +199,20 @@ var cordova = { * Method to fire event from native code */ fireDocumentEvent: function(type, data) { - var evt = createEvent(type, data); - if (typeof documentEventHandlers[type] != 'undefined') { - documentEventHandlers[type].fire(evt); - } else { - document.dispatchEvent(evt); - } + var evt = createEvent(type, data); + if (typeof documentEventHandlers[type] != 'undefined') { + documentEventHandlers[type].fire(evt); + } else { + document.dispatchEvent(evt); + } }, fireWindowEvent: function(type, data) { - var evt = createEvent(type,data); - if (typeof windowEventHandlers[type] != 'undefined') { - windowEventHandlers[type].fire(evt); - } else { - window.dispatchEvent(evt); - } + var evt = createEvent(type,data); + if (typeof windowEventHandlers[type] != 'undefined') { + windowEventHandlers[type].fire(evt); + } else { + window.dispatchEvent(evt); + } }, // TODO: this is Android only; think about how to do this better shuttingDown:false, @@ -319,15 +318,41 @@ var cordova = { } }; +// Adds deprecation warnings to functions of an object (but only logs a message once) +function deprecateFunctions(obj, objLabel) { + var newObj = {}; + var logHash = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + if (typeof obj[i] == 'function') { + newObj[i] = (function(prop){ + var oldFunk = obj[prop]; + var funkId = objLabel + '_' + prop; + return function() { + if (!logHash[funkId]) { + console.log('[DEPRECATION NOTICE] The "' + objLabel + '" global will be removed in version 2.0, please use lowercase "cordova".'); + logHash[funkId] = true; + } + oldFunk.apply(obj, arguments); + }; + })(i); + } else { + newObj[i] = (function(prop) { return obj[prop]; })(i); + } + } + } + return newObj; +} + /** * Legacy variable for plugin support * TODO: remove in 2.0. */ if (!window.PhoneGap) { - window.PhoneGap = cordova; + window.PhoneGap = deprecateFunctions(cordova, 'PhoneGap'); } if (!window.Cordova) { - window.Cordova = cordova; + window.Cordova = deprecateFunctions(cordova, 'Cordova'); } /** @@ -342,7 +367,7 @@ module.exports = cordova; }); -// file: lib/common/builder.js +// file: lib\common\builder.js define("cordova/builder", function(require, exports, module) { var utils = require('cordova/utils'); @@ -435,8 +460,10 @@ module.exports = { }); -// file: lib/common/channel.js +// file: lib\common\channel.js define("cordova/channel", function(require, exports, module) { +var utils = require('cordova/utils'); + /** * Custom pub-sub "channel" that can have functions subscribed to it * This object is used to define and control firing of events for @@ -484,21 +511,21 @@ define("cordova/channel", function(require, exports, module) { * context to the Channel. */ var Channel = function(type, opts) { - this.type = type; - this.handlers = {}; - this.numHandlers = 0; - this.guid = 0; - this.fired = false; - this.enabled = true; - this.events = { - onSubscribe:null, - onUnsubscribe:null - }; - if (opts) { - if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe; - if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe; - } - }, + this.type = type; + this.handlers = {}; + this.numHandlers = 0; + this.guid = 0; + this.fired = false; + this.enabled = true; + this.events = { + onSubscribe:null, + onUnsubscribe:null + }; + if (opts) { + if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe; + if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe; + } +}, channel = { /** * Calls the provided function only after all of the channels specified @@ -558,8 +585,11 @@ var Channel = function(type, opts) { c.fire(); } } - }, - utils = require('cordova/utils'); + }; + +function forceFunction(f) { + if (f === null || f === undefined || typeof f != 'function') throw "Function required as first argument!"; +} /** * Subscribes the given function to the channel. Any time that @@ -570,10 +600,10 @@ var Channel = function(type, opts) { */ Channel.prototype.subscribe = function(f, c, g) { // need a function to call - if (f === null || f === undefined) { return; } + forceFunction(f); var func = f; - if (typeof c == "object" && f instanceof Function) { func = utils.close(c, f); } + if (typeof c == "object") { func = utils.close(c, f); } g = g || func.observer_guid || f.observer_guid || this.guid++; func.observer_guid = g; @@ -590,7 +620,7 @@ Channel.prototype.subscribe = function(f, c, g) { */ Channel.prototype.subscribeOnce = function(f, c) { // need a function to call - if (f === null || f === undefined) { return; } + forceFunction(f); var g = null; var _this = this; @@ -599,7 +629,7 @@ Channel.prototype.subscribeOnce = function(f, c) { _this.unsubscribe(g); }; if (this.fired) { - if (typeof c == "object" && f instanceof Function) { f = utils.close(c, f); } + if (typeof c == "object") { f = utils.close(c, f); } f.apply(this, this.fireArgs); } else { g = this.subscribe(m); @@ -612,9 +642,9 @@ Channel.prototype.subscribeOnce = function(f, c) { */ Channel.prototype.unsubscribe = function(g) { // need a function to unsubscribe - if (g === null || g === undefined) { return; } + if (g === null || g === undefined) { throw "You must pass _something_ into Channel.unsubscribe"; } - if (g instanceof Function) { g = g.observer_guid; } + if (typeof g == 'function') { g = g.observer_guid; } this.handlers[g] = null; delete this.handlers[g]; this.numHandlers--; @@ -630,7 +660,7 @@ Channel.prototype.fire = function(e) { this.fired = true; for (var item in this.handlers) { var handler = this.handlers[item]; - if (handler instanceof Function) { + if (typeof handler == 'function') { var rv = (handler.apply(this, arguments)===false); fail = fail || rv; } @@ -676,9 +706,10 @@ channel.waitForInitialization('onCordovaInfoReady'); channel.waitForInitialization('onCordovaConnectionReady'); module.exports = channel; + }); -// file: lib/common/common.js +// file: lib\common\common.js define("cordova/common", function(require, exports, module) { module.exports = { objects: { @@ -862,7 +893,7 @@ module.exports = { }; }); -// file: lib/wp7/exec.js +// file: lib\wp7\exec.js define("cordova/exec", function(require, exports, module) { var cordova = require('cordova'); @@ -909,6 +940,9 @@ var NamedArgs = { }, Camera:{ takePicture:["quality", "destinationType", "sourceType", "targetWidth", "targetHeight", "encodingType"] + }, + Capture:{ + getFormatData:["fullPath","type"] } }; @@ -971,7 +1005,7 @@ module.exports = function(success, fail, service, action, args) { }); -// file: lib/wp7/platform.js +// file: lib\wp7\platform.js define("cordova/platform", function(require, exports, module) { var cordova = require('cordova'), exec = require('cordova/exec'); @@ -1057,7 +1091,7 @@ module.exports = { }; }); -// file: lib/common/plugin/Acceleration.js +// file: lib\common\plugin\Acceleration.js define("cordova/plugin/Acceleration", function(require, exports, module) { var Acceleration = function(x, y, z, timestamp) { this.x = x; @@ -1069,7 +1103,7 @@ var Acceleration = function(x, y, z, timestamp) { module.exports = Acceleration; }); -// file: lib/common/plugin/Camera.js +// file: lib\common\plugin\Camera.js define("cordova/plugin/Camera", function(require, exports, module) { var exec = require('cordova/exec'), Camera = require('cordova/plugin/CameraConstants'); @@ -1178,7 +1212,7 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) { module.exports = cameraExport; }); -// file: lib/common/plugin/CameraConstants.js +// file: lib\common\plugin\CameraConstants.js define("cordova/plugin/CameraConstants", function(require, exports, module) { module.exports = { DestinationType:{ @@ -1202,7 +1236,7 @@ module.exports = { }; }); -// file: lib/common/plugin/CaptureAudioOptions.js +// file: lib\common\plugin\CaptureAudioOptions.js define("cordova/plugin/CaptureAudioOptions", function(require, exports, module) { /** * Encapsulates all audio capture operation configuration options. @@ -1219,7 +1253,7 @@ var CaptureAudioOptions = function(){ module.exports = CaptureAudioOptions; }); -// file: lib/common/plugin/CaptureError.js +// file: lib\common\plugin\CaptureError.js define("cordova/plugin/CaptureError", function(require, exports, module) { /** * The CaptureError interface encapsulates all errors in the Capture API. @@ -1242,7 +1276,7 @@ CaptureError.CAPTURE_NOT_SUPPORTED = 20; module.exports = CaptureError; }); -// file: lib/common/plugin/CaptureImageOptions.js +// file: lib\common\plugin\CaptureImageOptions.js define("cordova/plugin/CaptureImageOptions", function(require, exports, module) { /** * Encapsulates all image capture operation configuration options. @@ -1257,7 +1291,7 @@ var CaptureImageOptions = function(){ module.exports = CaptureImageOptions; }); -// file: lib/common/plugin/CaptureVideoOptions.js +// file: lib\common\plugin\CaptureVideoOptions.js define("cordova/plugin/CaptureVideoOptions", function(require, exports, module) { /** * Encapsulates all video capture operation configuration options. @@ -1274,7 +1308,7 @@ var CaptureVideoOptions = function(){ module.exports = CaptureVideoOptions; }); -// file: lib/common/plugin/CompassError.js +// file: lib\common\plugin\CompassError.js define("cordova/plugin/CompassError", function(require, exports, module) { /** * CompassError. @@ -1291,7 +1325,7 @@ CompassError.COMPASS_NOT_SUPPORTED = 20; module.exports = CompassError; }); -// file: lib/common/plugin/CompassHeading.js +// file: lib\common\plugin\CompassHeading.js define("cordova/plugin/CompassHeading", function(require, exports, module) { var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, timestamp) { this.magneticHeading = (magneticHeading !== undefined ? magneticHeading : null); @@ -1303,7 +1337,7 @@ var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, tim module.exports = CompassHeading; }); -// file: lib/common/plugin/ConfigurationData.js +// file: lib\common\plugin\ConfigurationData.js define("cordova/plugin/ConfigurationData", function(require, exports, module) { /** * Encapsulates a set of parameters that the capture device supports. @@ -1322,7 +1356,7 @@ function ConfigurationData() { module.exports = ConfigurationData; }); -// file: lib/common/plugin/Connection.js +// file: lib\common\plugin\Connection.js define("cordova/plugin/Connection", function(require, exports, module) { /** * Network status @@ -1338,7 +1372,7 @@ module.exports = { }; }); -// file: lib/common/plugin/Contact.js +// file: lib\common\plugin\Contact.js define("cordova/plugin/Contact", function(require, exports, module) { var exec = require('cordova/exec'), ContactError = require('cordova/plugin/ContactError'), @@ -1367,14 +1401,14 @@ function convertOut(contact) { var value = contact.birthday; if (value !== null) { // try to make it a Date object if it is not already - if (!value instanceof Date){ + if (!utils.isDate(value)){ try { value = new Date(value); } catch(exception){ value = null; } } - if (value instanceof Date){ + if (utils.isDate(value)){ value = value.valueOf(); // convert to milliseconds } contact.birthday = value; @@ -1517,9 +1551,10 @@ Contact.prototype.save = function(successCB, errorCB) { module.exports = Contact; + }); -// file: lib/common/plugin/ContactAddress.js +// file: lib\common\plugin\ContactAddress.js define("cordova/plugin/ContactAddress", function(require, exports, module) { /** * Contact address. @@ -1548,7 +1583,7 @@ var ContactAddress = function(pref, type, formatted, streetAddress, locality, re module.exports = ContactAddress; }); -// file: lib/common/plugin/ContactError.js +// file: lib\common\plugin\ContactError.js define("cordova/plugin/ContactError", function(require, exports, module) { /** * ContactError. @@ -1573,7 +1608,7 @@ ContactError.PERMISSION_DENIED_ERROR = 20; module.exports = ContactError; }); -// file: lib/common/plugin/ContactField.js +// file: lib\common\plugin\ContactField.js define("cordova/plugin/ContactField", function(require, exports, module) { /** * Generic contact field. @@ -1585,15 +1620,15 @@ define("cordova/plugin/ContactField", function(require, exports, module) { */ var ContactField = function(type, value, pref) { this.id = null; - this.type = type || null; - this.value = value || null; + this.type = (type && type.toString()) || null; + this.value = (value && value.toString()) || null; this.pref = (typeof pref != 'undefined' ? pref : false); }; module.exports = ContactField; }); -// file: lib/common/plugin/ContactFindOptions.js +// file: lib\common\plugin\ContactFindOptions.js define("cordova/plugin/ContactFindOptions", function(require, exports, module) { /** * ContactFindOptions. @@ -1610,7 +1645,7 @@ var ContactFindOptions = function(filter, multiple) { module.exports = ContactFindOptions; }); -// file: lib/common/plugin/ContactName.js +// file: lib\common\plugin\ContactName.js define("cordova/plugin/ContactName", function(require, exports, module) { /** * Contact name. @@ -1634,7 +1669,7 @@ var ContactName = function(formatted, familyName, givenName, middle, prefix, suf module.exports = ContactName; }); -// file: lib/common/plugin/ContactOrganization.js +// file: lib\common\plugin\ContactOrganization.js define("cordova/plugin/ContactOrganization", function(require, exports, module) { /** * Contact organization. @@ -1661,7 +1696,7 @@ var ContactOrganization = function(pref, type, name, dept, title) { module.exports = ContactOrganization; }); -// file: lib/common/plugin/Coordinates.js +// file: lib\common\plugin\Coordinates.js define("cordova/plugin/Coordinates", function(require, exports, module) { /** * This class contains position information. @@ -1708,7 +1743,7 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) { module.exports = Coordinates; }); -// file: lib/common/plugin/DirectoryEntry.js +// file: lib\common\plugin\DirectoryEntry.js define("cordova/plugin/DirectoryEntry", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'), @@ -1794,7 +1829,7 @@ module.exports = DirectoryEntry; }); -// file: lib/common/plugin/DirectoryReader.js +// file: lib\common\plugin\DirectoryReader.js define("cordova/plugin/DirectoryReader", function(require, exports, module) { var exec = require('cordova/exec'), FileError = require('cordova/plugin/FileError') ; @@ -1841,7 +1876,7 @@ module.exports = DirectoryReader; }); -// file: lib/common/plugin/Entry.js +// file: lib\common\plugin\Entry.js define("cordova/plugin/Entry", function(require, exports, module) { var exec = require('cordova/exec'), FileError = require('cordova/plugin/FileError'), @@ -2048,7 +2083,7 @@ Entry.prototype.getParent = function(successCallback, errorCallback) { module.exports = Entry; }); -// file: lib/common/plugin/File.js +// file: lib\common\plugin\File.js define("cordova/plugin/File", function(require, exports, module) { /** * Constructor. @@ -2070,7 +2105,7 @@ var File = function(name, fullPath, type, lastModifiedDate, size){ module.exports = File; }); -// file: lib/common/plugin/FileEntry.js +// file: lib\common\plugin\FileEntry.js define("cordova/plugin/FileEntry", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'), @@ -2137,7 +2172,7 @@ FileEntry.prototype.file = function(successCallback, errorCallback) { module.exports = FileEntry; }); -// file: lib/common/plugin/FileError.js +// file: lib\common\plugin\FileError.js define("cordova/plugin/FileError", function(require, exports, module) { /** * FileError @@ -2166,7 +2201,7 @@ FileError.PATH_EXISTS_ERR = 12; module.exports = FileError; }); -// file: lib/common/plugin/FileReader.js +// file: lib\common\plugin\FileReader.js define("cordova/plugin/FileReader", function(require, exports, module) { var exec = require('cordova/exec'), FileError = require('cordova/plugin/FileError'), @@ -2419,7 +2454,7 @@ FileReader.prototype.readAsArrayBuffer = function(file) { module.exports = FileReader; }); -// file: lib/common/plugin/FileSystem.js +// file: lib\common\plugin\FileSystem.js define("cordova/plugin/FileSystem", function(require, exports, module) { var DirectoryEntry = require('cordova/plugin/DirectoryEntry'); @@ -2440,7 +2475,7 @@ var FileSystem = function(name, root) { module.exports = FileSystem; }); -// file: lib/common/plugin/FileTransfer.js +// file: lib\common\plugin\FileTransfer.js define("cordova/plugin/FileTransfer", function(require, exports, module) { var exec = require('cordova/exec'); @@ -2471,7 +2506,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro fileKey = options.fileKey; fileName = options.fileName; mimeType = options.mimeType; - if (options.chunkedMode !== null || typeof options.chunkedMode !== "undefined") { + if (options.chunkedMode !== null || typeof options.chunkedMode != "undefined") { chunkedMode = options.chunkedMode; } if (options.params) { @@ -2514,7 +2549,7 @@ module.exports = FileTransfer; }); -// file: lib/common/plugin/FileTransferError.js +// file: lib\common\plugin\FileTransferError.js define("cordova/plugin/FileTransferError", function(require, exports, module) { /** * FileTransferError @@ -2531,7 +2566,7 @@ FileTransferError.CONNECTION_ERR = 3; module.exports = FileTransferError; }); -// file: lib/common/plugin/FileUploadOptions.js +// file: lib\common\plugin\FileUploadOptions.js define("cordova/plugin/FileUploadOptions", function(require, exports, module) { /** * Options to customize the HTTP request used to upload files. @@ -2551,7 +2586,7 @@ var FileUploadOptions = function(fileKey, fileName, mimeType, params) { module.exports = FileUploadOptions; }); -// file: lib/common/plugin/FileUploadResult.js +// file: lib\common\plugin\FileUploadResult.js define("cordova/plugin/FileUploadResult", function(require, exports, module) { /** * FileUploadResult @@ -2566,7 +2601,7 @@ var FileUploadResult = function() { module.exports = FileUploadResult; }); -// file: lib/common/plugin/FileWriter.js +// file: lib\common\plugin\FileWriter.js define("cordova/plugin/FileWriter", function(require, exports, module) { var exec = require('cordova/exec'), FileError = require('cordova/plugin/FileError'), @@ -2824,7 +2859,7 @@ module.exports = FileWriter; }); -// file: lib/common/plugin/Flags.js +// file: lib\common\plugin\Flags.js define("cordova/plugin/Flags", function(require, exports, module) { /** * Supplies arguments to methods that lookup or create files and directories. @@ -2843,7 +2878,7 @@ function Flags(create, exclusive) { module.exports = Flags; }); -// file: lib/common/plugin/LocalFileSystem.js +// file: lib\common\plugin\LocalFileSystem.js define("cordova/plugin/LocalFileSystem", function(require, exports, module) { var exec = require('cordova/exec'); @@ -2860,7 +2895,7 @@ LocalFileSystem.PERSISTENT = 1; //persistent module.exports = LocalFileSystem; }); -// file: lib/common/plugin/Media.js +// file: lib\common\plugin\Media.js define("cordova/plugin/Media", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'); @@ -3051,7 +3086,7 @@ Media.onStatus = function(id, msg, value) { module.exports = Media; }); -// file: lib/common/plugin/MediaError.js +// file: lib\common\plugin\MediaError.js define("cordova/plugin/MediaError", function(require, exports, module) { /** * This class contains information about any Media errors. @@ -3071,7 +3106,7 @@ MediaError.MEDIA_ERR_NONE_SUPPORTED = 4; module.exports = MediaError; }); -// file: lib/common/plugin/MediaFile.js +// file: lib\common\plugin\MediaFile.js define("cordova/plugin/MediaFile", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'), @@ -3132,7 +3167,7 @@ module.exports = MediaFile; }); -// file: lib/common/plugin/MediaFileData.js +// file: lib\common\plugin\MediaFileData.js define("cordova/plugin/MediaFileData", function(require, exports, module) { /** * MediaFileData encapsulates format information of a media file. @@ -3154,7 +3189,7 @@ var MediaFileData = function(codecs, bitrate, height, width, duration){ module.exports = MediaFileData; }); -// file: lib/common/plugin/Metadata.js +// file: lib\common\plugin\Metadata.js define("cordova/plugin/Metadata", function(require, exports, module) { /** * Information about the state of the file or directory @@ -3168,7 +3203,7 @@ var Metadata = function(time) { module.exports = Metadata; }); -// file: lib/common/plugin/Position.js +// file: lib\common\plugin\Position.js define("cordova/plugin/Position", function(require, exports, module) { var Coordinates = require('cordova/plugin/Coordinates'); @@ -3180,7 +3215,7 @@ var Position = function(coords, timestamp) { module.exports = Position; }); -// file: lib/common/plugin/PositionError.js +// file: lib\common\plugin\PositionError.js define("cordova/plugin/PositionError", function(require, exports, module) { /** * Position error object @@ -3201,7 +3236,7 @@ PositionError.TIMEOUT = 3; module.exports = PositionError; }); -// file: lib/common/plugin/ProgressEvent.js +// file: lib\common\plugin\ProgressEvent.js define("cordova/plugin/ProgressEvent", function(require, exports, module) { // If ProgressEvent exists in global context, use it already, otherwise use our own polyfill // Feature test: See if we can instantiate a native ProgressEvent; @@ -3251,7 +3286,7 @@ var ProgressEvent = (function() { module.exports = ProgressEvent; }); -// file: lib/common/plugin/accelerometer.js +// file: lib\common\plugin\accelerometer.js define("cordova/plugin/accelerometer", function(require, exports, module) { /** * This class provides access to device accelerometer data. @@ -3350,7 +3385,7 @@ var accelerometer = { module.exports = accelerometer; }); -// file: lib/common/plugin/battery.js +// file: lib\common\plugin\battery.js define("cordova/plugin/battery", function(require, exports, module) { /** * This class contains information about the current battery status. @@ -3441,7 +3476,7 @@ var battery = new Battery(); module.exports = battery; }); -// file: lib/common/plugin/capture.js +// file: lib\common\plugin\capture.js define("cordova/plugin/capture", function(require, exports, module) { var exec = require('cordova/exec'), MediaFile = require('cordova/plugin/MediaFile'); @@ -3518,7 +3553,7 @@ module.exports = new Capture(); }); -// file: lib/common/plugin/compass.js +// file: lib\common\plugin\compass.js define("cordova/plugin/compass", function(require, exports, module) { var exec = require('cordova/exec'), utils = require('cordova/utils'), @@ -3623,10 +3658,11 @@ var exec = require('cordova/exec'), module.exports = compass; }); -// file: lib/common/plugin/contacts.js +// file: lib\common\plugin\contacts.js define("cordova/plugin/contacts", function(require, exports, module) { var exec = require('cordova/exec'), ContactError = require('cordova/plugin/ContactError'), + utils = require('cordova/utils'), Contact = require('cordova/plugin/Contact'); /** @@ -3646,7 +3682,7 @@ var contacts = { if (!successCB) { throw new TypeError("You must specify a success callback for the find command."); } - if (!fields || (fields instanceof Array && fields.length === 0)) { + if (!fields || (utils.isArray(fields) && fields.length === 0)) { if (typeof errorCB === "function") { errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR)); } @@ -3682,9 +3718,10 @@ var contacts = { }; module.exports = contacts; + }); -// file: lib/common/plugin/geolocation.js +// file: lib\common\plugin\geolocation.js define("cordova/plugin/geolocation", function(require, exports, module) { var utils = require('cordova/utils'), exec = require('cordova/exec'), @@ -3782,7 +3819,7 @@ var geolocation = { module.exports = geolocation; }); -// file: lib/common/plugin/network.js +// file: lib\common\plugin\network.js define("cordova/plugin/network", function(require, exports, module) { var exec = require('cordova/exec'), cordova = require('cordova'), @@ -3846,7 +3883,7 @@ NetworkConnection.prototype.getInfo = function (successCallback, errorCallback) module.exports = new NetworkConnection(); }); -// file: lib/common/plugin/notification.js +// file: lib\common\plugin\notification.js define("cordova/plugin/notification", function(require, exports, module) { var exec = require('cordova/exec'); @@ -3906,7 +3943,7 @@ module.exports = { }; }); -// file: lib/common/plugin/requestFileSystem.js +// file: lib\common\plugin\requestFileSystem.js define("cordova/plugin/requestFileSystem", function(require, exports, module) { var FileError = require('cordova/plugin/FileError'), FileSystem = require('cordova/plugin/FileSystem'), @@ -3950,7 +3987,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) { module.exports = requestFileSystem; }); -// file: lib/common/plugin/resolveLocalFileSystemURI.js +// file: lib\common\plugin\resolveLocalFileSystemURI.js define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) { var DirectoryEntry = require('cordova/plugin/DirectoryEntry'), FileEntry = require('cordova/plugin/FileEntry'), @@ -3997,7 +4034,7 @@ module.exports = function(uri, successCallback, errorCallback) { }); -// file: lib/wp7/plugin/wp7/CordovaCommandResult.js +// file: lib\wp7\plugin\wp7\CordovaCommandResult.js define("cordova/plugin/wp7/CordovaCommandResult", function(require, exports, module) { var cordova = require('cordova'); @@ -4053,7 +4090,7 @@ module.exports = function(status,callbackId,args,cast) { }; }); -// file: lib/wp7/plugin/wp7/CordovaMediaonStatus.js +// file: lib\wp7\plugin\wp7\CordovaMediaonStatus.js define("cordova/plugin/wp7/CordovaMediaonStatus", function(require, exports, module) { var cordova = require('cordova'); @@ -4066,7 +4103,7 @@ module.exports = function(args) { }; }); -// file: lib/wp7/plugin/wp7/DOMStorage.js +// file: lib\wp7\plugin\wp7\DOMStorage.js define("cordova/plugin/wp7/DOMStorage", function(require, exports, module) { (function() { @@ -4233,7 +4270,7 @@ define("cordova/plugin/wp7/DOMStorage", function(require, exports, module) { module.exports = null; }); -// file: lib/wp7/plugin/wp7/XHRPatch.js +// file: lib\wp7\plugin\wp7\XHRPatch.js define("cordova/plugin/wp7/XHRPatch", function(require, exports, module) { // TODO: the build process implicitly will wrap this in a define() call // with a closure of its own; do you need this extra closure? @@ -4435,7 +4472,7 @@ if (!docDomain || docDomain.length === 0) { module.exports = null; }); -// file: lib/wp7/plugin/wp7/console.js +// file: lib\wp7\plugin\wp7\console.js define("cordova/plugin/wp7/console", function(require, exports, module) { var exec = require('cordova/exec'), @@ -4457,7 +4494,7 @@ var debugConsole = { module.exports = debugConsole; }); -// file: lib/wp7/plugin/wp7/device.js +// file: lib\wp7\plugin\wp7\device.js define("cordova/plugin/wp7/device", function(require, exports, module) { var channel = require('cordova/channel'), utils = require('cordova/utils'), @@ -4521,7 +4558,7 @@ Device.prototype.getInfo = function(successCallback, errorCallback) { module.exports = new Device(); }); -// file: lib/wp7/plugin/wp7/requestFileSystem.js +// file: lib\wp7\plugin\wp7\requestFileSystem.js define("cordova/plugin/wp7/requestFileSystem", function(require, exports, module) { var FileError = require('cordova/plugin/FileError'), @@ -4567,7 +4604,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) { module.exports = requestFileSystem; }); -// file: lib/wp7/plugin/wp7/resolveLocalFileSystemURI.js +// file: lib\wp7\plugin\wp7\resolveLocalFileSystemURI.js define("cordova/plugin/wp7/resolveLocalFileSystemURI", function(require, exports, module) { @@ -4610,7 +4647,7 @@ module.exports = function(uri, successCallback, errorCallback) { }); -// file: lib/common/utils.js +// file: lib\common\utils.js define("cordova/utils", function(require, exports, module) { function UUIDcreatePart(length) { var uuidpart = ""; @@ -4625,17 +4662,23 @@ function UUIDcreatePart(length) { } var _self = { + isArray:function(a) { + return Object.prototype.toString.call(a) == '[object Array]'; + }, + isDate:function(d) { + return Object.prototype.toString.call(d) == '[object Date]'; + }, /** * Does a deep clone of the object. */ clone: function(obj) { - if(!obj) { + if(!obj || typeof obj == 'function' || _self.isDate(obj) || typeof obj != 'object') { return obj; } var retVal, i; - if(obj instanceof Array){ + if(_self.isArray(obj)){ retVal = []; for(i = 0; i < obj.length; ++i){ retVal.push(_self.clone(obj[i])); @@ -4643,18 +4686,6 @@ var _self = { return retVal; } - if (obj instanceof Function) { - return obj; - } - - if(!(obj instanceof Object)){ - return obj; - } - - if(obj instanceof Date){ - return obj; - } - retVal = {}; for(i in obj){ if(!(i in retVal) || retVal[i] != obj[i]) { @@ -4665,7 +4696,7 @@ var _self = { }, close: function(context, func, params) { - if (typeof params === 'undefined') { + if (typeof params == 'undefined') { return function() { return func.apply(context, arguments); }; @@ -4716,12 +4747,13 @@ var _self = { }; module.exports = _self; + }); window.cordova = require('cordova'); -// file: lib/scripts/bootstrap.js +// file: lib\scripts\bootstrap.js (function (context) { var channel = require("cordova/channel"), _self = { diff --git a/templates/full/www/index.html b/templates/full/www/index.html index 7669da6..5106a0f 100644 --- a/templates/full/www/index.html +++ b/templates/full/www/index.html @@ -13,11 +13,15 @@