From f10af56b978aba1f998e76db2f969aa877d058a3 Mon Sep 17 00:00:00 2001 From: Nikolaus Krismer <niko@krismer.de> Date: Fri, 14 Feb 2014 19:09:12 +0100 Subject: [PATCH] fixed further jsHint warnings --- build.gradle | 2 +- src/main/webapp/js/isochrone/configuration.js | 2 +- src/main/webapp/js/isochrone/initHelper.js | 4 +-- .../webapp/js/isochrone/searchExtender.js | 8 ++--- src/main/webapp/js/map/control/geosearch.js | 34 +++++++++---------- .../webapp/js/service/serviceConfiguration.js | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index bb59f78f..d63fbfa9 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 27b50a6e..e8477a2f 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 3e2a9219..ef6a171a 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 fe826797..9902704f 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 b230d8d5..1ad53bdd 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 d2deb636..24c68440 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) -- GitLab