jshint fixes

This commit is contained in:
John Firebaugh
2013-10-24 14:58:31 -07:00
parent ea7f84f1bd
commit 8323c948a7
24 changed files with 45 additions and 34 deletions
+1 -1
View File
@@ -25,5 +25,5 @@ iD.actions.AddMember = function(relationId, member, memberIndex) {
}
return graph.replace(relation.addMember(member, memberIndex));
}
};
};
+1 -1
View File
@@ -1,5 +1,5 @@
iD.actions.ChangeMember = function(relationId, member, memberIndex) {
return function(graph) {
return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
}
};
};
+2
View File
@@ -19,6 +19,7 @@ iD.actions.Connect = function(nodeIds) {
for (var i = 0; i < nodeIds.length - 1; i++) {
var node = graph.entity(nodeIds[i]);
/*jshint -W083 */
graph.parentWays(node).forEach(function(parent) {
if (!parent.areAdjacent(node.id, survivor.id)) {
graph = graph.replace(parent.replaceNode(node.id, survivor.id));
@@ -28,6 +29,7 @@ iD.actions.Connect = function(nodeIds) {
graph.parentRelations(node).forEach(function(parent) {
graph = graph.replace(parent.replaceMember(node, survivor));
});
/*jshint +W083 */
survivor = survivor.mergeTags(node.tags);
graph = iD.actions.DeleteNode(node.id)(graph);
+1 -1
View File
@@ -12,5 +12,5 @@ iD.actions.DiscardTags = function(difference) {
difference.created().forEach(discardTags);
return graph;
}
};
};
+1 -1
View File
@@ -27,7 +27,7 @@ iD.actions.Straighten = function(wayId, projection) {
var u = positionAlongWay(point, startPoint, endPoint),
p0 = startPoint[0] + u * (endPoint[0] - startPoint[0]),
p1 = startPoint[1] + u * (endPoint[1] - startPoint[1]),
p1 = startPoint[1] + u * (endPoint[1] - startPoint[1]);
graph = graph.replace(graph.entity(node.id)
.move(projection.invert([p0, p1])));
+4 -4
View File
@@ -28,10 +28,10 @@ iD.behavior.drag = function() {
event.of = function(thiz, argumentz) {
return function(e1) {
var e0 = e1.sourceEvent = d3.event;
e1.target = drag;
d3.event = e1;
try {
var e0 = e1.sourceEvent = d3.event;
e1.target = drag;
d3.event = e1;
event[e1.type].apply(thiz, argumentz);
} finally {
d3.event = e0;
@@ -64,7 +64,7 @@ iD.behavior.drag = function() {
offset,
origin_ = point(),
started = false,
selectEnable = d3_event_userSelectSuppress(touchId != null ? "drag-" + touchId : "drag");
selectEnable = d3_event_userSelectSuppress(touchId !== null ? "drag-" + touchId : "drag");
var w = d3.select(window)
.on(touchId !== null ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove)
+2 -2
View File
@@ -81,7 +81,7 @@ iD.behavior.Hover = function(context) {
function mousedown() {
down = true;
d3.select(window)
.on('mouseup.hover', mouseup)
.on('mouseup.hover', mouseup);
}
function mouseup() {
@@ -114,7 +114,7 @@ iD.behavior.Hover = function(context) {
d3.select(window)
.on('keydown.hover', null)
.on('keyup.hover', null)
.on('mouseup.hover', null)
.on('mouseup.hover', null);
};
hover.altDisables = function(_) {
+1 -1
View File
@@ -315,7 +315,7 @@ iD.Connection = function() {
extent: iD.geo.Extent(
projection.invert([x, y + ts]),
projection.invert([x + ts, y]))
}
};
});
function bboxUrl(tile) {
+11 -7
View File
@@ -233,14 +233,18 @@ iD.History = function(context) {
stack = h.stack.map(function(d) {
var entities = {}, entity;
d.modified && d.modified.forEach(function(key) {
entity = allEntities[key];
entities[entity.id] = entity;
});
if (d.modified) {
d.modified.forEach(function(key) {
entity = allEntities[key];
entities[entity.id] = entity;
});
}
d.deleted && d.deleted.forEach(function(id) {
entities[id] = undefined;
});
if (d.deleted) {
d.deleted.forEach(function(id) {
entities[id] = undefined;
});
}
return {
graph: iD.Graph(stack[0].graph).load(entities),
+1 -1
View File
@@ -40,7 +40,7 @@ _.extend(iD.Relation.prototype, {
indexedMembers: function() {
var result = new Array(this.members.length);
for (var i = 0; i < this.members.length; i++) {
result[i] = _.extend({}, this.members[i], {index: i})
result[i] = _.extend({}, this.members[i], {index: i});
}
return result;
},
+1
View File
@@ -1 +1,2 @@
/* jshint ignore:start */
})();
+1 -1
View File
@@ -34,7 +34,7 @@ _.extend(iD.geo.Extent.prototype, {
[this[1][0], this[1][1]],
[this[1][0], this[0][1]],
[this[0][0], this[0][1]]
]
];
},
intersects: function(obj) {
+1 -1
View File
@@ -107,7 +107,7 @@ window.iD = function () {
var result = fn.apply(history, arguments);
debouncedSave();
return result;
}
};
}
context.perform = withDebouncedSave(history.perform);
+1 -1
View File
@@ -85,7 +85,7 @@ iD.Background = function(context) {
gpx.call(gpxLayer);
var overlays = selection.selectAll('.overlay-layer')
.data(overlayLayers, function(d) { return d.source().name });
.data(overlayLayers, function(d) { return d.source().name; });
overlays.enter().insert('div', '.layer-data')
.attr('class', 'layer-layer overlay-layer');
+1 -1
View File
@@ -255,7 +255,7 @@ iD.Map = function(context) {
map.mouse = function() {
var e = mousemove || d3.event, s;
while (s = e.sourceEvent) e = s;
while ((s = e.sourceEvent)) e = s;
return mouse(e);
};
+1
View File
@@ -1,2 +1,3 @@
/* jshint ignore:start */
(function () {
'use strict';
+1 -1
View File
@@ -31,7 +31,7 @@ iD.svg = {
if (entity.id in cache) {
return cache[entity.id];
} else {
return cache[entity.id] = path(entity.asGeoJSON(graph, polygon));
return cache[entity.id] = path(entity.asGeoJSON(graph, polygon)); // jshint ignore:line
}
};
},
+2 -1
View File
@@ -35,7 +35,8 @@ iD.svg.Areas = function(projection) {
var entity = entities[i];
if (entity.geometry(graph) !== 'area') continue;
if (multipolygon = iD.geo.isSimpleMultipolygonOuterMember(entity, graph)) {
multipolygon = iD.geo.isSimpleMultipolygonOuterMember(entity, graph);
if (multipolygon) {
areas[multipolygon.id] = {
entity: multipolygon.mergeTags(entity.tags),
area: Math.abs(entity.area(graph))
+1 -1
View File
@@ -68,7 +68,7 @@ iD.svg.Restrictions = function(context) {
to: to,
restriction: restriction,
angle: Math.atan2(b[1] - a[1], b[0] - a[0])
}
};
};
return drawRestrictions;
+5 -4
View File
@@ -60,9 +60,10 @@ iD.svg.Vertices = function(projection, context) {
var icons = {};
function icon(entity) {
if (entity.id in icons) return icons[entity.id];
return icons[entity.id] = (zoom !== 0 &&
icons[entity.id] = zoom !== 0 &&
entity.hasInterestingTags() &&
context.presets().match(entity, graph).icon);
context.presets().match(entity, graph).icon;
return icons[entity.id];
}
function circle(klass) {
@@ -75,7 +76,7 @@ iD.svg.Vertices = function(projection, context) {
this.setAttribute('cx', c);
this.setAttribute('cy', -c);
this.setAttribute('r', r);
}
};
}
var enter = groups.enter().append('g')
@@ -120,7 +121,7 @@ iD.svg.Vertices = function(projection, context) {
if (entity.id in selected ||
entity.hasInterestingTags() ||
entity.isIntersection(graph)) {
vertices.push(entity)
vertices.push(entity);
}
}
+1 -1
View File
@@ -103,7 +103,7 @@ iD.ui.PresetList = function(context) {
function drawList(list, presets) {
var collection = presets.collection.map(function(preset) {
return preset.members ? CategoryItem(preset) : PresetItem(preset)
return preset.members ? CategoryItem(preset) : PresetItem(preset);
});
var items = list.selectAll('.preset-list-item')
+1 -1
View File
@@ -75,7 +75,7 @@ iD.ui.RawMembershipEditor = function(context) {
if (member.id === entity.id) {
memberships.push({relation: relation, member: member, index: index});
}
})
});
});
selection.call(iD.ui.Disclosure()
+1 -1
View File
@@ -13,7 +13,7 @@ iD.ui.Success = function(context) {
.attr('class', 'fr')
.append('span')
.attr('class', 'icon close')
.on('click', function() { event.cancel(success) });
.on('click', function() { event.cancel(success); });
header.append('h3')
.text(t('success.just_edited'));
+2 -1
View File
@@ -17,7 +17,7 @@ iD.util.entityOrMemberSelector = function(ids, graph) {
var entity = graph.hasEntity(id);
if (entity && entity.type === 'relation') {
entity.members.forEach(function(member) {
s += ',.' + member.id
s += ',.' + member.id;
});
}
});
@@ -130,6 +130,7 @@ iD.util.fastMouse = function(container) {
};
};
/* jshint -W103 */
iD.util.getPrototypeOf = Object.getPrototypeOf || function(obj) { return obj.__proto__; };
iD.util.asyncMap = function(inputs, func, callback) {