You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/08/07 16:00:18 UTC

[1/2] cordova-plugin-camera git commit: CB-12985 : setup eslint and removed jshint

Repository: cordova-plugin-camera
Updated Branches:
  refs/heads/master 55d419a36 -> 16c4325fe


CB-12985 : setup eslint and removed jshint


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/80342b0d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/80342b0d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/80342b0d

Branch: refs/heads/master
Commit: 80342b0dddfa8e9ec81f84bd352685fa4ab4c07d
Parents: 55d419a
Author: Audrey So <au...@apache.org>
Authored: Fri Jun 9 14:51:30 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Mon Jul 31 11:28:15 2017 -0700

----------------------------------------------------------------------
 .eslintrc.yml                     |  10 ++
 .jshintrc                         |  16 --
 package.json                      |  14 +-
 src/blackberry10/index.js         |  50 +++---
 src/browser/CameraProxy.js        |  20 +--
 src/firefoxos/CameraProxy.js      |  14 +-
 src/windows/CameraProxy.js        | 272 ++++++++++++++++-----------------
 www/Camera.js                     |  22 +--
 www/CameraConstants.js            | 150 +++++++++---------
 www/CameraPopoverHandle.js        |   4 +-
 www/CameraPopoverOptions.js       |   2 +-
 www/blackberry10/assets/camera.js |   6 +-
 www/ios/CameraPopoverHandle.js    |   6 +-
 13 files changed, 287 insertions(+), 299 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000..0cccb8c
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,10 @@
+root: true
+extends: semistandard
+rules:
+  indent:
+    - error
+    - 4
+  camelcase: off
+  padded-blocks: off
+  operator-linebreak: off
+  no-throw-literal: off
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index cf48aac..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-    "browser": true
-  , "devel": true
-  , "bitwise": true
-  , "undef": true
-  , "trailing": true
-  , "quotmark": false
-  , "indent": 4
-  , "unused": "vars"
-  , "latedef": "nofunc"
-  , "globals": {
-        "module": false,
-        "exports": false,
-        "require": false
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 7605ea1..b99e8f4 100644
--- a/package.json
+++ b/package.json
@@ -45,8 +45,8 @@
   "scripts": {
     "precommit": "npm run gen-docs && git add README.md",
     "gen-docs": "jsdoc2md --template \"jsdoc2md/TEMPLATE.md\" \"www/**/*.js\" --plugin \"dmd-plugin-cordova-plugin\" > README.md",
-    "test": "npm run jshint",
-    "jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests"
+    "test": "npm run eslint",
+    "eslint": "node node_modules/eslint/bin/eslint www && node node_modules/eslint/bin/eslint src && node node_modules/eslint/bin/eslint tests"
   },
   "author": "Apache Software Foundation",
   "license": "Apache-2.0",
@@ -59,8 +59,14 @@
   },
   "devDependencies": {
     "dmd-plugin-cordova-plugin": "^0.1.0",
+    "eslint": "^4.2.0",
+    "eslint-config-semistandard": "^11.0.0",
+    "eslint-config-standard": "^10.2.1",
+    "eslint-plugin-import": "^2.3.0",
+    "eslint-plugin-node": "^5.0.0",
+    "eslint-plugin-promise": "^3.5.0",
+    "eslint-plugin-standard": "^3.0.1",
     "husky": "^0.10.1",
-    "jsdoc-to-markdown": "^1.2.0",
-    "jshint": "^2.6.0"
+    "jsdoc-to-markdown": "^1.2.0"
   }
 }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
index afc3539..094e897 100644
--- a/src/blackberry10/index.js
+++ b/src/blackberry10/index.js
@@ -22,19 +22,19 @@
 /* globals qnx, FileError, PluginResult */
 
 var PictureSourceType = {
-        PHOTOLIBRARY : 0,    // Choose image from picture library (same as SAVEDPHOTOALBUM for Android)
-        CAMERA : 1,          // Take picture from camera
-        SAVEDPHOTOALBUM : 2  // Choose image from picture library (same as PHOTOLIBRARY for Android)
+        PHOTOLIBRARY: 0,    // Choose image from picture library (same as SAVEDPHOTOALBUM for Android)
+        CAMERA: 1,          // Take picture from camera
+        SAVEDPHOTOALBUM: 2  // Choose image from picture library (same as PHOTOLIBRARY for Android)
     },
     DestinationType = {
         DATA_URL: 0,         // Return base64 encoded string
         FILE_URI: 1,         // Return file uri (content://media/external/images/media/2 for Android)
         NATIVE_URI: 2        // Return native uri (eg. asset-library://... for iOS)
     },
-    savePath = window.qnx.webplatform.getApplication().getEnv("HOME").replace('/data', '') + '/shared/camera/',
+    savePath = window.qnx.webplatform.getApplication().getEnv('HOME').replace('/data', '') + '/shared/camera/',
     invokeAvailable = true;
 
