diff --git a/build.gradle b/build.gradle index bb59f78f6ed50bae19965dd1b6e3cba239efd3a1..d63fbfa9643e1b253e14d723fe1745539aec7611 100644 --- a/build.gradle +++ b/build.gradle @@ -191,7 +191,7 @@ 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] + jshint.predef = ['$': false, 'define': false, 'google': false, 'require': false] source = fileTree(dir: 'src/main/webapp/js', include: '**/*.js', exclude: ['**/*.min.js', 'lib/**']) dest = file("${buildDir}/reports/jshint/main.xml") diff --git a/src/main/webapp/js/isochrone/configuration.js b/src/main/webapp/js/isochrone/configuration.js index 27b50a6e580618030b6f7f29be580ba248cc85c6..e8477a2f23ad7332c9c378bd9789348e47a81a57 100644 --- a/src/main/webapp/js/isochrone/configuration.js +++ b/src/main/webapp/js/isochrone/configuration.js @@ -29,7 +29,7 @@ define(['console'], function(logger) { return { getInstance: function() { - if (instance == null) { + if (instance === null) { instance = new Configuration(); } diff --git a/src/main/webapp/js/isochrone/initHelper.js b/src/main/webapp/js/isochrone/initHelper.js index 3e2a92196241eb8893e39a1e2f27980598608f47..ef6a171af2a5a4135c7b9b3f1149a63b52a60018 100644 --- a/src/main/webapp/js/isochrone/initHelper.js +++ b/src/main/webapp/js/isochrone/initHelper.js @@ -33,8 +33,8 @@ define(['jQuery', 'console', 'map/isoMap', 'service/websocket', 'service/service }); $('#speed').spinner({ - step: 0.1, - numberFormat: 'n' + step: 0.1, + numberFormat: 'n' }); $('#settings-dialog select').css({'width':'100%'}); diff --git a/src/main/webapp/js/isochrone/searchExtender.js b/src/main/webapp/js/isochrone/searchExtender.js index fe8267976b8d42737b6b76d9817d4f4733a7e9d4..9902704f8c5231d2173e36fdb157f47cc05dee30 100644 --- a/src/main/webapp/js/isochrone/searchExtender.js +++ b/src/main/webapp/js/isochrone/searchExtender.js @@ -28,11 +28,11 @@ define(['jQuery', 'map/isoMap', 'isochrone/configuration'], function($, isoMap, // Check if only one datasets bbox contains the query point. // If so... return the matching dataset config var resultLength = configCandidates.length; - if (resultLength == 0) { + if (resultLength === 0) { return null; } - if (resultLength == 1) { + if (resultLength === 1) { // TODO: Should we combine this with the dataset dropdown in the settings? // Should we remove the combobox? return configCandidates[0]; @@ -58,8 +58,8 @@ define(['jQuery', 'map/isoMap', 'isochrone/configuration'], function($, isoMap, function onSearchResult(data) { var divIcons, dSetConfigs = null, - iconIsochrone = null, - li; + iconIsochrone = null, + li; if (!data.queryPoint) { return; diff --git a/src/main/webapp/js/map/control/geosearch.js b/src/main/webapp/js/map/control/geosearch.js index b230d8d588fcfbe213714f57d352ff0b85e4b784..1ad53bddb2531774e12bfe72164cc65d258ea6e2 100644 --- a/src/main/webapp/js/map/control/geosearch.js +++ b/src/main/webapp/js/map/control/geosearch.js @@ -88,9 +88,9 @@ define(['leaflet'], function(L) { this._container.appendChild(this._msgbox); L.DomEvent - .addListener(this._container, 'click', L.DomEvent.stop) - .addListener(this._searchbtn, 'click', this._onSearchClick, this) - .addListener(this._searchbox, 'keypress', this._onKeyUp, this); + .addListener(this._container, 'click', L.DomEvent.stop) + .addListener(this._searchbtn, 'click', this._onSearchClick, this) + .addListener(this._searchbox, 'keypress', this._onKeyUp, this); if (this._config.doReverseLookup && this._config.provider.options.reverseable) { L.DomEvent.addListener(this._map, 'click', this._onMapClick, this); @@ -125,25 +125,25 @@ define(['leaflet'], function(L) { var xhr = new XMLHttpRequest(); if ('withCredentials' in xhr) { - var xhr = new XMLHttpRequest(); + var xhrSec = new XMLHttpRequest(); - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { - var response = JSON.parse(xhr.responseText), + xhrSec.onreadystatechange = function () { + if (xhrSec.readyState == 4) { + if (xhrSec.status == 200) { + var response = JSON.parse(xhrSec.responseText), results = provider.ParseJSON(response); that._processResults(results); - } else if (xhr.status == 0 || xhr.status == 400) { + } else if (xhrSec.status === 0 || xhrSec.status === 400) { getJsonP(url); } else { - that._printError(xhr.responseText); + that._printError(xhrSec.responseText); } } }; - xhr.open('GET', url, true); - xhr.send(); + xhrSec.open('GET', url, true); + xhrSec.send(); } else if (XDomainRequest) { var xdr = new XDomainRequest(); @@ -183,7 +183,7 @@ define(['leaflet'], function(L) { }, _clearResult : function() { - if (this._timeout != null) { + if (this._timeout !== null) { clearTimeout(this._timeout); this._timeout = null; } @@ -195,7 +195,7 @@ define(['leaflet'], function(L) { _clearSuggestList : function() { this._suggestSet = []; - if (this._timeout != null) { + if (this._timeout !== null) { clearTimeout(this._timeout); this._timeout = null; } @@ -315,7 +315,7 @@ define(['leaflet'], function(L) { txtDescription = null, txtName = null; - if (result.lat == undefined || result.lon == undefined) { + if (result.lat === undefined || result.lon === undefined) { return; } @@ -356,7 +356,7 @@ define(['leaflet'], function(L) { for (i = 0, j = 0; i < results.length; ++i) { r = results[i]; - if (r.lat == undefined || r.lon == undefined) { + if (r.lat === undefined || r.lon === undefined) { continue; } @@ -383,7 +383,7 @@ define(['leaflet'], function(L) { this._setResult(location); this._clearSuggestList(); - if (this.options.showMarker == true) { + if (this.options.showMarker === true) { if (typeof this._positionMarker === 'undefined') { this._positionMarker = L.marker([location.lat, location.lon]).addTo(this._map); } else { diff --git a/src/main/webapp/js/service/serviceConfiguration.js b/src/main/webapp/js/service/serviceConfiguration.js index d2deb6364a1fc7dea01d454dbb4cbbb1b7ff5d31..24c6844081a0ae2a81717f4a79457557a616fdf5 100644 --- a/src/main/webapp/js/service/serviceConfiguration.js +++ b/src/main/webapp/js/service/serviceConfiguration.js @@ -59,7 +59,7 @@ define(['jQuery', 'leaflet', 'console', 'isochrone/configuration'], function($, } return result; - }; + } /** * Converts a point from projection EPSG:3857 to LatLng (EPSG:4326)