diff --git a/framework/assets/js/battery.js b/framework/assets/js/battery.js index 6048e40b..2723c49d 100755 --- a/framework/assets/js/battery.js +++ b/framework/assets/js/battery.js @@ -49,35 +49,33 @@ Battery.prototype.eventHandler = function(eventType, handler, add) { // Register the event listener in the proper array if (eventType === "batterystatus") { - var pos = me._batteryListener.indexOf(handler); - if (pos === -1) { - me._batteryListener.push(handler); + if (me._batteryListener.indexOf(handler) === -1) { + me._batteryListener.push(handler); } } else if (eventType === "batterylow") { - var pos = me._lowListener.indexOf(handler); - if (pos === -1) { - me._lowListener.push(handler); + if (me._lowListener.indexOf(handler) === -1) { + me._lowListener.push(handler); } } else if (eventType === "batterycritical") { - var pos = me._criticalListener.indexOf(handler); - if (pos === -1) { - me._criticalListener.push(handler); + if (me._criticalListener.indexOf(handler) === -1) { + me._criticalListener.push(handler); } } } else { + var pos = -1; // Remove the event listener from the proper array if (eventType === "batterystatus") { - var pos = me._batteryListener.indexOf(handler); + pos = me._batteryListener.indexOf(handler); if (pos > -1) { me._batteryListener.splice(pos, 1); } } else if (eventType === "batterylow") { - var pos = me._lowListener.indexOf(handler); + pos = me._lowListener.indexOf(handler); if (pos > -1) { me._lowListener.splice(pos, 1); } } else if (eventType === "batterycritical") { - var pos = me._criticalListener.indexOf(handler); + pos = me._criticalListener.indexOf(handler); if (pos > -1) { me._criticalListener.splice(pos, 1); } @@ -98,13 +96,14 @@ Battery.prototype.eventHandler = function(eventType, handler, add) { Battery.prototype._status = function(info) { if (info) { var me = this; - if (me._level != info.level || me._isPlugged != info.isPlugged) { + var level = info.level; + if (me._level !== level || me._isPlugged !== info.isPlugged) { // Fire batterystatus event PhoneGap.fireWindowEvent("batterystatus", info); // Fire low battery event - if (info.level == 20 || info.level == 5) { - if (info.level == 20) { + if (level === 20 || level === 5) { + if (level === 20) { PhoneGap.fireWindowEvent("batterylow", info); } else { @@ -112,7 +111,7 @@ Battery.prototype._status = function(info) { } } } - me._level = info.level; + me._level = level; me._isPlugged = info.isPlugged; } }; diff --git a/framework/assets/js/camera.js b/framework/assets/js/camera.js index 72784879..17af89d7 100755 --- a/framework/assets/js/camera.js +++ b/framework/assets/js/camera.js @@ -124,7 +124,7 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options) options.quality = 80; } if (options.maxResolution === null || typeof options.maxResolution === "undefined") { - options.maxResolution = 0; + options.maxResolution = 0; } if (options.destinationType === null || typeof options.destinationType === "undefined") { options.destinationType = Camera.DestinationType.DATA_URL; @@ -141,7 +141,7 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options) if (options.targetWidth === null || typeof options.targetWidth === "undefined") { options.targetWidth = -1; } - else if (typeof options.targetWidth == "string") { + else if (typeof options.targetWidth === "string") { var width = new Number(options.targetWidth); if (isNaN(width) === false) { options.targetWidth = width.valueOf(); @@ -150,7 +150,7 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options) if (options.targetHeight === null || typeof options.targetHeight === "undefined") { options.targetHeight = -1; } - else if (typeof options.targetHeight == "string") { + else if (typeof options.targetHeight === "string") { var height = new Number(options.targetHeight); if (isNaN(height) === false) { options.targetHeight = height.valueOf(); diff --git a/framework/assets/js/capture.js b/framework/assets/js/capture.js index a5ad35c5..28ad367f 100644 --- a/framework/assets/js/capture.js +++ b/framework/assets/js/capture.js @@ -192,9 +192,6 @@ var CaptureAudioOptions = function(){ }; PhoneGap.addConstructor(function(){ - if (typeof navigator.device === "undefined") { - navigator.device = window.device = new Device(); - } if (typeof navigator.device.capture === "undefined") { navigator.device.capture = window.device.capture = new Capture(); } diff --git a/framework/assets/js/compass.js b/framework/assets/js/compass.js index 06093a95..64655169 100755 --- a/framework/assets/js/compass.js +++ b/framework/assets/js/compass.js @@ -20,7 +20,7 @@ if (!PhoneGap.hasResource("compass")) { PhoneGap.addResource("compass"); -CompassError = function(){ +var CompassError = function(){ this.code = null; }; @@ -28,7 +28,7 @@ CompassError = function(){ CompassError.COMPASS_INTERNAL_ERR = 0; CompassError.COMPASS_NOT_SUPPORTED = 20; -CompassHeading = function() { +var CompassHeading = function() { this.magneticHeading = null; this.trueHeading = null; this.headingAccuracy = null; diff --git a/framework/assets/js/file.js b/framework/assets/js/file.js index c65f7692..256aa0ce 100755 --- a/framework/assets/js/file.js +++ b/framework/assets/js/file.js @@ -385,7 +385,7 @@ FileWriter.prototype.abort = function() { this.readyState = FileWriter.DONE; // If write end callback - if (typeof this.onwriteend == "function") { + if (typeof this.onwriteend === "function") { this.onwriteend({"type":"writeend", "target":this}); } }; @@ -843,14 +843,14 @@ FileEntry.prototype.createWriter = function(successCallback, errorCallback) { var writer = new FileWriter(filePointer); if (writer.fileName === null || writer.fileName === "") { - if (typeof errorCallback == "function") { + if (typeof errorCallback === "function") { errorCallback({ "code": FileError.INVALID_STATE_ERR }); } } - if (typeof successCallback == "function") { + if (typeof successCallback === "function") { successCallback(writer); } }, errorCallback); @@ -885,7 +885,7 @@ LocalFileSystem.APPLICATION = 3; */ LocalFileSystem.prototype.requestFileSystem = function(type, size, successCallback, errorCallback) { if (type < 0 || type > 3) { - if (typeof errorCallback == "function") { + if (typeof errorCallback === "function") { errorCallback({ "code": FileError.SYNTAX_ERR }); @@ -993,8 +993,14 @@ LocalFileSystem.prototype._castDate = function(pluginResult) { PhoneGap.addConstructor(function() { var pgLocalFileSystem = new LocalFileSystem(); // Needed for cast methods - if(typeof window.localFileSystem == "undefined") window.localFileSystem = pgLocalFileSystem; - if(typeof window.requestFileSystem == "undefined") window.requestFileSystem = pgLocalFileSystem.requestFileSystem; - if(typeof window.resolveLocalFileSystemURI == "undefined") window.resolveLocalFileSystemURI = pgLocalFileSystem.resolveLocalFileSystemURI; + if (typeof window.localFileSystem === "undefined") { + window.localFileSystem = pgLocalFileSystem; + } + if (typeof window.requestFileSystem === "undefined") { + window.requestFileSystem = pgLocalFileSystem.requestFileSystem; + } + if (typeof window.resolveLocalFileSystemURI === "undefined") { + window.resolveLocalFileSystemURI = pgLocalFileSystem.resolveLocalFileSystemURI; + } }); -} +} \ No newline at end of file diff --git a/framework/assets/js/filetransfer.js b/framework/assets/js/filetransfer.js index a3d794c5..690cfcd1 100644 --- a/framework/assets/js/filetransfer.js +++ b/framework/assets/js/filetransfer.js @@ -69,7 +69,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro fileKey = options.fileKey; fileName = options.fileName; mimeType = options.mimeType; - if (options.chunkedMode != null || typeof options.chunkedMode != "undefined") { + if (options.chunkedMode !== null || typeof options.chunkedMode !== "undefined") { chunkedMode = options.chunkedMode; } if (options.params) { diff --git a/framework/assets/js/media.js b/framework/assets/js/media.js index 5a1d9cc9..1f86af78 100755 --- a/framework/assets/js/media.js +++ b/framework/assets/js/media.js @@ -226,7 +226,7 @@ PhoneGap.Media.onStatus = function(id, msg, value) { media.errorCallback({"code":value}); } } - else if (msg == Media.MEDIA_POSITION) { + else if (msg === Media.MEDIA_POSITION) { media._position = value; } }; diff --git a/framework/assets/js/network.js b/framework/assets/js/network.js index e3939f8d..007355e8 100755 --- a/framework/assets/js/network.js +++ b/framework/assets/js/network.js @@ -35,7 +35,7 @@ var Connection = function() { this.getInfo( function(type) { // Need to send events if we are on or offline - if (type == "none") { + if (type === "none") { // set a timer if still offline at the end of timer send the offline event me._timer = setTimeout(function(){ me.type = type; @@ -44,7 +44,7 @@ var Connection = function() { }, me.timeout); } else { // If there is a current offline event pending clear it - if (me._timer != null) { + if (me._timer !== null) { clearTimeout(me._timer); me._timer = null; } @@ -91,7 +91,7 @@ Connection.prototype.getInfo = function(successCallback, errorCallback) { PhoneGap.addConstructor(function() { if (typeof navigator.network === "undefined") { - navigator.network = new Object(); + navigator.network = {}; } if (typeof navigator.network.connection === "undefined") { navigator.network.connection = new Connection(); diff --git a/framework/assets/js/phonegap.js.base b/framework/assets/js/phonegap.js.base index 01a61a58..2d7c383f 100755 --- a/framework/assets/js/phonegap.js.base +++ b/framework/assets/js/phonegap.js.base @@ -386,7 +386,7 @@ PhoneGap.m_window_addEventListener = window.addEventListener; */ PhoneGap.addWindowEventHandler = function(event, callback) { PhoneGap.windowEventHandler[event] = callback; -} +}; /** * Add a custom document event handler. @@ -396,7 +396,7 @@ PhoneGap.addWindowEventHandler = function(event, callback) { */ PhoneGap.addDocumentEventHandler = function(event, callback) { PhoneGap.documentEventHandler[event] = callback; -} +}; /** * Intercept adding document event listeners and handle our own diff --git a/framework/assets/js/storage.js b/framework/assets/js/storage.js index a9e80cf0..cb741a92 100755 --- a/framework/assets/js/storage.js +++ b/framework/assets/js/storage.js @@ -428,7 +428,7 @@ PhoneGap.addConstructor(function() { else { return db; } - } + }; } if (typeof window.localStorage === "undefined") { diff --git a/framework/build.xml b/framework/build.xml index 45d842ae..94b0bfdd 100644 --- a/framework/build.xml +++ b/framework/build.xml @@ -130,8 +130,8 @@ - - + +