mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
@@ -120,6 +120,7 @@
|
||||
|
||||
<script src='js/id/behavior.js'></script>
|
||||
<script src='js/id/behavior/add_way.js'></script>
|
||||
<script src='js/id/behavior/accept.js'></script>
|
||||
<script src='js/id/behavior/drag.js'></script>
|
||||
<script src='js/id/behavior/drag_node.js'></script>
|
||||
<script src='js/id/behavior/draw.js'></script>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
iD.behavior.accept = function() {
|
||||
var event = d3.dispatch('accept'),
|
||||
keybinding = d3.keybinding('accept');
|
||||
|
||||
function accept(selection) {
|
||||
keybinding.on('↩', function() {
|
||||
event.accept();
|
||||
})(selection);
|
||||
}
|
||||
|
||||
return d3.rebind(accept, event, "on");
|
||||
};
|
||||
@@ -16,7 +16,6 @@ iD.presets.Collection = function(collection) {
|
||||
});
|
||||
|
||||
return iD.presets.Collection(newcollection);
|
||||
|
||||
},
|
||||
|
||||
matchTags: function(entity) {
|
||||
@@ -34,7 +33,7 @@ iD.presets.Collection = function(collection) {
|
||||
|
||||
return match;
|
||||
},
|
||||
|
||||
|
||||
search: function(value) {
|
||||
if (!value) return this;
|
||||
|
||||
@@ -59,8 +58,6 @@ iD.presets.Collection = function(collection) {
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
return presets;
|
||||
|
||||
+10
-5
@@ -1,5 +1,5 @@
|
||||
iD.ui.preset = function(context) {
|
||||
var event = d3.dispatch('change', 'setTags'),
|
||||
var event = d3.dispatch('change', 'setTags', 'close'),
|
||||
taginfo = iD.taginfo(),
|
||||
entity,
|
||||
type,
|
||||
@@ -56,25 +56,29 @@ iD.ui.preset = function(context) {
|
||||
case 'text':
|
||||
i = this.append('input')
|
||||
.attr('type', 'text')
|
||||
.attr('id', 'input-' + d.key);
|
||||
.attr('id', 'input-' + d.key)
|
||||
.call(iD.behavior.accept().on('accept', event.close));
|
||||
break;
|
||||
case 'tel':
|
||||
i = this.append('input')
|
||||
.attr('type', 'tel')
|
||||
.attr('id', 'input-' + d.key)
|
||||
.attr('placeholder', '1-555-555-5555');
|
||||
.attr('placeholder', '1-555-555-5555')
|
||||
.call(iD.behavior.accept().on('accept', event.close));
|
||||
break;
|
||||
case 'email':
|
||||
i = this.append('input')
|
||||
.attr('type', 'email')
|
||||
.attr('id', 'input-' + d.key)
|
||||
.attr('placeholder', 'email@domain.com');
|
||||
.attr('placeholder', 'email@domain.com')
|
||||
.call(iD.behavior.accept().on('accept', event.close));
|
||||
break;
|
||||
case 'url':
|
||||
i = this.append('input')
|
||||
.attr('type', 'url')
|
||||
.attr('id', 'input-' + d.key)
|
||||
.attr('placeholder', 'http://example.com/');
|
||||
.attr('placeholder', 'http://example.com/')
|
||||
.call(iD.behavior.accept().on('accept', event.close));
|
||||
break;
|
||||
case 'check':
|
||||
wrap = this.append('span').attr('class', 'input-wrap-position'),
|
||||
@@ -155,6 +159,7 @@ iD.ui.preset = function(context) {
|
||||
.attr('class', 'col9 preset-input', d)
|
||||
.call(iD.ui.preset.address(context)
|
||||
.on('change', key)
|
||||
.on('close', event.close)
|
||||
.entity(entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
iD.ui.preset.address = function(context) {
|
||||
|
||||
var event = d3.dispatch('change'),
|
||||
var event = d3.dispatch('change', 'close'),
|
||||
entity;
|
||||
|
||||
function getStreets() {
|
||||
@@ -37,13 +37,16 @@ iD.ui.preset.address = function(context) {
|
||||
|
||||
function change() { event.change(); }
|
||||
|
||||
function close() { return iD.behavior.accept().on('accept', event.close); }
|
||||
|
||||
selection.append('input')
|
||||
.property('type', 'text')
|
||||
.attr('placeholder', 'Housename')
|
||||
.attr('class', 'addr-housename')
|
||||
.datum({ 'key': 'addr:housename' })
|
||||
.on('blur', change)
|
||||
.on('change', change);
|
||||
.on('change', change)
|
||||
.call(close());
|
||||
|
||||
selection.append('input')
|
||||
.property('type', 'text')
|
||||
@@ -51,7 +54,8 @@ iD.ui.preset.address = function(context) {
|
||||
.attr('class', 'addr-number')
|
||||
.datum({ 'key': 'addr:housenumber' })
|
||||
.on('blur', change)
|
||||
.on('change', change);
|
||||
.on('change', change)
|
||||
.call(close());
|
||||
|
||||
var streetwrap = selection.append('span')
|
||||
.attr('class', 'input-wrap-position')
|
||||
@@ -70,7 +74,8 @@ iD.ui.preset.address = function(context) {
|
||||
.attr('class', 'addr-city')
|
||||
.datum({ 'key': 'addr:city' })
|
||||
.on('blur', change)
|
||||
.on('change', change);
|
||||
.on('change', change)
|
||||
.call(close());
|
||||
|
||||
streetwrap.call(d3.combobox().data(getStreets()));
|
||||
}
|
||||
|
||||
@@ -78,7 +78,8 @@ iD.ui.TagEditor = function(context) {
|
||||
.entity(entity)
|
||||
.on('change', function() {
|
||||
event.changeTags();
|
||||
});
|
||||
})
|
||||
.on('close', event.close);
|
||||
|
||||
tagList = iD.ui.Taglist(context)
|
||||
.on('change', function() {
|
||||
|
||||
@@ -264,7 +264,7 @@ d3.combobox = function() {
|
||||
w.on('mousemove.typeahead', null);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
input
|
||||
.on('blur.typeahead', blur)
|
||||
.on('keydown.typeahead', keydown)
|
||||
|
||||
@@ -30,6 +30,7 @@ ohauth.xhr = function(method, url, auth, data, options, callback) {
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.onerror = function(e) { return callback(e, null); };
|
||||
var headers = (options && options.header) || { 'Content-Type': 'application/x-www-form-urlencoded' };
|
||||
xhr.open(method, url, true);
|
||||
xhr.setRequestHeader('Authorization', 'OAuth ' + ohauth.authHeader(auth));
|
||||
|
||||
Reference in New Issue
Block a user