From 7e8979b249c04cdab15c742445dc1ce955e8597f Mon Sep 17 00:00:00 2001
From: Nikolaus Krismer <niko@krismer.de>
Date: Fri, 14 Feb 2014 19:31:52 +0100
Subject: [PATCH] fixing further jsHint warnings

---
 build.gradle                                  |  2 +-
 src/main/webapp/js/map/control/geosearch.js   |  6 +++---
 .../js/map/control/geosearchProvider/osm.js   | 12 +++++------
 src/main/webapp/js/map/control/help.js        |  2 +-
 src/main/webapp/js/map/control/settings.js    |  2 +-
 src/main/webapp/js/map/isoMap.js              |  2 +-
 src/main/webapp/js/map/layer/bing.js          | 14 ++++++-------
 src/main/webapp/js/map/layer/google.js        | 20 +++++++++----------
 src/main/webapp/js/service/websocket.js       |  8 ++++----
 9 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/build.gradle b/build.gradle
index d63fbfa9..20417a9d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -190,7 +190,7 @@ 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.options = [browser: true, expr: true, jquery: true, latedef: 'nofunc', quotmark: 'single', unused: true, undef: true]
 	jshint.predef = ['$': false, 'define': false, 'google': false, 'require': false]
 
     source = fileTree(dir: 'src/main/webapp/js', include: '**/*.js', exclude: ['**/*.min.js', 'lib/**'])
diff --git a/src/main/webapp/js/map/control/geosearch.js b/src/main/webapp/js/map/control/geosearch.js
index 1ad53bdd..c4546b7e 100644
--- a/src/main/webapp/js/map/control/geosearch.js
+++ b/src/main/webapp/js/map/control/geosearch.js
@@ -247,7 +247,7 @@ define(['leaflet'], function(L) {
 			}
 		},
 
