From 24ad506da587345c81e5790d50992d095baef083 Mon Sep 17 00:00:00 2001 From: macdonst Date: Fri, 30 Sep 2011 14:26:48 -0400 Subject: [PATCH] Fixing JavaScript comparrison issues --- framework/assets/js/camera.js | 24 +++++++++++++----------- framework/assets/js/filetransfer.js | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/framework/assets/js/camera.js b/framework/assets/js/camera.js index 00f8557e..d4fbad4e 100755 --- a/framework/assets/js/camera.js +++ b/framework/assets/js/camera.js @@ -106,38 +106,40 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options) return; } - if (!options) { + if (options === null || typeof options === "undefined") { options = {}; } - if (!options.quality) { + if (options.quality === null || typeof options.quality === "undefined") { options.quality = 80; } - if (!options.maxResolution) { + if (options.maxResolution === null || typeof options.maxResolution === "undefined") { options.maxResolution = 0; } - if (!options.destinationType) { + if (options.destinationType === null || typeof options.destinationType === "undefined") { options.destinationType = Camera.DestinationType.DATA_URL; } - if (!options.sourceType) { + if (options.sourceType === null || typeof options.sourceType === "undefined") { options.sourceType = Camera.PictureSourceType.CAMERA; } - if (!options.encodingType) { + if (options.encodingType === null || typeof options.encodingType === "undefined") { options.encodingType = Camera.EncodingType.JPEG; } - if (!options.mediaType) { + if (options.mediaType === null || typeof options.mediaType === "undefined") { options.mediaType = Camera.MediaType.PICTURE; } - if (!options.targetWidth) { + if (options.targetWidth === null || typeof options.targetWidth === "undefined") { options.targetWidth = -1; - } else if (typeof options.targetWidth == "string") { + } + else if (typeof options.targetWidth == "string") { var width = new Number(options.targetWidth); if (isNaN(width) === false) { options.targetWidth = width.valueOf(); } } - if (!options.targetHeight) { + if (options.targetHeight === null || typeof options.targetHeight === "undefined") { options.targetHeight = -1; - } else if (typeof options.targetHeight == "string") { + } + else if (typeof options.targetHeight == "string") { var height = new Number(options.targetHeight); if (isNaN(height) === false) { options.targetHeight = height.valueOf(); diff --git a/framework/assets/js/filetransfer.js b/framework/assets/js/filetransfer.js index 5db046ae..adab0634 100644 --- a/framework/assets/js/filetransfer.js +++ b/framework/assets/js/filetransfer.js @@ -58,7 +58,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro fileKey = options.fileKey; fileName = options.fileName; mimeType = options.mimeType; - if (options.chunkedMode) { + if (options.chunkedMode != null || typeof options.chunkedMode != "undefined") { chunkedMode = options.chunkedMode; } if (options.params) {