return {
id: id,
- creditline: '<a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png">',
+ creditline: '<a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="' + document.location.protocol + '//developer.mapquest.com/content/osm/mq_logo.png">',
draggable: false,
getRoute: function (points, callback) {
url += "&manMaps=false";
url += "&shapeFormat=raw&generalize=0&unit=k";
- $.ajax({
+ return $.ajax({
url: url,
success: function (data) {
- if (data.info.statuscode != 0)
+ if (data.info.statuscode !== 0)
return callback(true);
+ var i;
var line = [];
var shape = data.route.shape.shapePoints;
- for (var i = 0; i < shape.length; i += 2) {
+ for (i = 0; i < shape.length; i += 2) {
line.push(L.latLng(shape[i], shape[i + 1]));
}
// data.route.legs[0].maneuvers is list of turns
var steps = [];
var mq = data.route.legs[0].maneuvers;
- for (var i = 0; i < mq.length; i++) {
+ for (i = 0; i < mq.length; i++) {
var s = mq[i];
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 {
line: line,
steps: steps,
distance: data.route.distance * 1000,
- time: data.route['time']
+ time: data.route.time
});
}
});
};
}
-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);