Skip to content
Snippets Groups Projects
Commit 7e8979b2 authored by Nikolaus Krismer's avatar Nikolaus Krismer
Browse files

fixing further jsHint warnings

parent f10af56b
No related branches found
No related tags found
No related merge requests found
...@@ -190,7 +190,7 @@ task jsDoc(type:com.eriwen.gradle.js.tasks.JsDocTask) { ...@@ -190,7 +190,7 @@ task jsDoc(type:com.eriwen.gradle.js.tasks.JsDocTask) {
tasks.jsDoc.dependsOn tasks.processResources tasks.jsDoc.dependsOn tasks.processResources
task jsHint(type:com.eriwen.gradle.js.tasks.JsHintTask) { 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] jshint.predef = ['$': false, 'define': false, 'google': false, 'require': false]
source = fileTree(dir: 'src/main/webapp/js', include: '**/*.js', exclude: ['**/*.min.js', 'lib/**']) source = fileTree(dir: 'src/main/webapp/js', include: '**/*.js', exclude: ['**/*.min.js', 'lib/**'])
......
...@@ -247,7 +247,7 @@ define(['leaflet'], function(L) { ...@@ -247,7 +247,7 @@ define(['leaflet'], function(L) {
} }
}, },
_onSuggestClick : function (e) { _onSuggestClick: function (e) {
var suggestId = e.target.id, var suggestId = e.target.id,
suggestIndex = -1, suggestIndex = -1,
suggest = null; suggest = null;
...@@ -265,7 +265,7 @@ define(['leaflet'], function(L) { ...@@ -265,7 +265,7 @@ define(['leaflet'], function(L) {
} }
}, },
_onSearchClick: function (e) { _onSearchClick: function () {
var queryBox = document.getElementById('leaflet-control-geosearch-qry'); var queryBox = document.getElementById('leaflet-control-geosearch-qry');
this.geosearch(queryBox.value); this.geosearch(queryBox.value);
...@@ -310,7 +310,7 @@ define(['leaflet'], function(L) { ...@@ -310,7 +310,7 @@ define(['leaflet'], function(L) {
displayDescription = null, displayDescription = null,
divText = document.createElement('div'), divText = document.createElement('div'),
elem = this._result, elem = this._result,
index = -1; index = -1,
li = document.createElement('li'), li = document.createElement('li'),
txtDescription = null, txtDescription = null,
txtName = null; txtName = null;
......
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
* @see https://github.com/smeijer/leaflet.control.geosearch * @see https://github.com/smeijer/leaflet.control.geosearch
*/ */
define(['leaflet'], function(L) { define(['leaflet'], function(L) {
ReverseResult = function (lon, lat, address, displayName) { L.Geosearch.ReverseResult = function (lon, lat, address, displayName) {
this.lon = lon; this.lon = lon;
this.lat = lat; this.lat = lat;
this.address = address; this.address = address;
this.displayName = displayName; this.displayName = displayName;
}; };
Result = function (lon, lat, displayName) { L.Geosearch.Result = function (lon, lat, displayName) {
this.lon = lon; this.lon = lon;
this.lat = lat; this.lat = lat;
this.displayName = displayName; this.displayName = displayName;
}; };
OsmProvider = L.Class.extend({ L.Geosearch.Provider.OsmProvider = L.Class.extend({
options : { options : {
reverseable: true reverseable: true
}, },
...@@ -70,7 +70,7 @@ define(['leaflet'], function(L) { ...@@ -70,7 +70,7 @@ define(['leaflet'], function(L) {
var results = []; var results = [];
for (var i = 0; i < data.length; i++) for (var i = 0; i < data.length; i++)
results.push(new Result( results.push(new L.Geosearch.Result(
data[i].lon, data[i].lon,
data[i].lat, data[i].lat,
data[i].display_name data[i].display_name
...@@ -84,7 +84,7 @@ define(['leaflet'], function(L) { ...@@ -84,7 +84,7 @@ define(['leaflet'], function(L) {
return {}; return {};
} }
return new ReverseResult( return new L.Geosearch.ReverseResult(
data.lon, data.lon,
data.lat, data.lat,
data.address, data.address,
...@@ -93,5 +93,5 @@ define(['leaflet'], function(L) { ...@@ -93,5 +93,5 @@ define(['leaflet'], function(L) {
} }
}); });
return OsmProvider; return L.Geosearch.Provider.OsmProvider;
}); });
...@@ -4,7 +4,7 @@ define(['leaflet', 'console'], function(L, logger) { ...@@ -4,7 +4,7 @@ define(['leaflet', 'console'], function(L, logger) {
position: 'bottomright' position: 'bottomright'
}, },
onAdd: function (map) { onAdd: function() {
this._container = L.DomUtil.create('div', 'help-control'); this._container = L.DomUtil.create('div', 'help-control');
this._container.id = 'help-control-div'; this._container.id = 'help-control-div';
this._container.className = 'help-control-div'; this._container.className = 'help-control-div';
......
...@@ -4,7 +4,7 @@ define(['leaflet', 'console'], function(L, logger) { ...@@ -4,7 +4,7 @@ define(['leaflet', 'console'], function(L, logger) {
position: 'bottomright' position: 'bottomright'
}, },
onAdd: function (map) { onAdd: function() {
this._container = L.DomUtil.create('div', 'settings-control'); this._container = L.DomUtil.create('div', 'settings-control');
this._container.id = 'settings-control-div'; this._container.id = 'settings-control-div';
this._container.className = 'settings-control-div'; this._container.className = 'settings-control-div';
......
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) { 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 // Private static fields
var INNSBRUCK = [47.265718, 11.391342]; var INNSBRUCK = [47.265718, 11.391342];
var VIENNA = [48.186312, 16.317615]; // var VIENNA = [48.186312, 16.317615];
// Class function (a.k.a. constructor) // Class function (a.k.a. constructor)
function IsoMap(div) { function IsoMap(div) {
......
...@@ -28,7 +28,7 @@ define(['leaflet', 'console'], function(L, logger) { ...@@ -28,7 +28,7 @@ define(['leaflet', 'console'], function(L, logger) {
return quad; return quad;
}, },
getTileUrl: function(p, z) { getTileUrl: function(p) {
var zoom = this._getZoomForUrl(); var zoom = this._getZoomForUrl();
var subdomains = this.options.subdomains, var subdomains = this.options.subdomains,
s = this.options.subdomains[Math.abs((p.x + p.y) % subdomains.length)]; s = this.options.subdomains[Math.abs((p.x + p.y) % subdomains.length)];
...@@ -46,18 +46,18 @@ define(['leaflet', 'console'], function(L, logger) { ...@@ -46,18 +46,18 @@ define(['leaflet', 'console'], function(L, logger) {
var e = document.getElementById(cbid); var e = document.getElementById(cbid);
e.parentNode.removeChild(e); e.parentNode.removeChild(e);
if (meta.errorDetails) { if (meta.errorDetails) {
logger.log("Leaflet Bing Plugin Error - Got metadata: " + meta.errorDetails); logger.log('Leaflet Bing Plugin Error - Got metadata: ' + meta.errorDetails);
return; return;
} }
_this.initMetadata(); _this.initMetadata();
}; };
var url = document.location.protocol + "//dev.virtualearth.net/REST/v1/Imagery/Metadata/" + this.options.type + "?include=ImageryProviders&jsonp=" + cbid + 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); '&key=' + this._key + '&UriScheme=' + document.location.protocol.slice(0, -1);
var script = document.createElement("script"); var script = document.createElement('script');
script.type = "text/javascript"; script.type = 'text/javascript';
script.src = url; script.src = url;
script.id = cbid; script.id = cbid;
document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName('head')[0].appendChild(script);
}, },
initMetadata: function() { initMetadata: function() {
......
...@@ -47,7 +47,7 @@ define(['leaflet'], function(L) { ...@@ -47,7 +47,7 @@ define(['leaflet'], function(L) {
map.on('zoomanim', this._handleZoomAnim, this); map.on('zoomanim', this._handleZoomAnim, this);
//20px instead of 1em to avoid a slight overlap with google's attribution //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._reset();
this._update(); this._update();
...@@ -63,7 +63,7 @@ define(['leaflet'], function(L) { ...@@ -63,7 +63,7 @@ define(['leaflet'], function(L) {
this._map.off('zoomanim', this._handleZoomAnim, this); 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); //this._map.off('moveend', this._update, this);
}, },
...@@ -79,8 +79,8 @@ define(['leaflet'], function(L) { ...@@ -79,8 +79,8 @@ define(['leaflet'], function(L) {
}, },
setElementSize: function(e, size) { setElementSize: function(e, size) {
e.style.width = size.x + "px"; e.style.width = size.x + 'px';
e.style.height = size.y + "px"; e.style.height = size.y + 'px';
}, },
_initContainer: function() { _initContainer: function() {
...@@ -89,8 +89,8 @@ define(['leaflet'], function(L) { ...@@ -89,8 +89,8 @@ define(['leaflet'], function(L) {
if (!this._container) { if (!this._container) {
this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left'); this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left');
this._container.id = "_GMapContainer_" + L.Util.stamp(this); this._container.id = '_GMapContainer_' + L.Util.stamp(this);
this._container.style.zIndex = "auto"; this._container.style.zIndex = 'auto';
} }
tilePane.insertBefore(this._container, first); tilePane.insertBefore(this._container, first);
...@@ -118,11 +118,11 @@ define(['leaflet'], function(L) { ...@@ -118,11 +118,11 @@ define(['leaflet'], function(L) {
}); });
var _this = this; var _this = this;
this._reposition = google.maps.event.addListenerOnce(map, "center_changed", this._reposition = google.maps.event.addListenerOnce(map, 'center_changed',
function() { _this.onReposition(); }); function() { _this.onReposition(); });
this._google = map; this._google = map;
google.maps.event.addListenerOnce(map, "idle", google.maps.event.addListenerOnce(map, 'idle',
function() { _this._checkZoomLevels(); }); function() { _this._checkZoomLevels(); });
}, },
...@@ -140,7 +140,7 @@ define(['leaflet'], function(L) { ...@@ -140,7 +140,7 @@ define(['leaflet'], function(L) {
this._reset(e.hard); this._reset(e.hard);
}, },
_reset: function(clearOldContainer) { _reset: function() {
this._initContainer(); this._initContainer();
}, },
...@@ -178,7 +178,7 @@ define(['leaflet'], function(L) { ...@@ -178,7 +178,7 @@ define(['leaflet'], function(L) {
onReposition: function() { onReposition: function() {
if (!this._google) return; if (!this._google) return;
google.maps.event.trigger(this._google, "resize"); google.maps.event.trigger(this._google, 'resize');
} }
}); });
......
...@@ -31,18 +31,18 @@ define(['jQuery', 'console'], function($, logger) { ...@@ -31,18 +31,18 @@ define(['jQuery', 'console'], function($, logger) {
} else if (websocket.readyState === websocket.CONNECTING) { } else if (websocket.readyState === websocket.CONNECTING) {
setTimeout(this.sendWsMessage.bind(this, msg), 100); setTimeout(this.sendWsMessage.bind(this, msg), 100);
} else { } 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 // Private methods
function onOpen(evt) { function onOpen(evt) {
logger.debug("Opening connection to websocket"); logger.debug('Opening connection to websocket', evt);
} }
function onClose(evt) { function onClose(evt) {
logger.debug("Closing connection to websocket"); logger.debug('Closing connection to websocket', evt);
} }
function onMessage(evt) { function onMessage(evt) {
...@@ -51,7 +51,7 @@ define(['jQuery', 'console'], function($, logger) { ...@@ -51,7 +51,7 @@ define(['jQuery', 'console'], function($, logger) {
var jsonResponse = jQuery.parseJSON(jsonString); var jsonResponse = jQuery.parseJSON(jsonString);
if (!jsonResponse.action) { if (!jsonResponse.action) {
logger.warn("Invalid server response. No action attribute set"); logger.warn('Invalid server response. No action attribute set');
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment