diff options
-rw-r--r-- | src/js/app.js | 8 | ||||
-rw-r--r-- | src/js/files.js | 28 | ||||
-rw-r--r-- | src/js/locate.js | 2 | ||||
-rw-r--r-- | src/js/router.js | 4 | ||||
-rw-r--r-- | src/js/views/around.js | 2 | ||||
-rw-r--r-- | src/js/views/fms.js | 4 | ||||
-rw-r--r-- | src/js/views/reports.js | 2 | ||||
-rw-r--r-- | src/js/views/sent.js | 2 | ||||
-rw-r--r-- | src/js/views/submit.js | 2 |
9 files changed, 30 insertions, 24 deletions
diff --git a/src/js/app.js b/src/js/app.js index b6de327..757507b 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -12,7 +12,7 @@ var tpl = { var loadTemplate = function (index) { var name = names[index]; - console.log('Loading template: ' + name + ', index: ' + index); + FMS.printDebug('Loading template: ' + name + ', index: ' + index); $.get('templates/' + CONFIG.LANGUAGE + '/' + name + '.html', function (data) { that.templates[name] = data; index++; @@ -66,6 +66,12 @@ var tpl = { FMS.isOffline = 1; }, + printDebug: function(msg) { + if ( CONFIG.DEBUG ) { + console.log(msg); + } + }, + checkOnlineStatus: function() { if ( navigator && navigator.connection && ( navigator.connection.type == Connection.NONE || navigator.connection.type == Connection.UNKNOWN ) ) { diff --git a/src/js/files.js b/src/js/files.js index 5a4604d..eea38c3 100644 --- a/src/js/files.js +++ b/src/js/files.js @@ -17,7 +17,7 @@ return getFileSystem(); }) .pipe( function (filesystem) { - console.log('Filesystem returned: ' + filesystem); + FMS.printDebug('Filesystem returned: ' + filesystem); return getDirectory(filesystem.root, CONFIG.FILES_DIR, {create: true}); }) @@ -36,7 +36,7 @@ return getFileSystem(); }) .pipe( function (filesystem) { - console.log('Filesystem returned: ' + filesystem); + FMS.printDebug('Filesystem returned: ' + filesystem); return getDirectory(filesystem.root, CONFIG.FILES_DIR, {create: true}); }) @@ -46,7 +46,7 @@ }, deleteURI: function (uri) { - console.log('Deleting URI: ' + uri); + FMS.printDebug('Deleting URI: ' + uri); return getFileFromURI(uri) .pipe( function (file) { @@ -60,7 +60,7 @@ // Delete a file from the filesystem deleteFile: function (path) { - console.log('Deleting file: ' + path); + FMS.printDebug('Deleting file: ' + path); // Turn path into a filename var filename = path.split('/').pop(); @@ -85,7 +85,7 @@ // Wrap the async Phonegap way of getting a filesystem in a promise function getFileSystem() { - console.log('Getting the file system'); + FMS.printDebug('Getting the file system'); var filesystem = $.Deferred(); @@ -101,7 +101,7 @@ // Wrap the async Phonegap way of getting a directory in a promise function getDirectory (rootDirectory, path, options) { - console.log('Getting a directory: ' + path); + FMS.printDebug('Getting a directory: ' + path); var directory = $.Deferred(); @@ -113,7 +113,7 @@ // Wrap the async Phonegap way of getting a file in a promise function getFile (directory, path, options) { - console.log('Getting a file with path: ' + path + ' in directory: ' + directory.fullPath); + FMS.printDebug('Getting a file with path: ' + path + ' in directory: ' + directory.fullPath); var file = $.Deferred(); @@ -124,17 +124,17 @@ function moveFile (src, dest, newName) { - console.log( 'moveing file ' + src.fullPath + ' to ' + dest.fullPath ); + FMS.printDebug( 'moveing file ' + src.fullPath + ' to ' + dest.fullPath ); var move = $.Deferred(); var destPath = dest.fullPath + '/' + src.name; var srcPath = src.fullPath + ''; if ( srcPath === destPath ) { - console.log('not moving because files are the same'); + FMS.printDebug('not moving because files are the same'); move.resolve( src ); } else { - console.log('paths differ so moving'); + FMS.printDebug('paths differ so moving'); src.moveTo( dest, newName, move.resolve, move.reject); } @@ -143,17 +143,17 @@ function copyFile (src, dest, newName) { - console.log( 'copying file ' + src.fullPath + ' to ' + dest.fullPath ); + FMS.printDebug( 'copying file ' + src.fullPath + ' to ' + dest.fullPath ); var copy = $.Deferred(); var destPath = dest.fullPath + '/' + src.name; var srcPath = src.fullPath + ''; if ( srcPath === destPath ) { - console.log('not copying because files are the same'); + FMS.printDebug('not copying because files are the same'); copy.resolve( src ); } else { - console.log('paths differ so copying'); + FMS.printDebug('paths differ so copying'); src.copyTo( dest, newName, copy.resolve, copy.reject); } @@ -162,7 +162,7 @@ function getFileFromURI(uri) { - console.log( 'getting file from uri ' + uri ); + FMS.printDebug( 'getting file from uri ' + uri ); var file = $.Deferred(); diff --git a/src/js/locate.js b/src/js/locate.js index dcc48fc..9d631f6 100644 --- a/src/js/locate.js +++ b/src/js/locate.js @@ -42,7 +42,7 @@ var that = this; this.watch_id = navigator.geolocation.watchPosition( function(location) { - if ( that.watch_id === undefined ) { console.log( 'no watch id' ); return; } + if ( that.watch_id === undefined ) { FMS.printDebug( 'no watch id' ); return; } if ( minAccuracy && location.coords.accuracy > minAccuracy ) { that.trigger('gps_locating', location.coords.accuracy); diff --git a/src/js/router.js b/src/js/router.js index c42a742..c691abb 100644 --- a/src/js/router.js +++ b/src/js/router.js @@ -147,7 +147,7 @@ }, changeView: function(view) { - console.log( 'change View to ' + view.id ); + FMS.printDebug( 'change View to ' + view.id ); $(view.el).attr('data-role', 'page'); if ( view.prev ) { $(view.el).attr('data-add-back-btn', 'true'); @@ -170,7 +170,7 @@ $.mobile.changePage($(view.el), options); if ( view.id != 'front-page' ) { - console.log('changed View to ' + view.id); + FMS.printDebug('changed View to ' + view.id); this.currentView = view; } } diff --git a/src/js/views/around.js b/src/js/views/around.js index a910e26..f4db059 100644 --- a/src/js/views/around.js +++ b/src/js/views/around.js @@ -25,7 +25,7 @@ render: function(){ if ( !this.template ) { - console.log('no template to render'); + FMS.printDebug('no template to render'); return; } template = _.template( tpl.get( this.template ) ); diff --git a/src/js/views/fms.js b/src/js/views/fms.js index 214dc2c..be4c84a 100644 --- a/src/js/views/fms.js +++ b/src/js/views/fms.js @@ -23,7 +23,7 @@ render: function(){ if ( !this.template ) { - console.log('no template to render'); + FMS.printDebug('no template to render'); return; } template = _.template( tpl.get( this.template ) ); @@ -102,7 +102,7 @@ $('.form-error').removeClass('form-error'); }, - destroy: function() { console.log('destory for ' + this.id); this._destroy(); this.remove(); }, + destroy: function() { FMS.printDebug('destory for ' + this.id); this._destroy(); this.remove(); }, _destroy: function() {} }) diff --git a/src/js/views/reports.js b/src/js/views/reports.js index f76db06..ff65700 100644 --- a/src/js/views/reports.js +++ b/src/js/views/reports.js @@ -87,7 +87,7 @@ render: function(){ if ( !this.template ) { - console.log('no template to render'); + FMS.printDebug('no template to render'); return; } template = _.template( tpl.get( this.template ) ); diff --git a/src/js/views/sent.js b/src/js/views/sent.js index 47e4ab8..f25a178 100644 --- a/src/js/views/sent.js +++ b/src/js/views/sent.js @@ -17,7 +17,7 @@ render: function(){ if ( !this.template ) { - console.log('no template to render'); + FMS.printDebug('no template to render'); return; } template = _.template( tpl.get( this.template ) ); diff --git a/src/js/views/submit.js b/src/js/views/submit.js index fbd81ac..fcebd52 100644 --- a/src/js/views/submit.js +++ b/src/js/views/submit.js @@ -19,7 +19,7 @@ render: function(){ if ( !this.template ) { - console.log('no template to render'); + FMS.printDebug('no template to render'); return; } template = _.template( tpl.get( this.template ) ); |