-//check for camera card - it isn't currently availble in work perimeter
+// check for camera card - it isn't currently availble in work perimeter
 window.qnx.webplatform.getApplication().invocation.queryTargets(
     {
         type: 'image/jpeg',
@@ -47,7 +47,7 @@ window.qnx.webplatform.getApplication().invocation.queryTargets(
     }
 );
 
-//open a webview with getUserMedia camera card implementation when camera card not available
+// open a webview with getUserMedia camera card implementation when camera card not available
 function showCameraDialog (done, cancel, fail) {
     var wv = qnx.webplatform.createWebView(function () {
         wv.url = 'local:///chrome/camera.html';
@@ -85,16 +85,16 @@ function showCameraDialog (done, cancel, fail) {
     });
 }
 
-//create unique name for saved file (same pattern as BB10 camera app)
-function imgName() {
+// create unique name for saved file (same pattern as BB10 camera app)
+function imgName () {
     var date = new Date(),
         pad = function (n) { return n < 10 ? '0' + n : n; };
     return 'IMG_' + date.getFullYear() + pad(date.getMonth() + 1) + pad(date.getDate()) + '_' +
             pad(date.getHours()) + pad(date.getMinutes()) + pad(date.getSeconds()) + '.png';
 }
 
-//convert dataURI to Blob
-function dataURItoBlob(dataURI) {
+// convert dataURI to Blob
+function dataURItoBlob (dataURI) {
     var byteString = atob(dataURI.split(',')[1]),
         mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0],
         arrayBuffer = new ArrayBuffer(byteString.length),
@@ -106,8 +106,8 @@ function dataURItoBlob(dataURI) {
     return new Blob([new DataView(arrayBuffer)], { type: mimeString });
 }
 
-//save dataURI to file system and call success with path
-function saveImage(data, success, fail) {
+// save dataURI to file system and call success with path
+function saveImage (data, success, fail) {
     var name = savePath + imgName();
     require('lib/webview').setSandbox(false);
     window.webkitRequestFileSystem(window.PERSISTENT, 0, function (fs) {
@@ -123,30 +123,30 @@ function saveImage(data, success, fail) {
     }, fail);
 }
 
-function encodeBase64(filePath, callback) {
+function encodeBase64 (filePath, callback) {
     var sandbox = window.qnx.webplatform.getController().setFileSystemSandbox, // save original sandbox value
         errorHandler = function (err) {
-            var msg = "An error occured: ";
+            var msg = 'An error occured: ';
 
             switch (err.code) {
             case FileError.NOT_FOUND_ERR:
-                msg += "File or directory not found";
+                msg += 'File or directory not found';
                 break;
 
             case FileError.NOT_READABLE_ERR:
-                msg += "File or directory not readable";
+                msg += 'File or directory not readable';
                 break;
 
             case FileError.PATH_EXISTS_ERR:
-                msg += "File or directory already exists";
+                msg += 'File or directory already exists';
                 break;
 
             case FileError.TYPE_MISMATCH_ERR:
-                msg += "Invalid file type";
+                msg += 'Invalid file type';
                 break;
 
             default:
-                msg += "Unknown Error";
+                msg += 'Unknown Error';
                 break;
             }
 
@@ -182,12 +182,12 @@ module.exports = {
             result = new PluginResult(args, env),
             done = function (data) {
                 if (destinationType === DestinationType.FILE_URI) {
-                    data = "file://" + data;
+                    data = 'file://' + data;
                     result.callbackOk(data, false);
                 } else {
                     encodeBase64(data, function (data) {
                         if (/^data:/.test(data)) {
-                            data = data.slice(data.indexOf(",") + 1);
+                            data = data.slice(data.indexOf(',') + 1);
                             result.callbackOk(data, false);
                         } else {
                             result.callbackError(data, false);
@@ -204,10 +204,10 @@ module.exports = {
                 }
             };
 
-        switch(sourceType) {
+        switch (sourceType) {
         case PictureSourceType.CAMERA:
             if (invokeAvailable) {
-                window.qnx.webplatform.getApplication().cards.camera.open("photo", done, cancel, invoked);
+                window.qnx.webplatform.getApplication().cards.camera.open('photo', done, cancel, invoked);
             } else {
                 showCameraDialog(done, cancel, fail);
             }
@@ -216,8 +216,8 @@ module.exports = {
         case PictureSourceType.PHOTOLIBRARY:
         case PictureSourceType.SAVEDPHOTOALBUM:
             window.qnx.webplatform.getApplication().cards.filePicker.open({
-                mode: "Picker",
-                type: ["picture"]
+                mode: 'Picker',
+                type: ['picture']
             }, done, cancel, invoked);
             break;
         }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/src/browser/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/browser/CameraProxy.js b/src/browser/CameraProxy.js
index 635a9fb..ff4971a 100644
--- a/src/browser/CameraProxy.js
+++ b/src/browser/CameraProxy.js
@@ -21,7 +21,7 @@
 
 var HIGHEST_POSSIBLE_Z_INDEX = 2147483647;
 
-function takePicture(success, error, opts) {
+function takePicture (success, error, opts) {
     if (opts && opts[2] === 1) {
         capture(success, error, opts);
     } else {
@@ -32,9 +32,9 @@ function takePicture(success, error, opts) {
         input.type = 'file';
         input.name = 'files[]';
 
-        input.onchange = function(inputEvent) {
+        input.onchange = function (inputEvent) {
             var reader = new FileReader();
-            reader.onload = function(readerEvent) {
+            reader.onload = function (readerEvent) {
                 input.parentNode.removeChild(input);
 
                 var imageData = readerEvent.target.result;
@@ -49,13 +49,13 @@ function takePicture(success, error, opts) {
     }
 }
 
-function capture(success, errorCallback, opts) {
+function capture (success, errorCallback, opts) {
     var localMediaStream;
     var targetWidth = opts[3];
     var targetHeight = opts[4];
 
-    targetWidth = targetWidth == -1?320:targetWidth;
-    targetHeight = targetHeight == -1?240:targetHeight;
+    targetWidth = targetWidth == -1 ? 320 : targetWidth;
+    targetHeight = targetHeight == -1 ? 240 : targetHeight;
 
     var video = document.createElement('video');
     var button = document.createElement('button');
@@ -70,7 +70,7 @@ function capture(success, errorCallback, opts) {
     video.height = targetHeight;
     button.innerHTML = 'Capture!';
 
-    button.onclick = function() {
+    button.onclick = function () {
         // create a canvas and capture a frame from video stream
         var canvas = document.createElement('canvas');
         canvas.width = targetWidth;
@@ -100,7 +100,7 @@ function capture(success, errorCallback, opts) {
                              navigator.mozGetUserMedia ||
                              navigator.msGetUserMedia;
 
-    var successCallback = function(stream) {
+    var successCallback = function (stream) {
         localMediaStream = stream;
         video.src = window.URL.createObjectURL(localMediaStream);
         video.play();
@@ -117,7 +117,7 @@ function capture(success, errorCallback, opts) {
 
 module.exports = {
     takePicture: takePicture,
-    cleanup: function(){}
+    cleanup: function () {}
 };
 
-require("cordova/exec/proxy").add("Camera",module.exports);
+require('cordova/exec/proxy').add('Camera', module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/src/firefoxos/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/CameraProxy.js b/src/firefoxos/CameraProxy.js
index 1e3018e..83a685a 100644
--- a/src/firefoxos/CameraProxy.js
+++ b/src/firefoxos/CameraProxy.js
@@ -21,17 +21,17 @@
 
 /* globals MozActivity */
 
-function takePicture(success, error, opts) {
+function takePicture (success, error, opts) {
     var pick = new MozActivity({
-        name: "pick",
+        name: 'pick',
         data: {
-            type: ["image/*"]
+            type: ['image/*']
         }
     });
 
-    pick.onerror = error || function() {};
+    pick.onerror = error || function () {};
 
-    pick.onsuccess = function() {
+    pick.onsuccess = function () {
         // image is returned as Blob in this.result.blob
         // we need to call success with url or base64 encoded image
         if (opts && opts.destinationType === 0) {
@@ -47,7 +47,7 @@ function takePicture(success, error, opts) {
 
 module.exports = {
     takePicture: takePicture,
-    cleanup: function(){}
+    cleanup: function () {}
 };
 
-require("cordova/exec/proxy").add("Camera", module.exports);
+require('cordova/exec/proxy').add('Camera', module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/src/windows/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js
index eb10cd2..7a2594f 100644
--- a/src/windows/CameraProxy.js
+++ b/src/windows/CameraProxy.js
@@ -19,13 +19,11 @@
  *
 */
 
-/*jshint unused:true, undef:true, browser:true */
-/*global Windows:true, URL:true, module:true, require:true, WinJS:true */
-
+/* jshint unused:true, undef:true, browser:true */
+/* global Windows:true, URL:true, module:true, require:true, WinJS:true */
 
 var Camera = require('./Camera');
 
-
 var getAppData = function () {
     return Windows.Storage.ApplicationData.current;
 };
@@ -67,8 +65,8 @@ module.exports = {
 };
 
 // https://msdn.microsoft.com/en-us/library/windows/apps/ff462087(v=vs.105).aspx
-var windowsVideoContainers = [".avi", ".flv", ".asx", ".asf", ".mov", ".mp4", ".mpg", ".rm", ".srt", ".swf", ".wmv", ".vob"];
-var windowsPhoneVideoContainers =  [".avi", ".3gp", ".3g2", ".wmv", ".3gp", ".3g2", ".mp4", ".m4v"];
+var windowsVideoContainers = ['.avi', '.flv', '.asx', '.asf', '.mov', '.mp4', '.mpg', '.rm', '.srt', '.swf', '.wmv', '.vob'];
+var windowsPhoneVideoContainers = ['.avi', '.3gp', '.3g2', '.wmv', '.3gp', '.3g2', '.mp4', '.m4v'];
 
 // Default aspect ratio 1.78 (16:9 hd video standard)
 var DEFAULT_ASPECT_RATIO = '1.8';
@@ -77,16 +75,16 @@ var DEFAULT_ASPECT_RATIO = '1.8';
 var HIGHEST_POSSIBLE_Z_INDEX = 2147483647;
 
 // Resize method
-function resizeImage(successCallback, errorCallback, file, targetWidth, targetHeight, encodingType) {
-    var tempPhotoFileName = "";
-    var targetContentType = "";
+function resizeImage (successCallback, errorCallback, file, targetWidth, targetHeight, encodingType) {
+    var tempPhotoFileName = '';
+    var targetContentType = '';
 
     if (encodingType == Camera.EncodingType.PNG) {
-        tempPhotoFileName = "camera_cordova_temp_return.png";
-        targetContentType = "image/png";
+        tempPhotoFileName = 'camera_cordova_temp_return.png';
+        targetContentType = 'image/png';
     } else {
-        tempPhotoFileName = "camera_cordova_temp_return.jpg";
-        targetContentType = "image/jpeg";
+        tempPhotoFileName = 'camera_cordova_temp_return.jpg';
+        targetContentType = 'image/jpeg';
     }
 
     var storageFolder = getAppData().localFolder;
@@ -94,12 +92,12 @@ function resizeImage(successCallback, errorCallback, file, targetWidth, targetHe
         .then(function (storageFile) {
             return fileIO.readBufferAsync(storageFile);
         })
-        .then(function(buffer) {
+        .then(function (buffer) {
             var strBase64 = encodeToBase64String(buffer);
-            var imageData = "data:" + file.contentType + ";base64," + strBase64;
+            var imageData = 'data:' + file.contentType + ';base64,' + strBase64;
             var image = new Image();
             image.src = imageData;
-            image.onload = function() {
+            image.onload = function () {
                 var ratio = Math.min(targetWidth / this.width, targetHeight / this.height);
                 var imageWidth = ratio * this.width;
                 var imageHeight = ratio * this.height;
@@ -110,7 +108,7 @@ function resizeImage(successCallback, errorCallback, file, targetWidth, targetHe
                 canvas.width = imageWidth;
                 canvas.height = imageHeight;
 
-                canvas.getContext("2d").drawImage(this, 0, 0, imageWidth, imageHeight);
+                canvas.getContext('2d').drawImage(this, 0, 0, imageWidth, imageHeight);
 
                 var fileContent = canvas.toDataURL(targetContentType).split(',')[1];
 
@@ -123,26 +121,26 @@ function resizeImage(successCallback, errorCallback, file, targetWidth, targetHe
                         return fileIO.writeBufferAsync(storagefile, content);
                     })
                     .done(function () {
-                        successCallback("ms-appdata:///local/" + storageFileName);
+                        successCallback('ms-appdata:///local/' + storageFileName);
                     }, errorCallback);
             };
         })
-        .done(null, function(err) {
+        .done(null, function (err) {
             errorCallback(err);
         }
     );
 }
 
 // Because of asynchronous method, so let the successCallback be called in it.
-function resizeImageBase64(successCallback, errorCallback, file, targetWidth, targetHeight) {
-    fileIO.readBufferAsync(file).done( function(buffer) {
+function resizeImageBase64 (successCallback, errorCallback, file, targetWidth, targetHeight) {
+    fileIO.readBufferAsync(file).done(function (buffer) {
         var strBase64 = encodeToBase64String(buffer);
-        var imageData = "data:" + file.contentType + ";base64," + strBase64;
+        var imageData = 'data:' + file.contentType + ';base64,' + strBase64;
 
         var image = new Image();
         image.src = imageData;
 
-        image.onload = function() {
+        image.onload = function () {
             var ratio = Math.min(targetWidth / this.width, targetHeight / this.height);
             var imageWidth = ratio * this.width;
             var imageHeight = ratio * this.height;
@@ -151,21 +149,21 @@ function resizeImageBase64(successCallback, errorCallback, file, targetWidth, ta
             canvas.width = imageWidth;
             canvas.height = imageHeight;
 
-            var ctx = canvas.getContext("2d");
+            var ctx = canvas.getContext('2d');
             ctx.drawImage(this, 0, 0, imageWidth, imageHeight);
 
             // The resized file ready for upload
             var finalFile = canvas.toDataURL(file.contentType);
 
             // Remove the prefix such as "data:" + contentType + ";base64," , in order to meet the Cordova API.
-            var arr = finalFile.split(",");
+            var arr = finalFile.split(',');
             var newStr = finalFile.substr(arr[0].length + 1);
             successCallback(newStr);
         };
-    }, function(err) { errorCallback(err); });
+    }, function (err) { errorCallback(err); });
 }
 
-function takePictureFromFile(successCallback, errorCallback, args) {
+function takePictureFromFile (successCallback, errorCallback, args) {
     // Detect Windows Phone
     if (navigator.appVersion.indexOf('Windows Phone 8.1') >= 0) {
         takePictureFromFileWP(successCallback, errorCallback, args);
@@ -174,7 +172,7 @@ function takePictureFromFile(successCallback, errorCallback, args) {
     }
 }
 
-function takePictureFromFileWP(successCallback, errorCallback, args) {
+function takePictureFromFileWP (successCallback, errorCallback, args) {
     var mediaType = args[6],
         destinationType = args[1],
         targetWidth = args[3],
@@ -186,65 +184,60 @@ function takePictureFromFileWP(successCallback, errorCallback, args) {
         Using FileOpenPicker will suspend the app and it's required to catch the PickSingleFileAndContinue
         https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn631755.aspx
     */
-    var filePickerActivationHandler = function(eventArgs) {
+    var filePickerActivationHandler = function (eventArgs) {
         if (eventArgs.kind === Windows.ApplicationModel.Activation.ActivationKind.pickFileContinuation) {
             var file = eventArgs.files[0];
             if (!file) {
                 errorCallback("User didn't choose a file.");
-                webUIApp.removeEventListener("activated", filePickerActivationHandler);
+                webUIApp.removeEventListener('activated', filePickerActivationHandler);
                 return;
             }
             if (destinationType == Camera.DestinationType.FILE_URI || destinationType == Camera.DestinationType.NATIVE_URI) {
                 if (targetHeight > 0 && targetWidth > 0) {
                     resizeImage(successCallback, errorCallback, file, targetWidth, targetHeight, encodingType);
-                }
-                else {
+                } else {
                     var storageFolder = getAppData().localFolder;
                     file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).done(function (storageFile) {
-                        if(destinationType == Camera.DestinationType.NATIVE_URI) {
-                            successCallback("ms-appdata:///local/" + storageFile.name);
-                        }
-                        else {
+                        if (destinationType == Camera.DestinationType.NATIVE_URI) {
+                            successCallback('ms-appdata:///local/' + storageFile.name);
+                        } else {
                             successCallback(URL.createObjectURL(storageFile));
                         }
                     }, function () {
                         errorCallback("Can't access localStorage folder.");
                     });
                 }
-            }
-            else {
+            } else {
                 if (targetHeight > 0 && targetWidth > 0) {
                     resizeImageBase64(successCallback, errorCallback, file, targetWidth, targetHeight);
                 } else {
                     fileIO.readBufferAsync(file).done(function (buffer) {
-                        var strBase64 =encodeToBase64String(buffer);
+                        var strBase64 = encodeToBase64String(buffer);
                         successCallback(strBase64);
                     }, errorCallback);
                 }
             }
-            webUIApp.removeEventListener("activated", filePickerActivationHandler);
+            webUIApp.removeEventListener('activated', filePickerActivationHandler);
         }
     };
 
     var fileOpenPicker = new Windows.Storage.Pickers.FileOpenPicker();
     if (mediaType == Camera.MediaType.PICTURE) {
-        fileOpenPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]);
+        fileOpenPicker.fileTypeFilter.replaceAll(['.png', '.jpg', '.jpeg']);
         fileOpenPicker.suggestedStartLocation = pickerLocId.picturesLibrary;
-    }
-    else if (mediaType == Camera.MediaType.VIDEO) {
+    } else if (mediaType == Camera.MediaType.VIDEO) {
         fileOpenPicker.fileTypeFilter.replaceAll(windowsPhoneVideoContainers);
         fileOpenPicker.suggestedStartLocation = pickerLocId.videosLibrary;
-    }
-    else {
-        fileOpenPicker.fileTypeFilter.replaceAll(["*"]);
+    } else {
+        fileOpenPicker.fileTypeFilter.replaceAll(['*']);
         fileOpenPicker.suggestedStartLocation = pickerLocId.documentsLibrary;
     }
 
-    webUIApp.addEventListener("activated", filePickerActivationHandler);
+    webUIApp.addEventListener('activated', filePickerActivationHandler);
     fileOpenPicker.pickSingleFileAndContinue();
 }
 
-function takePictureFromFileWindows(successCallback, errorCallback, args) {
+function takePictureFromFileWindows (successCallback, errorCallback, args) {
     var mediaType = args[6],
         destinationType = args[1],
         targetWidth = args[3],
@@ -253,15 +246,13 @@ function takePictureFromFileWindows(successCallback, errorCallback, args) {
 
     var fileOpenPicker = new Windows.Storage.Pickers.FileOpenPicker();
     if (mediaType == Camera.MediaType.PICTURE) {
-        fileOpenPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]);
+        fileOpenPicker.fileTypeFilter.replaceAll(['.png', '.jpg', '.jpeg']);
         fileOpenPicker.suggestedStartLocation = pickerLocId.picturesLibrary;
-    }
-    else if (mediaType == Camera.MediaType.VIDEO) {
+    } else if (mediaType == Camera.MediaType.VIDEO) {
         fileOpenPicker.fileTypeFilter.replaceAll(windowsVideoContainers);
         fileOpenPicker.suggestedStartLocation = pickerLocId.videosLibrary;
-    }
-    else {
-        fileOpenPicker.fileTypeFilter.replaceAll(["*"]);
+    } else {
+        fileOpenPicker.fileTypeFilter.replaceAll(['*']);
         fileOpenPicker.suggestedStartLocation = pickerLocId.documentsLibrary;
     }
 
@@ -273,27 +264,24 @@ function takePictureFromFileWindows(successCallback, errorCallback, args) {
         if (destinationType == Camera.DestinationType.FILE_URI || destinationType == Camera.DestinationType.NATIVE_URI) {
             if (targetHeight > 0 && targetWidth > 0) {
                 resizeImage(successCallback, errorCallback, file, targetWidth, targetHeight, encodingType);
-            }
-            else {
+            } else {
                 var storageFolder = getAppData().localFolder;
                 file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).done(function (storageFile) {
-                        if(destinationType == Camera.DestinationType.NATIVE_URI) {
-                            successCallback("ms-appdata:///local/" + storageFile.name);
-                        }
-                        else {
-                            successCallback(URL.createObjectURL(storageFile));
-                        }
+                    if (destinationType == Camera.DestinationType.NATIVE_URI) {
+                        successCallback('ms-appdata:///local/' + storageFile.name);
+                    } else {
+                        successCallback(URL.createObjectURL(storageFile));
+                    }
                 }, function () {
                     errorCallback("Can't access localStorage folder.");
                 });
             }
-        }
-        else {
+        } else {
             if (targetHeight > 0 && targetWidth > 0) {
                 resizeImageBase64(successCallback, errorCallback, file, targetWidth, targetHeight);
             } else {
                 fileIO.readBufferAsync(file).done(function (buffer) {
-                    var strBase64 =encodeToBase64String(buffer);
+                    var strBase64 = encodeToBase64String(buffer);
                     successCallback(strBase64);
                 }, errorCallback);
             }
@@ -303,7 +291,7 @@ function takePictureFromFileWindows(successCallback, errorCallback, args) {
     });
 }
 
-function takePictureFromCamera(successCallback, errorCallback, args) {
+function takePictureFromCamera (successCallback, errorCallback, args) {
     // Check if necessary API available
     if (!Windows.Media.Capture.CameraCaptureUI) {
         takePictureFromCameraWP(successCallback, errorCallback, args);
@@ -312,7 +300,7 @@ function takePictureFromCamera(successCallback, errorCallback, args) {
     }
 }
 
-function takePictureFromCameraWP(successCallback, errorCallback, args) {
+function takePictureFromCameraWP (successCallback, errorCallback, args) {
     // We are running on WP8.1 which lacks CameraCaptureUI class
     // so we need to use MediaCapture class instead and implement custom UI for camera
     var destinationType = args[1],
@@ -329,25 +317,25 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
         CaptureNS = Windows.Media.Capture,
         sensor = null;
 
-    function createCameraUI() {
+    function createCameraUI () {
         // create style for take and cancel buttons
-        var buttonStyle = "width:45%;padding: 10px 16px;font-size: 18px;line-height: 1.3333333;color: #333;background-color: #fff;border-color: #ccc; border: 1px solid transparent;border-radius: 6px; display: block; margin: 20px; z-index: 1000;border-color: #adadad;";
+        var buttonStyle = 'width:45%;padding: 10px 16px;font-size: 18px;line-height: 1.3333333;color: #333;background-color: #fff;border-color: #ccc; border: 1px solid transparent;border-radius: 6px; display: block; margin: 20px; z-index: 1000;border-color: #adadad;';
 
         // Create fullscreen preview
         // z-order style element for capturePreview and cameraCancelButton elts
         // is necessary to avoid overriding by another page elements, -1 sometimes is not enough
-        capturePreview = document.createElement("video");
-        capturePreview.style.cssText = "position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: " + (HIGHEST_POSSIBLE_Z_INDEX - 1) + ";";
+        capturePreview = document.createElement('video');
+        capturePreview.style.cssText = 'position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: ' + (HIGHEST_POSSIBLE_Z_INDEX - 1) + ';';
 
         // Create capture button
-        cameraCaptureButton = document.createElement("button");
-        cameraCaptureButton.innerText = "Take";
-        cameraCaptureButton.style.cssText = buttonStyle + "position: fixed; left: 0; bottom: 0; margin: 20px; z-index: " + HIGHEST_POSSIBLE_Z_INDEX + ";";
+        cameraCaptureButton = document.createElement('button');
+        cameraCaptureButton.innerText = 'Take';
+        cameraCaptureButton.style.cssText = buttonStyle + 'position: fixed; left: 0; bottom: 0; margin: 20px; z-index: ' + HIGHEST_POSSIBLE_Z_INDEX + ';';
 
         // Create cancel button
-        cameraCancelButton = document.createElement("button");
-        cameraCancelButton.innerText = "Cancel";
-        cameraCancelButton.style.cssText = buttonStyle + "position: fixed; right: 0; bottom: 0; margin: 20px; z-index: " + HIGHEST_POSSIBLE_Z_INDEX + ";";
+        cameraCancelButton = document.createElement('button');
+        cameraCancelButton.innerText = 'Cancel';
+        cameraCancelButton.style.cssText = buttonStyle + 'position: fixed; right: 0; bottom: 0; margin: 20px; z-index: ' + HIGHEST_POSSIBLE_Z_INDEX + ';';
 
         capture = new CaptureNS.MediaCapture();
 
@@ -355,21 +343,21 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
         captureSettings.streamingCaptureMode = CaptureNS.StreamingCaptureMode.video;
     }
 
-    function continueVideoOnFocus() {
+    function continueVideoOnFocus () {
         // if preview is defined it would be stuck, play it
         if (capturePreview) {
             capturePreview.play();
         }
     }
 
-    function startCameraPreview() {
+    function startCameraPreview () {
         // Search for available camera devices
         // This is necessary to detect which camera (front or back) we should use
         var DeviceEnum = Windows.Devices.Enumeration;
         var expectedPanel = cameraDirection === 1 ? DeviceEnum.Panel.front : DeviceEnum.Panel.back;
 
         // Add focus event handler to capture the event when user suspends the app and comes back while the preview is on
-        window.addEventListener("focus", continueVideoOnFocus);
+        window.addEventListener('focus', continueVideoOnFocus);
 
         DeviceEnum.DeviceInformation.findAllAsync(DeviceEnum.DeviceClass.videoCapture).then(function (devices) {
             if (devices.length <= 0) {
@@ -378,7 +366,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
                 return;
             }
 
-            devices.forEach(function(currDev) {
+            devices.forEach(function (currDev) {
                 if (currDev.enclosureLocation.panel && currDev.enclosureLocation.panel == expectedPanel) {
                     captureSettings.videoDeviceId = currDev.id;
                 }
@@ -418,7 +406,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
             // Bind events to controls
             sensor = Windows.Devices.Sensors.SimpleOrientationSensor.getDefault();
             if (sensor !== null) {
-                sensor.addEventListener("orientationchanged", onOrientationChange);
+                sensor.addEventListener('orientationchanged', onOrientationChange);
             }
 
             // add click events to capture and cancel buttons
@@ -459,7 +447,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
         });
     }
 
-    function destroyCameraPreview() {
+    function destroyCameraPreview () {
         // If sensor is available, remove event listener
         if (sensor !== null) {
             sensor.removeEventListener('orientationchanged', onOrientationChange);
@@ -474,7 +462,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
         cameraCancelButton.removeEventListener('click', onCameraCancelButtonClick);
 
         // Remove the focus event handler
-        window.removeEventListener("focus", continueVideoOnFocus);
+        window.removeEventListener('focus', continueVideoOnFocus);
 
         // Remove elements
         [capturePreview, cameraCaptureButton, cameraCancelButton].forEach(function (elem) {
@@ -490,7 +478,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
         }
     }
 
-    function captureAction() {
+    function captureAction () {
 
         var encodingProperties,
             fileName,
@@ -505,41 +493,41 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
         }
 
         tempFolder.createFileAsync(fileName, OptUnique)
-            .then(function(tempCapturedFile) {
+            .then(function (tempCapturedFile) {
                 return new WinJS.Promise(function (complete) {
                     var photoStream = new Windows.Storage.Streams.InMemoryRandomAccessStream();
                     var finalStream = new Windows.Storage.Streams.InMemoryRandomAccessStream();
                     capture.capturePhotoToStreamAsync(encodingProperties, photoStream)
-                        .then(function() {
+                        .then(function () {
                             return Windows.Graphics.Imaging.BitmapDecoder.createAsync(photoStream);
                         })
-                        .then(function(dec) {
+                        .then(function (dec) {
                             finalStream.size = 0; // BitmapEncoder requires the output stream to be empty
                             return Windows.Graphics.Imaging.BitmapEncoder.createForTranscodingAsync(finalStream, dec);
                         })
-                        .then(function(enc) {
+                        .then(function (enc) {
                             // We need to rotate the photo wrt sensor orientation
                             enc.bitmapTransform.rotation = orientationToRotation(sensor.getCurrentOrientation());
                             return enc.flushAsync();
                         })
-                        .then(function() {
+                        .then(function () {
                             return tempCapturedFile.openAsync(Windows.Storage.FileAccessMode.readWrite);
                         })
-                        .then(function(fileStream) {
+                        .then(function (fileStream) {
                             return Windows.Storage.Streams.RandomAccessStream.copyAndCloseAsync(finalStream, fileStream);
                         })
-                        .done(function() {
+                        .done(function () {
                             photoStream.close();
                             finalStream.close();
                             complete(tempCapturedFile);
-                        }, function() {
+                        }, function () {
                             photoStream.close();
                             finalStream.close();
-                            throw new Error("An error has occured while capturing the photo.");
+                            throw new Error('An error has occured while capturing the photo.');
                         });
                 });
             })
-            .done(function(capturedFile) {
+            .done(function (capturedFile) {
                 destroyCameraPreview();
                 savePhoto(capturedFile, {
                     destinationType: destinationType,
@@ -548,13 +536,13 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
                     encodingType: encodingType,
                     saveToPhotoAlbum: saveToPhotoAlbum
                 }, successCallback, errorCallback);
-            }, function(err) {
+            }, function (err) {
                 destroyCameraPreview();
                 errorCallback(err);
             });
     }
 
-    function getAspectRatios(capture) {
+    function getAspectRatios (capture) {
         var videoDeviceController = capture.videoDeviceController;
         var photoAspectRatios = videoDeviceController.getAvailableMediaStreamProperties(CapMSType.photo).map(function (element) {
             return (element.width / element.height).toFixed(1);
@@ -583,7 +571,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
         });
     }
 
-    function setAspectRatio(capture, aspect) {
+    function setAspectRatio (capture, aspect) {
         // Max photo resolution with desired aspect ratio
         var videoDeviceController = capture.videoDeviceController;
         var photoResolution = videoDeviceController.getAvailableMediaStreamProperties(CapMSType.photo)
@@ -624,7 +612,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
     /**
      * When Capture button is clicked, try to capture a picture and return
      */
-    function onCameraCaptureButtonClick() {
+    function onCameraCaptureButtonClick () {
         // Make sure user can't click more than once
         if (this.getAttribute('clicked') === '1') {
             return false;
@@ -637,7 +625,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
     /**
      * When Cancel button is clicked, destroy camera preview and return with error callback
      */
-    function onCameraCancelButtonClick() {
+    function onCameraCancelButtonClick () {
         // Make sure user can't click more than once
         if (this.getAttribute('clicked') === '1') {
             return false;
@@ -652,7 +640,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
      * When the phone orientation change, get the event and change camera preview rotation
      * @param  {Object} e - SimpleOrientationSensorOrientationChangedEventArgs
      */
-    function onOrientationChange(e) {
+    function onOrientationChange (e) {
         setPreviewRotation(e.orientation);
     }
 
@@ -662,29 +650,29 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
      * @param  {number} orientation - Windows.Devices.Sensors.SimpleOrientation
      * @return {number} - Windows.Media.Capture.VideoRotation
      */
-    function orientationToRotation(orientation) {
+    function orientationToRotation (orientation) {
         // VideoRotation enumerable and BitmapRotation enumerable have the same values
         // https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.videorotation.aspx
         // https://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.imaging.bitmaprotation.aspx
 
         switch (orientation) {
             // portrait
-            case Windows.Devices.Sensors.SimpleOrientation.notRotated:
-                return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
+        case Windows.Devices.Sensors.SimpleOrientation.notRotated:
+            return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
             // landscape
-            case Windows.Devices.Sensors.SimpleOrientation.rotated90DegreesCounterclockwise:
-                return Windows.Media.Capture.VideoRotation.none;
+        case Windows.Devices.Sensors.SimpleOrientation.rotated90DegreesCounterclockwise:
+            return Windows.Media.Capture.VideoRotation.none;
             // portrait-flipped (not supported by WinPhone Apps)
-            case Windows.Devices.Sensors.SimpleOrientation.rotated180DegreesCounterclockwise:
+        case Windows.Devices.Sensors.SimpleOrientation.rotated180DegreesCounterclockwise:
                 // Falling back to portrait default
-                return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
+            return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
             // landscape-flipped
-            case Windows.Devices.Sensors.SimpleOrientation.rotated270DegreesCounterclockwise:
-                return Windows.Media.Capture.VideoRotation.clockwise180Degrees;
+        case Windows.Devices.Sensors.SimpleOrientation.rotated270DegreesCounterclockwise:
+            return Windows.Media.Capture.VideoRotation.clockwise180Degrees;
             // faceup & facedown
-            default:
+        default:
                 // Falling back to portrait default
-                return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
+            return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
         }
     }
 
@@ -692,7 +680,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
      * Rotates the current MediaCapture's video
      * @param {number} orientation - Windows.Devices.Sensors.SimpleOrientation
      */
-    function setPreviewRotation(orientation) {
+    function setPreviewRotation (orientation) {
         capture.setPreviewRotation(orientationToRotation(orientation));
     }
 
@@ -704,7 +692,7 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
     }
 }
 
-function takePictureFromCameraWindows(successCallback, errorCallback, args) {
+function takePictureFromCameraWindows (successCallback, errorCallback, args) {
     var destinationType = args[1],
         targetWidth = args[3],
         targetHeight = args[4],
@@ -731,9 +719,9 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) {
         maxRes = UIMaxRes.highestAvailable;
     }
     // Temp fix for CB-10539
-    /*else if (totalPixels <= 320 * 240) {
+    /* else if (totalPixels <= 320 * 240) {
         maxRes = UIMaxRes.verySmallQvga;
-    }*/
+    } */
     else if (totalPixels <= 640 * 480) {
         maxRes = UIMaxRes.smallVga;
     } else if (totalPixels <= 1024 * 768) {
@@ -752,7 +740,7 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) {
 
     // define focus handler for windows phone 10.0
     var savePhotoOnFocus = function () {
-        window.removeEventListener("focus", savePhotoOnFocus);
+        window.removeEventListener('focus', savePhotoOnFocus);
         // call only when the app is in focus again
         savePhoto(cameraPicture, {
             destinationType: destinationType,
@@ -765,14 +753,14 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) {
 
     // if windows phone 10, add and delete focus eventHandler to capture the focus back from cameraUI to app
     if (navigator.appVersion.indexOf('Windows Phone 10.0') >= 0) {
-        window.addEventListener("focus", savePhotoOnFocus);
+        window.addEventListener('focus', savePhotoOnFocus);
     }
 
     cameraCaptureUI.captureFileAsync(WMCapture.CameraCaptureUIMode.photo).done(function (picture) {
         if (!picture) {
             errorCallback("User didn't capture a photo.");
             // Remove the focus handler if present
-            window.removeEventListener("focus", savePhotoOnFocus);
+            window.removeEventListener('focus', savePhotoOnFocus);
             return;
         }
         cameraPicture = picture;
@@ -788,31 +776,31 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) {
             }, successCallback, errorCallback);
         }
     }, function () {
-        errorCallback("Fail to capture a photo.");
-        window.removeEventListener("focus", savePhotoOnFocus);
+        errorCallback('Fail to capture a photo.');
+        window.removeEventListener('focus', savePhotoOnFocus);
     });
 }
 
-function savePhoto(picture, options, successCallback, errorCallback) {
+function savePhoto (picture, options, successCallback, errorCallback) {
     // success callback for capture operation
-    var success = function(picture) {
+    var success = function (picture) {
         if (options.destinationType == Camera.DestinationType.FILE_URI || options.destinationType == Camera.DestinationType.NATIVE_URI) {
             if (options.targetHeight > 0 && options.targetWidth > 0) {
                 resizeImage(successCallback, errorCallback, picture, options.targetWidth, options.targetHeight, options.encodingType);
             } else {
                 picture.copyAsync(getAppData().localFolder, picture.name, OptUnique).done(function (copiedFile) {
-                    successCallback("ms-appdata:///local/" + copiedFile.name);
-                },errorCallback);
+                    successCallback('ms-appdata:///local/' + copiedFile.name);
+                }, errorCallback);
             }
         } else {
             if (options.targetHeight > 0 && options.targetWidth > 0) {
                 resizeImageBase64(successCallback, errorCallback, picture, options.targetWidth, options.targetHeight);
             } else {
-                fileIO.readBufferAsync(picture).done(function(buffer) {
+                fileIO.readBufferAsync(picture).done(function (buffer) {
                     var strBase64 = encodeToBase64String(buffer);
-                    picture.deleteAsync().done(function() {
+                    picture.deleteAsync().done(function () {
                         successCallback(strBase64);
-                    }, function(err) {
+                    }, function (err) {
                         errorCallback(err);
                     });
                 }, errorCallback);
@@ -822,38 +810,38 @@ function savePhoto(picture, options, successCallback, errorCallback) {
 
     if (!options.saveToPhotoAlbum) {
         success(picture);
-        return;
+
     } else {
         var savePicker = new Windows.Storage.Pickers.FileSavePicker();
-        var saveFile = function(file) {
+        var saveFile = function (file) {
             if (file) {
                 // Prevent updates to the remote version of the file until we're done
                 Windows.Storage.CachedFileManager.deferUpdates(file);
                 picture.moveAndReplaceAsync(file)
-                    .then(function() {
+                    .then(function () {
                         // Let Windows know that we're finished changing the file so
                         // the other app can update the remote version of the file.
                         return Windows.Storage.CachedFileManager.completeUpdatesAsync(file);
                     })
-                    .done(function(updateStatus) {
+                    .done(function (updateStatus) {
                         if (updateStatus === Windows.Storage.Provider.FileUpdateStatus.complete) {
                             success(picture);
                         } else {
-                            errorCallback("File update status is not complete.");
+                            errorCallback('File update status is not complete.');
                         }
                     }, errorCallback);
             } else {
-                errorCallback("Failed to select a file.");
+                errorCallback('Failed to select a file.');
             }
         };
         savePicker.suggestedStartLocation = pickerLocId.picturesLibrary;
 
         if (options.encodingType === Camera.EncodingType.PNG) {
-            savePicker.fileTypeChoices.insert("PNG", [".png"]);
-            savePicker.suggestedFileName = "photo.png";
+            savePicker.fileTypeChoices.insert('PNG', ['.png']);
+            savePicker.suggestedFileName = 'photo.png';
         } else {
-            savePicker.fileTypeChoices.insert("JPEG", [".jpg"]);
-            savePicker.suggestedFileName = "photo.jpg";
+            savePicker.fileTypeChoices.insert('JPEG', ['.jpg']);
+            savePicker.suggestedFileName = 'photo.jpg';
         }
 
         // If Windows Phone 8.1 use pickSaveFileAndContinue()
@@ -863,14 +851,14 @@ function savePhoto(picture, options, successCallback, errorCallback) {
                 Using FileSavePicker will suspend the app and it's required to catch the pickSaveFileContinuation
                 https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn631755.aspx
             */
-            var fileSaveHandler = function(eventArgs) {
+            var fileSaveHandler = function (eventArgs) {
                 if (eventArgs.kind === Windows.ApplicationModel.Activation.ActivationKind.pickSaveFileContinuation) {
                     var file = eventArgs.file;
                     saveFile(file);
-                    webUIApp.removeEventListener("activated", fileSaveHandler);
+                    webUIApp.removeEventListener('activated', fileSaveHandler);
                 }
             };
-            webUIApp.addEventListener("activated", fileSaveHandler);
+            webUIApp.addEventListener('activated', fileSaveHandler);
             savePicker.pickSaveFileAndContinue();
         } else {
             savePicker.pickSaveFileAsync()
@@ -879,4 +867,4 @@ function savePhoto(picture, options, successCallback, errorCallback) {
     }
 }
 
-require("cordova/exec/proxy").add("Camera",module.exports);
+require('cordova/exec/proxy').add('Camera', module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/www/Camera.js
----------------------------------------------------------------------
diff --git a/www/Camera.js b/www/Camera.js
index d006787..c14e3f3 100644
--- a/www/Camera.js
+++ b/www/Camera.js
@@ -19,11 +19,11 @@
  *
 */
 
-var argscheck = require('cordova/argscheck'),
-    exec = require('cordova/exec'),
-    Camera = require('./Camera');
-    // XXX: commented out
-    //CameraPopoverHandle = require('./CameraPopoverHandle');
+var argscheck = require('cordova/argscheck');
+var exec = require('cordova/exec');
+var Camera = require('./Camera');
+// XXX: commented out
+// CameraPopoverHandle = require('./CameraPopoverHandle');
 
 /**
  * @namespace navigator
@@ -131,7 +131,7 @@ for (var key in Camera) {
  * @param {module:camera.onError} errorCallback
  * @param {module:camera.CameraOptions} options CameraOptions
  */
-cameraExport.getPicture = function(successCallback, errorCallback, options) {
+cameraExport.getPicture = function (successCallback, errorCallback, options) {
     argscheck.checkArgs('fFO', 'Camera.getPicture', arguments);
     options = options || {};
     var getValue = argscheck.getValue;
@@ -150,11 +150,11 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) {
     var cameraDirection = getValue(options.cameraDirection, Camera.Direction.BACK);
 
     var args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType,
-                mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions, cameraDirection];
+        mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions, cameraDirection];
 
-    exec(successCallback, errorCallback, "Camera", "takePicture", args);
+    exec(successCallback, errorCallback, 'Camera', 'takePicture', args);
     // XXX: commented out
-    //return new CameraPopoverHandle();
+    // return new CameraPopoverHandle();
 };
 
 /**
@@ -178,8 +178,8 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) {
  *     alert('Failed because: ' + message);
  * }
  */
-cameraExport.cleanup = function(successCallback, errorCallback) {
-    exec(successCallback, errorCallback, "Camera", "cleanup", []);
+cameraExport.cleanup = function (successCallback, errorCallback) {
+    exec(successCallback, errorCallback, 'Camera', 'cleanup', []);
 };
 
 module.exports = cameraExport;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/www/CameraConstants.js
----------------------------------------------------------------------
diff --git a/www/CameraConstants.js b/www/CameraConstants.js
index 9974c15..d92d381 100644
--- a/www/CameraConstants.js
+++ b/www/CameraConstants.js
@@ -23,79 +23,79 @@
  * @module Camera
  */
 module.exports = {
-  /**
-   * @description
-   * Defines the output format of `Camera.getPicture` call.
-   * _Note:_ On iOS passing `DestinationType.NATIVE_URI` along with
-   * `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM` will
-   * disable any image modifications (resize, quality change, cropping, etc.) due
-   * to implementation specific.
-   *
-   * @enum {number}
-   */
-  DestinationType:{
-    /** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */
-    DATA_URL: 0,
-    /** Return file uri (content://media/external/images/media/2 for Android) */
-    FILE_URI: 1,
-    /** Return native uri (eg. asset-library://... for iOS) */
-    NATIVE_URI: 2
-  },
-  /**
-   * @enum {number}
-   */
-  EncodingType:{
-    /** Return JPEG encoded image */
-    JPEG: 0,
-    /** Return PNG encoded image */
-    PNG: 1
-  },
-  /**
-   * @enum {number}
-   */
-  MediaType:{
-    /** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
-    PICTURE: 0,
-    /** Allow selection of video only, ONLY RETURNS URL */
-    VIDEO: 1,
-    /** Allow selection from all media types */
-    ALLMEDIA : 2
-  },
-  /**
-   * @description
-   * Defines the output format of `Camera.getPicture` call.
-   * _Note:_ On iOS passing `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM`
-   * along with `DestinationType.NATIVE_URI` will disable any image modifications (resize, quality
-   * change, cropping, etc.) due to implementation specific.
-   *
-   * @enum {number}
-   */
-  PictureSourceType:{
-    /** Choose image from the device's photo library (same as SAVEDPHOTOALBUM for Android) */
-    PHOTOLIBRARY : 0,
-    /** Take picture from camera */
-    CAMERA : 1,
-    /** Choose image only from the device's Camera Roll album (same as PHOTOLIBRARY for Android) */
-    SAVEDPHOTOALBUM : 2
-  },
-  /**
-   * Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
-   * @enum {number}
-   */
-  PopoverArrowDirection:{
-      ARROW_UP : 1,
-      ARROW_DOWN : 2,
-      ARROW_LEFT : 4,
-      ARROW_RIGHT : 8,
-      ARROW_ANY : 15
-  },
-  /**
-   * @enum {number}
-   */
-  Direction:{
-      /** Use the back-facing camera */
-      BACK: 0,
-      /** Use the front-facing camera */
-      FRONT: 1
-  }
+    /**
+     * @description
+     * Defines the output format of `Camera.getPicture` call.
+     * _Note:_ On iOS passing `DestinationType.NATIVE_URI` along with
+     * `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM` will
+     * disable any image modifications (resize, quality change, cropping, etc.) due
+     * to implementation specific.
+     *
+     * @enum {number}
+     */
+    DestinationType: {
+        /** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */
+        DATA_URL: 0,
+        /** Return file uri (content://media/external/images/media/2 for Android) */
+        FILE_URI: 1,
+        /** Return native uri (eg. asset-library://... for iOS) */
+        NATIVE_URI: 2
+    },
+    /**
+     * @enum {number}
+     */
+    EncodingType: {
+        /** Return JPEG encoded image */
+        JPEG: 0,
+        /** Return PNG encoded image */
+        PNG: 1
+    },
+    /**
+     * @enum {number}
+     */
+    MediaType: {
+        /** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
+        PICTURE: 0,
+        /** Allow selection of video only, ONLY RETURNS URL */
+        VIDEO: 1,
+        /** Allow selection from all media types */
+        ALLMEDIA: 2
+    },
+    /**
+     * @description
+     * Defines the output format of `Camera.getPicture` call.
+     * _Note:_ On iOS passing `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM`
+     * along with `DestinationType.NATIVE_URI` will disable any image modifications (resize, quality
+     * change, cropping, etc.) due to implementation specific.
+     *
+     * @enum {number}
+     */
+    PictureSourceType: {
+        /** Choose image from the device's photo library (same as SAVEDPHOTOALBUM for Android) */
+        PHOTOLIBRARY: 0,
+        /** Take picture from camera */
+        CAMERA: 1,
+        /** Choose image only from the device's Camera Roll album (same as PHOTOLIBRARY for Android) */
+        SAVEDPHOTOALBUM: 2
+    },
+    /**
+     * Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
+     * @enum {number}
+     */
+    PopoverArrowDirection: {
+        ARROW_UP: 1,
+        ARROW_DOWN: 2,
+        ARROW_LEFT: 4,
+        ARROW_RIGHT: 8,
+        ARROW_ANY: 15
+    },
+    /**
+     * @enum {number}
+     */
+    Direction: {
+        /** Use the back-facing camera */
+        BACK: 0,
+        /** Use the front-facing camera */
+        FRONT: 1
+    }
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/www/CameraPopoverHandle.js
----------------------------------------------------------------------
diff --git a/www/CameraPopoverHandle.js b/www/CameraPopoverHandle.js
index ba1063a..211ae74 100644
--- a/www/CameraPopoverHandle.js
+++ b/www/CameraPopoverHandle.js
@@ -23,8 +23,8 @@
  * @ignore in favour of iOS' one
  * A handle to an image picker popover.
  */
-var CameraPopoverHandle = function() {
-    this.setPosition = function(popoverOptions) {
+var CameraPopoverHandle = function () {
+    this.setPosition = function (popoverOptions) {
         console.log('CameraPopoverHandle.setPosition is only supported on iOS.');
     };
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/www/CameraPopoverOptions.js
----------------------------------------------------------------------
diff --git a/www/CameraPopoverOptions.js b/www/CameraPopoverOptions.js
index 27998b6..14829fd 100644
--- a/www/CameraPopoverOptions.js
+++ b/www/CameraPopoverOptions.js
@@ -21,7 +21,7 @@
 
 var Camera = require('./Camera');
 
-/** 
+/**
  * @namespace navigator
  */
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/www/blackberry10/assets/camera.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/assets/camera.js b/www/blackberry10/assets/camera.js
index 8a245e5..2a272be 100644
--- a/www/blackberry10/assets/camera.js
+++ b/www/blackberry10/assets/camera.js
@@ -25,9 +25,9 @@ document.addEventListener('DOMContentLoaded', function () {
     window.navigator.webkitGetUserMedia(
         { video: true },
         function (stream) {
-            var video = document.getElementById('v'),
-                canvas = document.getElementById('c'),
-                camera = document.getElementById('camera');
+            var video = document.getElementById('v');
+            var canvas = document.getElementById('c');
+            var camera = document.getElementById('camera');
             video.autoplay = true;
             video.width = window.innerWidth;
             video.height = window.innerHeight - 100;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/80342b0d/www/ios/CameraPopoverHandle.js
----------------------------------------------------------------------
diff --git a/www/ios/CameraPopoverHandle.js b/www/ios/CameraPopoverHandle.js
index 8b92137..6912a4e 100644
--- a/www/ios/CameraPopoverHandle.js
+++ b/www/ios/CameraPopoverHandle.js
@@ -48,7 +48,7 @@ var exec = require('cordova/exec');
  * }
  * @module CameraPopoverHandle
  */
-var CameraPopoverHandle = function() {
+var CameraPopoverHandle = function () {
     /**
      * Can be used to reposition the image selection dialog,
      * for example, when the device orientation changes.
@@ -57,9 +57,9 @@ var CameraPopoverHandle = function() {
      * @method setPosition
      * @param {module:CameraPopoverOptions} popoverOptions
      */
-    this.setPosition = function(popoverOptions) {
+    this.setPosition = function (popoverOptions) {
         var args = [ popoverOptions ];
-        exec(null, null, "Camera", "repositionPopover", args);
+        exec(null, null, 'Camera', 'repositionPopover', args);
     };
 };
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[2/2] cordova-plugin-camera git commit: CB-12895 : updated src files to use eslint format

Posted by au...@apache.org.
CB-12895 : updated src files to use eslint format


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/16c4325f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/16c4325f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/16c4325f

Branch: refs/heads/master
Commit: 16c4325fef80327bceccedb491e29064da79b556
Parents: 80342b0
Author: Audrey So <au...@apache.org>
Authored: Fri Jul 14 14:19:05 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Mon Jul 31 13:29:36 2017 -0700

----------------------------------------------------------------------
 appium-tests/android/android.spec.js |   2 -
 appium-tests/helpers/cameraHelper.js |   1 -
 appium-tests/ios/ios.spec.js         |   2 -
 package.json                         |   2 +-
 src/blackberry10/index.js            | 182 +++++++++++++++---------------
 src/browser/CameraProxy.js           |   6 +-
 src/windows/CameraProxy.js           | 123 ++++++++++----------
 tests/tests.js                       | 138 +++++++++++-----------
 8 files changed, 225 insertions(+), 231 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/16c4325f/appium-tests/android/android.spec.js
----------------------------------------------------------------------
diff --git a/appium-tests/android/android.spec.js b/appium-tests/android/android.spec.js
index d21959f..b756987 100644
--- a/appium-tests/android/android.spec.js
+++ b/appium-tests/android/android.spec.js
@@ -1,5 +1,3 @@
-/*jshint node: true, jasmine: true */
-
 /*
  *
  * Licensed to the Apache Software Foundation (ASF) under one

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/16c4325f/appium-tests/helpers/cameraHelper.js
----------------------------------------------------------------------
diff --git a/appium-tests/helpers/cameraHelper.js b/appium-tests/helpers/cameraHelper.js
index e1d21bc..72f7a27 100644
--- a/appium-tests/helpers/cameraHelper.js
+++ b/appium-tests/helpers/cameraHelper.js
@@ -1,4 +1,3 @@
-/*jshint node: true */
 /* global Q, resolveLocalFileSystemURL, Camera, cordova */
 /*
  *

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/16c4325f/appium-tests/ios/ios.spec.js
----------------------------------------------------------------------
diff --git a/appium-tests/ios/ios.spec.js b/appium-tests/ios/ios.spec.js
index 1c5f65d..d4eebde 100644
--- a/appium-tests/ios/ios.spec.js
+++ b/appium-tests/ios/ios.spec.js
@@ -1,5 +1,3 @@
-/*jshint node: true, jasmine: true */
-
 /*
  *
  * Licensed to the Apache Software Foundation (ASF) under one

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/16c4325f/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index b99e8f4..0d89a1f 100644
--- a/package.json
+++ b/package.json
@@ -59,7 +59,7 @@
   },
   "devDependencies": {
     "dmd-plugin-cordova-plugin": "^0.1.0",
-    "eslint": "^4.2.0",
+    "eslint": "^4.3.0",
     "eslint-config-semistandard": "^11.0.0",
     "eslint-config-standard": "^10.2.1",
     "eslint-plugin-import": "^2.3.0",

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/16c4325f/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
index 094e897..2ec7f69 100644
--- a/src/blackberry10/index.js
+++ b/src/blackberry10/index.js
@@ -22,17 +22,17 @@
 /* globals qnx, FileError, PluginResult */
 
 var PictureSourceType = {
-        PHOTOLIBRARY: 0,    // Choose image from picture library (same as SAVEDPHOTOALBUM for Android)
-        CAMERA: 1,          // Take picture from camera
-        SAVEDPHOTOALBUM: 2  // Choose image from picture library (same as PHOTOLIBRARY for Android)
-    },
-    DestinationType = {
-        DATA_URL: 0,         // Return base64 encoded string
-        FILE_URI: 1,         // Return file uri (content://media/external/images/media/2 for Android)
-        NATIVE_URI: 2        // Return native uri (eg. asset-library://... for iOS)
-    },
-    savePath = window.qnx.webplatform.getApplication().getEnv('HOME').replace('/data', '') + '/shared/camera/',
-    invokeAvailable = true;
+    PHOTOLIBRARY: 0, // Choose image from picture library (same as SAVEDPHOTOALBUM for Android)
+    CAMERA: 1, // Take picture from camera
+    SAVEDPHOTOALBUM: 2 // Choose image from picture library (same as PHOTOLIBRARY for Android)
+};
+var DestinationType = {
+    DATA_URL: 0, // Return base64 encoded string
+    FILE_URI: 1, // Return file uri (content://media/external/images/media/2 for Android)
+    NATIVE_URI: 2 // Return native uri (eg. asset-library://... for iOS)
+};
+var savePath = window.qnx.webplatform.getApplication().getEnv('HOME').replace('/data', '') + '/shared/camera/';
+var invokeAvailable = true;
 
 // check for camera card - it isn't currently availble in work perimeter
 window.qnx.webplatform.getApplication().invocation.queryTargets(
@@ -54,7 +54,7 @@ function showCameraDialog (done, cancel, fail) {
         wv.allowQnxObject = true;
         wv.allowRpc = true;
         wv.zOrder = 1;
-        wv.setGeometry(0, 0, screen.width, screen.height);
+        wv.setGeometry(0, 0, screen.width, screen.height); /* eslint no-undef : 0 */
         wv.backgroundColor = 0x00000000;
         wv.active = true;
         wv.visible = true;
@@ -71,7 +71,7 @@ function showCameraDialog (done, cancel, fail) {
                 } else {
                     saveImage(args[1], done, fail);
                 }
-                wv.un('JavaScriptCallback', arguments.callee);
+                wv.un('JavaScriptCallback', arguments.callee); /* eslint no-caller : 0 */
                 wv.visible = false;
                 wv.destroy();
                 qnx.webplatform.getApplication().unlockRotation();
@@ -87,19 +87,19 @@ function showCameraDialog (done, cancel, fail) {
 
 // create unique name for saved file (same pattern as BB10 camera app)
 function imgName () {
-    var date = new Date(),
-        pad = function (n) { return n < 10 ? '0' + n : n; };
+    var date = new Date();
+    var pad = function (n) { return n < 10 ? '0' + n : n; };
     return 'IMG_' + date.getFullYear() + pad(date.getMonth() + 1) + pad(date.getDate()) + '_' +
             pad(date.getHours()) + pad(date.getMinutes()) + pad(date.getSeconds()) + '.png';
 }
 
 // convert dataURI to Blob
 function dataURItoBlob (dataURI) {
-    var byteString = atob(dataURI.split(',')[1]),
-        mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0],
-        arrayBuffer = new ArrayBuffer(byteString.length),
-        ia = new Uint8Array(arrayBuffer),
-        i;
+    var byteString = atob(dataURI.split(',')[1]);
+    var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
+    var arrayBuffer = new ArrayBuffer(byteString.length);
+    var ia = new Uint8Array(arrayBuffer);
+    var i;
     for (i = 0; i < byteString.length; i++) {
         ia[i] = byteString.charCodeAt(i);
     }
@@ -124,85 +124,85 @@ function saveImage (data, success, fail) {
 }
 
 function encodeBase64 (filePath, callback) {
-    var sandbox = window.qnx.webplatform.getController().setFileSystemSandbox, // save original sandbox value
-        errorHandler = function (err) {
-            var msg = 'An error occured: ';
-
-            switch (err.code) {
-            case FileError.NOT_FOUND_ERR:
-                msg += 'File or directory not found';
-                break;
-
-            case FileError.NOT_READABLE_ERR:
-                msg += 'File or directory not readable';
-                break;
-
-            case FileError.PATH_EXISTS_ERR:
-                msg += 'File or directory already exists';
-                break;
-
-            case FileError.TYPE_MISMATCH_ERR:
-                msg += 'Invalid file type';
-                break;
-
-            default:
-                msg += 'Unknown Error';
-                break;
-            }
+    var sandbox = window.qnx.webplatform.getController().setFileSystemSandbox; // save original sandbox value
+    var errorHandler = function (err) {
+        var msg = 'An error occured: ';
 
-            // set it back to original value
-            window.qnx.webplatform.getController().setFileSystemSandbox = sandbox;
-            callback(msg);
-        },
-        gotFile = function (fileEntry) {
-            fileEntry.file(function (file) {
-                var reader = new FileReader();
-
-                reader.onloadend = function (e) {
-                    // set it back to original value
-                    window.qnx.webplatform.getController().setFileSystemSandbox = sandbox;
-                    callback(this.result);
-                };
+        switch (err.code) {
+        case FileError.NOT_FOUND_ERR:
+            msg += 'File or directory not found';
+            break;
 
-                reader.readAsDataURL(file);
-            }, errorHandler);
-        },
-        onInitFs = function (fs) {
-            window.qnx.webplatform.getController().setFileSystemSandbox = false;
-            fs.root.getFile(filePath, {create: false}, gotFile, errorHandler);
-        };
+        case FileError.NOT_READABLE_ERR:
+            msg += 'File or directory not readable';
+            break;
+
+        case FileError.PATH_EXISTS_ERR:
+            msg += 'File or directory already exists';
+            break;
+
+        case FileError.TYPE_MISMATCH_ERR:
+            msg += 'Invalid file type';
+            break;
+
+        default:
+            msg += 'Unknown Error';
+            break;
+        }
+
+        // set it back to original value
+        window.qnx.webplatform.getController().setFileSystemSandbox = sandbox;
+        callback(msg);
+    };
+    var gotFile = function (fileEntry) {
+        fileEntry.file(function (file) {
+            var reader = new FileReader();
+
+            reader.onloadend = function (e) {
+                // set it back to original value
+                window.qnx.webplatform.getController().setFileSystemSandbox = sandbox;
+                callback(this.result);
+            };
+
+            reader.readAsDataURL(file);
+        }, errorHandler);
+    };
+    var onInitFs = function (fs) {
+        window.qnx.webplatform.getController().setFileSystemSandbox = false;
+        fs.root.getFile(filePath, {create: false}, gotFile, errorHandler);
+    };
 
     window.webkitRequestFileSystem(window.TEMPORARY, 10 * 1024 * 1024, onInitFs, errorHandler); // set size to 10MB max
 }
 
 module.exports = {
     takePicture: function (success, fail, args, env) {
-        var destinationType = JSON.parse(decodeURIComponent(args[1])),
-            sourceType = JSON.parse(decodeURIComponent(args[2])),
-            result = new PluginResult(args, env),
-            done = function (data) {
-                if (destinationType === DestinationType.FILE_URI) {
-                    data = 'file://' + data;
-                    result.callbackOk(data, false);
-                } else {
-                    encodeBase64(data, function (data) {
-                        if (/^data:/.test(data)) {
-                            data = data.slice(data.indexOf(',') + 1);
-                            result.callbackOk(data, false);
-                        } else {
-                            result.callbackError(data, false);
-                        }
-                    });
-                }
-            },
-            cancel = function (reason) {
-                result.callbackError(reason, false);
-            },
-            invoked = function (error) {
-                if (error) {
-                    result.callbackError(error, false);
-                }
-            };
+        var destinationType = JSON.parse(decodeURIComponent(args[1]));
+        var sourceType = JSON.parse(decodeURIComponent(args[2]));
+        var result = new PluginResult(args, env);
+        var done = function (data) {
+            if (destinationType === DestinationType.FILE_URI) {
+                data = 'file://' + data;
+                result.callbackOk(data, false);
+            } else {
+                encodeBase64(data, function (data) {
+                    if (/^data:/.test(data)) {
+                        data = data.slice(data.indexOf(',') + 1);
+                        result.callbackOk(data, false);
+                    } else {
+                        result.callbackError(data, false);
+                    }
+                });
+            }
+        };
+        var cancel = function (reason) {
+            result.callbackError(reason, false);
+        };
+        var invoked = function (error) {
+            if (error) {
+                result.callbackError(error, false);
+            }
+        };
 
         switch (sourceType) {
         case PictureSourceType.CAMERA:

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/16c4325f/src/browser/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/browser/CameraProxy.js b/src/browser/CameraProxy.js
index ff4971a..38f241f 100644
--- a/src/browser/CameraProxy.js
+++ b/src/browser/CameraProxy.js
@@ -33,7 +33,7 @@ function takePicture (success, error, opts) {
         input.name = 'files[]';
 
         input.onchange = function (inputEvent) {
-            var reader = new FileReader();
+            var reader = new FileReader(); /* eslint no-undef : 0 */
             reader.onload = function (readerEvent) {
                 input.parentNode.removeChild(input);
 
@@ -54,8 +54,8 @@ function capture (success, errorCallback, opts) {
     var targetWidth = opts[3];
     var targetHeight = opts[4];
 
-    targetWidth = targetWidth == -1 ? 320 : targetWidth;
-    targetHeight = targetHeight == -1 ? 240 : targetHeight;
+    targetWidth = targetWidth === -1 ? 320 : targetWidth;
+    targetHeight = targetHeight === -1 ? 240 : targetHeight;
 
     var video = document.createElement('video');
     var button = document.createElement('button');

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/16c4325f/src/windows/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js
index 7a2594f..e20d28d 100644
--- a/src/windows/CameraProxy.js
+++ b/src/windows/CameraProxy.js
@@ -19,7 +19,6 @@
  *
 */
 
-/* jshint unused:true, undef:true, browser:true */
 /* global Windows:true, URL:true, module:true, require:true, WinJS:true */
 
 var Camera = require('./Camera');
@@ -56,7 +55,7 @@ module.exports = {
     takePicture: function (successCallback, errorCallback, args) {
         var sourceType = args[2];
 
-        if (sourceType != Camera.PictureSourceType.CAMERA) {
+        if (sourceType !== Camera.PictureSourceType.CAMERA) {
             takePictureFromFile(successCallback, errorCallback, args);
         } else {
             takePictureFromCamera(successCallback, errorCallback, args);
@@ -79,7 +78,7 @@ function resizeImage (successCallback, errorCallback, file, targetWidth, targetH
     var tempPhotoFileName = '';
     var targetContentType = '';
 
-    if (encodingType == Camera.EncodingType.PNG) {
+    if (encodingType === Camera.EncodingType.PNG) {
         tempPhotoFileName = 'camera_cordova_temp_return.png';
         targetContentType = 'image/png';
     } else {
@@ -95,7 +94,7 @@ function resizeImage (successCallback, errorCallback, file, targetWidth, targetH
         .then(function (buffer) {
             var strBase64 = encodeToBase64String(buffer);
             var imageData = 'data:' + file.contentType + ';base64,' + strBase64;
-            var image = new Image();
+            var image = new Image(); /* eslint no-undef : 0 */
             image.src = imageData;
             image.onload = function () {
                 var ratio = Math.min(targetWidth / this.width, targetHeight / this.height);
@@ -127,8 +126,7 @@ function resizeImage (successCallback, errorCallback, file, targetWidth, targetH
         })
         .done(null, function (err) {
             errorCallback(err);
-        }
-    );
+        });
 }
 
 // Because of asynchronous method, so let the successCallback be called in it.
@@ -137,7 +135,7 @@ function resizeImageBase64 (successCallback, errorCallback, file, targetWidth, t
         var strBase64 = encodeToBase64String(buffer);
         var imageData = 'data:' + file.contentType + ';base64,' + strBase64;
 
-        var image = new Image();
+        var image = new Image(); /* eslint no-undef : 0 */
         image.src = imageData;
 
         image.onload = function () {
@@ -173,11 +171,11 @@ function takePictureFromFile (successCallback, errorCallback, args) {
 }
 
 function takePictureFromFileWP (successCallback, errorCallback, args) {
-    var mediaType = args[6],
-        destinationType = args[1],
-        targetWidth = args[3],
-        targetHeight = args[4],
-        encodingType = args[5];
+    var mediaType = args[6];
+    var destinationType = args[1];
+    var targetWidth = args[3];
+    var targetHeight = args[4];
+    var encodingType = args[5];
 
     /*
         Need to add and remove an event listener to catch activation state
@@ -192,13 +190,13 @@ function takePictureFromFileWP (successCallback, errorCallback, args) {
                 webUIApp.removeEventListener('activated', filePickerActivationHandler);
                 return;
             }
-            if (destinationType == Camera.DestinationType.FILE_URI || destinationType == Camera.DestinationType.NATIVE_URI) {
+            if (destinationType === Camera.DestinationType.FILE_URI || destinationType === Camera.DestinationType.NATIVE_URI) {
                 if (targetHeight > 0 && targetWidth > 0) {
                     resizeImage(successCallback, errorCallback, file, targetWidth, targetHeight, encodingType);
                 } else {
                     var storageFolder = getAppData().localFolder;
                     file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).done(function (storageFile) {
-                        if (destinationType == Camera.DestinationType.NATIVE_URI) {
+                        if (destinationType === Camera.DestinationType.NATIVE_URI) {
                             successCallback('ms-appdata:///local/' + storageFile.name);
                         } else {
                             successCallback(URL.createObjectURL(storageFile));
@@ -222,10 +220,10 @@ function takePictureFromFileWP (successCallback, errorCallback, args) {
     };
 
     var fileOpenPicker = new Windows.Storage.Pickers.FileOpenPicker();
-    if (mediaType == Camera.MediaType.PICTURE) {
+    if (mediaType === Camera.MediaType.PICTURE) {
         fileOpenPicker.fileTypeFilter.replaceAll(['.png', '.jpg', '.jpeg']);
         fileOpenPicker.suggestedStartLocation = pickerLocId.picturesLibrary;
-    } else if (mediaType == Camera.MediaType.VIDEO) {
+    } else if (mediaType === Camera.MediaType.VIDEO) {
         fileOpenPicker.fileTypeFilter.replaceAll(windowsPhoneVideoContainers);
         fileOpenPicker.suggestedStartLocation = pickerLocId.videosLibrary;
     } else {
@@ -238,17 +236,17 @@ function takePictureFromFileWP (successCallback, errorCallback, args) {
 }
 
 function takePictureFromFileWindows (successCallback, errorCallback, args) {
-    var mediaType = args[6],
-        destinationType = args[1],
-        targetWidth = args[3],
-        targetHeight = args[4],
-        encodingType = args[5];
+    var mediaType = args[6];
+    var destinationType = args[1];
+    var targetWidth = args[3];
+    var targetHeight = args[4];
+    var encodingType = args[5];
 
     var fileOpenPicker = new Windows.Storage.Pickers.FileOpenPicker();
-    if (mediaType == Camera.MediaType.PICTURE) {
+    if (mediaType === Camera.MediaType.PICTURE) {
         fileOpenPicker.fileTypeFilter.replaceAll(['.png', '.jpg', '.jpeg']);
         fileOpenPicker.suggestedStartLocation = pickerLocId.picturesLibrary;
-    } else if (mediaType == Camera.MediaType.VIDEO) {
+    } else if (mediaType === Camera.MediaType.VIDEO) {
         fileOpenPicker.fileTypeFilter.replaceAll(windowsVideoContainers);
         fileOpenPicker.suggestedStartLocation = pickerLocId.videosLibrary;
     } else {
@@ -261,13 +259,13 @@ function takePictureFromFileWindows (successCallback, errorCallback, args) {
             errorCallback("User didn't choose a file.");
             return;
         }
-        if (destinationType == Camera.DestinationType.FILE_URI || destinationType == Camera.DestinationType.NATIVE_URI) {
+        if (destinationType === Camera.DestinationType.FILE_URI || destinationType === Camera.DestinationType.NATIVE_URI) {
             if (targetHeight > 0 && targetWidth > 0) {
                 resizeImage(successCallback, errorCallback, file, targetWidth, targetHeight, encodingType);
             } else {
                 var storageFolder = getAppData().localFolder;
                 file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).done(function (storageFile) {
-                    if (destinationType == Camera.DestinationType.NATIVE_URI) {
+                    if (destinationType === Camera.DestinationType.NATIVE_URI) {
                         successCallback('ms-appdata:///local/' + storageFile.name);
                     } else {
                         successCallback(URL.createObjectURL(storageFile));
@@ -303,19 +301,19 @@ function takePictureFromCamera (successCallback, errorCallback, args) {
 function takePictureFromCameraWP (successCallback, errorCallback, args) {
     // We are running on WP8.1 which lacks CameraCaptureUI class
     // so we need to use MediaCapture class instead and implement custom UI for camera
-    var destinationType = args[1],
-        targetWidth = args[3],
-        targetHeight = args[4],
-        encodingType = args[5],
-        saveToPhotoAlbum = args[9],
-        cameraDirection = args[11],
-        capturePreview = null,
-        cameraCaptureButton = null,
-        cameraCancelButton = null,
-        capture = null,
-        captureSettings = null,
-        CaptureNS = Windows.Media.Capture,
-        sensor = null;
+    var destinationType = args[1];
+    var targetWidth = args[3];
+    var targetHeight = args[4];
+    var encodingType = args[5];
+    var saveToPhotoAlbum = args[9];
+    var cameraDirection = args[11];
+    var capturePreview = null;
+    var cameraCaptureButton = null;
+    var cameraCancelButton = null;
+    var capture = null;
+    var captureSettings = null;
+    var CaptureNS = Windows.Media.Capture;
+    var sensor = null;
 
     function createCameraUI () {
         // create style for take and cancel buttons
@@ -367,7 +365,7 @@ function takePictureFromCameraWP (successCallback, errorCallback, args) {
             }
 
             devices.forEach(function (currDev) {
-                if (currDev.enclosureLocation.panel && currDev.enclosureLocation.panel == expectedPanel) {
+                if (currDev.enclosureLocation.panel && currDev.enclosureLocation.panel === expectedPanel) {
                     captureSettings.videoDeviceId = currDev.id;
                 }
             });
@@ -480,11 +478,11 @@ function takePictureFromCameraWP (successCallback, errorCallback, args) {
 
     function captureAction () {
 
-        var encodingProperties,
-            fileName,
-            tempFolder = getAppData().temporaryFolder;
+        var encodingProperties;
+        var fileName;
+        var tempFolder = getAppData().temporaryFolder;
 
-        if (encodingType == Camera.EncodingType.PNG) {
+        if (encodingType === Camera.EncodingType.PNG) {
             fileName = 'photo.png';
             encodingProperties = Windows.Media.MediaProperties.ImageEncodingProperties.createPng();
         } else {
@@ -656,22 +654,22 @@ function takePictureFromCameraWP (successCallback, errorCallback, args) {
         // https://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.imaging.bitmaprotation.aspx
 
         switch (orientation) {
-            // portrait
+        // portrait
         case Windows.Devices.Sensors.SimpleOrientation.notRotated:
             return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
-            // landscape
+        // landscape
         case Windows.Devices.Sensors.SimpleOrientation.rotated90DegreesCounterclockwise:
             return Windows.Media.Capture.VideoRotation.none;
-            // portrait-flipped (not supported by WinPhone Apps)
+        // portrait-flipped (not supported by WinPhone Apps)
         case Windows.Devices.Sensors.SimpleOrientation.rotated180DegreesCounterclockwise:
-                // Falling back to portrait default
+            // Falling back to portrait default
             return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
-            // landscape-flipped
+        // landscape-flipped
         case Windows.Devices.Sensors.SimpleOrientation.rotated270DegreesCounterclockwise:
             return Windows.Media.Capture.VideoRotation.clockwise180Degrees;
-            // faceup & facedown
+        // faceup & facedown
         default:
-                // Falling back to portrait default
+            // Falling back to portrait default
             return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
         }
     }
@@ -693,18 +691,18 @@ function takePictureFromCameraWP (successCallback, errorCallback, args) {
 }
 
 function takePictureFromCameraWindows (successCallback, errorCallback, args) {
-    var destinationType = args[1],
-        targetWidth = args[3],
-        targetHeight = args[4],
-        encodingType = args[5],
-        allowCrop = !!args[7],
-        saveToPhotoAlbum = args[9],
-        WMCapture = Windows.Media.Capture,
-        cameraCaptureUI = new WMCapture.CameraCaptureUI();
+    var destinationType = args[1];
+    var targetWidth = args[3];
+    var targetHeight = args[4];
+    var encodingType = args[5];
+    var allowCrop = !!args[7];
+    var saveToPhotoAlbum = args[9];
+    var WMCapture = Windows.Media.Capture;
+    var cameraCaptureUI = new WMCapture.CameraCaptureUI();
 
     cameraCaptureUI.photoSettings.allowCropping = allowCrop;
 
-    if (encodingType == Camera.EncodingType.PNG) {
+    if (encodingType === Camera.EncodingType.PNG) {
         cameraCaptureUI.photoSettings.format = WMCapture.CameraCaptureUIPhotoFormat.png;
     } else {
         cameraCaptureUI.photoSettings.format = WMCapture.CameraCaptureUIPhotoFormat.jpeg;
@@ -715,14 +713,13 @@ function takePictureFromCameraWindows (successCallback, errorCallback, args) {
     var UIMaxRes = WMCapture.CameraCaptureUIMaxPhotoResolution;
     var totalPixels = targetWidth * targetHeight;
 
-    if (targetWidth == -1 && targetHeight == -1) {
+    if (targetWidth === -1 && targetHeight === -1) {
         maxRes = UIMaxRes.highestAvailable;
-    }
     // Temp fix for CB-10539
     /* else if (totalPixels <= 320 * 240) {
         maxRes = UIMaxRes.verySmallQvga;
     } */
-    else if (totalPixels <= 640 * 480) {
+    } else if (totalPixels <= 640 * 480) {
         maxRes = UIMaxRes.smallVga;
     } else if (totalPixels <= 1024 * 768) {
         maxRes = UIMaxRes.mediumXga;
@@ -784,7 +781,7 @@ function takePictureFromCameraWindows (successCallback, errorCallback, args) {
 function savePhoto (picture, options, successCallback, errorCallback) {
     // success callback for capture operation
     var success = function (picture) {
-        if (options.destinationType == Camera.DestinationType.FILE_URI || options.destinationType == Camera.DestinationType.NATIVE_URI) {
+        if (options.destinationType === Camera.DestinationType.FILE_URI || options.destinationType === Camera.DestinationType.NATIVE_URI) {
             if (options.targetHeight > 0 && options.targetWidth > 0) {
                 resizeImage(successCallback, errorCallback, picture, options.targetWidth, options.targetHeight, options.encodingType);
             } else {

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/16c4325f/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 0c85188..f45b8b6 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -20,26 +20,26 @@
 */
 
 /* globals Camera, resolveLocalFileSystemURL, FileEntry, CameraPopoverOptions, FileTransfer, FileUploadOptions, LocalFileSystem, MSApp */
-/* jshint jasmine: true */
+/* eslint-env jasmine */
 
 exports.defineAutoTests = function () {
     describe('Camera (navigator.camera)', function () {
-        it("should exist", function () {
+        it('should exist', function () {
             expect(navigator.camera).toBeDefined();
         });
 
-        it("should contain a getPicture function", function () {
+        it('should contain a getPicture function', function () {
             expect(navigator.camera.getPicture).toBeDefined();
-            expect(typeof navigator.camera.getPicture == 'function').toBe(true);
+            expect(typeof navigator.camera.getPicture === 'function').toBe(true);
         });
     });
 
     describe('Camera Constants (window.Camera + navigator.camera)', function () {
-        it("camera.spec.1 window.Camera should exist", function () {
+        it('camera.spec.1 window.Camera should exist', function () {
             expect(window.Camera).toBeDefined();
         });
 
-        it("camera.spec.2 should contain three DestinationType constants", function () {
+        it('camera.spec.2 should contain three DestinationType constants', function () {
             expect(Camera.DestinationType.DATA_URL).toBe(0);
             expect(Camera.DestinationType.FILE_URI).toBe(1);
             expect(Camera.DestinationType.NATIVE_URI).toBe(2);
@@ -48,14 +48,14 @@ exports.defineAutoTests = function () {
             expect(navigator.camera.DestinationType.NATIVE_URI).toBe(2);
         });
 
-        it("camera.spec.3 should contain two EncodingType constants", function () {
+        it('camera.spec.3 should contain two EncodingType constants', function () {
             expect(Camera.EncodingType.JPEG).toBe(0);
             expect(Camera.EncodingType.PNG).toBe(1);
             expect(navigator.camera.EncodingType.JPEG).toBe(0);
             expect(navigator.camera.EncodingType.PNG).toBe(1);
         });
 
-        it("camera.spec.4 should contain three MediaType constants", function () {
+        it('camera.spec.4 should contain three MediaType constants', function () {
             expect(Camera.MediaType.PICTURE).toBe(0);
             expect(Camera.MediaType.VIDEO).toBe(1);
             expect(Camera.MediaType.ALLMEDIA).toBe(2);
@@ -64,7 +64,7 @@ exports.defineAutoTests = function () {
             expect(navigator.camera.MediaType.ALLMEDIA).toBe(2);
         });
 
-        it("camera.spec.5 should contain three PictureSourceType constants", function () {
+        it('camera.spec.5 should contain three PictureSourceType constants', function () {
             expect(Camera.PictureSourceType.PHOTOLIBRARY).toBe(0);
             expect(Camera.PictureSourceType.CAMERA).toBe(1);
             expect(Camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2);
@@ -75,7 +75,6 @@ exports.defineAutoTests = function () {
     });
 };
 
-
 /******************************************************************************/
 /******************************************************************************/
 /******************************************************************************/
@@ -86,7 +85,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
     var fileEntry = null;
     var pageStartTime = +new Date();
 
-    //default camera options
+    // default camera options
     var camQualityDefault = ['50', 50];
     var camDestinationTypeDefault = ['FILE_URI', 1];
     var camPictureSourceTypeDefault = ['CAMERA', 1];
@@ -96,12 +95,12 @@ exports.defineManualTests = function (contentEl, createActionButton) {
     var camCorrectOrientationDefault = ['correctOrientation', false];
     var camSaveToPhotoAlbumDefault = ['saveToPhotoAlbum', true];
 
-    function log(value) {
+    function log (value) {
         console.log(value);
         document.getElementById('camera_status').textContent += (new Date() - pageStartTime) / 1000 + ': ' + value + '\n';
     }
 
-    function clearStatus() {
+    function clearStatus () {
         document.getElementById('camera_status').innerHTML = '';
         document.getElementById('camera_image').src = 'about:blank';
         var canvas = document.getElementById('canvas');
@@ -111,11 +110,11 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         fileEntry = null;
     }
 
-    function setPicture(url, callback) {
+    function setPicture (url, callback) {
         try {
             window.atob(url);
             // if we got here it is a base64 string (DATA_URL)
-            url = "data:image/jpeg;base64," + url;
+            url = 'data:image/jpeg;base64,' + url;
         } catch (e) {
             // not DATA_URL
         }
@@ -134,11 +133,11 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         };
     }
 
-    function onGetPictureError(e) {
+    function onGetPictureError (e) {
         log('Error getting picture: ' + (e.code || e));
     }
 
-    function getPictureWin(data) {
+    function getPictureWin (data) {
         setPicture(data);
         // TODO: Fix resolveLocalFileSystemURI to work with native-uri.
         if (pictureUrl.indexOf('file:') === 0 || pictureUrl.indexOf('content:') === 0 || pictureUrl.indexOf('ms-appdata:') === 0 || pictureUrl.indexOf('assets-library:') === 0) {
@@ -155,7 +154,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         }
     }
 
-    function getPicture() {
+    function getPicture () {
         clearStatus();
         var options = extractOptions();
         log('Getting picture with options: ' + JSON.stringify(options));
@@ -168,27 +167,27 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         };
     }
 
-    function uploadImage() {
-        var ft = new FileTransfer(),
-            options = new FileUploadOptions();
-        options.fileKey = "photo";
+    function uploadImage () {
+        var ft = new FileTransfer();
+        var options = new FileUploadOptions();
+        options.fileKey = 'photo';
         options.fileName = 'test.jpg';
-        options.mimeType = "image/jpeg";
+        options.mimeType = 'image/jpeg';
         ft.onprogress = function (progressEvent) {
             console.log('progress: ' + progressEvent.loaded + ' of ' + progressEvent.total);
         };
-        var server = "http://sheltered-retreat-43956.herokuapp.com";
+        var server = 'http://sheltered-retreat-43956.herokuapp.com';
 
         ft.upload(pictureUrl, server + '/upload', win, fail, options);
-        function win(information_back) {
+        function win (information_back) {
             log('upload complete');
         }
-        function fail(message) {
+        function fail (message) {
             log('upload failed: ' + JSON.stringify(message));
         }
     }
 
-    function logCallback(apiName, success) {
+    function logCallback (apiName, success) {
         return function () {
             log('Call to ' + apiName + (success ? ' success: ' : ' failed: ') + JSON.stringify([].slice.call(arguments)));
         };
@@ -198,20 +197,21 @@ exports.defineManualTests = function (contentEl, createActionButton) {
      * Select image from library using a NATIVE_URI destination type
      * This calls FileEntry.getMetadata, FileEntry.setMetadata, FileEntry.getParent, FileEntry.file, and FileReader.readAsDataURL.
      */
-    function readFile() {
-        function onFileReadAsDataURL(evt) {
+    function readFile () {
+        function onFileReadAsDataURL (evt) {
             var img = document.getElementById('camera_image');
-            img.style.visibility = "visible";
-            img.style.display = "block";
+            img.style.visibility = 'visible';
+            img.style.display = 'block';
             img.src = evt.target.result;
-            log("FileReader.readAsDataURL success");
+            log('FileReader.readAsDataURL success');
         }
 
-        function onFileReceived(file) {
+        function onFileReceived (file) {
             log('Got file: ' + JSON.stringify(file));
             fileObj = file;
-
+            /* eslint-disable no-undef */
             var reader = new FileReader();
+            /* eslint-enable no-undef */
             reader.onload = function () {
                 log('FileReader.readAsDataURL() - length = ' + reader.result.length);
             };
@@ -228,10 +228,10 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         }
     }
 
-    function getFileInfo() {
+    function getFileInfo () {
         // Test FileEntry API here.
         fileEntry.getMetadata(logCallback('FileEntry.getMetadata', true), logCallback('FileEntry.getMetadata', false));
-        fileEntry.setMetadata(logCallback('FileEntry.setMetadata', true), logCallback('FileEntry.setMetadata', false), { "com.apple.MobileBackup": 1 });
+        fileEntry.setMetadata(logCallback('FileEntry.setMetadata', true), logCallback('FileEntry.setMetadata', false), { 'com.apple.MobileBackup': 1 });
         fileEntry.getParent(logCallback('FileEntry.getParent', true), logCallback('FileEntry.getParent', false));
         fileEntry.getParent(logCallback('FileEntry.getParent', true), logCallback('FileEntry.getParent', false));
     }
@@ -240,7 +240,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
      * Copy image from library using a NATIVE_URI destination type
      * This calls FileEntry.copyTo and FileEntry.moveTo.
      */
-    function copyImage() {
+    function copyImage () {
         var onFileSystemReceived = function (fileSystem) {
             var destDirEntry = fileSystem.root;
             var origName = fileEntry.name;
@@ -249,17 +249,17 @@ exports.defineManualTests = function (contentEl, createActionButton) {
             fileEntry.copyTo(destDirEntry, 'copied_file.png', logCallback('FileEntry.copyTo', true), logCallback('FileEntry.copyTo', false));
             fileEntry.moveTo(destDirEntry, 'moved_file.png', logCallback('FileEntry.moveTo', true), logCallback('FileEntry.moveTo', false));
 
-            //cleanup
-            //rename moved file back to original name so other tests can reference image
-            resolveLocalFileSystemURL(destDirEntry.nativeURL+'moved_file.png', function(fileEntry) {
+            // cleanup
+            // rename moved file back to original name so other tests can reference image
+            resolveLocalFileSystemURL(destDirEntry.nativeURL + 'moved_file.png', function (fileEntry) {
                 fileEntry.moveTo(destDirEntry, origName, logCallback('FileEntry.moveTo', true), logCallback('FileEntry.moveTo', false));
                 console.log('Cleanup: successfully renamed file back to original name');
             }, function () {
                 console.log('Cleanup: failed to rename file back to original name');
             });
 
-            //remove copied file
-            resolveLocalFileSystemURL(destDirEntry.nativeURL+'copied_file.png', function(fileEntry) {
+            // remove copied file
+            resolveLocalFileSystemURL(destDirEntry.nativeURL + 'copied_file.png', function (fileEntry) {
                 fileEntry.remove(logCallback('FileEntry.remove', true), logCallback('FileEntry.remove', false));
                 console.log('Cleanup: successfully removed copied file');
             }, function () {
@@ -274,11 +274,11 @@ exports.defineManualTests = function (contentEl, createActionButton) {
      * Write image to library using a NATIVE_URI destination type
      * This calls FileEntry.createWriter, FileWriter.write, and FileWriter.truncate.
      */
-    function writeImage() {
+    function writeImage () {
         var onFileWriterReceived = function (fileWriter) {
             fileWriter.onwrite = logCallback('FileWriter.write', true);
             fileWriter.onerror = logCallback('FileWriter.write', false);
-            fileWriter.write("some text!");
+            fileWriter.write('some text!');
         };
 
         var onFileTruncateWriterReceived = function (fileWriter) {
@@ -291,7 +291,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         fileEntry.createWriter(onFileTruncateWriterReceived, null);
     }
 
-    function displayImageUsingCanvas() {
+    function displayImageUsingCanvas () {
         var canvas = document.getElementById('canvas');
         var img = document.getElementById('camera_image');
         var w = img.width;
@@ -308,11 +308,11 @@ exports.defineManualTests = function (contentEl, createActionButton) {
      * Remove image from library using a NATIVE_URI destination type
      * This calls FileEntry.remove.
      */
-    function removeImage() {
+    function removeImage () {
         fileEntry.remove(logCallback('FileEntry.remove', true), logCallback('FileEntry.remove', false));
     }
 
-    function testInputTag(inputEl) {
+    function testInputTag (inputEl) {
         clearStatus();
         // iOS 6 likes to dead-lock in the onchange context if you
         // do any alerts or try to remote-debug.
@@ -321,7 +321,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         }, 0);
     }
 
-    function testNativeFile2(inputEl) {
+    function testNativeFile2 (inputEl) {
+        /* eslint-disable no-undef */
         if (!inputEl.value) {
             alert('No file selected.');
             return;
@@ -331,6 +332,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
             alert('Got value but no file.');
             return;
         }
+        /* eslint-enable no-undef */
         var URLApi = window.URL || window.webkitURL;
         if (URLApi) {
             var blobURL = URLApi.createObjectURL(fileObj);
@@ -346,26 +348,26 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         }
     }
 
-    function extractOptions() {
+    function extractOptions () {
         var els = document.querySelectorAll('#image-options select');
         var ret = {};
-        /*jshint -W084 */
+        /* eslint-disable no-cond-assign */
         for (var i = 0, el; el = els[i]; ++i) {
             var value = el.value;
             if (value === '') continue;
             value = +value;
 
             if (el.isBool) {
-                ret[el.getAttribute("name")] = !!value;
+                ret[el.getAttribute('name')] = !!value;
             } else {
-                ret[el.getAttribute("name")] = value;
+                ret[el.getAttribute('name')] = value;
             }
         }
-        /*jshint +W084 */
+        /* eslint-enable no-cond-assign */
         return ret;
     }
 
-    function createOptionsEl(name, values, selectionDefault) {
+    function createOptionsEl (name, values, selectionDefault) {
         var openDiv = '<div style="display: inline-block">' + name + ': ';
         var select = '<select name=' + name + ' id="' + name + '">';
 
@@ -375,13 +377,13 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         }
 
         var options = '';
-        if (typeof values == 'boolean') {
+        if (typeof values === 'boolean') {
             values = { 'true': 1, 'false': 0 };
         }
         for (var k in values) {
             var isSelected = '';
             if (selectionDefault) {
-                if (selectionDefault[0] == k) {
+                if (selectionDefault[0] === k) {
                     isSelected = 'selected';
                 }
             }
@@ -400,8 +402,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
             '<b>Status:</b> <div id="camera_status"></div>' +
             'img: <img width="100" id="camera_image">' +
             'canvas: <canvas id="canvas" width="1" height="1"></canvas>' +
-            '</div>',
-        options_div = '<h2>Cordova Camera API Options</h2>' +
+            '</div>';
+    var options_div = '<h2>Cordova Camera API Options</h2>' +
             '<div id="image-options">' +
             createOptionsEl('sourceType', Camera.PictureSourceType, camPictureSourceTypeDefault) +
             createOptionsEl('destinationType', Camera.DestinationType, camDestinationTypeDefault) +
@@ -414,9 +416,9 @@ exports.defineManualTests = function (contentEl, createActionButton) {
             createOptionsEl('correctOrientation', true, camCorrectOrientationDefault) +
             createOptionsEl('saveToPhotoAlbum', true, camSaveToPhotoAlbumDefault) +
             createOptionsEl('cameraDirection', Camera.Direction) +
-            '</div>',
-        getpicture_div = '<div id="getpicture"></div>',
-        test_procedure = '<h4>Recommended Test Procedure</h4>' +
+            '</div>';
+    var getpicture_div = '<div id="getpicture"></div>';
+    var test_procedure = '<h4>Recommended Test Procedure</h4>' +
             'Options not specified should be the default value' +
             '<br>Status box should update with image and info whenever an image is taken or selected from library' +
             '</p><div style="background:#B0C4DE;border:1px solid #FFA07A;margin:15px 6px 0px;min-width:295px;max-width:97%;padding:4px 0px 2px 10px;min-height:160px;max-height:200px;overflow:auto">' +
@@ -429,14 +431,14 @@ exports.defineManualTests = function (contentEl, createActionButton) {
             '</p><li>sourceType=PHOTOLIBRARY<br>mediaType=ALLMEDIA<br>allowEdit=true<br>Should be able to select pics and videos and edit picture if selected</li>' +
             '</p><li>sourceType=CAMERA<br>targetWidth & targetHeight=50<br>allowEdit=false<br>Do Get File Metadata test below and take note of size<br>Repeat test but with width and height=800. Size should be significantly larger.</li>' +
             '</p><li>quality=0<br>targetWidth & targetHeight=default<br>allowEdit=false<br>Do Get File Metadata test below and take note of size<br>Repeat test but with quality=80. Size should be significantly larger.</li>' +
-            '</ol></div>',
-        inputs_div = '<h2>Native File Inputs</h2>' +
+            '</ol></div>';
+    var inputs_div = '<h2>Native File Inputs</h2>' +
             'For the following tests, status box should update with file selected' +
             '</p><div>input type=file <input type="file" class="testInputTag"></div>' +
             '<div>capture=camera <input type="file" accept="image/*;capture=camera" class="testInputTag"></div>' +
             '<div>capture=camcorder <input type="file" accept="video/*;capture=camcorder" class="testInputTag"></div>' +
-            '<div>capture=microphone <input type="file" accept="audio/*;capture=microphone" class="testInputTag"></div>',
-        actions_div = '<h2>Actions</h2>' +
+            '<div>capture=microphone <input type="file" accept="audio/*;capture=microphone" class="testInputTag"></div>';
+    var actions_div = '<h2>Actions</h2>' +
             'For the following tests, ensure that an image is set in status box' +
             '</p><div id="metadata"></div>' +
             'Expected result: Get metadata about file selected.<br>Status box will show, along with the metadata, "Call to FileEntry.getMetadata success, Call to FileEntry.setMetadata success, Call to FileEntry.getParent success"' +
@@ -456,20 +458,20 @@ exports.defineManualTests = function (contentEl, createActionButton) {
     // We need to wrap this code due to Windows security restrictions
     // see http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx#differences for details
     if (window.MSApp && window.MSApp.execUnsafeLocalFunction) {
-        MSApp.execUnsafeLocalFunction(function() {
+        MSApp.execUnsafeLocalFunction(function () {
             contentEl.innerHTML = info_div + options_div + getpicture_div + test_procedure + inputs_div + actions_div;
         });
     } else {
         contentEl.innerHTML = info_div + options_div + getpicture_div + test_procedure + inputs_div + actions_div;
     }
 
-    var elements = document.getElementsByClassName("testInputTag");
+    var elements = document.getElementsByClassName('testInputTag');
     var listener = function (e) {
         testInputTag(e.target);
     };
     for (var i = 0; i < elements.length; ++i) {
         var item = elements[i];
-        item.addEventListener("change", listener, false);
+        item.addEventListener('change', listener, false);
     }
 
     createActionButton('Get picture', function () {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org