Fix some JSHint complaints

This commit is contained in:
Tom Hughes 2015-02-23 20:47:38 +00:00
parent 6671a934bf
commit 1596713871
22 changed files with 96 additions and 93 deletions

View file

@ -19,12 +19,12 @@ function GraphHopperEngine(id, vehicleParam) {
getRoute: function (points, callback) {
// documentation
// https://github.com/graphhopper/graphhopper/blob/master/docs/web/api-doc.md
var url = document.location.protocol + "//graphhopper.com/api/1/route?"
+ vehicleParam
+ "&locale=" + I18n.currentLocale()
+ "&key=LijBPDQGfu7Iiq80w3HzwB4RUDJbMbhs6BU0dEnn"
+ "&type=jsonp"
+ "&instructions=true";
var url = document.location.protocol + "//graphhopper.com/api/1/route?" +
vehicleParam +
"&locale=" + I18n.currentLocale() +
"&key=LijBPDQGfu7Iiq80w3HzwB4RUDJbMbhs6BU0dEnn" +
"&type=jsonp" +
"&instructions=true";
for (var i = 0; i < points.length; i++) {
url += "&point=" + points[i].lat + ',' + points[i].lng;
@ -34,7 +34,7 @@ function GraphHopperEngine(id, vehicleParam) {
url: url,
dataType: 'jsonp',
success: function (data) {
if (!data.paths || data.paths.length == 0)
if (!data.paths || data.paths.length === 0)
return callback(true);
var path = data.paths[0];
@ -70,5 +70,5 @@ function GraphHopperEngine(id, vehicleParam) {
};
}
OSM.Directions.addEngine(GraphHopperEngine("graphhopper_bicycle", "vehicle=bike"), true);
OSM.Directions.addEngine(GraphHopperEngine("graphhopper_foot", "vehicle=foot"), true);
OSM.Directions.addEngine(new GraphHopperEngine("graphhopper_bicycle", "vehicle=bike"), true);
OSM.Directions.addEngine(new GraphHopperEngine("graphhopper_foot", "vehicle=foot"), true);

View file

@ -45,7 +45,7 @@ function MapQuestEngine(id, vehicleParam) {
$.ajax({
url: url,
success: function (data) {
if (data.info.statuscode != 0)
if (data.info.statuscode !== 0)
return callback(true);
var line = [];
@ -63,7 +63,7 @@ function MapQuestEngine(id, vehicleParam) {
var d;
var linesegstart, linesegend, lineseg;
linesegstart = data.route.shape.maneuverIndexes[i];
if (i == mq.length - 1) {
if (i === mq.length - 1) {
d = 15;
linesegend = linesegstart + 1;
} else {
@ -81,7 +81,7 @@ function MapQuestEngine(id, vehicleParam) {
line: line,
steps: steps,
distance: data.route.distance * 1000,
time: data.route['time']
time: data.route.time
});
}
});
@ -89,6 +89,6 @@ function MapQuestEngine(id, vehicleParam) {
};
}
OSM.Directions.addEngine(MapQuestEngine("mapquest_bicycle", "routeType=bicycle"), true);
OSM.Directions.addEngine(MapQuestEngine("mapquest_foot", "routeType=pedestrian"), true);
OSM.Directions.addEngine(MapQuestEngine("mapquest_car", "routeType=fastest"), true);
OSM.Directions.addEngine(new MapQuestEngine("mapquest_bicycle", "routeType=bicycle"), true);
OSM.Directions.addEngine(new MapQuestEngine("mapquest_foot", "routeType=pedestrian"), true);
OSM.Directions.addEngine(new MapQuestEngine("mapquest_car", "routeType=fastest"), true);

View file

@ -48,7 +48,7 @@ function OSRMEngine() {
url: url,
dataType: 'json',
success: function (data) {
if (data.status == 207)
if (data.status === 207)
return callback(true);
previousPoints = points;
@ -68,7 +68,7 @@ function OSRMEngine() {
if (instCodes[1]) {
instText += "exit " + instCodes[1] + " ";
}
if (instCodes[0] != 15) {
if (instCodes[0] !== 15) {
instText += s[1] ? "<b>" + s[1] + "</b>" : I18n.t('javascripts.directions.instructions.unnamed');
}
if ((i + 1) < data.route_instructions.length) {
@ -91,4 +91,4 @@ function OSRMEngine() {
};
}
OSM.Directions.addEngine(OSRMEngine(), true);
OSM.Directions.addEngine(new OSRMEngine(), true);