mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-25 06:55:46 +00:00
Consistify syntax
This commit is contained in:
@@ -27,11 +27,11 @@ iD.History = function() {
|
||||
}
|
||||
|
||||
var history = {
|
||||
graph: function () {
|
||||
graph: function() {
|
||||
return stack[index].graph;
|
||||
},
|
||||
|
||||
merge: function (entities) {
|
||||
merge: function(entities) {
|
||||
for (var i = 0; i < stack.length; i++) {
|
||||
stack[i].graph.rebase(entities);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ iD.History = function() {
|
||||
dispatch.change();
|
||||
},
|
||||
|
||||
perform: function () {
|
||||
perform: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
stack = stack.slice(0, index + 1);
|
||||
@@ -49,7 +49,7 @@ iD.History = function() {
|
||||
return change(previous);
|
||||
},
|
||||
|
||||
replace: function () {
|
||||
replace: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
// assert(index == stack.length - 1)
|
||||
@@ -58,7 +58,7 @@ iD.History = function() {
|
||||
return change(previous);
|
||||
},
|
||||
|
||||
pop: function () {
|
||||
pop: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
if (index > 0) {
|
||||
@@ -68,7 +68,7 @@ iD.History = function() {
|
||||
}
|
||||
},
|
||||
|
||||
undo: function () {
|
||||
undo: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
// Pop to the first annotated state.
|
||||
@@ -87,7 +87,7 @@ iD.History = function() {
|
||||
return change(previous);
|
||||
},
|
||||
|
||||
redo: function () {
|
||||
redo: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
while (index < stack.length - 1) {
|
||||
@@ -99,7 +99,7 @@ iD.History = function() {
|
||||
return change(previous);
|
||||
},
|
||||
|
||||
undoAnnotation: function () {
|
||||
undoAnnotation: function() {
|
||||
var i = index;
|
||||
while (i >= 0) {
|
||||
if (stack[i].annotation) return stack[i].annotation;
|
||||
@@ -107,7 +107,7 @@ iD.History = function() {
|
||||
}
|
||||
},
|
||||
|
||||
redoAnnotation: function () {
|
||||
redoAnnotation: function() {
|
||||
var i = index + 1;
|
||||
while (i <= stack.length - 1) {
|
||||
if (stack[i].annotation) return stack[i].annotation;
|
||||
@@ -115,13 +115,13 @@ iD.History = function() {
|
||||
}
|
||||
},
|
||||
|
||||
difference: function () {
|
||||
difference: function() {
|
||||
var base = stack[0].graph,
|
||||
head = stack[index].graph;
|
||||
return iD.Difference(base, head);
|
||||
},
|
||||
|
||||
changes: function () {
|
||||
changes: function() {
|
||||
var difference = history.difference();
|
||||
return {
|
||||
modified: difference.modified(),
|
||||
@@ -145,7 +145,7 @@ iD.History = function() {
|
||||
undefined, 'Custom');
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
reset: function() {
|
||||
stack = [{graph: iD.Graph()}];
|
||||
index = 0;
|
||||
dispatch.change();
|
||||
|
||||
@@ -39,11 +39,11 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
});
|
||||
|
||||
var operations = d3.values(iD.operations)
|
||||
.map(function (o) { return o(selection, context); })
|
||||
.filter(function (o) { return o.available(); });
|
||||
.map(function(o) { return o(selection, context); })
|
||||
.filter(function(o) { return o.available(); });
|
||||
|
||||
operations.forEach(function(operation) {
|
||||
keybinding.on(operation.key, function () {
|
||||
keybinding.on(operation.key, function() {
|
||||
if (operation.enabled()) {
|
||||
operation();
|
||||
}
|
||||
@@ -87,7 +87,7 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
context.history().on('change.select', function() {
|
||||
context.surface().call(radialMenu.close);
|
||||
|
||||
if (_.any(selection, function (id) { return !context.entity(id); })) {
|
||||
if (_.any(selection, function(id) { return !context.entity(id); })) {
|
||||
// Exit mode if selected entity gets undone
|
||||
context.enter(iD.modes.Browse(context));
|
||||
|
||||
@@ -128,7 +128,7 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
context.surface()
|
||||
.on('dblclick.select', dblclick)
|
||||
.selectAll("*")
|
||||
.filter(function (d) { return d && selection.indexOf(d.id) >= 0; })
|
||||
.filter(function(d) { return d && selection.indexOf(d.id) >= 0; })
|
||||
.classed('selected', true);
|
||||
|
||||
radialMenu = iD.ui.RadialMenu(operations);
|
||||
@@ -144,7 +144,7 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
}
|
||||
};
|
||||
|
||||
mode.exit = function () {
|
||||
mode.exit = function() {
|
||||
if (singular()) {
|
||||
changeTags(singular(), inspector.tags());
|
||||
}
|
||||
|
||||
16
js/id/ui.js
16
js/id/ui.js
@@ -1,4 +1,4 @@
|
||||
iD.ui = function (context) {
|
||||
iD.ui = function(context) {
|
||||
return function(container) {
|
||||
context.container(container);
|
||||
|
||||
@@ -42,12 +42,12 @@ iD.ui = function (context) {
|
||||
.data(modes)
|
||||
.enter().append('button')
|
||||
.attr('tabindex', -1)
|
||||
.attr('class', function (mode) { return mode.title + ' add-button col3'; })
|
||||
.attr('class', function(mode) { return mode.title + ' add-button col3'; })
|
||||
.call(bootstrap.tooltip().placement('bottom').html(true))
|
||||
.attr('data-original-title', function (mode) {
|
||||
.attr('data-original-title', function(mode) {
|
||||
return hintprefix(mode.key, mode.description);
|
||||
})
|
||||
.on('click.editor', function (mode) { context.enter(mode); });
|
||||
.on('click.editor', function(mode) { context.enter(mode); });
|
||||
|
||||
function disableTooHigh() {
|
||||
if (map.editable()) {
|
||||
@@ -74,14 +74,14 @@ iD.ui = function (context) {
|
||||
return d.id + ' icon icon-pre-text';
|
||||
});
|
||||
|
||||
buttons.append('span').attr('class', 'label').text(function (mode) { return mode.title; });
|
||||
buttons.append('span').attr('class', 'label').text(function(mode) { return mode.title; });
|
||||
|
||||
context.on('enter.editor', function (entered) {
|
||||
buttons.classed('active', function (mode) { return entered.button === mode.button; });
|
||||
context.on('enter.editor', function(entered) {
|
||||
buttons.classed('active', function(mode) { return entered.button === mode.button; });
|
||||
container.classed("mode-" + entered.id, true);
|
||||
});
|
||||
|
||||
context.on('exit.editor', function (exited) {
|
||||
context.on('exit.editor', function(exited) {
|
||||
container.classed("mode-" + exited.id, false);
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@ iD.ui.save = function(context) {
|
||||
|
||||
d3.select('.shaded').remove();
|
||||
var l = iD.ui.loading(t('uploading_changes'), true);
|
||||
connection.putChangeset(history.changes(), e.comment, history.imagery_used(), function(err, changeset_id) {
|
||||
connection.putChangeset(history.changes(),
|
||||
e.comment,
|
||||
history.imagery_used(), function(err, changeset_id) {
|
||||
l.remove();
|
||||
history.reset();
|
||||
map.flush().redraw();
|
||||
|
||||
Reference in New Issue
Block a user