mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Present errors, namespace events.
This commit is contained in:
+4
-5
@@ -107,18 +107,17 @@ iD.Connection = function() {
|
||||
path: '/api/0.6/changeset/create',
|
||||
options: { header: { 'Content-Type': 'text/xml' } },
|
||||
content: iD.format.XML.changeset(comment)
|
||||
},
|
||||
function (changeset_id) {
|
||||
}, function (err, changeset_id) {
|
||||
oauth.xhr({
|
||||
method: 'POST',
|
||||
path: '/api/0.6/changeset/' + changeset_id + '/upload',
|
||||
options: { header: { 'Content-Type': 'text/xml' } },
|
||||
content: iD.format.XML.osmChange(user.id, changeset_id, changes)
|
||||
}, function () {
|
||||
}, function (err) {
|
||||
oauth.xhr({
|
||||
method: 'PUT',
|
||||
path: '/api/0.6/changeset/' + changeset_id + '/close'
|
||||
}, function () {
|
||||
}, function (err) {
|
||||
callback(changeset_id);
|
||||
});
|
||||
});
|
||||
@@ -126,7 +125,7 @@ iD.Connection = function() {
|
||||
}
|
||||
|
||||
function userDetails(callback) {
|
||||
oauth.xhr({ method: 'GET', path: '/api/0.6/user/details' }, function(user_details) {
|
||||
oauth.xhr({ method: 'GET', path: '/api/0.6/user/details' }, function(err, user_details) {
|
||||
var u = user_details.getElementsByTagName('user')[0];
|
||||
callback(connection.user({
|
||||
display_name: u.attributes.display_name.nodeValue,
|
||||
|
||||
+3
-3
@@ -49,9 +49,9 @@ iD.OAuth = function() {
|
||||
var oauth_token_secret = token('oauth_token_secret');
|
||||
o.oauth_signature = ohauth.signature(oauth_secret, oauth_token_secret,
|
||||
ohauth.baseString(options.method, url, o));
|
||||
ohauth.xhr(options.method, url, o, options.content, options.options, function(xhr) {
|
||||
if (xhr.responseXML) callback(xhr.responseXML);
|
||||
else callback(xhr.response);
|
||||
ohauth.xhr(options.method, url, o, options.content, options.options, function(err, xhr) {
|
||||
if (xhr.responseXML) callback(err, xhr.responseXML);
|
||||
else callback(err, xhr.response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ d3.typeahead = function() {
|
||||
top: rect.bottom + 'px'
|
||||
});
|
||||
selection
|
||||
.on('keyup.update', update);
|
||||
.on('keyup.typeahead', update);
|
||||
hidden = false;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ d3.typeahead = function() {
|
||||
}
|
||||
|
||||
selection
|
||||
.on('focus', setup)
|
||||
.on('blur', hide);
|
||||
.on('focus.typeahead', setup)
|
||||
.on('blur.typeahead', hide);
|
||||
|
||||
var idx = 0;
|
||||
function update() {
|
||||
|
||||
+9
-2
@@ -19,9 +19,16 @@ ohauth.stringQs = function(str) {
|
||||
};
|
||||
|
||||
ohauth.xhr = function(method, url, auth, data, options, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
var xhr = new XMLHttpRequest(),
|
||||
twoHundred = /^20\d$/;
|
||||
xhr.onreadystatechange = function() {
|
||||
if (4 == xhr.readyState && 0 !== xhr.status) callback(xhr);
|
||||
if (4 == xhr.readyState && 0 !== xhr.status) {
|
||||
if (twoHundred.test(xhr.status)) {
|
||||
callback(null, xhr);
|
||||
} else {
|
||||
callback(xhr, null);
|
||||
}
|
||||
}
|
||||
};
|
||||
var headers = (options && options.header) || { 'Content-Type': 'application/x-www-form-urlencoded' };
|
||||
xhr.open(method, url, true);
|
||||
|
||||
Reference in New Issue
Block a user