Fixing JavaScript comparrison issues

This commit is contained in:
macdonst 2011-09-30 14:26:48 -04:00
parent 80695ec5e4
commit 24ad506da5
2 changed files with 14 additions and 12 deletions

View File

@ -106,38 +106,40 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options)
return; return;
} }
if (!options) { if (options === null || typeof options === "undefined") {
options = {}; options = {};
} }
if (!options.quality) { if (options.quality === null || typeof options.quality === "undefined") {
options.quality = 80; options.quality = 80;
} }
if (!options.maxResolution) { if (options.maxResolution === null || typeof options.maxResolution === "undefined") {
options.maxResolution = 0; options.maxResolution = 0;
} }
if (!options.destinationType) { if (options.destinationType === null || typeof options.destinationType === "undefined") {
options.destinationType = Camera.DestinationType.DATA_URL; options.destinationType = Camera.DestinationType.DATA_URL;
} }
if (!options.sourceType) { if (options.sourceType === null || typeof options.sourceType === "undefined") {
options.sourceType = Camera.PictureSourceType.CAMERA; options.sourceType = Camera.PictureSourceType.CAMERA;
} }
if (!options.encodingType) { if (options.encodingType === null || typeof options.encodingType === "undefined") {
options.encodingType = Camera.EncodingType.JPEG; options.encodingType = Camera.EncodingType.JPEG;
} }
if (!options.mediaType) { if (options.mediaType === null || typeof options.mediaType === "undefined") {
options.mediaType = Camera.MediaType.PICTURE; options.mediaType = Camera.MediaType.PICTURE;
} }
if (!options.targetWidth) { if (options.targetWidth === null || typeof options.targetWidth === "undefined") {
options.targetWidth = -1; options.targetWidth = -1;
} else if (typeof options.targetWidth == "string") { }
else if (typeof options.targetWidth == "string") {
var width = new Number(options.targetWidth); var width = new Number(options.targetWidth);
if (isNaN(width) === false) { if (isNaN(width) === false) {
options.targetWidth = width.valueOf(); options.targetWidth = width.valueOf();
} }
} }
if (!options.targetHeight) { if (options.targetHeight === null || typeof options.targetHeight === "undefined") {
options.targetHeight = -1; options.targetHeight = -1;
} else if (typeof options.targetHeight == "string") { }
else if (typeof options.targetHeight == "string") {
var height = new Number(options.targetHeight); var height = new Number(options.targetHeight);
if (isNaN(height) === false) { if (isNaN(height) === false) {
options.targetHeight = height.valueOf(); options.targetHeight = height.valueOf();

View File

@ -58,7 +58,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
fileKey = options.fileKey; fileKey = options.fileKey;
fileName = options.fileName; fileName = options.fileName;
mimeType = options.mimeType; mimeType = options.mimeType;
if (options.chunkedMode) { if (options.chunkedMode != null || typeof options.chunkedMode != "undefined") {
chunkedMode = options.chunkedMode; chunkedMode = options.chunkedMode;
} }
if (options.params) { if (options.params) {