From b343f7a854ced3628e600d65875e5248ae56bb9d Mon Sep 17 00:00:00 2001
From: Nikolaus Krismer <niko@krismer.de>
Date: Fri, 14 Feb 2014 19:00:08 +0100
Subject: [PATCH] fixed further jsHint problems

---
 build.gradle                                     |  3 +++
 src/main/webapp/js/isochrone/initHelper.js       | 10 +++++-----
 src/main/webapp/js/isochrone/searchExtender.js   | 10 +++++-----
 .../webapp/js/service/serviceConfiguration.js    |  6 +++---
 src/main/webapp/js/service/websocket.js          | 16 ++++++++--------
 5 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/build.gradle b/build.gradle
index 5d5cfe25..bb59f78f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -190,6 +190,9 @@ task jsDoc(type:com.eriwen.gradle.js.tasks.JsDocTask) {
 tasks.jsDoc.dependsOn tasks.processResources
 
 task jsHint(type:com.eriwen.gradle.js.tasks.JsHintTask) {
+	jshint.options = [browser: true, jquery: true]
+	jshint.predef = ['define': false, '$': false, 'require': false]
+
     source = fileTree(dir: 'src/main/webapp/js', include: '**/*.js', exclude: ['**/*.min.js', 'lib/**'])
     dest = file("${buildDir}/reports/jshint/main.xml")
     reporter = 'checkstyle'
diff --git a/src/main/webapp/js/isochrone/initHelper.js b/src/main/webapp/js/isochrone/initHelper.js
index b5e64053..3e2a9219 100644
--- a/src/main/webapp/js/isochrone/initHelper.js
+++ b/src/main/webapp/js/isochrone/initHelper.js
@@ -37,8 +37,8 @@ define(['jQuery', 'console', 'map/isoMap', 'service/websocket', 'service/service
 				 numberFormat: 'n'
 			});
 
-		    $('#settings-dialog select').css({'width':'100%'});
-		    $('#settings-dialog input').css({'width':'100%'});
+			$('#settings-dialog select').css({'width':'100%'});
+			$('#settings-dialog input').css({'width':'100%'});
 			$('#datetime').datetimepicker({
 				dateFormat: 'dd.mm.yy',
 				timeFormat: 'HH:mm'
@@ -48,14 +48,14 @@ define(['jQuery', 'console', 'map/isoMap', 'service/websocket', 'service/service
 
 		// Private methods
 
-		extendSearch = function() {
+		function extendSearch() {
 			var mapElem = isoMap.getMap(),
 				searchExtender;
 
 			searchExtender = new SearchExtender(mapElem);
 			searchExtender.extendResult(isoMap.getMap());
-		};
-	};
+		}
+	}
 
 	return InitHelper;
 });
\ No newline at end of file
diff --git a/src/main/webapp/js/isochrone/searchExtender.js b/src/main/webapp/js/isochrone/searchExtender.js
index 8d08ed42..fe826797 100644
--- a/src/main/webapp/js/isochrone/searchExtender.js
+++ b/src/main/webapp/js/isochrone/searchExtender.js
@@ -13,7 +13,7 @@ define(['jQuery', 'map/isoMap', 'isochrone/configuration'], function($, isoMap,
 
 		// Private methods
 
-		getDSetConfigs = function(point) {
+		function getDSetConfigs(point) {
 			var config = Configuration.getInstance(),
 				configCandidates = [],
 				datasetConfigs = config.getDatasetConfigMap();
@@ -53,9 +53,9 @@ define(['jQuery', 'map/isoMap', 'isochrone/configuration'], function($, isoMap,
 			}
 
 			return tmpCandidate;
-		};
+		}
 
-		onSearchResult = function(data) {
+		function onSearchResult(data) {
 			var divIcons,
 				dSetConfigs = null,
 	        	iconIsochrone = null,
@@ -81,8 +81,8 @@ define(['jQuery', 'map/isoMap', 'isochrone/configuration'], function($, isoMap,
 			divIcons.appendChild(iconIsochrone);
 
 			$(divIcons).insertBefore(li);
-		};
-	};
+		}
+	}
 
 	return SearchExtender;
 });
diff --git a/src/main/webapp/js/service/serviceConfiguration.js b/src/main/webapp/js/service/serviceConfiguration.js
index 00ae341f..d2deb636 100644
--- a/src/main/webapp/js/service/serviceConfiguration.js
+++ b/src/main/webapp/js/service/serviceConfiguration.js
@@ -25,7 +25,7 @@ define(['jQuery', 'leaflet', 'console', 'isochrone/configuration'], function($,
 		 * <li>time the arrival or departure time of the query point</li>
 		 * </ul>
 		 */
-		onServerResponse = function(data) {
+		function onServerResponse(data) {
 			var config = Configuration.getInstance(),
 				datasets = data.defaultDatasets,
 				result = {};
@@ -68,10 +68,10 @@ define(['jQuery', 'leaflet', 'console', 'isochrone/configuration'], function($,
 		 * @param L.Point the point to convert (containing EPSG:3857 x and y)
 		 * @return L.latLng the matching L.latLng object (coordinates in EPSG:4326)
 		 */
-		convertToLatLng = function(point) {
+		function convertToLatLng(point) {
 			var earthRadius = 6378137;
 			return L.Projection.SphericalMercator.unproject(point.divideBy(earthRadius));
-		};
+		}
 	}
 
 	return ServiceConfiguration;
diff --git a/src/main/webapp/js/service/websocket.js b/src/main/webapp/js/service/websocket.js
index 4ae17df2..b0e8a5a0 100644
--- a/src/main/webapp/js/service/websocket.js
+++ b/src/main/webapp/js/service/websocket.js
@@ -37,15 +37,15 @@ define(['jQuery', 'console'], function($, logger) {
 
 		// Private methods
 
-		onOpen = function(evt) {
+		function onOpen(evt) {
 			logger.debug("Opening connection to websocket");
-		};
+		}
 
-		onClose = function(evt) {
+		function onClose(evt) {
 			logger.debug("Closing connection to websocket");
-		};
+		}
 
-		onMessage = function(evt) {
+		function onMessage(evt) {
 			var jsonString = evt.data;
 			logger.debug('Configuration returned by server: ', jsonString);
 
@@ -57,12 +57,12 @@ define(['jQuery', 'console'], function($, logger) {
 
 			var e = jQuery.Event(jsonResponse.action, jsonResponse);
 			$(document).trigger(e);
-		};
+		}
 
-		onError = function(evt) {
+		function onError(evt) {
 			logger.error('Could not get data from configuration websocket');
 			logger.warn('Error data: ' + evt.data);
-		};
+		}
 	}
 
 	return Websocket;
-- 
GitLab