diff --git a/modules/actions/add_member.js b/modules/actions/add_member.js index b3e6bafb9..db9d58d21 100644 --- a/modules/actions/add_member.js +++ b/modules/actions/add_member.js @@ -1,4 +1,5 @@ import { joinWays } from '../geo/index'; + export function AddMember(relationId, member, memberIndex) { return function(graph) { var relation = graph.entity(relationId); diff --git a/modules/actions/add_midpoint.js b/modules/actions/add_midpoint.js index 5ce114c9c..b3a370617 100644 --- a/modules/actions/add_midpoint.js +++ b/modules/actions/add_midpoint.js @@ -1,5 +1,6 @@ import _ from 'lodash'; import { edgeEqual } from '../geo/index'; + export function AddMidpoint(midpoint, node) { return function(graph) { graph = graph.replace(node.move(midpoint.loc)); diff --git a/modules/actions/circularize.js b/modules/actions/circularize.js index f4e56098b..bc63a2c7b 100644 --- a/modules/actions/circularize.js +++ b/modules/actions/circularize.js @@ -1,7 +1,7 @@ import * as d3 from 'd3'; +import _ from 'lodash'; import { euclideanDistance, interp } from '../geo/index'; import { Node } from '../core/index'; -import _ from 'lodash'; export function Circularize(wayId , projection, maxAngle) { diff --git a/modules/actions/connect.js b/modules/actions/connect.js index 5ccd0e5e9..6437ff52d 100644 --- a/modules/actions/connect.js +++ b/modules/actions/connect.js @@ -1,5 +1,5 @@ -import { DeleteNode } from './delete_node'; import _ from 'lodash'; +import { DeleteNode } from './delete_node'; // Connect the ways at the given nodes. // diff --git a/modules/actions/disconnect.js b/modules/actions/disconnect.js index dbc2a08ed..f96fcf0f8 100644 --- a/modules/actions/disconnect.js +++ b/modules/actions/disconnect.js @@ -1,3 +1,5 @@ +import { Node } from '../core/index'; + // Disconect the ways at the given node. // // Optionally, disconnect only the given ways. @@ -12,7 +14,6 @@ // https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/UnjoinNodeAction.as // https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/actions/UnGlueAction.java // -import { Node } from '../core/index'; export function Disconnect(nodeId, newNodeId) { var wayIds; diff --git a/modules/actions/join.js b/modules/actions/join.js index 2f45b5ac8..a9b0afaf5 100644 --- a/modules/actions/join.js +++ b/modules/actions/join.js @@ -1,4 +1,8 @@ import _ from 'lodash'; +import { DeleteWay } from './delete_way'; +import { interestingTag } from '../core/index'; +import { joinWays } from '../geo/index'; + // Join ways at the end node they share. // // This is the inverse of `iD.actions.Split`. @@ -7,10 +11,6 @@ import _ from 'lodash'; // https://github.com/systemed/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MergeWaysAction.as // https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/actions/CombineWayAction.java // -import { DeleteWay } from './delete_way'; -import { interestingTag } from '../core/index'; -import { joinWays } from '../geo/index'; - export function Join(ids) { function groupEntitiesByGeometry(graph) { diff --git a/modules/actions/merge.js b/modules/actions/merge.js index 13b74f6f9..5aae60cfc 100644 --- a/modules/actions/merge.js +++ b/modules/actions/merge.js @@ -1,4 +1,5 @@ import _ from 'lodash'; + export function Merge(ids) { function groupEntitiesByGeometry(graph) { var entities = ids.map(function(id) { return graph.entity(id); }); diff --git a/modules/actions/merge_remote_changes.js b/modules/actions/merge_remote_changes.js index aa725417c..c130a06fc 100644 --- a/modules/actions/merge_remote_changes.js +++ b/modules/actions/merge_remote_changes.js @@ -1,5 +1,5 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { DeleteMultiple } from './delete_multiple'; import { Entity } from '../core/index'; import { diff3_merge } from '../util/diff3'; diff --git a/modules/actions/move.js b/modules/actions/move.js index c19cad604..23fa57755 100644 --- a/modules/actions/move.js +++ b/modules/actions/move.js @@ -1,6 +1,5 @@ import _ from 'lodash'; -// https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/command/MoveCommand.java -// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MoveNodeAction.as +import { Node } from '../core/index'; import { chooseEdge, angle as getAngle, @@ -9,8 +8,9 @@ import { pathLength, sphericalDistance } from '../geo/index'; -import { Node } from '../core/index'; +// https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/command/MoveCommand.java +// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MoveNodeAction.as export function Move(moveIds, tryDelta, projection, cache) { var delta = tryDelta; diff --git a/modules/actions/orthogonalize.js b/modules/actions/orthogonalize.js index e73aa748d..983c8dfc0 100644 --- a/modules/actions/orthogonalize.js +++ b/modules/actions/orthogonalize.js @@ -1,10 +1,10 @@ import _ from 'lodash'; import { DeleteNode } from './delete_node'; import { euclideanDistance } from '../geo/index'; + /* * Based on https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/potlatch2/tools/Quadrilateralise.as */ - export function Orthogonalize(wayId, projection) { var threshold = 12, // degrees within right or straight to alter lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180), diff --git a/modules/actions/restrict_turn.js b/modules/actions/restrict_turn.js index 52e74c11a..0afc7c68a 100644 --- a/modules/actions/restrict_turn.js +++ b/modules/actions/restrict_turn.js @@ -1,6 +1,7 @@ import { Relation, Way } from '../core/index'; import { Split } from './split'; import { inferRestriction } from '../geo/index'; + // Create a restriction relation for `turn`, which must have the following structure: // // { diff --git a/modules/actions/revert.js b/modules/actions/revert.js index b5deab6fa..1580bd595 100644 --- a/modules/actions/revert.js +++ b/modules/actions/revert.js @@ -2,7 +2,6 @@ import { DeleteRelation } from './delete_relation'; import { DeleteWay } from './delete_way'; export function Revert(id) { - var action = function(graph) { var entity = graph.hasEntity(id), base = graph.base().entities[id]; diff --git a/modules/actions/rotate_way.js b/modules/actions/rotate_way.js index 4838cfff5..539d73714 100644 --- a/modules/actions/rotate_way.js +++ b/modules/actions/rotate_way.js @@ -1,4 +1,5 @@ import _ from 'lodash'; + export function RotateWay(wayId, pivot, angle, projection) { return function(graph) { return graph.update(function(graph) { diff --git a/modules/actions/straighten.js b/modules/actions/straighten.js index a3ef944e2..a66ec0a24 100644 --- a/modules/actions/straighten.js +++ b/modules/actions/straighten.js @@ -3,7 +3,6 @@ import { DeleteNode } from './delete_node'; /* * Based on https://github.com/openstreetmap/potlatch2/net/systemeD/potlatch2/tools/Straighten.as */ - export function Straighten(wayId, projection) { function positionAlongWay(n, s, e) { return ((n[0] - s[0]) * (e[0] - s[0]) + (n[1] - s[1]) * (e[1] - s[1]))/ diff --git a/modules/behavior/add_way.js b/modules/behavior/add_way.js index 1633f5c66..1c3fd4c02 100644 --- a/modules/behavior/add_way.js +++ b/modules/behavior/add_way.js @@ -1,5 +1,5 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../util/rebind'; import { Browse } from '../modes/index'; import { Draw } from './draw'; diff --git a/modules/behavior/copy.js b/modules/behavior/copy.js index 6c5deddbb..c4480ab0a 100644 --- a/modules/behavior/copy.js +++ b/modules/behavior/copy.js @@ -1,7 +1,8 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; import _ from 'lodash'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { cmd } from '../ui/index'; + export function Copy(context) { var keybinding = d3keybinding('copy'); diff --git a/modules/behavior/drag.js b/modules/behavior/drag.js index 5aa661321..0488ae4ca 100644 --- a/modules/behavior/drag.js +++ b/modules/behavior/drag.js @@ -1,6 +1,7 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../util/rebind'; import { prefixCSSProperty, prefixDOMProperty } from '../util/index'; + /* `iD.behavior.drag` is like `d3.behavior.drag`, with the following differences: @@ -62,7 +63,7 @@ export function drag() { function mousedown() { target = this; - event_ = event.call("of", target, arguments); + event_ = event.call('of', target, arguments); var eventTarget = d3.event.target, touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null, offset, @@ -191,7 +192,7 @@ export function drag() { drag.target = function() { if (!arguments.length) return target; target = arguments[0]; - event_ = event.call("of", target, Array.prototype.slice.call(arguments, 1)); + event_ = event.call('of', target, Array.prototype.slice.call(arguments, 1)); return drag; }; diff --git a/modules/behavior/draw.js b/modules/behavior/draw.js index d599331b3..32d97aa09 100644 --- a/modules/behavior/draw.js +++ b/modules/behavior/draw.js @@ -1,14 +1,14 @@ +import * as d3 from 'd3'; import { rebind } from '../util/rebind'; import { getDimensions } from '../util/dimensions'; import { d3keybinding } from '../../js/lib/d3.keybinding.js'; -import * as d3 from 'd3'; import { chooseEdge, euclideanDistance } from '../geo/index'; import { Edit } from './edit'; import { Hover } from './hover'; import { Tail } from './tail'; export function Draw(context) { - var event = d3.dispatch('move', 'click', 'clickWay', + var dispatch = d3.dispatch('move', 'click', 'clickWay', 'clickNode', 'undo', 'cancel', 'finish'), keybinding = d3keybinding('draw'), hover = Hover(context) @@ -76,7 +76,7 @@ export function Draw(context) { function mousemove() { lastMouse = d3.event; - event.call("move", datum()); + dispatch.call('move', datum()); } function mouseenter() { @@ -99,16 +99,16 @@ export function Draw(context) { if (trySnap) { var choice = chooseEdge(context.childNodes(d), context.mouse(), context.projection), edge = [d.nodes[choice.index - 1], d.nodes[choice.index]]; - event.call("clickWay", choice.loc, edge); + dispatch.call('clickWay', choice.loc, edge); } else { - event.call("click", context.map().mouseCoordinates()); + dispatch.call('click', context.map().mouseCoordinates()); } } else if (d.type === 'node') { - event.call("clickNode", d); + dispatch.call('clickNode', d); } else { - event.call("click", context.map().mouseCoordinates()); + dispatch.call('click', context.map().mouseCoordinates()); } } @@ -138,17 +138,17 @@ export function Draw(context) { function backspace() { d3.event.preventDefault(); - event.call("undo"); + dispatch.call('undo'); } function del() { d3.event.preventDefault(); - event.call("cancel"); + dispatch.call('cancel'); } function ret() { d3.event.preventDefault(); - event.call("finish"); + dispatch.call('finish'); } function draw(selection) { @@ -208,7 +208,7 @@ export function Draw(context) { return draw; }; - return rebind(draw, event, 'on'); + return rebind(draw, dispatch, 'on'); } Draw.usedTails = {}; diff --git a/modules/behavior/draw_way.js b/modules/behavior/draw_way.js index 174480295..7d81910a7 100644 --- a/modules/behavior/draw_way.js +++ b/modules/behavior/draw_way.js @@ -1,7 +1,6 @@ -import * as d3 from 'd3'; +import _ from 'lodash'; import { t } from '../util/locale'; import { getDimensions } from '../util/dimensions'; -import _ from 'lodash'; import { AddEntity, AddMidpoint, AddVertex, MoveNode } from '../actions/index'; import { Browse, Select } from '../modes/index'; import { Node, Way } from '../core/index'; diff --git a/modules/behavior/hash.js b/modules/behavior/hash.js index 1024a8766..c696a6787 100644 --- a/modules/behavior/hash.js +++ b/modules/behavior/hash.js @@ -1,6 +1,7 @@ import * as d3 from 'd3'; import _ from 'lodash'; import { qsString, stringQs } from '../util/index'; + export function Hash(context) { var s0 = null, // cached location.hash lat = 90 - 1e-8; // allowable latitude range diff --git a/modules/behavior/hover.js b/modules/behavior/hover.js index 1d4fb4533..36ad4ec4d 100644 --- a/modules/behavior/hover.js +++ b/modules/behavior/hover.js @@ -1,7 +1,8 @@ +import * as d3 from 'd3'; import { rebind } from '../util/rebind'; import { d3keybinding } from '../../js/lib/d3.keybinding.js'; -import * as d3 from 'd3'; import { Entity } from '../core/index'; + /* The hover behavior adds the `.hover` class on mouseover to all elements to which the identical datum is bound, and removes it on mouseout. @@ -19,7 +20,7 @@ export function Hover() { function keydown() { if (altDisables && d3.event.keyCode === d3keybinding.modifierCodes.alt) { - dispatch.call("hover", this, null); + dispatch.call('hover', this, null); selection.selectAll('.hover') .classed('hover-suppressed', true) .classed('hover', false); @@ -28,7 +29,7 @@ export function Hover() { function keyup() { if (altDisables && d3.event.keyCode === d3keybinding.modifierCodes.alt) { - dispatch.call("hover", this, target ? target.id : null); + dispatch.call('hover', this, target ? target.id : null); selection.selectAll('.hover-suppressed') .classed('hover-suppressed', false) .classed('hover', true); @@ -62,9 +63,9 @@ export function Hover() { selection.selectAll(selector) .classed(suppressed ? 'hover-suppressed' : 'hover', true); - dispatch.call("hover", this, target.id); + dispatch.call('hover', this, target.id); } else { - dispatch.call("hover", this, null); + dispatch.call('hover', this, null); } } diff --git a/modules/behavior/paste.js b/modules/behavior/paste.js index 1d496e5a5..d7a37c381 100644 --- a/modules/behavior/paste.js +++ b/modules/behavior/paste.js @@ -1,6 +1,6 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; import _ from 'lodash'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { ChangeTags, CopyEntities, Move as MoveAction} from '../actions/index'; import { Extent, pointInPolygon } from '../geo/index'; import { Move as MoveMode } from '../modes/index'; diff --git a/modules/behavior/select.js b/modules/behavior/select.js index 136276903..b7f23812e 100644 --- a/modules/behavior/select.js +++ b/modules/behavior/select.js @@ -2,6 +2,7 @@ import * as d3 from 'd3'; import _ from 'lodash'; import { Browse, Select as SelectMode } from '../modes/index'; import { Entity } from '../core/index'; + export function Select(context) { function keydown() { if (d3.event && d3.event.shiftKey) { diff --git a/modules/behavior/tail.js b/modules/behavior/tail.js index 03dbbb39c..630388f4f 100644 --- a/modules/behavior/tail.js +++ b/modules/behavior/tail.js @@ -1,6 +1,7 @@ import * as d3 from 'd3'; import { setTransform } from '../util/index'; import { getDimensions } from '../util/dimensions'; + export function Tail() { var text, container, diff --git a/modules/core/connection.js b/modules/core/connection.js index 624aa519d..7f615b258 100644 --- a/modules/core/connection.js +++ b/modules/core/connection.js @@ -1,8 +1,8 @@ +import * as d3 from 'd3'; +import _ from 'lodash'; import { rebind } from '../util/rebind'; import { functor } from '../util/index'; import { d3geoTile } from '../../js/lib/d3.geo.tile'; -import * as d3 from 'd3'; -import _ from 'lodash'; import { Detect } from '../util/detect'; import { Entity } from './entity'; import { Extent } from '../geo/index'; @@ -14,10 +14,10 @@ import osmAuth from 'osm-auth'; export function Connection(useHttps) { if (typeof useHttps !== 'boolean') { - useHttps = window.location.protocol === 'https:'; + useHttps = window.location.protocol === 'https:'; } - var event = d3.dispatch('authenticating', 'authenticated', 'auth', 'loading', 'loaded'), + var dispatch = d3.dispatch('authenticating', 'authenticated', 'auth', 'loading', 'loaded'), protocol = useHttps ? 'https:' : 'http:', url = protocol + '//www.openstreetmap.org', connection = {}, @@ -106,11 +106,11 @@ export function Connection(useHttps) { }; function authenticating() { - event.call("authenticating"); + dispatch.call('authenticating'); } function authenticated() { - event.call("authenticated"); + dispatch.call('authenticated'); } function getLoc(attrs) { @@ -417,7 +417,7 @@ export function Connection(useHttps) { if (loadedTiles[id] || inflight[id]) return; if (_.isEmpty(inflight)) { - event.call("loading"); + dispatch.call('loading'); } inflight[id] = connection.loadFromURL(bboxUrl(tile), function(err, parsed) { @@ -427,7 +427,7 @@ export function Connection(useHttps) { if (callback) callback(err, _.extend({data: parsed}, tile)); if (_.isEmpty(inflight)) { - event.call("loaded"); + dispatch.call('loaded'); } }); }); @@ -439,7 +439,7 @@ export function Connection(useHttps) { loading: authenticating, done: authenticated }, options)); - event.call("auth"); + dispatch.call('auth'); connection.flush(); return connection; }; @@ -466,18 +466,18 @@ export function Connection(useHttps) { connection.logout = function() { userDetails = undefined; oauth.logout(); - event.call("auth"); + dispatch.call('auth'); return connection; }; connection.authenticate = function(callback) { userDetails = undefined; function done(err, res) { - event.call("auth"); + dispatch.call('auth'); if (callback) callback(err, res); } return oauth.authenticate(done); }; - return rebind(connection, event, 'on'); + return rebind(connection, dispatch, 'on'); } diff --git a/modules/core/context.js b/modules/core/context.js index 3e27f4f83..41661493a 100644 --- a/modules/core/context.js +++ b/modules/core/context.js @@ -1,7 +1,7 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; -import { t, addTranslation, setLocale } from '../util/locale'; import _ from 'lodash'; +import { rebind } from '../util/rebind'; +import { t, addTranslation, setLocale } from '../util/locale'; import { Background } from '../renderer/background'; import { Connection } from './connection'; import { Detect } from '../util/detect'; @@ -172,12 +172,12 @@ export function Context(root) { context.enter = function(newMode) { if (mode) { mode.exit(); - dispatch.call("exit", this, mode); + dispatch.call('exit', this, mode); } mode = newMode; mode.enter(); - dispatch.call("enter", this, mode); + dispatch.call('enter', this, mode); }; context.selectedIDs = function() { @@ -253,7 +253,7 @@ export function Context(root) { context.setDebug = function(flag, val) { if (arguments.length === 1) val = true; debugFlags[flag] = val; - dispatch.call("change"); + dispatch.call('change'); return context; }; context.getDebug = function(flag) { diff --git a/modules/core/difference.js b/modules/core/difference.js index a8c3da9b7..281ad9c86 100644 --- a/modules/core/difference.js +++ b/modules/core/difference.js @@ -1,5 +1,6 @@ import * as d3 from 'd3'; import _ from 'lodash'; + /* iD.Difference represents the difference between two graphs. It knows how to calculate the set of entities that were diff --git a/modules/core/entity.js b/modules/core/entity.js index ae0d22ecd..5fc2253d4 100644 --- a/modules/core/entity.js +++ b/modules/core/entity.js @@ -1,4 +1,3 @@ -import * as d3 from 'd3'; import _ from 'lodash'; import { debug } from '../index'; import { interestingTag } from './tags'; diff --git a/modules/core/history.js b/modules/core/history.js index 28f328f72..35bc48d50 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -1,6 +1,6 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; import _ from 'lodash'; +import { rebind } from '../util/rebind'; import * as Validations from '../validations/index'; import { Difference } from './difference'; import { Entity } from './entity'; @@ -38,7 +38,7 @@ export function History(context) { function change(previous) { var difference = Difference(previous, history.graph()); - dispatch.call("change", this, difference); + dispatch.call('change', this, difference); return difference; } @@ -60,7 +60,7 @@ export function History(context) { stack[0].graph.rebase(entities, _.map(stack, 'graph'), false); tree.rebase(entities, false); - dispatch.call("change", this, undefined, extent); + dispatch.call('change', this, undefined, extent); }, perform: function() { @@ -116,7 +116,7 @@ export function History(context) { if (stack[index].annotation) break; } - dispatch.call("undone"); + dispatch.call('undone'); return change(previous); }, @@ -128,7 +128,7 @@ export function History(context) { if (stack[index].annotation) break; } - dispatch.call("redone"); + dispatch.call('redone'); return change(previous); }, @@ -204,7 +204,7 @@ export function History(context) { stack = [{graph: Graph()}]; index = 0; tree = Tree(stack[0].graph); - dispatch.call("change"); + dispatch.call('change'); return history; }, @@ -319,7 +319,7 @@ export function History(context) { if (err || _.isEmpty(missing)) { loading.close(); context.redrawEnable(true); - dispatch.call("change"); + dispatch.call('change'); } }; @@ -366,7 +366,7 @@ export function History(context) { } if (loadComplete) { - dispatch.call("change"); + dispatch.call('change'); } return history; diff --git a/modules/geo/extent.js b/modules/geo/extent.js index 4bf28a97f..f5b8472ee 100644 --- a/modules/geo/extent.js +++ b/modules/geo/extent.js @@ -1,5 +1,6 @@ import _ from 'lodash'; import { metersToLat, metersToLon } from './index'; + export function Extent(min, max) { if (!(this instanceof Extent)) return new Extent(min, max); if (min instanceof Extent) { diff --git a/modules/geo/index.js b/modules/geo/index.js index bae8fff72..cadd53749 100644 --- a/modules/geo/index.js +++ b/modules/geo/index.js @@ -1,15 +1,18 @@ import _ from 'lodash'; + export { Extent } from './extent.js'; export { Intersection, Turn, inferRestriction - } from './intersection.js'; +} from './intersection.js'; + export { isSimpleMultipolygonOuterMember, simpleMultipolygonOuterMember, joinWays - } from './multipolygon.js'; +} from './multipolygon.js'; + export { RawMercator } from './raw_mercator.js'; export function roundCoords(c) { diff --git a/modules/modes/drag_node.js b/modules/modes/drag_node.js index d4c298b20..fbe35339a 100644 --- a/modules/modes/drag_node.js +++ b/modules/modes/drag_node.js @@ -1,7 +1,7 @@ import * as d3 from 'd3'; +import _ from 'lodash'; import { t } from '../util/locale'; import { getDimensions } from '../util/dimensions'; -import _ from 'lodash'; import { AddMidpoint, Connect, MoveNode, Noop } from '../actions/index'; import { Browse, Select } from './index'; import { Edit, Hover, drag } from '../behavior/index'; diff --git a/modules/modes/draw_line.js b/modules/modes/draw_line.js index 038edcc51..9c8691123 100644 --- a/modules/modes/draw_line.js +++ b/modules/modes/draw_line.js @@ -1,5 +1,6 @@ import { t } from '../util/locale'; import { DrawWay } from '../behavior/index'; + export function DrawLine(context, wayId, baseGraph, affix) { var mode = { button: 'line', diff --git a/modules/modes/move.js b/modules/modes/move.js index 1ef61c133..33747ee2e 100644 --- a/modules/modes/move.js +++ b/modules/modes/move.js @@ -1,5 +1,5 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { t } from '../util/locale'; import { getDimensions } from '../util/dimensions'; import { Browse, Select } from './index'; diff --git a/modules/modes/rotate_way.js b/modules/modes/rotate_way.js index 8a3a0044b..85afe9a88 100644 --- a/modules/modes/rotate_way.js +++ b/modules/modes/rotate_way.js @@ -1,7 +1,7 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; -import { t } from '../util/locale'; import _ from 'lodash'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; +import { t } from '../util/locale'; import { Browse, Select } from './index'; import { Noop, RotateWay as RotateWayAction } from '../actions/index'; import { Edit } from '../behavior/index'; diff --git a/modules/modes/save.js b/modules/modes/save.js index 9e1f0ba80..77d459def 100644 --- a/modules/modes/save.js +++ b/modules/modes/save.js @@ -1,6 +1,6 @@ import * as d3 from 'd3'; -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Conflicts, uiconfirm, Commit, Loading, Success } from '../ui/index'; import { DiscardTags, MergeRemoteChanges, Noop, Revert } from '../actions/index'; import { displayName, displayType } from '../util/index'; diff --git a/modules/modes/select.js b/modules/modes/select.js index ef736c8f0..f9e99d571 100644 --- a/modules/modes/select.js +++ b/modules/modes/select.js @@ -1,7 +1,7 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; -import { t } from '../util/locale'; import _ from 'lodash'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; +import { t } from '../util/locale'; import * as Operations from '../operations/index'; import { Breathe, Copy, Hover, Lasso, Paste, Select as SelectBehavior } from '../behavior/index'; import { Extent, chooseEdge, pointInPolygon } from '../geo/index'; diff --git a/modules/operations/circularize.js b/modules/operations/circularize.js index 7b9132bb8..420d7605a 100644 --- a/modules/operations/circularize.js +++ b/modules/operations/circularize.js @@ -1,6 +1,7 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Circularize as CircularizeAction } from '../actions/index'; + export function Circularize(selectedIDs, context) { var entityId = selectedIDs[0], entity = context.entity(entityId), diff --git a/modules/operations/continue.js b/modules/operations/continue.js index c9382b85b..13758ade0 100644 --- a/modules/operations/continue.js +++ b/modules/operations/continue.js @@ -1,6 +1,7 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { DrawLine } from '../modes/index'; + export function Continue(selectedIDs, context) { var graph = context.graph(), entities = selectedIDs.map(function(id) { return graph.entity(id); }), diff --git a/modules/operations/delete.js b/modules/operations/delete.js index b548fec11..21644de2d 100644 --- a/modules/operations/delete.js +++ b/modules/operations/delete.js @@ -1,5 +1,5 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Browse, Select } from '../modes/index'; import { DeleteMultiple } from '../actions/index'; import { cmd } from '../ui/index'; diff --git a/modules/operations/disconnect.js b/modules/operations/disconnect.js index 83334fd51..9adcf74a4 100644 --- a/modules/operations/disconnect.js +++ b/modules/operations/disconnect.js @@ -1,6 +1,7 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Disconnect as DisconnectAction } from '../actions/index'; + export function Disconnect(selectedIDs, context) { var vertices = _.filter(selectedIDs, function vertex(entityId) { return context.geometry(entityId) === 'vertex'; diff --git a/modules/operations/move.js b/modules/operations/move.js index 9ce35e280..9ef9b5e99 100644 --- a/modules/operations/move.js +++ b/modules/operations/move.js @@ -1,5 +1,5 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Extent } from '../geo/index'; import { Move as MoveAction } from '../actions/index'; import { Move as MoveMode } from '../modes/index'; diff --git a/modules/operations/orthogonalize.js b/modules/operations/orthogonalize.js index 9a77ae853..31bd58bd4 100644 --- a/modules/operations/orthogonalize.js +++ b/modules/operations/orthogonalize.js @@ -1,6 +1,7 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Orthogonalize as OrthogonalizeAction } from '../actions/index'; + export function Orthogonalize(selectedIDs, context) { var entityId = selectedIDs[0], entity = context.entity(entityId), diff --git a/modules/operations/reverse.js b/modules/operations/reverse.js index bbc5ad849..65ee1c2ec 100644 --- a/modules/operations/reverse.js +++ b/modules/operations/reverse.js @@ -1,5 +1,6 @@ import { t } from '../util/locale'; import { Reverse as ReverseAction } from '../actions/index'; + export function Reverse(selectedIDs, context) { var entityId = selectedIDs[0]; diff --git a/modules/operations/rotate.js b/modules/operations/rotate.js index 46d7ae9fd..9c4e1988a 100644 --- a/modules/operations/rotate.js +++ b/modules/operations/rotate.js @@ -1,5 +1,6 @@ import { t } from '../util/locale'; import { RotateWay } from '../modes/index'; + export function Rotate(selectedIDs, context) { var entityId = selectedIDs[0], entity = context.entity(entityId), diff --git a/modules/operations/split.js b/modules/operations/split.js index 0c27410de..72b11a73e 100644 --- a/modules/operations/split.js +++ b/modules/operations/split.js @@ -1,7 +1,8 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Select } from '../modes/index'; import { Split as SplitAction } from '../actions/index'; + export function Split(selectedIDs, context) { var vertices = _.filter(selectedIDs, function vertex(entityId) { return context.geometry(entityId) === 'vertex'; diff --git a/modules/operations/straighten.js b/modules/operations/straighten.js index 5448594bf..fd79b8cc6 100644 --- a/modules/operations/straighten.js +++ b/modules/operations/straighten.js @@ -1,6 +1,7 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Straighten as StraightenAction } from '../actions/index'; + export function Straighten(selectedIDs, context) { var entityId = selectedIDs[0], action = StraightenAction(entityId, context.projection); diff --git a/modules/presets/category.js b/modules/presets/category.js index 01992bf09..905938c8f 100644 --- a/modules/presets/category.js +++ b/modules/presets/category.js @@ -1,6 +1,7 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Collection } from './collection'; + export function Category(id, category, all) { category = _.clone(category); diff --git a/modules/presets/field.js b/modules/presets/field.js index d72684c3e..f9d7e58d7 100644 --- a/modules/presets/field.js +++ b/modules/presets/field.js @@ -1,5 +1,5 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; export function Field(id, field) { field = _.clone(field); diff --git a/modules/presets/preset.js b/modules/presets/preset.js index 99a110d79..50e198671 100644 --- a/modules/presets/preset.js +++ b/modules/presets/preset.js @@ -1,5 +1,5 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { areaKeys } from '../core/context'; export function Preset(id, preset, fields) { diff --git a/modules/renderer/background.js b/modules/renderer/background.js index f80c09e03..ee7967e05 100644 --- a/modules/renderer/background.js +++ b/modules/renderer/background.js @@ -1,6 +1,6 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; import _ from 'lodash'; +import { rebind } from '../util/rebind'; import { Extent, metersToOffset, offsetToMeters} from '../geo/index'; import { qsString, stringQs } from '../util/index'; import { BackgroundSource } from './background_source'; @@ -125,7 +125,7 @@ export function Background(context) { background.baseLayerSource = function(d) { if (!arguments.length) return baseLayer.source(); baseLayer.source(d); - dispatch.call("change"); + dispatch.call('change'); background.updateImagery(); return background; }; @@ -151,7 +151,7 @@ export function Background(context) { layer = overlayLayers[i]; if (layer.source() === d) { overlayLayers.splice(i, 1); - dispatch.call("change"); + dispatch.call('change'); background.updateImagery(); return; } @@ -163,13 +163,13 @@ export function Background(context) { .dimensions(baseLayer.dimensions()); overlayLayers.push(layer); - dispatch.call("change"); + dispatch.call('change'); background.updateImagery(); }; background.nudge = function(d, zoom) { baseLayer.source().nudge(d, zoom); - dispatch.call("change"); + dispatch.call('change'); background.updateImagery(); return background; }; @@ -177,7 +177,7 @@ export function Background(context) { background.offset = function(d) { if (!arguments.length) return baseLayer.source().offset(); baseLayer.source().offset(d); - dispatch.call("change"); + dispatch.call('change'); background.updateImagery(); return background; }; diff --git a/modules/renderer/background_source.js b/modules/renderer/background_source.js index 505256434..b460a2c2a 100644 --- a/modules/renderer/background_source.js +++ b/modules/renderer/background_source.js @@ -1,6 +1,6 @@ import * as d3 from 'd3'; -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Extent, polygonIntersectsPolygon } from '../geo/index'; import { jsonpRequest } from '../util/jsonp_request'; @@ -112,7 +112,7 @@ BackgroundSource.Bing = function(data, dispatch) { }) }; }); - dispatch.call("change"); + dispatch.call('change'); }); bing.copyrightNotices = function(zoom, extent) { @@ -146,7 +146,7 @@ BackgroundSource.None = function() { }; source.area = function() { - return -1; + return -1; // sources in background pane are sorted by area }; return source; @@ -164,7 +164,7 @@ BackgroundSource.Custom = function(template) { }; source.area = function() { - return -2; + return -2; // sources in background pane are sorted by area }; return source; diff --git a/modules/renderer/features.js b/modules/renderer/features.js index 3f80044ef..041c24f75 100644 --- a/modules/renderer/features.js +++ b/modules/renderer/features.js @@ -1,7 +1,8 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; import _ from 'lodash'; +import { rebind } from '../util/rebind'; import { Entity } from '../core/index'; + export function Features(context) { var traffic_roads = { 'motorway': true, @@ -56,8 +57,8 @@ export function Features(context) { function update() { _hidden = features.hidden(); - dispatch.call("change"); - dispatch.call("redraw"); + dispatch.call('change'); + dispatch.call('redraw'); } function defineFeature(k, filter, max) { @@ -228,7 +229,7 @@ export function Features(context) { features.resetStats = function() { _.each(_features, function(f) { f.count = 0; }); - dispatch.call("change"); + dispatch.call('change'); }; features.gatherStats = function(d, resolver, dimensions) { @@ -257,7 +258,7 @@ export function Features(context) { if (currHidden !== _hidden) { _hidden = currHidden; needsRedraw = true; - dispatch.call("change"); + dispatch.call('change'); } return needsRedraw; @@ -300,7 +301,7 @@ export function Features(context) { // Multipolygon members: // If an entity... - // 1. is a way that hasn't matched other "interesting" feature rules, + // 1. is a way that hasn't matched other 'interesting' feature rules, // 2. and it belongs to a single parent multipolygon relation // ...then match whatever feature rules the parent multipolygon has matched. // see #2548, #2887 diff --git a/modules/renderer/map.js b/modules/renderer/map.js index 45fb21caa..d8a689a4c 100644 --- a/modules/renderer/map.js +++ b/modules/renderer/map.js @@ -1,9 +1,9 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; +import _ from 'lodash'; +import { rebind } from '../util/rebind'; import { t } from '../util/locale'; import { bindOnce } from '../util/bind_once'; -import { getDimensions, setDimensions } from '../util/dimensions'; -import _ from 'lodash'; +import { getDimensions } from '../util/dimensions'; import { Areas, Labels, Layers, Lines, Midpoints, Points, Vertices } from '../svg/index'; import { Extent, interp } from '../geo/index'; import { fastMouse, setTransform, functor } from '../util/index'; diff --git a/modules/renderer/tile_layer.js b/modules/renderer/tile_layer.js index 6b3b0c12a..d9616728e 100644 --- a/modules/renderer/tile_layer.js +++ b/modules/renderer/tile_layer.js @@ -1,6 +1,7 @@ import * as d3 from 'd3'; import { d3geoTile } from '../../js/lib/d3.geo.tile'; import { prefixCSSProperty, functor } from '../util/index'; + export function TileLayer(context) { var tileSize = 256, tile = d3geoTile(), diff --git a/modules/services/index.js b/modules/services/index.js index 54b4e39f4..b549af20d 100644 --- a/modules/services/index.js +++ b/modules/services/index.js @@ -3,4 +3,5 @@ import * as nominatim from './nominatim'; import * as taginfo from './taginfo'; import * as wikidata from './wikidata'; import * as wikipedia from './wikipedia'; + export { mapillary, taginfo, nominatim, wikidata, wikipedia}; diff --git a/modules/services/mapillary.js b/modules/services/mapillary.js index 8e43d1426..6f69a79d7 100644 --- a/modules/services/mapillary.js +++ b/modules/services/mapillary.js @@ -1,14 +1,14 @@ -import { rebind } from '../util/rebind'; -import * as d3 from 'd3'; /* global Mapillary:false */ +import * as d3 from 'd3'; import _ from 'lodash'; +import rbush from 'rbush'; +import { rebind } from '../util/rebind'; import { d3geoTile } from '../../js/lib/d3.geo.tile'; import { Detect } from '../util/detect'; import { Extent } from '../geo/index'; import { Icon } from '../svg/index'; import { qsString } from '../util/index'; -import rbush from 'rbush'; var mapillary = {}, apibase = 'https://a.mapillary.com/v2/', @@ -210,8 +210,8 @@ function loadTilePage(which, url, tile, page) { cache.rtree.load(features); - if (which === 'images') dispatch.call("loadedImages"); - if (which === 'signs') dispatch.call("loadedSigns"); + if (which === 'images') dispatch.call('loadedImages'); + if (which === 'signs') dispatch.call('loadedSigns'); if (data.features.length === maxResults && nextPage < maxPages) { loadTilePage(which, url, tile, nextPage); diff --git a/modules/services/nominatim.js b/modules/services/nominatim.js index d5e9eb792..70a3e5e3c 100644 --- a/modules/services/nominatim.js +++ b/modules/services/nominatim.js @@ -1,7 +1,7 @@ import * as d3 from 'd3'; +import rbush from 'rbush'; import { Extent } from '../geo/index'; import { qsString } from '../util/index'; -import rbush from 'rbush'; var endpoint, cache; diff --git a/modules/services/wikipedia.js b/modules/services/wikipedia.js index b9c039e7e..a2f572e94 100644 --- a/modules/services/wikipedia.js +++ b/modules/services/wikipedia.js @@ -1,5 +1,5 @@ -import { qsString } from '../util/index'; import { jsonpRequest } from '../util/jsonp_request'; +import { qsString } from '../util/index'; var wikipedia = {}, endpoint = 'https://en.wikipedia.org/w/api.php?'; diff --git a/modules/svg/defs.js b/modules/svg/defs.js index e93012738..bc899e6f3 100644 --- a/modules/svg/defs.js +++ b/modules/svg/defs.js @@ -1,4 +1,5 @@ import * as d3 from 'd3'; + /* A standalone SVG element that contains only a `defs` sub-element. To be used once globally, since defs IDs must be unique within a document. @@ -8,14 +9,14 @@ export function Defs(context) { function SVGSpriteDefinition(id, href) { return function(defs) { d3.request(href) - .mimeType('image/svg+xml') - .response(function(xhr) { return xhr.responseXML; }) - .get(function(err, svg) { - if (err) return; - defs.node().appendChild( - d3.select(svg.documentElement).attr('id', id).node() - ); - }); + .mimeType('image/svg+xml') + .response(function(xhr) { return xhr.responseXML; }) + .get(function(err, svg) { + if (err) return; + defs.node().appendChild( + d3.select(svg.documentElement).attr('id', id).node() + ); + }); }; } @@ -60,7 +61,7 @@ export function Defs(context) { }) .attr('width', 32) .attr('height', 32) - .attr('patternUnits', 'userSpaceOnUse') + .attr('patternUnits', 'userSpaceOnUse'); patterns.append('rect') .attr('x', 0) diff --git a/modules/svg/gpx.js b/modules/svg/gpx.js index 9e832f106..fb45c89d8 100644 --- a/modules/svg/gpx.js +++ b/modules/svg/gpx.js @@ -107,7 +107,7 @@ export function Gpx(projection, context, dispatch) { drawGpx.enabled = function(_) { if (!arguments.length) return Gpx.enabled; Gpx.enabled = _; - dispatch.call("change"); + dispatch.call('change'); return this; }; @@ -120,7 +120,7 @@ export function Gpx(projection, context, dispatch) { if (!arguments.length) return Gpx.geojson; if (_.isEmpty(gj) || _.isEmpty(gj.features)) return this; Gpx.geojson = gj; - dispatch.call("change"); + dispatch.call('change'); return this; }; diff --git a/modules/svg/labels.js b/modules/svg/labels.js index f642428ca..2bb5fceec 100644 --- a/modules/svg/labels.js +++ b/modules/svg/labels.js @@ -1,9 +1,9 @@ import * as d3 from 'd3'; import _ from 'lodash'; +import rbush from 'rbush'; import { displayName, getStyle } from '../util/index'; import { Entity } from '../core/index'; import { pathLength } from '../geo/index'; -import rbush from 'rbush'; export function Labels(projection, context) { var path = d3.geoPath().projection(projection); diff --git a/modules/svg/layers.js b/modules/svg/layers.js index ae7410ec8..b2ff09e65 100644 --- a/modules/svg/layers.js +++ b/modules/svg/layers.js @@ -1,7 +1,7 @@ -import { rebind } from '../util/rebind'; -import { getDimensions, setDimensions } from '../util/dimensions'; import * as d3 from 'd3'; import _ from 'lodash'; +import { rebind } from '../util/rebind'; +import { getDimensions, setDimensions } from '../util/dimensions'; import { Debug } from './debug'; import { Gpx } from './gpx'; import { MapillaryImages } from './mapillary_images'; @@ -63,7 +63,7 @@ export function Layers(projection, context) { arr.forEach(function(id) { layers = _.reject(layers, function(o) {return o.id === id;}); }); - dispatch.call("change"); + dispatch.call('change'); return this; }; @@ -74,7 +74,7 @@ export function Layers(projection, context) { layers.push(obj); } }); - dispatch.call("change"); + dispatch.call('change'); return this; }; diff --git a/modules/svg/mapillary_images.js b/modules/svg/mapillary_images.js index 21528c3c0..12561e868 100644 --- a/modules/svg/mapillary_images.js +++ b/modules/svg/mapillary_images.js @@ -5,7 +5,7 @@ import { getDimensions, setDimensions } from '../util/dimensions'; import { mapillary as mapillaryService } from '../services/index'; export function MapillaryImages(projection, context, dispatch) { - var debouncedRedraw = _.debounce(function () { dispatch.call("change"); }, 1000), + var debouncedRedraw = _.debounce(function () { dispatch.call('change'); }, 1000), minZoom = 12, layer = d3.select(null), _mapillary; @@ -153,7 +153,7 @@ export function MapillaryImages(projection, context, dispatch) { } else { hideLayer(); } - dispatch.call("change"); + dispatch.call('change'); return this; }; diff --git a/modules/svg/mapillary_signs.js b/modules/svg/mapillary_signs.js index d477153ef..ad9ba61f5 100644 --- a/modules/svg/mapillary_signs.js +++ b/modules/svg/mapillary_signs.js @@ -5,7 +5,7 @@ import { PointTransform } from './point_transform'; import { mapillary as mapillaryService } from '../services/index'; export function MapillarySigns(projection, context, dispatch) { - var debouncedRedraw = _.debounce(function () { dispatch.call("change"); }, 1000), + var debouncedRedraw = _.debounce(function () { dispatch.call('change'); }, 1000), minZoom = 12, layer = d3.select(null), _mapillary; @@ -122,7 +122,7 @@ export function MapillarySigns(projection, context, dispatch) { } else { hideLayer(); } - dispatch.call("change"); + dispatch.call('change'); return this; }; diff --git a/modules/svg/path.js b/modules/svg/path.js index afa9e3e86..0819b3bc8 100644 --- a/modules/svg/path.js +++ b/modules/svg/path.js @@ -1,4 +1,5 @@ import * as d3 from 'd3'; + export function Path(projection, graph, polygon) { var cache = {}, clip = d3.geoClipExtent().extent(projection.clipExtent()).stream, diff --git a/modules/svg/relation_member_tags.js b/modules/svg/relation_member_tags.js index 74a4c1a67..94fa6c567 100644 --- a/modules/svg/relation_member_tags.js +++ b/modules/svg/relation_member_tags.js @@ -1,4 +1,5 @@ import _ from 'lodash'; + export function RelationMemberTags(graph) { return function(entity) { var tags = entity.tags; diff --git a/modules/ui/account.js b/modules/ui/account.js index 542d79695..f92e559d4 100644 --- a/modules/ui/account.js +++ b/modules/ui/account.js @@ -1,6 +1,7 @@ import * as d3 from 'd3'; import { t } from '../util/locale'; import { Icon } from '../svg/index'; + export function Account(context) { var connection = context.connection(); diff --git a/modules/ui/attribution.js b/modules/ui/attribution.js index ce99f3f77..75cb9fd60 100644 --- a/modules/ui/attribution.js +++ b/modules/ui/attribution.js @@ -1,5 +1,6 @@ import * as d3 from 'd3'; import _ from 'lodash'; + export function Attribution(context) { var selection; diff --git a/modules/ui/background.js b/modules/ui/background.js index b225aa806..b5c29315b 100644 --- a/modules/ui/background.js +++ b/modules/ui/background.js @@ -1,8 +1,8 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import _ from 'lodash'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { t } from '../util/locale'; import { tooltip } from '../util/tooltip'; -import _ from 'lodash'; import { metersToOffset, offsetToMeters } from '../geo/index'; import { BackgroundSource } from '../renderer/index'; import { Detect } from '../util/detect'; diff --git a/modules/ui/commit.js b/modules/ui/commit.js index 3e564f774..2af07a3c2 100644 --- a/modules/ui/commit.js +++ b/modules/ui/commit.js @@ -1,10 +1,10 @@ +import * as d3 from 'd3'; +import _ from 'lodash'; import { rebind } from '../util/rebind'; import { d3combobox } from '../../js/lib/d3.combobox.js'; -import * as d3 from 'd3'; import { t } from '../util/locale'; import { triggerEvent } from '../util/trigger_event'; import { tooltip } from '../util/tooltip'; -import _ from 'lodash'; import { displayName, entityOrMemberSelector } from '../util/index'; import { Icon } from '../svg/index'; import { Select } from '../modes/index'; @@ -184,7 +184,7 @@ export function Commit(context) { var cancelButton = buttonSection.append('button') .attr('class', 'secondary-action col5 button cancel-button') - .on('click.cancel', function() { dispatch.call("cancel"); }); + .on('click.cancel', function() { dispatch.call('cancel'); }); cancelButton.append('span') .attr('class', 'label') diff --git a/modules/ui/conflicts.js b/modules/ui/conflicts.js index 40734b1cc..186222a1d 100644 --- a/modules/ui/conflicts.js +++ b/modules/ui/conflicts.js @@ -1,5 +1,5 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../util/rebind'; import { t } from '../util/locale'; import { Extent } from '../geo/index'; import { Icon } from '../svg/index'; @@ -17,7 +17,7 @@ export function Conflicts(context) { header .append('button') .attr('class', 'fr') - .on('click', function() { dispatch.call("cancel"); }) + .on('click', function() { dispatch.call('cancel'); }) .call(Icon('#icon-close')); header @@ -35,7 +35,7 @@ export function Conflicts(context) { .append('a') .attr('class', 'conflicts-download') .text(t('save.conflict.download_changes')) - .on('click.download', function() { dispatch.call("download"); }); + .on('click.download', function() { dispatch.call('download'); }); body .append('div') @@ -58,13 +58,13 @@ export function Conflicts(context) { .attr('disabled', list.length > 1) .attr('class', 'action conflicts-button col6') .text(t('save.title')) - .on('click.try_again', function() { dispatch.call("save"); }); + .on('click.try_again', function() { dispatch.call('save'); }); buttons .append('button') .attr('class', 'secondary-action conflicts-button col6') .text(t('confirm.cancel')) - .on('click.cancel', function() { dispatch.call("cancel"); }); + .on('click.cancel', function() { dispatch.call('cancel'); }); } diff --git a/modules/ui/contributors.js b/modules/ui/contributors.js index 4a9c2cbf0..07cca4684 100644 --- a/modules/ui/contributors.js +++ b/modules/ui/contributors.js @@ -1,7 +1,8 @@ import * as d3 from 'd3'; -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Icon } from '../svg/index'; + export function Contributors(context) { var debouncedUpdate = _.debounce(function() { update(); }, 1000), limit = 4, diff --git a/modules/ui/disclosure.js b/modules/ui/disclosure.js index e1056b2b2..65bde0359 100644 --- a/modules/ui/disclosure.js +++ b/modules/ui/disclosure.js @@ -1,5 +1,5 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../util/rebind'; import { Toggle } from './toggle'; export function Disclosure() { @@ -32,7 +32,7 @@ export function Disclosure() { expanded = !expanded; $link.classed('expanded', expanded); $body.call(Toggle(expanded)); - dispatch.call("toggled", this, expanded); + dispatch.call('toggled', this, expanded); } }; diff --git a/modules/ui/entity_editor.js b/modules/ui/entity_editor.js index e92e77c3b..748874b2c 100644 --- a/modules/ui/entity_editor.js +++ b/modules/ui/entity_editor.js @@ -1,8 +1,8 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; +import _ from 'lodash'; +import { rebind } from '../util/rebind'; import { t } from '../util/locale'; import { tooltip } from '../util/tooltip'; -import _ from 'lodash'; import { Browse } from '../modes/index'; import { ChangeTags } from '../actions/index'; import { Icon } from '../svg/index'; @@ -98,7 +98,7 @@ export function EntityEditor(context) { selection.selectAll('.preset-reset') .on('click', function() { - dispatch.call("choose", this, activePreset); + dispatch.call('choose', this, activePreset); }); // Update diff --git a/modules/ui/feature_info.js b/modules/ui/feature_info.js index 5158ad6ab..badd9dd72 100644 --- a/modules/ui/feature_info.js +++ b/modules/ui/feature_info.js @@ -1,8 +1,9 @@ import * as d3 from 'd3'; +import _ from 'lodash'; import { t } from '../util/locale'; import { tooltip } from '../util/tooltip'; -import _ from 'lodash'; import { tooltipHtml } from './tooltipHtml'; + export function FeatureInfo(context) { function update(selection) { var features = context.features(), diff --git a/modules/ui/feature_list.js b/modules/ui/feature_list.js index 086477d52..36336d188 100644 --- a/modules/ui/feature_list.js +++ b/modules/ui/feature_list.js @@ -1,6 +1,6 @@ import * as d3 from 'd3'; -import { t } from '../util/locale'; import * as sexagesimal from 'sexagesimal'; +import { t } from '../util/locale'; import { Extent, chooseEdge } from '../geo/index'; import { displayName, entityOrMemberSelector } from '../util/index'; import { Entity } from '../core/index'; diff --git a/modules/ui/fields/access.js b/modules/ui/fields/access.js index 9e71d65d6..fd3427f2c 100644 --- a/modules/ui/fields/access.js +++ b/modules/ui/fields/access.js @@ -1,8 +1,8 @@ +import * as d3 from 'd3'; +import _ from 'lodash'; import { rebind } from '../../util/rebind'; import { getSetValue } from '../../util/get_set_value'; import { d3combobox } from '../../../js/lib/d3.combobox.js'; -import * as d3 from 'd3'; -import _ from 'lodash'; export function access(field) { var dispatch = d3.dispatch('change'), @@ -51,7 +51,7 @@ export function access(field) { function change(d) { var tag = {}; tag[d] = getSetValue(d3.select(this)) || undefined; - dispatch.call("change", this, tag); + dispatch.call('change', this, tag); } access.options = function(type) { diff --git a/modules/ui/fields/address.js b/modules/ui/fields/address.js index c35f64efe..396009966 100644 --- a/modules/ui/fields/address.js +++ b/modules/ui/fields/address.js @@ -1,8 +1,8 @@ +import * as d3 from 'd3'; +import _ from 'lodash'; import { rebind } from '../../util/rebind'; import { getSetValue } from '../../util/get_set_value'; import { d3combobox } from '../../../js/lib/d3.combobox.js'; -import * as d3 from 'd3'; -import _ from 'lodash'; import { Extent, chooseEdge, sphericalDistance } from '../../geo/index'; import { nominatim } from '../../services/index'; import { addressFormats } from '../../../data/index'; @@ -178,7 +178,7 @@ export function address(field, context) { wrap.selectAll('input:not(.combobox-input)') .on('input', change(true)); - dispatch.call("init"); + dispatch.call('init'); isInitialized = true; }); } @@ -192,7 +192,7 @@ export function address(field, context) { tags['addr:' + field.id] = this.value || undefined; }); - dispatch.call("change", this, tags, onInput); + dispatch.call('change', this, tags, onInput); }; } @@ -212,7 +212,7 @@ export function address(field, context) { if (isInitialized) { updateTags(tags); } else { - dispatch.call("on", this, 'init', function () { + dispatch.call('on', this, 'init', function () { updateTags(tags); }); } diff --git a/modules/ui/fields/check.js b/modules/ui/fields/check.js index 37b8f8892..071c19080 100644 --- a/modules/ui/fields/check.js +++ b/modules/ui/fields/check.js @@ -1,9 +1,10 @@ -import { rebind } from '../../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../../util/rebind'; import { t } from '../../util/locale'; import { oneWayTags } from '../../core/index'; export { check as defaultcheck }; + export function check(field) { var dispatch = d3.dispatch('change'), options = field.strings && field.strings.options, @@ -58,7 +59,7 @@ export function check(field) { .on('click', function() { var t = {}; t[field.key] = values[(values.indexOf(value) + 1) % values.length]; - dispatch.call("change", this, t); + dispatch.call('change', this, t); d3.event.stopPropagation(); }); diff --git a/modules/ui/fields/combo.js b/modules/ui/fields/combo.js index 5efa5875f..ae8e75a63 100644 --- a/modules/ui/fields/combo.js +++ b/modules/ui/fields/combo.js @@ -1,10 +1,9 @@ +import * as d3 from 'd3'; +import _ from 'lodash'; +import { t } from '../../util/locale'; import { rebind } from '../../util/rebind'; import { getSetValue } from '../../util/get_set_value'; import { d3combobox } from '../../../js/lib/d3.combobox.js'; -import * as d3 from 'd3'; -import _ from 'lodash'; - -import { t } from '../../util/locale'; import { nominatim } from '../../services/index'; export { @@ -208,7 +207,7 @@ export function combo(field, context) { t[field.key] = val; } - dispatch.call("change", this, t); + dispatch.call('change', this, t); } @@ -216,7 +215,7 @@ export function combo(field, context) { d3.event.stopPropagation(); var t = {}; t[d.key] = undefined; - dispatch.call("change", this, t); + dispatch.call('change', this, t); } @@ -291,7 +290,7 @@ export function combo(field, context) { var available = objectDifference(comboData, multiData); combobox.data(available); - // Hide "Add" button if this field uses fixed set of + // Hide 'Add' button if this field uses fixed set of // translateable optstrings and they're all currently used.. container.selectAll('.combobox-input, .combobox-caret') .classed('hide', optstrings && !available.length); diff --git a/modules/ui/fields/cycleway.js b/modules/ui/fields/cycleway.js index 34eab5c73..9ec0838be 100644 --- a/modules/ui/fields/cycleway.js +++ b/modules/ui/fields/cycleway.js @@ -1,7 +1,8 @@ +import * as d3 from 'd3'; import { rebind } from '../../util/rebind'; import { getSetValue } from '../../util/get_set_value'; import { d3combobox } from '../../../js/lib/d3.combobox.js'; -import * as d3 from 'd3'; + export function cycleway(field) { var dispatch = d3.dispatch('change'), items; @@ -18,7 +19,6 @@ export function cycleway(field) { .data(field.keys); // Enter - var enter = items.enter().append('li') .attr('class', function(d) { return 'cf preset-cycleway-' + d; }); @@ -40,7 +40,6 @@ export function cycleway(field) { }); // Update - wrap.selectAll('.preset-input-cycleway') .on('change', change) .on('blur', change); @@ -51,6 +50,7 @@ export function cycleway(field) { left = getSetValue(d3.select(inputs[0])), right = getSetValue(d3.select(inputs[1])), tag = {}; + if (left === 'none' || left === '') { left = undefined; } if (right === 'none' || right === '') { right = undefined; } @@ -71,7 +71,7 @@ export function cycleway(field) { }; } - dispatch.call("change", this, tag); + dispatch.call('change', this, tag); } cycleway.options = function() { diff --git a/modules/ui/fields/input.js b/modules/ui/fields/input.js index 5015aa117..902cb44ee 100644 --- a/modules/ui/fields/input.js +++ b/modules/ui/fields/input.js @@ -1,16 +1,17 @@ +import * as d3 from 'd3'; import { rebind } from '../../util/rebind'; import { getSetValue } from '../../util/get_set_value'; -import * as d3 from 'd3'; import { t } from '../../util/locale'; import { nominatim as nominatimService } from '../../services/index'; import { phoneFormats } from '../../../data/index'; export { - url as text, - url as number, - url as tel, - url as email + url as text, + url as number, + url as tel, + url as email }; + export function url(field, context) { var dispatch = d3.dispatch('change'), @@ -75,7 +76,7 @@ export function url(field, context) { return function() { var t = {}; t[field.key] = getSetValue(input) || undefined; - dispatch.call("change", this, t, onInput); + dispatch.call('change', this, t, onInput); }; } diff --git a/modules/ui/fields/lanes.js b/modules/ui/fields/lanes.js index 857a7fc51..309bc295e 100644 --- a/modules/ui/fields/lanes.js +++ b/modules/ui/fields/lanes.js @@ -1,5 +1,7 @@ -import { rebind } from '../../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../../util/rebind'; +import { getDimensions } from '../../util/dimensions'; + export function lanes(field, context) { var dispatch = d3.dispatch('change'), LANE_WIDTH = 40, diff --git a/modules/ui/fields/localized.js b/modules/ui/fields/localized.js index 92db448f2..e137dc4ff 100644 --- a/modules/ui/fields/localized.js +++ b/modules/ui/fields/localized.js @@ -1,10 +1,10 @@ +import * as d3 from 'd3'; +import _ from 'lodash'; import { rebind } from '../../util/rebind'; import { d3combobox } from '../../../js/lib/d3.combobox.js'; import { getSetValue } from '../../util/get_set_value'; -import * as d3 from 'd3'; import { t } from '../../util/locale'; import { tooltip } from '../../util/tooltip'; -import _ from 'lodash'; import { Detect } from '../../util/detect'; import { Icon } from '../../svg/index'; import { SuggestNames } from '../../util/index'; @@ -78,7 +78,7 @@ export function localized(field, context) { return function() { var t = {}; t[field.key] = getSetValue(d3.select(this)) || undefined; - dispatch.call("change", this, t, onInput); + dispatch.call('change', this, t, onInput); }; } @@ -108,14 +108,14 @@ export function localized(field, context) { } d.lang = lang; - dispatch.call("change", this, t); + dispatch.call('change', this, t); } function changeValue(d) { if (!d.lang) return; var t = {}; t[key(d.lang)] = getSetValue(d3.select(this)) || undefined; - dispatch.call("change", this, t); + dispatch.call('change', this, t); } function fetcher(value, cb) { @@ -153,7 +153,7 @@ export function localized(field, context) { d3.event.preventDefault(); var t = {}; t[key(d.lang)] = undefined; - dispatch.call("change", this, t); + dispatch.call('change', this, t); d3.select(this.parentNode.parentNode) .style('top','0') .style('max-height','240px') diff --git a/modules/ui/fields/maxspeed.js b/modules/ui/fields/maxspeed.js index 1e48bbe47..dc05f5836 100644 --- a/modules/ui/fields/maxspeed.js +++ b/modules/ui/fields/maxspeed.js @@ -1,8 +1,8 @@ +import * as d3 from 'd3'; +import _ from 'lodash'; import { rebind } from '../../util/rebind'; import { getSetValue } from '../../util/get_set_value'; import { d3combobox } from '../../../js/lib/d3.combobox.js'; -import * as d3 from 'd3'; -import _ from 'lodash'; import { pointInPolygon } from '../../geo/index'; import { imperial as imperialData } from '../../../data/index'; @@ -88,7 +88,7 @@ export function maxspeed(field, context) { tag[field.key] = value + ' mph'; } - dispatch.call("change", this, tag); + dispatch.call('change', this, tag); } maxspeed.tags = function(tags) { diff --git a/modules/ui/fields/radio.js b/modules/ui/fields/radio.js index 27f8e88d2..24093129f 100644 --- a/modules/ui/fields/radio.js +++ b/modules/ui/fields/radio.js @@ -1,5 +1,5 @@ -import { rebind } from '../../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../../util/rebind'; import { t } from '../../util/locale'; export function radio(field) { @@ -49,7 +49,7 @@ export function radio(field) { t[d] = active ? 'yes' : undefined; } }); - dispatch.call("change", this, t); + dispatch.call('change', this, t); } radio.tags = function(tags) { diff --git a/modules/ui/fields/restrictions.js b/modules/ui/fields/restrictions.js index bdf084c25..08d1502b3 100644 --- a/modules/ui/fields/restrictions.js +++ b/modules/ui/fields/restrictions.js @@ -1,8 +1,8 @@ +import * as d3 from 'd3'; +import { t } from '../../util/locale'; import { rebind } from '../../util/rebind'; import { functor } from '../../util/index'; import { getDimensions, setDimensions } from '../../util/dimensions'; -import * as d3 from 'd3'; -import { t } from '../../util/locale'; import { Extent, Intersection, RawMercator, Turn, inferRestriction } from '../../geo/index'; import { Layers, Lines, Turns, Vertices } from '../../svg/index'; import { RestrictTurn, UnrestrictTurn, } from '../../actions/index'; diff --git a/modules/ui/fields/textarea.js b/modules/ui/fields/textarea.js index 2eaff2164..8a8bbd011 100644 --- a/modules/ui/fields/textarea.js +++ b/modules/ui/fields/textarea.js @@ -1,5 +1,6 @@ -import { rebind } from '../../util/rebind'; import * as d3 from 'd3'; +import { getSetValue } from '../../util/get_set_value'; +import { rebind } from '../../util/rebind'; import { t } from '../../util/locale'; export function textarea(field) { @@ -25,7 +26,7 @@ export function textarea(field) { return function() { var t = {}; t[field.key] = getSetValue(input) || undefined; - dispatch.call("change", this, t, onInput); + dispatch.call('change', this, t, onInput); }; } diff --git a/modules/ui/fields/wikipedia.js b/modules/ui/fields/wikipedia.js index 11e1a59fb..2c14fa734 100644 --- a/modules/ui/fields/wikipedia.js +++ b/modules/ui/fields/wikipedia.js @@ -1,12 +1,14 @@ -import { rebind } from '../../util/rebind'; -import { d3combobox } from '../../../js/lib/d3.combobox.js'; import * as d3 from 'd3'; -import { t } from '../../util/locale'; import _ from 'lodash'; +import { d3combobox } from '../../../js/lib/d3.combobox.js'; +import { getSetValue } from '../../util/get_set_value'; +import { rebind } from '../../util/rebind'; +import { t } from '../../util/locale'; import { ChangeTags } from '../../actions/index'; import { Detect } from '../../util/detect'; import { Icon } from '../../svg/index'; import { wikipedia as wikipediaData } from '../../../data/index'; + import { wikipedia as wikipediaService, wikidata as wikidataService @@ -132,7 +134,7 @@ export function wikipedia(field, context) { syncTags.wikidata = undefined; } - dispatch.call("change", this, syncTags); + dispatch.call('change', this, syncTags); if (skipWikidata || !value || !language()[2]) return; @@ -163,7 +165,7 @@ export function wikipedia(field, context) { }); context.overwrite(ChangeTags(currEntityId, currTags), annotation); - dispatch.call("change", this, currTags); + dispatch.call('change', this, currTags); }); } diff --git a/modules/ui/full_screen.js b/modules/ui/full_screen.js index 13d4285e9..79b92b862 100644 --- a/modules/ui/full_screen.js +++ b/modules/ui/full_screen.js @@ -1,5 +1,5 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { cmd } from './cmd'; export function FullScreen(context) { diff --git a/modules/ui/help.js b/modules/ui/help.js index ee5459a09..529a507ec 100644 --- a/modules/ui/help.js +++ b/modules/ui/help.js @@ -1,10 +1,10 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import marked from 'marked'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { t } from '../util/locale'; import { tooltip } from '../util/tooltip'; import { Icon } from '../svg/index'; import { intro } from './intro/index'; -import marked from 'marked'; import { tooltipHtml } from './tooltipHtml'; export function Help(context) { diff --git a/modules/ui/info.js b/modules/ui/info.js index 27ae8d830..2ef37414a 100644 --- a/modules/ui/info.js +++ b/modules/ui/info.js @@ -1,7 +1,7 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; -import { t } from '../util/locale'; import _ from 'lodash'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; +import { t } from '../util/locale'; import { Detect } from '../util/detect'; import { Extent } from '../geo/index'; import { cmd } from './cmd'; diff --git a/modules/ui/init.js b/modules/ui/init.js index 809373eda..cf6d4afb9 100644 --- a/modules/ui/init.js +++ b/modules/ui/init.js @@ -1,7 +1,7 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { t } from '../util/locale'; -import { getDimensions, setDimensions } from '../util/dimensions'; +import { setDimensions } from '../util/dimensions'; import { tooltip } from '../util/tooltip'; import { Defs, Icon } from '../svg/index'; import { Account } from './account'; @@ -38,7 +38,6 @@ export function init(context) { if (Detect().opera) container.classed('opera', true); var hash = Hash(context); - hash(); if (!hash.hadHash) { diff --git a/modules/ui/intro/area.js b/modules/ui/intro/area.js index b7ab1b2d0..4b7a8f596 100644 --- a/modules/ui/intro/area.js +++ b/modules/ui/intro/area.js @@ -1,10 +1,10 @@ -import { rebind } from '../../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../../util/rebind'; import { t } from '../../util/locale'; import { icon, pad } from './helper'; export function area(context, reveal) { - var event = d3.dispatch('done'), + var dispatch = d3.dispatch('done'), timeout; var step = { @@ -76,7 +76,7 @@ export function area(context, reveal) { function selectedPreset() { reveal('.pane', t('intro.areas.describe', { button: icon('#icon-apply', 'pre-text') })); - context.on('exit.intro', event.done); + context.on('exit.intro', dispatch.done); } }; @@ -89,5 +89,5 @@ export function area(context, reveal) { d3.select('.preset-search-input').on('keyup.intro', null); }; - return rebind(step, event, 'on'); + return rebind(step, dispatch, 'on'); } diff --git a/modules/ui/intro/helper.js b/modules/ui/intro/helper.js index 9256b31dc..341e5a74e 100644 --- a/modules/ui/intro/helper.js +++ b/modules/ui/intro/helper.js @@ -1,4 +1,4 @@ -export function pointBox (point, context) { +export function pointBox(point, context) { var rect = context.surfaceRect(); point = context.projection(point); return { @@ -9,7 +9,7 @@ export function pointBox (point, context) { }; } -export function pad (box, padding, context) { +export function pad(box, padding, context) { if (box instanceof Array) { var rect = context.surfaceRect(); box = context.projection(box); diff --git a/modules/ui/intro/line.js b/modules/ui/intro/line.js index 0a65073cf..0e3a79870 100644 --- a/modules/ui/intro/line.js +++ b/modules/ui/intro/line.js @@ -1,14 +1,14 @@ +import * as d3 from 'd3'; +import _ from 'lodash'; import { rebind } from '../../util/rebind'; import { bindOnce } from '../../util/bind_once'; -import * as d3 from 'd3'; import { t } from '../../util/locale'; -import _ from 'lodash'; import { icon, pad } from './helper'; import { DeleteMultiple } from '../../actions/index'; export function line(context, reveal) { - var event = d3.dispatch('done'), + var dispatch = d3.dispatch('done'), timeouts = []; var step = { @@ -143,7 +143,7 @@ export function line(context, reveal) { function roadDetails() { reveal('.pane', t('intro.lines.describe', { button: icon('#icon-apply', 'pre-text') })); - context.on('exit.intro', event.done); + context.on('exit.intro', dispatch.done); } }; @@ -158,5 +158,5 @@ export function line(context, reveal) { context.history().on('change.intro', null); }; - return rebind(step, event, 'on'); + return rebind(step, dispatch, 'on'); } diff --git a/modules/ui/intro/navigation.js b/modules/ui/intro/navigation.js index d5fc52d75..a14a5a88d 100644 --- a/modules/ui/intro/navigation.js +++ b/modules/ui/intro/navigation.js @@ -1,11 +1,11 @@ -import { rebind } from '../../util/rebind'; import * as d3 from 'd3'; -import { t } from '../../util/locale'; import _ from 'lodash'; +import { rebind } from '../../util/rebind'; +import { t } from '../../util/locale'; import { icon, pointBox } from './helper'; export function navigation(context, reveal) { - var event = d3.dispatch('done'), + var dispatch = d3.dispatch('done'), timeouts = []; var step = { @@ -93,7 +93,7 @@ export function navigation(context, reveal) { function selectedStreet() { var springSt = [-85.63585099140167, 41.942506848938926]; context.map().center(springSt); - context.on('exit.intro', event.done); + context.on('exit.intro', dispatch.done); set(function() { reveal('.entity-editor-pane', t('intro.navigation.chosen', { @@ -114,5 +114,5 @@ export function navigation(context, reveal) { .on('keyup.intro', null); }; - return rebind(step, event, 'on'); + return rebind(step, dispatch, 'on'); } diff --git a/modules/ui/intro/point.js b/modules/ui/intro/point.js index d106afdbc..23ba4c15f 100644 --- a/modules/ui/intro/point.js +++ b/modules/ui/intro/point.js @@ -1,10 +1,10 @@ -import { rebind } from '../../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../../util/rebind'; import { t } from '../../util/locale'; import { icon, pad } from './helper'; export function point(context, reveal) { - var event = d3.dispatch('done'), + var dispatch = d3.dispatch('done'), timeouts = []; var step = { @@ -137,7 +137,9 @@ export function point(context, reveal) { } function deleted(changed) { - if (changed.deleted().length) event.call("done"); + if (changed.deleted().length) { + dispatch.call('done'); + } } }; @@ -153,5 +155,5 @@ export function point(context, reveal) { .on('keydown.intro', null); }; - return rebind(step, event, 'on'); + return rebind(step, dispatch, 'on'); } diff --git a/modules/ui/intro/start_editing.js b/modules/ui/intro/start_editing.js index 6ddac4958..802b487b7 100644 --- a/modules/ui/intro/start_editing.js +++ b/modules/ui/intro/start_editing.js @@ -1,11 +1,11 @@ -import { rebind } from '../../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../../util/rebind'; import { t } from '../../util/locale'; import { icon } from './helper'; import { modal } from '../modal'; export function startEditing(context, reveal) { - var event = d3.dispatch('done', 'startEditing'), + var dispatch = d3.dispatch('done', 'startEditing'), modalSelection, timeouts = []; @@ -50,7 +50,7 @@ export function startEditing(context, reveal) { startbutton.append('h2') .text(t('intro.startediting.start')); - event.call("startEditing"); + dispatch.call('startEditing'); }, 10500); }; @@ -59,5 +59,5 @@ export function startEditing(context, reveal) { timeouts.forEach(window.clearTimeout); }; - return rebind(step, event, 'on'); + return rebind(step, dispatch, 'on'); } diff --git a/modules/ui/map_data.js b/modules/ui/map_data.js index ba651c0c7..da00d316d 100644 --- a/modules/ui/map_data.js +++ b/modules/ui/map_data.js @@ -1,10 +1,10 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import _ from 'lodash'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { t } from '../util/locale'; import { tooltip } from '../util/tooltip'; import { Icon } from '../svg/index'; import { tooltipHtml } from './tooltipHtml'; -import _ from 'lodash'; export function MapData(context) { var key = 'F', diff --git a/modules/ui/map_in_map.js b/modules/ui/map_in_map.js index 5f75fe4da..ea37627d2 100644 --- a/modules/ui/map_in_map.js +++ b/modules/ui/map_in_map.js @@ -1,10 +1,10 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { Debug, Gpx } from '../svg/index'; import { RawMercator } from '../geo/index'; import { TileLayer } from '../renderer/index'; import { setTransform } from '../util/index'; -import { getDimensions, setDimensions } from '../util/dimensions'; +import { getDimensions } from '../util/dimensions'; export function MapInMap(context) { var key = '/'; diff --git a/modules/ui/modal.js b/modules/ui/modal.js index 962ea84c1..d7099724f 100644 --- a/modules/ui/modal.js +++ b/modules/ui/modal.js @@ -1,6 +1,7 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { Icon } from '../svg/index'; + export function modal(selection, blocking) { var keybinding = d3keybinding('modal'); var previous = selection.select('div.modal'); diff --git a/modules/ui/modes.js b/modules/ui/modes.js index 7447b05c9..c9cf836a3 100644 --- a/modules/ui/modes.js +++ b/modules/ui/modes.js @@ -1,6 +1,6 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; import _ from 'lodash'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { tooltip } from '../util/tooltip'; import { AddArea, AddLine, AddPoint, Browse } from '../modes/index'; import { Icon } from '../svg/index'; diff --git a/modules/ui/notice.js b/modules/ui/notice.js index 39b59ca01..434abd829 100644 --- a/modules/ui/notice.js +++ b/modules/ui/notice.js @@ -1,6 +1,7 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Icon } from '../svg/index'; + export function Notice(context) { return function(selection) { var div = selection.append('div') diff --git a/modules/ui/preset.js b/modules/ui/preset.js index 15c92e52a..10e9db4c4 100644 --- a/modules/ui/preset.js +++ b/modules/ui/preset.js @@ -1,9 +1,9 @@ +import * as d3 from 'd3'; +import _ from 'lodash'; import { rebind } from '../util/rebind'; import { getSetValue } from '../util/get_set_value'; import { d3combobox } from '../../js/lib/d3.combobox.js'; -import * as d3 from 'd3'; import { t } from '../util/locale'; -import _ from 'lodash'; import { Browse } from '../modes/index'; import { Disclosure } from './disclosure'; import { Icon } from '../svg/index'; @@ -11,7 +11,7 @@ import { TagReference } from './tag_reference'; import { fields } from './fields/index'; export function preset(context) { - var event = d3.dispatch('change'), + var dispatch = d3.dispatch('change'), state, fieldsArr, preset, @@ -22,7 +22,7 @@ export function preset(context) { field = _.clone(field); field.input = fields[field.type](field, context) - .on('change', event.change); + .on('change', dispatch.change); if (field.input.entity) field.input.entity(entity); @@ -238,13 +238,13 @@ export function preset(context) { function revert(field) { d3.event.stopPropagation(); d3.event.preventDefault(); - event.call("change", field.revert()); + dispatch.call('change', field.revert()); } function remove(field) { d3.event.stopPropagation(); d3.event.preventDefault(); - event.call("change", field.remove()); + dispatch.call('change', field.remove()); } } @@ -277,5 +277,5 @@ export function preset(context) { return presets; }; - return rebind(presets, event, 'on'); + return rebind(presets, dispatch, 'on'); } diff --git a/modules/ui/preset_icon.js b/modules/ui/preset_icon.js index 4ec29ce61..e0defc8c8 100644 --- a/modules/ui/preset_icon.js +++ b/modules/ui/preset_icon.js @@ -1,5 +1,5 @@ -import { functor } from '../util/index'; import * as d3 from 'd3'; +import { functor } from '../util/index'; import { Icon } from '../svg/index'; import { featureIcons } from '../../data/index'; diff --git a/modules/ui/preset_list.js b/modules/ui/preset_list.js index 278925b7b..08bb79abe 100644 --- a/modules/ui/preset_list.js +++ b/modules/ui/preset_list.js @@ -1,6 +1,6 @@ +import * as d3 from 'd3'; import { rebind } from '../util/rebind'; import { d3keybinding } from '../../js/lib/d3.keybinding.js'; -import * as d3 from 'd3'; import { t } from '../util/locale'; import { Browse } from '../modes/index'; import { ChangePreset } from '../actions/index'; @@ -37,7 +37,7 @@ export function PresetList(context) { if (context.entity(id).isUsed(context.graph())) { messagewrap.append('button') .attr('class', 'preset-choose') - .on('click', function() { dispatch.call("choose", this, currentPreset); }) + .on('click', function() { dispatch.call('choose', this, currentPreset); }) .append('span') .html('►'); } else { @@ -232,7 +232,7 @@ export function PresetList(context) { ChangePreset(id, currentPreset, preset), t('operations.change_tags.annotation')); - dispatch.call("choose", this, preset); + dispatch.call('choose', this, preset); }; item.help = function() { diff --git a/modules/ui/raw_member_editor.js b/modules/ui/raw_member_editor.js index 9d3229a41..d7c1f4f19 100644 --- a/modules/ui/raw_member_editor.js +++ b/modules/ui/raw_member_editor.js @@ -1,5 +1,5 @@ -import { d3combobox } from '../../js/lib/d3.combobox.js'; import * as d3 from 'd3'; +import { d3combobox } from '../../js/lib/d3.combobox.js'; import { t } from '../util/locale'; import { Browse, Select } from '../modes/index'; import { ChangeMember, DeleteMember } from '../actions/index'; @@ -126,7 +126,7 @@ export function RawMemberEditor(context) { function bindTypeahead(d) { var row = d3.select(this), role = row.selectAll('input.member-role'); - + function sort(value, data) { var sameletter = [], other = []; @@ -139,7 +139,7 @@ export function RawMemberEditor(context) { } return sameletter.concat(other); } - + role.call(d3combobox() .fetcher(function(role, callback) { var rtype = entity.tags.type; @@ -153,10 +153,10 @@ export function RawMemberEditor(context) { }); })); } - + function unbind() { var row = d3.select(this); - + row.selectAll('input.member-role') .call(d3combobox.off); } diff --git a/modules/ui/raw_membership_editor.js b/modules/ui/raw_membership_editor.js index 2d72f4971..851eb4c2e 100644 --- a/modules/ui/raw_membership_editor.js +++ b/modules/ui/raw_membership_editor.js @@ -1,7 +1,7 @@ -import { d3combobox } from '../../js/lib/d3.combobox.js'; import * as d3 from 'd3'; -import { t } from '../util/locale'; import _ from 'lodash'; +import { d3combobox } from '../../js/lib/d3.combobox.js'; +import { t } from '../util/locale'; import { AddEntity, AddMember, ChangeMember, DeleteMember } from '../actions/index'; import { Entity, Relation } from '../core/index'; import { Disclosure } from './disclosure'; @@ -224,7 +224,7 @@ export function RawMembershipEditor(context) { function bindTypeahead(d) { var row = d3.select(this), role = row.selectAll('input.member-role'); - + function sort(value, data) { var sameletter = [], other = []; @@ -237,7 +237,7 @@ export function RawMembershipEditor(context) { } return sameletter.concat(other); } - + role.call(d3combobox() .fetcher(function(role, callback) { var rtype = d.relation.tags.type; @@ -251,10 +251,10 @@ export function RawMembershipEditor(context) { }); })); } - + function unbind() { var row = d3.select(this); - + row.selectAll('input.member-role') .call(d3combobox.off); } diff --git a/modules/ui/raw_tag_editor.js b/modules/ui/raw_tag_editor.js index d3317c4e2..82100ff11 100644 --- a/modules/ui/raw_tag_editor.js +++ b/modules/ui/raw_tag_editor.js @@ -1,7 +1,7 @@ +import * as d3 from 'd3'; import { rebind } from '../util/rebind'; import { getSetValue } from '../util/get_set_value'; import { d3combobox } from '../../js/lib/d3.combobox.js'; -import * as d3 from 'd3'; import { t } from '../util/locale'; import { Disclosure } from './disclosure'; import { Icon } from '../svg/index'; @@ -112,14 +112,16 @@ export function RawTagEditor(context) { .attr('title', function(d) { return d.key; }) .on('blur', keyChange) .on('change', keyChange), - function(d) { return d.key; }) + function(d) { return d.key; } + ); getSetValue($items.select('input.value') .attr('title', function(d) { return d.value; }) .on('blur', valueChange) .on('change', valueChange) .on('keydown.push-more', pushMore), - function(d) { return d.value; }) + function(d) { return d.value; } + ); $items.select('button.remove') .on('click', removeTag); @@ -204,19 +206,19 @@ export function RawTagEditor(context) { tag[kNew] = d.value; d.key = kNew; // Maintain DOM identity through the subsequent update. this.value = kNew; - event.call("change", tag); + event.call('change', tag); } function valueChange(d) { var tag = {}; tag[d.key] = this.value; - event.call("change", tag); + event.call('change', tag); } function removeTag(d) { var tag = {}; tag[d.key] = undefined; - event.call("change", tag); + event.call('change', tag); d3.select(this.parentNode).remove(); } diff --git a/modules/ui/save.js b/modules/ui/save.js index 5c5365bb8..21b5325f1 100644 --- a/modules/ui/save.js +++ b/modules/ui/save.js @@ -1,5 +1,5 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { t } from '../util/locale'; import { tooltip } from '../util/tooltip'; import { Save as SaveMode } from '../modes/index'; diff --git a/modules/ui/scale.js b/modules/ui/scale.js index bda008f90..179a4f4f8 100644 --- a/modules/ui/scale.js +++ b/modules/ui/scale.js @@ -1,6 +1,5 @@ import { lonToMeters, metersToLon } from '../geo/index'; import { Detect } from '../util/detect'; -import { getDimensions, setDimensions } from '../util/dimensions'; export function Scale(context) { var projection = context.projection, diff --git a/modules/ui/source_switch.js b/modules/ui/source_switch.js index 3d5544314..3b8c961db 100644 --- a/modules/ui/source_switch.js +++ b/modules/ui/source_switch.js @@ -1,6 +1,7 @@ import * as d3 from 'd3'; import { t } from '../util/locale'; import { Browse } from '../modes/index'; + export function SourceSwitch(context) { var keys; diff --git a/modules/ui/status.js b/modules/ui/status.js index 8a761308b..9e0a201bf 100644 --- a/modules/ui/status.js +++ b/modules/ui/status.js @@ -1,4 +1,5 @@ import { t } from '../util/locale'; + export function Status(context) { var connection = context.connection(), errCount = 0; diff --git a/modules/ui/success.js b/modules/ui/success.js index 1d709b9b1..45aef323b 100644 --- a/modules/ui/success.js +++ b/modules/ui/success.js @@ -1,8 +1,9 @@ -import { rebind } from '../util/rebind'; import * as d3 from 'd3'; +import { rebind } from '../util/rebind'; import { t } from '../util/locale'; import { tooltip } from '../util/tooltip'; import { Icon } from '../svg/index'; + export function Success(context) { var dispatch = d3.dispatch('cancel'), changeset; @@ -16,7 +17,7 @@ export function Success(context) { header.append('button') .attr('class', 'fr') - .on('click', function() { dispatch.call("cancel"); }) + .on('click', function() { dispatch.call('cancel'); }) .call(Icon('#icon-close')); header.append('h3') diff --git a/modules/ui/tag_reference.js b/modules/ui/tag_reference.js index ab8cb9872..4fba84fd9 100644 --- a/modules/ui/tag_reference.js +++ b/modules/ui/tag_reference.js @@ -1,6 +1,6 @@ import * as d3 from 'd3'; -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { Detect } from '../util/detect'; import { Icon } from '../svg/index'; diff --git a/modules/ui/toggle.js b/modules/ui/toggle.js index 9ebd50527..4a8d16c5e 100644 --- a/modules/ui/toggle.js +++ b/modules/ui/toggle.js @@ -1,4 +1,5 @@ import * as d3 from 'd3'; + // toggles the visibility of ui elements, using a combination of the // hide class, which sets display=none, and a d3 transition for opacity. // this will cause blinking when called repeatedly, so check that the diff --git a/modules/ui/tooltipHtml.js b/modules/ui/tooltipHtml.js index 6601d1fc6..c8299a740 100644 --- a/modules/ui/tooltipHtml.js +++ b/modules/ui/tooltipHtml.js @@ -1,4 +1,5 @@ import { t } from '../util/locale'; + export function tooltipHtml(text, key) { var s = '' + text + ''; if (key) { diff --git a/modules/ui/undo_redo.js b/modules/ui/undo_redo.js index 9736a0d54..6d0e207cb 100644 --- a/modules/ui/undo_redo.js +++ b/modules/ui/undo_redo.js @@ -1,5 +1,5 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { t } from '../util/locale'; import { tooltip } from '../util/tooltip'; import { Icon } from '../svg/index'; diff --git a/modules/ui/view_on_osm.js b/modules/ui/view_on_osm.js index cf603eca6..87d77b0fd 100644 --- a/modules/ui/view_on_osm.js +++ b/modules/ui/view_on_osm.js @@ -1,5 +1,6 @@ import { t } from '../util/locale'; import { Icon } from '../svg/index'; + export function ViewOnOSM(context) { var id; diff --git a/modules/ui/zoom.js b/modules/ui/zoom.js index 27dbf6c9a..fd5f511f1 100644 --- a/modules/ui/zoom.js +++ b/modules/ui/zoom.js @@ -1,11 +1,11 @@ -import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import * as d3 from 'd3'; +import _ from 'lodash'; +import { d3keybinding } from '../../js/lib/d3.keybinding.js'; import { t } from '../util/locale'; import { tooltip } from '../util/tooltip'; import { Icon } from '../svg/index'; import { cmd } from './cmd'; import { tooltipHtml } from './tooltipHtml'; -import _ from 'lodash'; export function Zoom(context) { var zooms = [{ diff --git a/modules/util/bind_once.js b/modules/util/bind_once.js index 14d345f9c..67905e89a 100644 --- a/modules/util/bind_once.js +++ b/modules/util/bind_once.js @@ -1,9 +1,9 @@ export function bindOnce(target, type, listener, capture) { - var typeOnce = type + ".once"; + var typeOnce = type + '.once'; function one() { target.on(typeOnce, null); listener.apply(this, arguments); } target.on(typeOnce, one, capture); return this; -}; +} diff --git a/modules/util/curtain.js b/modules/util/curtain.js index 9ed975311..540a7fe2e 100644 --- a/modules/util/curtain.js +++ b/modules/util/curtain.js @@ -1,18 +1,18 @@ -import { getDimensions } from './dimensions'; -import { rebind } from '../../modules/util/rebind'; -import 'd3-selection-multi'; import * as d3 from 'd3'; +import 'd3-selection-multi'; +import { getDimensions } from './dimensions'; +import { rebind } from './rebind'; +import { Toggle } from '../ui/toggle'; // Tooltips and svg mask used to highlight certain features export function d3curtain() { - var event = d3.dispatch(), + var dispatch = d3.dispatch(), surface, tooltip, darkness; function curtain(selection) { - surface = selection.append('svg') .attr('id', 'curtain') .styles({ @@ -26,7 +26,7 @@ export function d3curtain() { darkness = surface.append('path') .attr('x', 0) .attr('y', 0) - .attr('class', 'curtain-darkness') + .attr('class', 'curtain-darkness'); d3.select(window).on('resize.curtain', resize); @@ -63,7 +63,7 @@ export function d3curtain() { .select('.tooltip-inner') .html(html)); - var pos; + var side, pos; var w = window.innerWidth, h = window.innerHeight; @@ -90,7 +90,9 @@ export function d3curtain() { ]; - if (duration !== 0 || !tooltip.classed(side)) tooltip.call(iD.ui.Toggle(true)); + if (duration !== 0 || !tooltip.classed(side)) { + tooltip.call(Toggle(true)); + } tooltip .style('top', pos[1] + 'px') @@ -100,7 +102,7 @@ export function d3curtain() { .html(html); } else { - tooltip.call(iD.ui.Toggle(false)); + tooltip.call(Toggle(false)); } }; @@ -109,9 +111,9 @@ export function d3curtain() { (duration === 0 ? darkness : darkness.transition().duration(duration || 600)) .attr('d', function(d) { - var string = "M 0,0 L 0," + window.innerHeight + " L " + - window.innerWidth + "," + window.innerHeight + "L" + - window.innerWidth + ",0 Z"; + var string = 'M 0,0 L 0,' + window.innerHeight + ' L ' + + window.innerWidth + ',' + window.innerHeight + 'L' + + window.innerWidth + ',0 Z'; if (!d) return string; return string + 'M' + @@ -128,5 +130,5 @@ export function d3curtain() { tooltip.remove(); }; - return rebind(curtain, event, 'on'); -}; + return rebind(curtain, dispatch, 'on'); +} diff --git a/modules/util/dimensions.js b/modules/util/dimensions.js index e9c4b9c9f..139d0e5c1 100644 --- a/modules/util/dimensions.js +++ b/modules/util/dimensions.js @@ -20,5 +20,5 @@ export function setDimensions (target, dimensions) { return target .property('__dimensions__', [dimensions[0], dimensions[1]]) .attr('width', dimensions[0]) - .attr('height', dimensions[1]) + .attr('height', dimensions[1]); } diff --git a/modules/util/get_set_value.js b/modules/util/get_set_value.js index 5e2150874..9d7d92a07 100644 --- a/modules/util/get_set_value.js +++ b/modules/util/get_set_value.js @@ -1,26 +1,34 @@ // Like selection.property('value', ...), but avoids no-op value sets, // which can result in layout/repaint thrashing in some situations. -export function getSetValue (target, value) { +export function getSetValue(target, value) { function d3_selection_value(value) { - function valueNull() { - delete target.value; - } + function valueNull() { + delete target.value; + } - function valueConstant() { - if (target.value !== value) target.value = value; - } + function valueConstant() { + if (target.value !== value) { + target.value = value; + } + } - function valueFunction() { - var x = value.apply(target, arguments); - if (x == null) delete target.value; - else if (target.value !== x) target.value = x; - } + function valueFunction() { + var x = value.apply(target, arguments); + if (x == null) { + delete target.value; + } + else if (target.value !== x) { + target.value = x; + } + } - return value == null - ? valueNull : (typeof value === "function" - ? valueFunction : valueConstant); + return value == null + ? valueNull : (typeof value === 'function' + ? valueFunction : valueConstant); } - if (!arguments.length) return target.property('value'); + if (!arguments.length) { + return target.property('value'); + } return target.each(d3_selection_value(value)); } diff --git a/modules/util/jsonp_request.js b/modules/util/jsonp_request.js index c740b6caf..c4c79d6b0 100644 --- a/modules/util/jsonp_request.js +++ b/modules/util/jsonp_request.js @@ -1,4 +1,5 @@ import * as d3 from 'd3'; + var jsonpCache = {}; window.jsonpCache = jsonpCache; diff --git a/modules/util/rebind.js b/modules/util/rebind.js index a9c78a8b2..32943c146 100644 --- a/modules/util/rebind.js +++ b/modules/util/rebind.js @@ -1,16 +1,18 @@ // Copies a variable number of methods from source to target. export function rebind(target, source) { - var i = 1, n = arguments.length, method; - while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); - return target; -}; + var i = 1, n = arguments.length, method; + while (++i < n) { + target[method = arguments[i]] = d3_rebind(target, source, source[method]); + } + return target; +} // Method is assumed to be a standard D3 getter-setter: // If passed with no arguments, gets the value. // If passed with arguments, sets the value and returns the target. function d3_rebind(target, source, method) { - return function() { - var value = method.apply(source, arguments); - return value === source ? target : value; - }; + return function() { + var value = method.apply(source, arguments); + return value === source ? target : value; + }; } diff --git a/modules/util/tooltip.js b/modules/util/tooltip.js index 2645ad0db..8e18ab557 100644 --- a/modules/util/tooltip.js +++ b/modules/util/tooltip.js @@ -1,8 +1,8 @@ -import { functor } from './index'; import * as d3 from 'd3'; +import { functor } from './index'; import 'd3-selection-multi'; -export function tooltip() { +export function tooltip() { var tooltip = function(selection) { selection.each(setup); }, diff --git a/modules/util/trigger_event.js b/modules/util/trigger_event.js index 676add372..e54b148da 100644 --- a/modules/util/trigger_event.js +++ b/modules/util/trigger_event.js @@ -4,4 +4,4 @@ export function triggerEvent(target, type) { evt.initEvent(type, true, true); this.dispatchEvent(evt); }); -}; +} diff --git a/modules/util/util.js b/modules/util/util.js index dff1c982a..e6486d02d 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -1,9 +1,8 @@ -import { functor } from '../index'; import * as d3 from 'd3'; +import _ from 'lodash'; import { t } from './locale'; import { Detect } from './detect'; import { remove as removeDiacritics } from 'diacritics'; -import _ from 'lodash'; export function tagText(entity) { return d3.entries(entity.tags).map(function(e) { diff --git a/modules/validations/deprecated_tag.js b/modules/validations/deprecated_tag.js index b4555cc32..52ac36646 100644 --- a/modules/validations/deprecated_tag.js +++ b/modules/validations/deprecated_tag.js @@ -1,8 +1,8 @@ -import { t } from '../util/locale'; import _ from 'lodash'; +import { t } from '../util/locale'; import { tagText } from '../util/index'; -export function DeprecatedTag() { +export function DeprecatedTag() { var validation = function(changes) { var warnings = []; for (var i = 0; i < changes.created.length; i++) { diff --git a/modules/validations/many_deletions.js b/modules/validations/many_deletions.js index 3dc4bfd58..bf74973cf 100644 --- a/modules/validations/many_deletions.js +++ b/modules/validations/many_deletions.js @@ -1,4 +1,5 @@ import { t } from '../util/locale'; + export function ManyDeletions() { var threshold = 100; diff --git a/modules/validations/missing_tag.js b/modules/validations/missing_tag.js index 1c235d771..f5255ac1e 100644 --- a/modules/validations/missing_tag.js +++ b/modules/validations/missing_tag.js @@ -1,7 +1,7 @@ -import { t } from '../util/locale'; import _ from 'lodash'; -export function MissingTag() { +import { t } from '../util/locale'; +export function MissingTag() { // Slightly stricter check than Entity#isUsed (#3091) function hasTags(entity, graph) { return _.without(Object.keys(entity.tags), 'area', 'name').length > 0 || diff --git a/modules/validations/tag_suggests_area.js b/modules/validations/tag_suggests_area.js index 0fd279a1d..a4fba7227 100644 --- a/modules/validations/tag_suggests_area.js +++ b/modules/validations/tag_suggests_area.js @@ -1,9 +1,9 @@ -import { t } from '../util/locale'; import _ from 'lodash'; -export function TagSuggestsArea() { +import { t } from '../util/locale'; - // https://github.com/openstreetmap/josm/blob/mirror/src/org/ - // openstreetmap/josm/data/validation/tests/UnclosedWays.java#L80 +// https://github.com/openstreetmap/josm/blob/mirror/src/org/ +// openstreetmap/josm/data/validation/tests/UnclosedWays.java#L80 +export function TagSuggestsArea() { function tagSuggestsArea(tags) { if (_.isEmpty(tags)) return false; diff --git a/package.json b/package.json index 67df4fb96..05b1829c0 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "test": "test" }, "scripts": { - "test": "npm run lint && make && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html dot", + "test": "npm run lint && make && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec", "start": "rollup --config=./rollup.config.js -f iife --input ./modules/id.js --output dist/iD.js -w", "web": "http-server", "build-min": "npm run build && uglifyjs dist/iD.js -c -m -o dist/iD.min.js", diff --git a/test/index.html b/test/index.html index b8c2be03a..276ebe5b1 100644 --- a/test/index.html +++ b/test/index.html @@ -15,6 +15,7 @@ +