-		_onSuggestClick : function (e) {
+		_onSuggestClick: function (e) {
 			var suggestId = e.target.id,
 				suggestIndex = -1,
 				suggest = null;
@@ -265,7 +265,7 @@ define(['leaflet'], function(L) {
 			}
 		},
 
-		_onSearchClick: function (e) {
+		_onSearchClick: function () {
 			var queryBox = document.getElementById('leaflet-control-geosearch-qry');
 
 			this.geosearch(queryBox.value);
@@ -310,7 +310,7 @@ define(['leaflet'], function(L) {
 				displayDescription = null,
 				divText = document.createElement('div'),
 				elem = this._result,
-				index = -1;
+				index = -1,
 				li = document.createElement('li'),
 				txtDescription = null,
 				txtName = null;
diff --git a/src/main/webapp/js/map/control/geosearchProvider/osm.js b/src/main/webapp/js/map/control/geosearchProvider/osm.js
index 74b1c423..a0fdcc10 100644
--- a/src/main/webapp/js/map/control/geosearchProvider/osm.js
+++ b/src/main/webapp/js/map/control/geosearchProvider/osm.js
@@ -4,20 +4,20 @@
  * @see https://github.com/smeijer/leaflet.control.geosearch
  */
 define(['leaflet'], function(L) {
-	ReverseResult = function (lon, lat, address, displayName) {
+	L.Geosearch.ReverseResult = function (lon, lat, address, displayName) {
 		this.lon = lon;
 		this.lat = lat;
 		this.address = address;
 		this.displayName = displayName;
 	};
 
-	Result = function (lon, lat, displayName) {
+	L.Geosearch.Result = function (lon, lat, displayName) {
 		this.lon = lon;
 		this.lat = lat;
 		this.displayName = displayName;
 	};
 
-	OsmProvider = L.Class.extend({
+	L.Geosearch.Provider.OsmProvider = L.Class.extend({
 		options : {
 			reverseable: true
 		},
@@ -70,7 +70,7 @@ define(['leaflet'], function(L) {
 
 			var results = [];
 			for (var i = 0; i < data.length; i++)
-				results.push(new Result(
+				results.push(new L.Geosearch.Result(
 					data[i].lon,
 					data[i].lat,
 					data[i].display_name
@@ -84,7 +84,7 @@ define(['leaflet'], function(L) {
 				return {};
 			}
 
-			return new ReverseResult(
+			return new L.Geosearch.ReverseResult(
 				data.lon,
 				data.lat,
 				data.address,
@@ -93,5 +93,5 @@ define(['leaflet'], function(L) {
 		}
 	});
 
-	return OsmProvider;
+	return L.Geosearch.Provider.OsmProvider;
 });
diff --git a/src/main/webapp/js/map/control/help.js b/src/main/webapp/js/map/control/help.js
index 7ad64bd8..39e67502 100644
--- a/src/main/webapp/js/map/control/help.js
+++ b/src/main/webapp/js/map/control/help.js
@@ -4,7 +4,7 @@ define(['leaflet', 'console'], function(L, logger) {
 			position: 'bottomright'
 		},
 
-		onAdd: function (map) {
+		onAdd: function() {
 			this._container = L.DomUtil.create('div', 'help-control');
 			this._container.id = 'help-control-div';
 			this._container.className = 'help-control-div';
diff --git a/src/main/webapp/js/map/control/settings.js b/src/main/webapp/js/map/control/settings.js
index de082aac..4ced945c 100644
--- a/src/main/webapp/js/map/control/settings.js
+++ b/src/main/webapp/js/map/control/settings.js
@@ -4,7 +4,7 @@ define(['leaflet', 'console'], function(L, logger) {
 			position: 'bottomright'
 		},
 
-		onAdd: function (map) {
+		onAdd: function() {
 			this._container = L.DomUtil.create('div', 'settings-control');
 			this._container.id = 'settings-control-div';
 			this._container.className = 'settings-control-div';
diff --git a/src/main/webapp/js/map/isoMap.js b/src/main/webapp/js/map/isoMap.js
index cdb5fded..3d0cb744 100644
--- a/src/main/webapp/js/map/isoMap.js
+++ b/src/main/webapp/js/map/isoMap.js
@@ -1,7 +1,7 @@
 define(['jQuery', 'leaflet', 'console', 'map/layer/bing','map/layer/google', 'map/control/settings', 'map/control/help', 'map/control/geosearch', 'map/control/geosearchProvider/osm', 'map/ipLocator/ipProvider', 'map/ipLocator/ipLocator'], function($, L, logger, BingLayer, GoogleLayer, SettingsControl, HelpControl, GeoSearch, OSMProvider, IpProvider, IpLocator) {
 	// Private static fields
 	var INNSBRUCK = [47.265718, 11.391342];
-	var VIENNA = [48.186312, 16.317615];
+//	var VIENNA = [48.186312, 16.317615];
 
 	// Class function (a.k.a. constructor)
 	function IsoMap(div) {
diff --git a/src/main/webapp/js/map/layer/bing.js b/src/main/webapp/js/map/layer/bing.js
index 0efca45e..ee99c13a 100644
--- a/src/main/webapp/js/map/layer/bing.js
+++ b/src/main/webapp/js/map/layer/bing.js
@@ -28,7 +28,7 @@ define(['leaflet', 'console'], function(L, logger) {
 			return quad;
 		},
 
-		getTileUrl: function(p, z) {
+		getTileUrl: function(p) {
 			var zoom = this._getZoomForUrl();
 			var subdomains = this.options.subdomains,
 				s = this.options.subdomains[Math.abs((p.x + p.y) % subdomains.length)];
@@ -46,18 +46,18 @@ define(['leaflet', 'console'], function(L, logger) {
 				var e = document.getElementById(cbid);
 				e.parentNode.removeChild(e);
 				if (meta.errorDetails) {
-					logger.log("Leaflet Bing Plugin Error - Got metadata: " + meta.errorDetails);
+					logger.log('Leaflet Bing Plugin Error - Got metadata: ' + meta.errorDetails);
 					return;
 				}
 				_this.initMetadata();
 			};
-			var url = document.location.protocol + "//dev.virtualearth.net/REST/v1/Imagery/Metadata/" + this.options.type + "?include=ImageryProviders&jsonp=" + cbid +
-						"&key=" + this._key + "&UriScheme=" + document.location.protocol.slice(0, -1);
-			var script = document.createElement("script");
-			script.type = "text/javascript";
+			var url = document.location.protocol + '//dev.virtualearth.net/REST/v1/Imagery/Metadata/' + this.options.type + '?include=ImageryProviders&jsonp=' + cbid +
+						'&key=' + this._key + '&UriScheme=' + document.location.protocol.slice(0, -1);
+			var script = document.createElement('script');
+			script.type = 'text/javascript';
 			script.src = url;
 			script.id = cbid;
-			document.getElementsByTagName("head")[0].appendChild(script);
+			document.getElementsByTagName('head')[0].appendChild(script);
 		},
 
 		initMetadata: function() {
diff --git a/src/main/webapp/js/map/layer/google.js b/src/main/webapp/js/map/layer/google.js
index 041ef379..1b3402d3 100644
--- a/src/main/webapp/js/map/layer/google.js
+++ b/src/main/webapp/js/map/layer/google.js
@@ -47,7 +47,7 @@ define(['leaflet'], function(L) {
 			map.on('zoomanim', this._handleZoomAnim, this);
 
 			//20px instead of 1em to avoid a slight overlap with google's attribution
-			map._controlCorners.bottomright.style.marginBottom = "20px";
+			map._controlCorners.bottomright.style.marginBottom = '20px';
 
 			this._reset();
 			this._update();
@@ -63,7 +63,7 @@ define(['leaflet'], function(L) {
 
 			this._map.off('zoomanim', this._handleZoomAnim, this);
 
-			map._controlCorners.bottomright.style.marginBottom = "0em";
+			map._controlCorners.bottomright.style.marginBottom = '0em';
 			//this._map.off('moveend', this._update, this);
 		},
 
@@ -79,8 +79,8 @@ define(['leaflet'], function(L) {
 		},
 
 		setElementSize: function(e, size) {
-			e.style.width = size.x + "px";
-			e.style.height = size.y + "px";
+			e.style.width = size.x + 'px';
+			e.style.height = size.y + 'px';
 		},
 
 		_initContainer: function() {
@@ -89,8 +89,8 @@ define(['leaflet'], function(L) {
 
 			if (!this._container) {
 				this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left');
-				this._container.id = "_GMapContainer_" + L.Util.stamp(this);
-				this._container.style.zIndex = "auto";
+				this._container.id = '_GMapContainer_' + L.Util.stamp(this);
+				this._container.style.zIndex = 'auto';
 			}
 
 			tilePane.insertBefore(this._container, first);
@@ -118,11 +118,11 @@ define(['leaflet'], function(L) {
 			});
 
 			var _this = this;
-			this._reposition = google.maps.event.addListenerOnce(map, "center_changed",
+			this._reposition = google.maps.event.addListenerOnce(map, 'center_changed',
 				function() { _this.onReposition(); });
 			this._google = map;
 
-			google.maps.event.addListenerOnce(map, "idle",
+			google.maps.event.addListenerOnce(map, 'idle',
 				function() { _this._checkZoomLevels(); });
 		},
 
@@ -140,7 +140,7 @@ define(['leaflet'], function(L) {
 			this._reset(e.hard);
 		},
 
-		_reset: function(clearOldContainer) {
+		_reset: function() {
 			this._initContainer();
 		},
 
@@ -178,7 +178,7 @@ define(['leaflet'], function(L) {
 
 		onReposition: function() {
 			if (!this._google) return;
-			google.maps.event.trigger(this._google, "resize");
+			google.maps.event.trigger(this._google, 'resize');
 		}
 	});
 
diff --git a/src/main/webapp/js/service/websocket.js b/src/main/webapp/js/service/websocket.js
index b0e8a5a0..cb5395ce 100644
--- a/src/main/webapp/js/service/websocket.js
+++ b/src/main/webapp/js/service/websocket.js
@@ -31,18 +31,18 @@ define(['jQuery', 'console'], function($, logger) {
 			} else if (websocket.readyState === websocket.CONNECTING) {
 				setTimeout(this.sendWsMessage.bind(this, msg), 100);
 			} else {
-				logger.error("Could not send message using websocket: socket closed (or closing)");
+				logger.error('Could not send message using websocket: socket closed (or closing)');
 			}
 		};
 
 		// Private methods
 
 		function onOpen(evt) {
-			logger.debug("Opening connection to websocket");
+			logger.debug('Opening connection to websocket', evt);
 		}
 
 		function onClose(evt) {
-			logger.debug("Closing connection to websocket");
+			logger.debug('Closing connection to websocket', evt);
 		}
 
 		function onMessage(evt) {
@@ -51,7 +51,7 @@ define(['jQuery', 'console'], function($, logger) {
 
 			var jsonResponse = jQuery.parseJSON(jsonString);
 			if (!jsonResponse.action) {
-				logger.warn("Invalid server response. No action attribute set");
+				logger.warn('Invalid server response. No action attribute set');
 				return;
 			}
 
-- 
GitLab